@openedx/frontend-app-authn 1.0.0-alpha.6 → 1.0.0-alpha.7

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 (254) hide show
  1. package/dist/Main.js +1 -3
  2. package/dist/Main.js.map +1 -1
  3. package/dist/common-components/EmbeddedRegistrationRoute.js +2 -2
  4. package/dist/common-components/EmbeddedRegistrationRoute.js.map +1 -1
  5. package/dist/common-components/EnterpriseSSO.js +6 -3
  6. package/dist/common-components/EnterpriseSSO.js.map +1 -1
  7. package/dist/common-components/PasswordField.d.ts +17 -9
  8. package/dist/common-components/PasswordField.js +10 -6
  9. package/dist/common-components/PasswordField.js.map +1 -1
  10. package/dist/common-components/RedirectLogistration.js +7 -3
  11. package/dist/common-components/RedirectLogistration.js.map +1 -1
  12. package/dist/common-components/SocialAuthProviders.d.ts +2 -2
  13. package/dist/common-components/SocialAuthProviders.js +5 -4
  14. package/dist/common-components/SocialAuthProviders.js.map +1 -1
  15. package/dist/common-components/ThirdPartyAuth.js +3 -2
  16. package/dist/common-components/ThirdPartyAuth.js.map +1 -1
  17. package/dist/common-components/ThirdPartyAuthAlert.d.ts +2 -2
  18. package/dist/common-components/ThirdPartyAuthAlert.js +4 -4
  19. package/dist/common-components/ThirdPartyAuthAlert.js.map +1 -1
  20. package/dist/common-components/UnAuthOnlyRoute.js +5 -4
  21. package/dist/common-components/UnAuthOnlyRoute.js.map +1 -1
  22. package/dist/common-components/components/ThirdPartyAuthContext.d.ts +31 -0
  23. package/dist/common-components/components/ThirdPartyAuthContext.js +84 -0
  24. package/dist/common-components/components/ThirdPartyAuthContext.js.map +1 -0
  25. package/dist/common-components/data/api.d.ts +6 -0
  26. package/dist/common-components/data/api.js +26 -0
  27. package/dist/common-components/data/api.js.map +1 -0
  28. package/dist/common-components/data/apiHook.d.ts +9 -0
  29. package/dist/common-components/data/apiHook.js +14 -0
  30. package/dist/common-components/data/apiHook.js.map +1 -0
  31. package/dist/common-components/data/queryKeys.d.ts +4 -0
  32. package/dist/common-components/data/queryKeys.js +6 -0
  33. package/dist/common-components/data/queryKeys.js.map +1 -0
  34. package/dist/common-components/index.d.ts +0 -3
  35. package/dist/common-components/index.js +0 -3
  36. package/dist/common-components/index.js.map +1 -1
  37. package/dist/constants.d.ts +13 -0
  38. package/dist/constants.js +15 -0
  39. package/dist/constants.js.map +1 -1
  40. package/dist/data/constants.d.ts +0 -8
  41. package/dist/data/constants.js +0 -9
  42. package/dist/data/constants.js.map +1 -1
  43. package/dist/data/utils/dataUtils.d.ts +1 -0
  44. package/dist/data/utils/dataUtils.js +14 -0
  45. package/dist/data/utils/dataUtils.js.map +1 -1
  46. package/dist/data/utils/index.d.ts +1 -2
  47. package/dist/data/utils/index.js +1 -2
  48. package/dist/data/utils/index.js.map +1 -1
  49. package/dist/forgot-password/ForgotPasswordPage.d.ts +2 -36
  50. package/dist/forgot-password/ForgotPasswordPage.js +45 -44
  51. package/dist/forgot-password/ForgotPasswordPage.js.map +1 -1
  52. package/dist/forgot-password/data/api.d.ts +2 -0
  53. package/dist/forgot-password/data/{service.js → api.js} +13 -14
  54. package/dist/forgot-password/data/api.js.map +1 -0
  55. package/dist/forgot-password/data/apiHook.d.ts +16 -0
  56. package/dist/forgot-password/data/apiHook.js +26 -0
  57. package/dist/forgot-password/data/apiHook.js.map +1 -0
  58. package/dist/forgot-password/index.d.ts +0 -4
  59. package/dist/forgot-password/index.js +0 -4
  60. package/dist/forgot-password/index.js.map +1 -1
  61. package/dist/forgot-password/messages.js +1 -1
  62. package/dist/forgot-password/messages.js.map +1 -1
  63. package/dist/login/ChangePasswordPrompt.js +11 -5
  64. package/dist/login/ChangePasswordPrompt.js.map +1 -1
  65. package/dist/login/LoginPage.d.ts +12 -10
  66. package/dist/login/LoginPage.js +85 -127
  67. package/dist/login/LoginPage.js.map +1 -1
  68. package/dist/login/components/LoginContext.d.ts +21 -0
  69. package/dist/login/components/LoginContext.js +28 -0
  70. package/dist/login/components/LoginContext.js.map +1 -0
  71. package/dist/login/data/api.d.ts +2 -0
  72. package/dist/login/data/api.js +27 -0
  73. package/dist/login/data/api.js.map +1 -0
  74. package/dist/login/data/apiHook.d.ts +13 -0
  75. package/dist/login/data/apiHook.js +57 -0
  76. package/dist/login/data/apiHook.js.map +1 -0
  77. package/dist/login/index.d.ts +0 -3
  78. package/dist/login/index.js +0 -3
  79. package/dist/login/index.js.map +1 -1
  80. package/dist/logistration/Logistration.d.ts +5 -32
  81. package/dist/logistration/Logistration.js +28 -54
  82. package/dist/logistration/Logistration.js.map +1 -1
  83. package/dist/progressive-profiling/ProgressiveProfiling.d.ts +2 -46
  84. package/dist/progressive-profiling/ProgressiveProfiling.js +47 -71
  85. package/dist/progressive-profiling/ProgressiveProfiling.js.map +1 -1
  86. package/dist/progressive-profiling/ProgressiveProfilingPageModal.js +8 -1
  87. package/dist/progressive-profiling/ProgressiveProfilingPageModal.js.map +1 -1
  88. package/dist/progressive-profiling/components/ProgressiveProfilingContext.d.ts +18 -0
  89. package/dist/progressive-profiling/components/ProgressiveProfilingContext.js +52 -0
  90. package/dist/progressive-profiling/components/ProgressiveProfilingContext.js.map +1 -0
  91. package/dist/progressive-profiling/data/api.d.ts +2 -0
  92. package/dist/progressive-profiling/data/{service.js → api.js} +11 -12
  93. package/dist/progressive-profiling/data/api.js.map +1 -0
  94. package/dist/progressive-profiling/data/apiHook.d.ts +10 -0
  95. package/dist/progressive-profiling/data/apiHook.js +36 -0
  96. package/dist/progressive-profiling/data/apiHook.js.map +1 -0
  97. package/dist/progressive-profiling/index.d.ts +0 -2
  98. package/dist/progressive-profiling/index.js +0 -2
  99. package/dist/progressive-profiling/index.js.map +1 -1
  100. package/dist/register/RegistrationFields/CountryField/CountryField.d.ts +1 -1
  101. package/dist/register/RegistrationFields/CountryField/CountryField.js +5 -7
  102. package/dist/register/RegistrationFields/CountryField/CountryField.js.map +1 -1
  103. package/dist/register/RegistrationFields/EmailField/EmailField.js +17 -9
  104. package/dist/register/RegistrationFields/EmailField/EmailField.js.map +1 -1
  105. package/dist/register/RegistrationFields/NameField/NameField.js +14 -7
  106. package/dist/register/RegistrationFields/NameField/NameField.js.map +1 -1
  107. package/dist/register/RegistrationFields/NameField/validator.d.ts +1 -0
  108. package/dist/register/RegistrationFields/NameField/validator.js +4 -0
  109. package/dist/register/RegistrationFields/NameField/validator.js.map +1 -1
  110. package/dist/register/RegistrationFields/UsernameField/UsernameField.js +20 -14
  111. package/dist/register/RegistrationFields/UsernameField/UsernameField.js.map +1 -1
  112. package/dist/register/RegistrationPage.d.ts +1 -1
  113. package/dist/register/RegistrationPage.js +102 -59
  114. package/dist/register/RegistrationPage.js.map +1 -1
  115. package/dist/register/components/RegisterContext.d.ts +8 -0
  116. package/dist/register/components/RegisterContext.js +167 -0
  117. package/dist/register/components/RegisterContext.js.map +1 -0
  118. package/dist/register/components/RegistrationFailure.js +4 -1
  119. package/dist/register/components/RegistrationFailure.js.map +1 -1
  120. package/dist/register/data/api.d.ts +9 -0
  121. package/dist/register/data/api.js +45 -0
  122. package/dist/register/data/api.js.map +1 -0
  123. package/dist/register/data/apiHook.d.ts +33 -0
  124. package/dist/register/data/apiHook.js +66 -0
  125. package/dist/register/data/apiHook.js.map +1 -0
  126. package/dist/register/data/constants.d.ts +1 -0
  127. package/dist/register/data/constants.js +1 -0
  128. package/dist/register/data/constants.js.map +1 -1
  129. package/dist/register/index.d.ts +0 -2
  130. package/dist/register/index.js +0 -3
  131. package/dist/register/index.js.map +1 -1
  132. package/dist/register/messages.d.ts +10 -0
  133. package/dist/register/messages.js +10 -0
  134. package/dist/register/messages.js.map +1 -1
  135. package/dist/register/types.d.ts +74 -0
  136. package/dist/register/types.js +2 -0
  137. package/dist/register/types.js.map +1 -0
  138. package/dist/reset-password/ResetPasswordPage.d.ts +2 -32
  139. package/dist/reset-password/ResetPasswordPage.js +90 -58
  140. package/dist/reset-password/ResetPasswordPage.js.map +1 -1
  141. package/dist/reset-password/data/api.d.ts +4 -0
  142. package/dist/reset-password/data/api.js +57 -0
  143. package/dist/reset-password/data/api.js.map +1 -0
  144. package/dist/reset-password/data/apiHook.d.ts +31 -0
  145. package/dist/reset-password/data/apiHook.js +74 -0
  146. package/dist/reset-password/data/apiHook.js.map +1 -0
  147. package/dist/reset-password/index.d.ts +0 -4
  148. package/dist/reset-password/index.js +0 -4
  149. package/dist/reset-password/index.js.map +1 -1
  150. package/dist/routes.d.ts +1 -0
  151. package/dist/routes.js +15 -14
  152. package/dist/routes.js.map +1 -1
  153. package/dist/sass/_registration.scss +8 -10
  154. package/dist/slots/LoginComponentSlot/index.d.ts +12 -0
  155. package/dist/slots/LoginComponentSlot/index.js +11 -0
  156. package/dist/slots/LoginComponentSlot/index.js.map +1 -0
  157. package/package.json +18 -14
  158. package/dist/common-components/data/actions.d.ts +0 -26
  159. package/dist/common-components/data/actions.js +0 -22
  160. package/dist/common-components/data/actions.js.map +0 -1
  161. package/dist/common-components/data/reducers.d.ts +0 -62
  162. package/dist/common-components/data/reducers.js +0 -39
  163. package/dist/common-components/data/reducers.js.map +0 -1
  164. package/dist/common-components/data/sagas.d.ts +0 -12
  165. package/dist/common-components/data/sagas.js +0 -21
  166. package/dist/common-components/data/sagas.js.map +0 -1
  167. package/dist/common-components/data/selectors.d.ts +0 -98
  168. package/dist/common-components/data/selectors.js +0 -11
  169. package/dist/common-components/data/selectors.js.map +0 -1
  170. package/dist/common-components/data/service.d.ts +0 -5
  171. package/dist/common-components/data/service.js +0 -31
  172. package/dist/common-components/data/service.js.map +0 -1
  173. package/dist/data/configureStore.d.ts +0 -3
  174. package/dist/data/configureStore.js +0 -24
  175. package/dist/data/configureStore.js.map +0 -1
  176. package/dist/data/reducers.d.ts +0 -254
  177. package/dist/data/reducers.js +0 -17
  178. package/dist/data/reducers.js.map +0 -1
  179. package/dist/data/sagas.d.ts +0 -1
  180. package/dist/data/sagas.js +0 -18
  181. package/dist/data/sagas.js.map +0 -1
  182. package/dist/data/utils/reduxUtils.d.ts +0 -15
  183. package/dist/data/utils/reduxUtils.js +0 -29
  184. package/dist/data/utils/reduxUtils.js.map +0 -1
  185. package/dist/forgot-password/data/actions.d.ts +0 -30
  186. package/dist/forgot-password/data/actions.js +0 -26
  187. package/dist/forgot-password/data/actions.js.map +0 -1
  188. package/dist/forgot-password/data/reducers.d.ts +0 -13
  189. package/dist/forgot-password/data/reducers.js +0 -46
  190. package/dist/forgot-password/data/reducers.js.map +0 -1
  191. package/dist/forgot-password/data/sagas.d.ts +0 -4
  192. package/dist/forgot-password/data/sagas.js +0 -28
  193. package/dist/forgot-password/data/sagas.js.map +0 -1
  194. package/dist/forgot-password/data/selectors.d.ts +0 -23
  195. package/dist/forgot-password/data/selectors.js +0 -5
  196. package/dist/forgot-password/data/selectors.js.map +0 -1
  197. package/dist/forgot-password/data/service.d.ts +0 -1
  198. package/dist/forgot-password/data/service.js.map +0 -1
  199. package/dist/login/data/actions.d.ts +0 -36
  200. package/dist/login/data/actions.js +0 -32
  201. package/dist/login/data/actions.js.map +0 -1
  202. package/dist/login/data/reducers.d.ts +0 -82
  203. package/dist/login/data/reducers.js +0 -44
  204. package/dist/login/data/reducers.js.map +0 -1
  205. package/dist/login/data/sagas.d.ts +0 -10
  206. package/dist/login/data/sagas.js +0 -34
  207. package/dist/login/data/sagas.js.map +0 -1
  208. package/dist/login/data/service.d.ts +0 -4
  209. package/dist/login/data/service.js +0 -32
  210. package/dist/login/data/service.js.map +0 -1
  211. package/dist/progressive-profiling/data/actions.d.ts +0 -19
  212. package/dist/progressive-profiling/data/actions.js +0 -18
  213. package/dist/progressive-profiling/data/actions.js.map +0 -1
  214. package/dist/progressive-profiling/data/reducers.d.ts +0 -22
  215. package/dist/progressive-profiling/data/reducers.js +0 -23
  216. package/dist/progressive-profiling/data/reducers.js.map +0 -1
  217. package/dist/progressive-profiling/data/sagas.d.ts +0 -4
  218. package/dist/progressive-profiling/data/sagas.js +0 -17
  219. package/dist/progressive-profiling/data/sagas.js.map +0 -1
  220. package/dist/progressive-profiling/data/selectors.d.ts +0 -39
  221. package/dist/progressive-profiling/data/selectors.js +0 -9
  222. package/dist/progressive-profiling/data/selectors.js.map +0 -1
  223. package/dist/progressive-profiling/data/service.d.ts +0 -1
  224. package/dist/progressive-profiling/data/service.js.map +0 -1
  225. package/dist/register/data/actions.d.ts +0 -80
  226. package/dist/register/data/actions.js +0 -69
  227. package/dist/register/data/actions.js.map +0 -1
  228. package/dist/register/data/reducers.d.ts +0 -237
  229. package/dist/register/data/reducers.js +0 -86
  230. package/dist/register/data/reducers.js.map +0 -1
  231. package/dist/register/data/sagas.d.ts +0 -19
  232. package/dist/register/data/sagas.js +0 -45
  233. package/dist/register/data/sagas.js.map +0 -1
  234. package/dist/register/data/selectors.d.ts +0 -26
  235. package/dist/register/data/selectors.js +0 -25
  236. package/dist/register/data/selectors.js.map +0 -1
  237. package/dist/register/data/service.d.ts +0 -8
  238. package/dist/register/data/service.js +0 -46
  239. package/dist/register/data/service.js.map +0 -1
  240. package/dist/reset-password/data/actions.d.ts +0 -56
  241. package/dist/reset-password/data/actions.js +0 -41
  242. package/dist/reset-password/data/actions.js.map +0 -1
  243. package/dist/reset-password/data/reducers.d.ts +0 -19
  244. package/dist/reset-password/data/reducers.js +0 -25
  245. package/dist/reset-password/data/reducers.js.map +0 -1
  246. package/dist/reset-password/data/sagas.d.ts +0 -7
  247. package/dist/reset-password/data/sagas.js +0 -63
  248. package/dist/reset-password/data/sagas.js.map +0 -1
  249. package/dist/reset-password/data/selectors.d.ts +0 -23
  250. package/dist/reset-password/data/selectors.js +0 -5
  251. package/dist/reset-password/data/selectors.js.map +0 -1
  252. package/dist/reset-password/data/service.d.ts +0 -3
  253. package/dist/reset-password/data/service.js +0 -62
  254. package/dist/reset-password/data/service.js.map +0 -1
@@ -0,0 +1,167 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { createContext, useCallback, useContext, useMemo, useReducer, } from 'react';
14
+ const RegisterContext = createContext(null);
15
+ const initialState = {
16
+ validations: null,
17
+ usernameSuggestions: [],
18
+ validationApiRateLimited: false,
19
+ registrationResult: { success: false, redirectUrl: '', authenticatedUser: null },
20
+ registrationError: {},
21
+ backendCountryCode: '',
22
+ registrationFormData: {
23
+ configurableFormFields: {
24
+ marketingEmailsOptIn: true,
25
+ },
26
+ formFields: {
27
+ name: '', email: '', username: '', password: '',
28
+ },
29
+ emailSuggestion: {
30
+ suggestion: '', type: '',
31
+ },
32
+ errors: {
33
+ name: '', email: '', username: '', password: '',
34
+ },
35
+ },
36
+ };
37
+ const registerReducer = (state, action) => {
38
+ switch (action.type) {
39
+ case 'SET_VALIDATIONS_SUCCESS': {
40
+ const _a = action.payload, { usernameSuggestions: newUsernameSuggestions } = _a, validationWithoutUsernameSuggestions = __rest(_a, ["usernameSuggestions"]);
41
+ return Object.assign(Object.assign({}, state), { validations: validationWithoutUsernameSuggestions, usernameSuggestions: newUsernameSuggestions || state.usernameSuggestions, validationApiRateLimited: false });
42
+ }
43
+ case 'SET_VALIDATIONS_FAILURE':
44
+ return Object.assign(Object.assign({}, state), { validationApiRateLimited: true, validations: null });
45
+ case 'CLEAR_USERNAME_SUGGESTIONS':
46
+ return Object.assign(Object.assign({}, state), { usernameSuggestions: [] });
47
+ case 'CLEAR_REGISTRATION_BACKEND_ERROR': {
48
+ const rest = Object.assign({}, state.registrationError);
49
+ delete rest[action.payload];
50
+ return Object.assign(Object.assign({}, state), { registrationError: rest });
51
+ }
52
+ case 'SET_BACKEND_COUNTRY_CODE':
53
+ return Object.assign(Object.assign({}, state), { backendCountryCode: !state.registrationFormData.configurableFormFields.country
54
+ ? action.payload
55
+ : state.backendCountryCode });
56
+ case 'SET_EMAIL_SUGGESTION':
57
+ return Object.assign(Object.assign({}, state), { registrationFormData: Object.assign(Object.assign({}, state.registrationFormData), { emailSuggestion: { suggestion: action.payload.suggestion, type: action.payload.type } }) });
58
+ case 'UPDATE_REGISTRATION_FORM_DATA':
59
+ return Object.assign(Object.assign({}, state), { registrationFormData: Object.assign(Object.assign({}, state.registrationFormData), action.payload) });
60
+ case 'SET_REGISTRATION_FORM_DATA':
61
+ return Object.assign(Object.assign({}, state), { registrationFormData: typeof action.payload === 'function'
62
+ ? action.payload(state.registrationFormData)
63
+ : action.payload });
64
+ case 'SET_REGISTRATION_RESULT':
65
+ return Object.assign(Object.assign({}, state), { registrationResult: action.payload });
66
+ case 'SET_REGISTRATION_ERROR':
67
+ return Object.assign(Object.assign({}, state), { registrationError: action.payload });
68
+ default:
69
+ return state;
70
+ }
71
+ };
72
+ export const RegisterProvider = ({ children }) => {
73
+ const [state, dispatch] = useReducer(registerReducer, initialState);
74
+ const setValidationsSuccess = useCallback((validationData) => {
75
+ dispatch({ type: 'SET_VALIDATIONS_SUCCESS', payload: validationData });
76
+ }, []);
77
+ const setValidationsFailure = useCallback(() => {
78
+ dispatch({ type: 'SET_VALIDATIONS_FAILURE' });
79
+ }, []);
80
+ const clearUsernameSuggestions = useCallback(() => {
81
+ dispatch({ type: 'CLEAR_USERNAME_SUGGESTIONS' });
82
+ }, []);
83
+ const clearRegistrationBackendError = useCallback((field) => {
84
+ dispatch({ type: 'CLEAR_REGISTRATION_BACKEND_ERROR', payload: field });
85
+ }, []);
86
+ const setBackendCountryCode = useCallback((countryCode) => {
87
+ dispatch({ type: 'SET_BACKEND_COUNTRY_CODE', payload: countryCode });
88
+ }, []);
89
+ const setEmailSuggestionContext = useCallback((suggestion, type) => {
90
+ dispatch({ type: 'SET_EMAIL_SUGGESTION', payload: { suggestion, type } });
91
+ }, []);
92
+ const updateRegistrationFormData = useCallback((newData) => {
93
+ dispatch({ type: 'UPDATE_REGISTRATION_FORM_DATA', payload: newData });
94
+ }, []);
95
+ const setRegistrationResult = useCallback((result) => {
96
+ dispatch({ type: 'SET_REGISTRATION_RESULT', payload: result });
97
+ }, []);
98
+ const setRegistrationFormData = useCallback((data) => {
99
+ dispatch({ type: 'SET_REGISTRATION_FORM_DATA', payload: data });
100
+ }, []);
101
+ const setRegistrationError = useCallback((error) => {
102
+ dispatch({ type: 'SET_REGISTRATION_ERROR', payload: error });
103
+ }, []);
104
+ const backendValidations = useMemo(() => {
105
+ if (state.registrationError && Object.keys(state.registrationError).length > 0) {
106
+ const fields = Object.keys(state.registrationError).filter((fieldName) => !(['errorCode', 'usernameSuggestions'].includes(fieldName)));
107
+ const validationDecisions = {};
108
+ fields.forEach(field => {
109
+ var _a, _b;
110
+ validationDecisions[field] = ((_b = (_a = state.registrationError[field]) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.userMessage) || '';
111
+ });
112
+ return validationDecisions;
113
+ }
114
+ if (state.validations) {
115
+ return state.validations.validationDecisions;
116
+ }
117
+ return null;
118
+ }, [state.validations, state.registrationError]);
119
+ const contextValue = useMemo(() => ({
120
+ validations: state.validations,
121
+ registrationFormData: state.registrationFormData,
122
+ registrationError: state.registrationError,
123
+ registrationResult: state.registrationResult,
124
+ backendCountryCode: state.backendCountryCode,
125
+ usernameSuggestions: state.usernameSuggestions,
126
+ validationApiRateLimited: state.validationApiRateLimited,
127
+ backendValidations,
128
+ setValidationsSuccess,
129
+ setValidationsFailure,
130
+ clearUsernameSuggestions,
131
+ clearRegistrationBackendError,
132
+ setRegistrationFormData,
133
+ setEmailSuggestionContext,
134
+ updateRegistrationFormData,
135
+ setBackendCountryCode,
136
+ setRegistrationError,
137
+ setRegistrationResult,
138
+ }), [
139
+ state.validations,
140
+ state.registrationFormData,
141
+ state.backendCountryCode,
142
+ state.usernameSuggestions,
143
+ state.validationApiRateLimited,
144
+ state.registrationError,
145
+ state.registrationResult,
146
+ backendValidations,
147
+ setValidationsSuccess,
148
+ setValidationsFailure,
149
+ clearUsernameSuggestions,
150
+ clearRegistrationBackendError,
151
+ setRegistrationFormData,
152
+ setEmailSuggestionContext,
153
+ updateRegistrationFormData,
154
+ setBackendCountryCode,
155
+ setRegistrationError,
156
+ setRegistrationResult,
157
+ ]);
158
+ return (_jsx(RegisterContext.Provider, { value: contextValue, children: children }));
159
+ };
160
+ export const useRegisterContext = () => {
161
+ const context = useContext(RegisterContext);
162
+ if (!context) {
163
+ throw new Error('useRegisterContext must be used within a RegisterProvider');
164
+ }
165
+ return context;
166
+ };
167
+ //# sourceMappingURL=RegisterContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegisterContext.js","sourceRoot":"","sources":["../../../src/register/components/RegisterContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,aAAa,EAAiB,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAC3E,MAAM,OAAO,CAAC;AAMf,MAAM,eAAe,GAAG,aAAa,CAA6B,IAAI,CAAC,CAAC;AAExE,MAAM,YAAY,GAAkB;IAClC,WAAW,EAAE,IAAI;IACjB,mBAAmB,EAAE,EAAE;IACvB,wBAAwB,EAAE,KAAK;IAC/B,kBAAkB,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE;IAChF,iBAAiB,EAAE,EAAE;IACrB,kBAAkB,EAAE,EAAE;IACtB,oBAAoB,EAAE;QACpB,sBAAsB,EAAE;YACtB,oBAAoB,EAAE,IAAI;SAC3B;QACD,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE;SAChD;QACD,eAAe,EAAE;YACf,UAAU,EAAE,EAAE,EAAE,IAA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;QAC9B,oBAAoB,EAAE,KAAK,CAAC,oBAAoB;QAChD,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;QAC5C,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;QAC5C,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;QAC9C,wBAAwB,EAAE,KAAK,CAAC,wBAAwB;QACxD,kBAAkB;QAClB,qBAAqB;QACrB,qBAAqB;QACrB,wBAAwB;QACxB,6BAA6B;QAC7B,uBAAuB;QACvB,yBAAyB;QACzB,0BAA0B;QAC1B,qBAAqB;QACrB,oBAAoB;QACpB,qBAAqB;KACtB,CAAC,EAAE;QACF,KAAK,CAAC,WAAW;QACjB,KAAK,CAAC,oBAAoB;QAC1B,KAAK,CAAC,kBAAkB;QACxB,KAAK,CAAC,mBAAmB;QACzB,KAAK,CAAC,wBAAwB;QAC9B,KAAK,CAAC,iBAAiB;QACvB,KAAK,CAAC,kBAAkB;QACxB,kBAAkB;QAClB,qBAAqB;QACrB,qBAAqB;QACrB,wBAAwB;QACxB,6BAA6B;QAC7B,uBAAuB;QACvB,yBAAyB;QACzB,0BAA0B;QAC1B,qBAAqB;QACrB,oBAAoB;QACpB,qBAAqB;KACtB,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC1C,QAAQ,GACgB,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n createContext, FC, ReactNode, useCallback, useContext, useMemo, useReducer,\n} from 'react';\n\nimport {\n RegisterContextType, RegisterState, RegistrationFormData, RegistrationResult, ValidationData,\n} from '../types';\n\nconst RegisterContext = createContext<RegisterContextType | null>(null);\n\nconst initialState: RegisterState = {\n validations: null,\n usernameSuggestions: [],\n validationApiRateLimited: false,\n registrationResult: { success: false, redirectUrl: '', authenticatedUser: null },\n registrationError: {},\n backendCountryCode: '',\n registrationFormData: {\n configurableFormFields: {\n marketingEmailsOptIn: true,\n },\n formFields: {\n name: '', email: '', username: '', password: '',\n },\n emailSuggestion: {\n suggestion: '', type: '',\n },\n errors: {\n name: '', email: '', username: '', password: '',\n },\n },\n};\n\nconst registerReducer = (state: RegisterState, action: any): RegisterState => {\n switch (action.type) {\n case 'SET_VALIDATIONS_SUCCESS': {\n const { usernameSuggestions: newUsernameSuggestions, ...validationWithoutUsernameSuggestions } = action.payload;\n return {\n ...state,\n validations: validationWithoutUsernameSuggestions,\n usernameSuggestions: newUsernameSuggestions || state.usernameSuggestions,\n validationApiRateLimited: false,\n };\n }\n case 'SET_VALIDATIONS_FAILURE':\n return {\n ...state,\n validationApiRateLimited: true,\n validations: null,\n };\n case 'CLEAR_USERNAME_SUGGESTIONS':\n return { ...state, usernameSuggestions: [] };\n case 'CLEAR_REGISTRATION_BACKEND_ERROR': {\n const rest = { ...state.registrationError };\n delete rest[action.payload];\n return { ...state, registrationError: rest };\n }\n case 'SET_BACKEND_COUNTRY_CODE':\n return {\n ...state,\n backendCountryCode: !state.registrationFormData.configurableFormFields.country\n ? action.payload\n : state.backendCountryCode,\n };\n case 'SET_EMAIL_SUGGESTION':\n return {\n ...state,\n registrationFormData: {\n ...state.registrationFormData,\n emailSuggestion: { suggestion: action.payload.suggestion, type: action.payload.type },\n },\n };\n case 'UPDATE_REGISTRATION_FORM_DATA':\n return {\n ...state,\n registrationFormData: { ...state.registrationFormData, ...action.payload },\n };\n case 'SET_REGISTRATION_FORM_DATA':\n return {\n ...state,\n registrationFormData: typeof action.payload === 'function'\n ? action.payload(state.registrationFormData)\n : action.payload,\n };\n case 'SET_REGISTRATION_RESULT':\n return { ...state, registrationResult: action.payload };\n case 'SET_REGISTRATION_ERROR':\n return { ...state, registrationError: action.payload };\n default:\n return state;\n }\n};\n\ninterface RegisterProviderProps {\n children: ReactNode,\n}\n\nexport const RegisterProvider: FC<RegisterProviderProps> = ({ children }) => {\n const [state, dispatch] = useReducer(registerReducer, initialState);\n\n const setValidationsSuccess = useCallback((validationData: ValidationData) => {\n dispatch({ type: 'SET_VALIDATIONS_SUCCESS', payload: validationData });\n }, []);\n\n const setValidationsFailure = useCallback(() => {\n dispatch({ type: 'SET_VALIDATIONS_FAILURE' });\n }, []);\n\n const clearUsernameSuggestions = useCallback(() => {\n dispatch({ type: 'CLEAR_USERNAME_SUGGESTIONS' });\n }, []);\n\n const clearRegistrationBackendError = useCallback((field: string) => {\n dispatch({ type: 'CLEAR_REGISTRATION_BACKEND_ERROR', payload: field });\n }, []);\n\n const setBackendCountryCode = useCallback((countryCode: string) => {\n dispatch({ type: 'SET_BACKEND_COUNTRY_CODE', payload: countryCode });\n }, []);\n\n const setEmailSuggestionContext = useCallback((suggestion: string, type: string) => {\n dispatch({ type: 'SET_EMAIL_SUGGESTION', payload: { suggestion, type } });\n }, []);\n\n const updateRegistrationFormData = useCallback((newData: Partial<RegistrationFormData>) => {\n dispatch({ type: 'UPDATE_REGISTRATION_FORM_DATA', payload: newData });\n }, []);\n\n const setRegistrationResult = useCallback((result: RegistrationResult) => {\n dispatch({ type: 'SET_REGISTRATION_RESULT', payload: result });\n }, []);\n\n const setRegistrationFormData = useCallback((data: RegistrationFormData |\n ((prev: RegistrationFormData) => RegistrationFormData)) => {\n dispatch({ type: 'SET_REGISTRATION_FORM_DATA', payload: data });\n }, []);\n\n const setRegistrationError = useCallback((error: Record<string, { userMessage: string }[]>) => {\n dispatch({ type: 'SET_REGISTRATION_ERROR', payload: error });\n }, []);\n\n const backendValidations = useMemo(() => {\n if (state.registrationError && Object.keys(state.registrationError).length > 0) {\n const fields = Object.keys(state.registrationError).filter(\n (fieldName) => !(['errorCode', 'usernameSuggestions'].includes(fieldName)),\n );\n\n const validationDecisions: Record<string, string> = {};\n fields.forEach(field => {\n validationDecisions[field] = state.registrationError[field]?.[0]?.userMessage || '';\n });\n return validationDecisions;\n }\n\n if (state.validations) {\n return state.validations.validationDecisions;\n }\n\n return null;\n }, [state.validations, state.registrationError]);\n\n const contextValue = useMemo(() => ({\n validations: state.validations,\n registrationFormData: state.registrationFormData,\n registrationError: state.registrationError,\n registrationResult: state.registrationResult,\n backendCountryCode: state.backendCountryCode,\n usernameSuggestions: state.usernameSuggestions,\n validationApiRateLimited: state.validationApiRateLimited,\n backendValidations,\n setValidationsSuccess,\n setValidationsFailure,\n clearUsernameSuggestions,\n clearRegistrationBackendError,\n setRegistrationFormData,\n setEmailSuggestionContext,\n updateRegistrationFormData,\n setBackendCountryCode,\n setRegistrationError,\n setRegistrationResult,\n }), [\n state.validations,\n state.registrationFormData,\n state.backendCountryCode,\n state.usernameSuggestions,\n state.validationApiRateLimited,\n state.registrationError,\n state.registrationResult,\n backendValidations,\n setValidationsSuccess,\n setValidationsFailure,\n clearUsernameSuggestions,\n clearRegistrationBackendError,\n setRegistrationFormData,\n setEmailSuggestionContext,\n updateRegistrationFormData,\n setBackendCountryCode,\n setRegistrationError,\n setRegistrationResult,\n ]);\n\n return (\n <RegisterContext.Provider value={contextValue}>\n {children}\n </RegisterContext.Provider>\n );\n};\n\nexport const useRegisterContext = () => {\n const context = useContext(RegisterContext);\n if (!context) {\n throw new Error('useRegisterContext must be used within a RegisterProvider');\n }\n return context;\n};\n"]}
@@ -5,7 +5,7 @@ import { Alert } from '@openedx/paragon';
5
5
  import { Error } from '@openedx/paragon/icons';
6
6
  import PropTypes from 'prop-types';
7
7
  import { windowScrollTo } from '../../data/utils';
8
- import { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR, TPA_AUTHENTICATION_FAILURE, TPA_SESSION_EXPIRED, } from '../data/constants';
8
+ import { FORBIDDEN_REQUEST, FORBIDDEN_USERNAME, INTERNAL_SERVER_ERROR, TPA_AUTHENTICATION_FAILURE, TPA_SESSION_EXPIRED, } from '../data/constants';
9
9
  import messages from '../messages';
10
10
  const RegistrationFailureMessage = (props) => {
11
11
  const { formatMessage } = useIntl();
@@ -34,6 +34,9 @@ const RegistrationFailureMessage = (props) => {
34
34
  case TPA_SESSION_EXPIRED:
35
35
  errorMessage = formatMessage(messages['registration.tpa.session.expired'], { provider: context.provider });
36
36
  break;
37
+ case FORBIDDEN_USERNAME:
38
+ errorMessage = formatMessage(messages['registration.forbidden.username']);
39
+ break;
37
40
  default:
38
41
  errorMessage = formatMessage(messages['registration.empty.form.submission.error']);
39
42
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"RegistrationFailure.js","sourceRoot":"","sources":["../../../src/register/components/RegistrationFailure.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,MAAM,0BAA0B,GAAG,CAAC,KAAK,EAAE,EAAE;IAC3C,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EACJ,OAAO,EAAE,SAAS,EAAE,YAAY,GACjC,GAAG,KAAK,CAAC;IAEV,SAAS,CAAC,GAAG,EAAE;QACb,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,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AAE;QACP,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEF,0BAA0B,CAAC,SAAS,GAAG;IACrC,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC;QACvB,QAAQ,EAAE,SAAS,CAAC,MAAM;QAC1B,YAAY,EAAE,SAAS,CAAC,MAAM;KAC/B,CAAC;IACF,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACtC,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;CAC1C,CAAC;AAEF,eAAe,0BAA0B,CAAC","sourcesContent":["import { useEffect } from 'react';\n\nimport { getSiteConfig, useIntl } from '@openedx/frontend-base';\nimport { Alert } from '@openedx/paragon';\nimport { Error } from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nimport { windowScrollTo } from '../../data/utils';\nimport {\n FORBIDDEN_REQUEST,\n INTERNAL_SERVER_ERROR,\n TPA_AUTHENTICATION_FAILURE,\n TPA_SESSION_EXPIRED,\n} from '../data/constants';\nimport messages from '../messages';\n\nconst RegistrationFailureMessage = (props) => {\n const { formatMessage } = useIntl();\n const {\n context, errorCode, failureCount,\n } = props;\n\n useEffect(() => {\n windowScrollTo({ left: 0, top: 0, behavior: 'smooth' });\n }, [errorCode, failureCount]);\n\n if (!errorCode) {\n return null;\n }\n\n let errorMessage;\n switch (errorCode) {\n case INTERNAL_SERVER_ERROR:\n errorMessage = formatMessage(messages['registration.request.server.error']);\n break;\n case FORBIDDEN_REQUEST:\n errorMessage = formatMessage(messages['registration.rate.limit.error']);\n break;\n case TPA_AUTHENTICATION_FAILURE:\n errorMessage = formatMessage(\n messages['registration.tpa.authentication.failure'],\n {\n platform_name: getSiteConfig().siteName,\n lineBreak: <br />,\n errorMessage: context.errorMessage,\n }\n );\n break;\n case TPA_SESSION_EXPIRED:\n errorMessage = formatMessage(messages['registration.tpa.session.expired'], { provider: context.provider });\n break;\n default:\n errorMessage = formatMessage(messages['registration.empty.form.submission.error']);\n break;\n }\n\n return (\n <Alert id=\"validation-errors\" className=\"mb-5\" variant=\"danger\" icon={Error}>\n <Alert.Heading>{formatMessage(messages['registration.request.failure.header'])}</Alert.Heading>\n <p>{errorMessage}</p>\n </Alert>\n );\n};\n\nRegistrationFailureMessage.defaultProps = {\n context: {\n errorMessage: null,\n },\n};\n\nRegistrationFailureMessage.propTypes = {\n context: PropTypes.shape({\n provider: PropTypes.string,\n errorMessage: PropTypes.string,\n }),\n errorCode: PropTypes.string.isRequired,\n failureCount: PropTypes.number.isRequired,\n};\n\nexport default RegistrationFailureMessage;\n"]}
1
+ {"version":3,"file":"RegistrationFailure.js","sourceRoot":"","sources":["../../../src/register/components/RegistrationFailure.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,MAAM,0BAA0B,GAAG,CAAC,KAAK,EAAE,EAAE;IAC3C,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EACJ,OAAO,EAAE,SAAS,EAAE,YAAY,GACjC,GAAG,KAAK,CAAC;IAEV,SAAS,CAAC,GAAG,EAAE;QACb,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC1D,CAAC,EAAE,CAAC,SAAS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Y,GAAG;IACxC,OAAO,EAAE;QACP,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEF,0BAA0B,CAAC,SAAS,GAAG;IACrC,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC;QACvB,QAAQ,EAAE,SAAS,CAAC,MAAM;QAC1B,YAAY,EAAE,SAAS,CAAC,MAAM;KAC/B,CAAC;IACF,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACtC,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;CAC1C,CAAC;AAEF,eAAe,0BAA0B,CAAC","sourcesContent":["import { useEffect } from 'react';\n\nimport { getSiteConfig, useIntl } from '@openedx/frontend-base';\nimport { Alert } from '@openedx/paragon';\nimport { Error } from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nimport { windowScrollTo } from '../../data/utils';\nimport {\n FORBIDDEN_REQUEST,\n FORBIDDEN_USERNAME,\n INTERNAL_SERVER_ERROR,\n TPA_AUTHENTICATION_FAILURE,\n TPA_SESSION_EXPIRED,\n} from '../data/constants';\nimport messages from '../messages';\n\nconst RegistrationFailureMessage = (props) => {\n const { formatMessage } = useIntl();\n const {\n context, errorCode, failureCount,\n } = props;\n\n useEffect(() => {\n windowScrollTo({ left: 0, top: 0, behavior: 'smooth' });\n }, [errorCode, failureCount]);\n\n if (!errorCode) {\n return null;\n }\n\n let errorMessage;\n switch (errorCode) {\n case INTERNAL_SERVER_ERROR:\n errorMessage = formatMessage(messages['registration.request.server.error']);\n break;\n case FORBIDDEN_REQUEST:\n errorMessage = formatMessage(messages['registration.rate.limit.error']);\n break;\n case TPA_AUTHENTICATION_FAILURE:\n errorMessage = formatMessage(\n messages['registration.tpa.authentication.failure'],\n {\n platform_name: getSiteConfig().siteName,\n lineBreak: <br />,\n errorMessage: context.errorMessage,\n }\n );\n break;\n case TPA_SESSION_EXPIRED:\n errorMessage = formatMessage(messages['registration.tpa.session.expired'], { provider: context.provider });\n break;\n case FORBIDDEN_USERNAME:\n errorMessage = formatMessage(messages['registration.forbidden.username']);\n break;\n default:\n errorMessage = formatMessage(messages['registration.empty.form.submission.error']);\n break;\n }\n\n return (\n <Alert id=\"validation-errors\" className=\"mb-5\" variant=\"danger\" icon={Error}>\n <Alert.Heading>{formatMessage(messages['registration.request.failure.header'])}</Alert.Heading>\n <p>{errorMessage}</p>\n </Alert>\n );\n};\n\nRegistrationFailureMessage.defaultProps = {\n context: {\n errorMessage: null,\n },\n};\n\nRegistrationFailureMessage.propTypes = {\n context: PropTypes.shape({\n provider: PropTypes.string,\n errorMessage: PropTypes.string,\n }),\n errorCode: PropTypes.string.isRequired,\n failureCount: PropTypes.number.isRequired,\n};\n\nexport default RegistrationFailureMessage;\n"]}
@@ -0,0 +1,9 @@
1
+ declare const registerNewUserApi: (registrationInformation: any) => Promise<{
2
+ redirectUrl: any;
3
+ success: any;
4
+ authenticatedUser: any;
5
+ }>;
6
+ declare const getFieldsValidations: (formPayload: any) => Promise<{
7
+ fieldValidations: any;
8
+ }>;
9
+ export { registerNewUserApi, getFieldsValidations, };
@@ -0,0 +1,45 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { getAuthenticatedHttpClient, getHttpClient, getSiteConfig } from '@openedx/frontend-base';
11
+ import * as QueryString from 'query-string';
12
+ import { normalizeRedirectUrl } from '../../data/utils';
13
+ const registerNewUserApi = (registrationInformation) => __awaiter(void 0, void 0, void 0, function* () {
14
+ const requestConfig = {
15
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
16
+ isPublic: true,
17
+ };
18
+ const url = `${getSiteConfig().lmsBaseUrl}/api/user/v2/account/registration/`;
19
+ const { data } = yield getAuthenticatedHttpClient()
20
+ .post(url, QueryString.stringify(registrationInformation), requestConfig)
21
+ .catch((e) => {
22
+ throw (e);
23
+ });
24
+ return {
25
+ redirectUrl: normalizeRedirectUrl(data.redirect_url || ''),
26
+ success: data.success || false,
27
+ authenticatedUser: data.authenticated_user,
28
+ };
29
+ });
30
+ const getFieldsValidations = (formPayload) => __awaiter(void 0, void 0, void 0, function* () {
31
+ const requestConfig = {
32
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
33
+ };
34
+ const url = `${getSiteConfig().lmsBaseUrl}/api/user/v1/validation/registration`;
35
+ const { data } = yield getHttpClient()
36
+ .post(url, QueryString.stringify(formPayload), requestConfig)
37
+ .catch((e) => {
38
+ throw (e);
39
+ });
40
+ return {
41
+ fieldValidations: data,
42
+ };
43
+ });
44
+ export { registerNewUserApi, getFieldsValidations, };
45
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/register/data/api.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,kBAAkB,GAAG,CAAO,uBAAuB,EAAE,EAAE;IAC3D,MAAM,aAAa,GAAG;QACpB,OAAO,EAAE,EAAE,cAAc,EAAE,mCAAmC,EAAE;QAChE,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,MAAM,GAAG,GAAG,GAAG,aAAa,EAAE,CAAC,UAAU,oCAAoC,CAAC;IAC9E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE;SAChD,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,SAAS,CAAC,uBAAuB,CAAC,EAAE,aAAa,CAAC;SACxE,KAAK,CAAC,CAAC,CAAM,EAAE,EAAE;QAChB,MAAM,CAAC,CAAC,CAAC,CAAC;IACZ,CAAC,CAAC,CAAC;IAEL,OAAO;QACL,WAAW,EAAE,oBAAoB,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;QAC1D,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,KAAK;QAC9B,iBAAiB,EAAE,IAAI,CAAC,kBAAkB;KAC3C,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAO,WAAW,EAAE,EAAE;IACjD,MAAM,aAAa,GAAG;QACpB,OAAO,EAAE,EAAE,cAAc,EAAE,mCAAmC,EAAE;KACjE,CAAC;IACF,MAAM,GAAG,GAAG,GAAG,aAAa,EAAE,CAAC,UAAU,sCAAsC,CAAC;IAChF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,aAAa,EAAE;SACnC,IAAI,CACH,GAAG,EAAE,WAAW,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC;SACxD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACX,MAAM,CAAC,CAAC,CAAC,CAAC;IACZ,CAAC,CAAC,CAAC;IAEL,OAAO;QACL,gBAAgB,EAAE,IAAI;KACvB,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,OAAO,EACL,kBAAkB,EAClB,oBAAoB,GACrB,CAAC","sourcesContent":["import { getAuthenticatedHttpClient, getHttpClient, getSiteConfig } from '@openedx/frontend-base';\nimport * as QueryString from 'query-string';\n\nimport { normalizeRedirectUrl } from '../../data/utils';\n\nconst registerNewUserApi = async (registrationInformation) => {\n const requestConfig = {\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n isPublic: true,\n };\n const url = `${getSiteConfig().lmsBaseUrl}/api/user/v2/account/registration/`;\n const { data } = await getAuthenticatedHttpClient()\n .post(url, QueryString.stringify(registrationInformation), requestConfig)\n .catch((e: any) => {\n throw (e);\n });\n\n return {\n redirectUrl: normalizeRedirectUrl(data.redirect_url || ''),\n success: data.success || false,\n authenticatedUser: data.authenticated_user,\n };\n};\n\nconst getFieldsValidations = async (formPayload) => {\n const requestConfig = {\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n };\n const url = `${getSiteConfig().lmsBaseUrl}/api/user/v1/validation/registration`;\n const { data } = await getHttpClient()\n .post(\n url, QueryString.stringify(formPayload), requestConfig)\n .catch((e) => {\n throw (e);\n });\n\n return {\n fieldValidations: data,\n };\n};\n\nexport {\n registerNewUserApi,\n getFieldsValidations,\n};\n"]}
@@ -0,0 +1,33 @@
1
+ type RegistrationPayload = Record<string, unknown>;
2
+ interface AuthenticatedUser {
3
+ username: string;
4
+ full_name: string;
5
+ user_id: number;
6
+ }
7
+ interface RegistrationResponse {
8
+ redirectUrl: string;
9
+ success: boolean;
10
+ authenticatedUser: AuthenticatedUser;
11
+ }
12
+ interface UseRegistrationOptions {
13
+ onSuccess?: (data: RegistrationResponse) => void;
14
+ onError?: (error: unknown) => void;
15
+ }
16
+ interface ApiError extends Error {
17
+ response?: {
18
+ status: number;
19
+ data?: unknown;
20
+ };
21
+ }
22
+ type FieldValidationsPayload = Record<string, unknown>;
23
+ interface UseFieldValidationsOptions {
24
+ onSuccess?: (data: unknown) => void;
25
+ onError?: (error: unknown) => void;
26
+ }
27
+ declare const useRegistration: (options?: UseRegistrationOptions) => import("@tanstack/react-query").UseMutationResult<{
28
+ redirectUrl: any;
29
+ success: any;
30
+ authenticatedUser: any;
31
+ }, ApiError, RegistrationPayload, unknown>;
32
+ declare const useFieldValidations: (options?: UseFieldValidationsOptions) => import("@tanstack/react-query").UseMutationResult<unknown, ApiError, FieldValidationsPayload, unknown>;
33
+ export { useRegistration, useFieldValidations, };
@@ -0,0 +1,66 @@
1
+ import { camelCaseObject, logError, logInfo } from '@openedx/frontend-base';
2
+ import { useMutation } from '@tanstack/react-query';
3
+ import { getFieldsValidations, registerNewUserApi } from './api';
4
+ import { INTERNAL_SERVER_ERROR } from './constants';
5
+ const useRegistration = (options = {}) => useMutation({
6
+ mutationFn: (registrationPayload) => (registerNewUserApi(registrationPayload)),
7
+ onSuccess: (data) => {
8
+ if (options.onSuccess) {
9
+ options.onSuccess(data);
10
+ }
11
+ },
12
+ onError: (error) => {
13
+ const statusCodes = [400, 403, 409];
14
+ let errorData;
15
+ if (error.response) {
16
+ if (error.response.status && statusCodes.includes(error.response.status)) {
17
+ errorData = camelCaseObject(error.response.data || {});
18
+ logInfo(error);
19
+ }
20
+ else {
21
+ errorData = { errorCode: INTERNAL_SERVER_ERROR };
22
+ logError(error);
23
+ }
24
+ }
25
+ else {
26
+ errorData = { errorCode: INTERNAL_SERVER_ERROR };
27
+ logError(error);
28
+ }
29
+ if (options.onError) {
30
+ options.onError(errorData);
31
+ }
32
+ },
33
+ });
34
+ const useFieldValidations = (options = {}) => useMutation({
35
+ mutationFn: (payload) => (getFieldsValidations(payload)),
36
+ onSuccess: (data) => {
37
+ const transformedData = camelCaseObject(data.fieldValidations);
38
+ if (options.onSuccess) {
39
+ options.onSuccess(transformedData);
40
+ }
41
+ },
42
+ onError: (error) => {
43
+ if (error.response) {
44
+ if (error.response.status === 403) {
45
+ logInfo(error);
46
+ if (options.onError) {
47
+ options.onError({ validationApiRateLimited: true });
48
+ }
49
+ }
50
+ else {
51
+ logError(error);
52
+ if (options.onError) {
53
+ options.onError(error);
54
+ }
55
+ }
56
+ }
57
+ else {
58
+ logError(error);
59
+ if (options.onError) {
60
+ options.onError(error);
61
+ }
62
+ }
63
+ },
64
+ });
65
+ export { useRegistration, useFieldValidations, };
66
+ //# sourceMappingURL=apiHook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiHook.js","sourceRoot":"","sources":["../../../src/register/data/apiHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EA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,GACpB,CAAC","sourcesContent":["import { camelCaseObject, logError, logInfo } from '@openedx/frontend-base';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { getFieldsValidations, registerNewUserApi } from './api';\nimport { INTERNAL_SERVER_ERROR } from './constants';\n\ntype RegistrationPayload = Record<string, unknown>;\n\ninterface AuthenticatedUser {\n username: string,\n full_name: string,\n user_id: number,\n}\n\ninterface RegistrationResponse {\n redirectUrl: string,\n success: boolean,\n authenticatedUser: AuthenticatedUser,\n}\n\ninterface UseRegistrationOptions {\n onSuccess?: (data: RegistrationResponse) => void,\n onError?: (error: unknown) => void,\n}\n\ninterface ApiError extends Error {\n response?: {\n status: number,\n data?: unknown,\n },\n}\n\ntype FieldValidationsPayload = Record<string, unknown>;\n\ninterface UseFieldValidationsOptions {\n onSuccess?: (data: unknown) => void,\n onError?: (error: unknown) => void,\n}\n\nconst useRegistration = (options: UseRegistrationOptions = {}) => useMutation({\n mutationFn: (registrationPayload: RegistrationPayload) => (\n registerNewUserApi(registrationPayload)\n ),\n onSuccess: (data: RegistrationResponse) => {\n if (options.onSuccess) {\n options.onSuccess(data);\n }\n },\n onError: (error: ApiError) => {\n const statusCodes = [400, 403, 409];\n let errorData: unknown;\n\n if (error.response) {\n if (error.response.status && statusCodes.includes(error.response.status)) {\n errorData = camelCaseObject(error.response.data || {});\n logInfo(error);\n } else {\n errorData = { errorCode: INTERNAL_SERVER_ERROR };\n logError(error);\n }\n } else {\n errorData = { errorCode: INTERNAL_SERVER_ERROR };\n logError(error);\n }\n\n if (options.onError) {\n options.onError(errorData);\n }\n },\n});\n\nconst useFieldValidations = (options: UseFieldValidationsOptions = {}) => useMutation({\n mutationFn: (payload: FieldValidationsPayload) => (\n getFieldsValidations(payload)\n ),\n onSuccess: (data: unknown) => {\n const transformedData = camelCaseObject((data as { fieldValidations: unknown }).fieldValidations);\n if (options.onSuccess) {\n options.onSuccess(transformedData);\n }\n },\n onError: (error: ApiError) => {\n if (error.response) {\n if (error.response.status === 403) {\n logInfo(error);\n if (options.onError) {\n options.onError({ validationApiRateLimited: true });\n }\n } else {\n logError(error);\n if (options.onError) {\n options.onError(error);\n }\n }\n } else {\n logError(error);\n if (options.onError) {\n options.onError(error);\n }\n }\n },\n});\n\nexport {\n useRegistration,\n useFieldValidations,\n};\n"]}
@@ -8,3 +8,4 @@ export const FORM_SUBMISSION_ERROR: "form-submission-error";
8
8
  export const INTERNAL_SERVER_ERROR: "internal-server-error";
9
9
  export const TPA_AUTHENTICATION_FAILURE: "tpa-authentication-failure";
10
10
  export const TPA_SESSION_EXPIRED: "tpa-session-expired";
11
+ export const FORBIDDEN_USERNAME: "forbidden-username";
@@ -10,4 +10,5 @@ export const FORM_SUBMISSION_ERROR = 'form-submission-error';
10
10
  export const INTERNAL_SERVER_ERROR = 'internal-server-error';
11
11
  export const TPA_AUTHENTICATION_FAILURE = 'tpa-authentication-failure';
12
12
  export const TPA_SESSION_EXPIRED = 'tpa-session-expired';
13
+ export const FORBIDDEN_USERNAME = 'forbidden-username';
13
14
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/register/data/constants.js"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,YAAY;IACxB,gBAAgB,EAAE,kBAAkB;CACrC,CAAC;AAEF,2BAA2B;AAC3B,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACrD,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,0BAA0B,GAAG,4BAA4B,CAAC;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC","sourcesContent":["// Registration Fields\nexport const FIELDS = {\n COUNTRY: 'country',\n HONOR_CODE: 'honor_code',\n TERMS_OF_SERVICE: 'terms_of_service',\n};\n\n// Registration Error Codes\nexport const FORBIDDEN_REQUEST = 'forbidden-request';\nexport const FORM_SUBMISSION_ERROR = 'form-submission-error';\nexport const INTERNAL_SERVER_ERROR = 'internal-server-error';\nexport const TPA_AUTHENTICATION_FAILURE = 'tpa-authentication-failure';\nexport const TPA_SESSION_EXPIRED = 'tpa-session-expired';\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/register/data/constants.js"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,YAAY;IACxB,gBAAgB,EAAE,kBAAkB;CACrC,CAAC;AAEF,2BAA2B;AAC3B,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACrD,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,0BAA0B,GAAG,4BAA4B,CAAC;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC","sourcesContent":["// Registration Fields\nexport const FIELDS = {\n COUNTRY: 'country',\n HONOR_CODE: 'honor_code',\n TERMS_OF_SERVICE: 'terms_of_service',\n};\n\n// Registration Error Codes\nexport const FORBIDDEN_REQUEST = 'forbidden-request';\nexport const FORM_SUBMISSION_ERROR = 'form-submission-error';\nexport const INTERNAL_SERVER_ERROR = 'internal-server-error';\nexport const TPA_AUTHENTICATION_FAILURE = 'tpa-authentication-failure';\nexport const TPA_SESSION_EXPIRED = 'tpa-session-expired';\nexport const FORBIDDEN_USERNAME = 'forbidden-username';\n"]}
@@ -1,3 +1 @@
1
1
  export { default as RegistrationPage } from "./RegistrationPage";
2
- export { default as saga } from "./data/sagas";
3
- export { default as reducer, storeName } from "./data/reducers";
@@ -1,5 +1,2 @@
1
1
  export { default as RegistrationPage } from './RegistrationPage';
2
- export { default as reducer } from './data/reducers';
3
- export { default as saga } from './data/sagas';
4
- export { storeName } from './data/reducers';
5
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/register/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { default as RegistrationPage } from './RegistrationPage';\nexport { default as reducer } from './data/reducers';\nexport { default as saga } from './data/sagas';\nexport { storeName } from './data/reducers';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/register/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { default as RegistrationPage } from './RegistrationPage';\n"]}
@@ -120,6 +120,11 @@ declare const messages: {
120
120
  defaultMessage: string;
121
121
  description: string;
122
122
  };
123
+ 'name.validation.length.message': {
124
+ id: string;
125
+ defaultMessage: string;
126
+ description: string;
127
+ };
123
128
  'password.validation.message': {
124
129
  id: string;
125
130
  defaultMessage: string;
@@ -155,6 +160,11 @@ declare const messages: {
155
160
  defaultMessage: string;
156
161
  description: string;
157
162
  };
163
+ 'registration.forbidden.username': {
164
+ id: string;
165
+ defaultMessage: string;
166
+ description: string;
167
+ };
158
168
  'registration.tpa.authentication.failure': {
159
169
  id: string;
160
170
  defaultMessage: string;
@@ -125,6 +125,11 @@ const messages = defineMessages({
125
125
  defaultMessage: 'Enter a valid name',
126
126
  description: 'Validation message that appears when fullname contain URL',
127
127
  },
128
+ 'name.validation.length.message': {
129
+ id: 'registration.name.validation.length.message',
130
+ defaultMessage: 'Full name cannot be longer than {limit} characters',
131
+ description: 'Validation message that appears when the full name exceeds the character limit',
132
+ },
128
133
  'password.validation.message': {
129
134
  id: 'password.validation.message',
130
135
  defaultMessage: 'Password criteria has not been met',
@@ -161,6 +166,11 @@ const messages = defineMessages({
161
166
  defaultMessage: 'Registration using {provider} has timed out.',
162
167
  description: 'Error message that appears when a user has not registered in the required timeframe for the registration method they chose.',
163
168
  },
169
+ 'registration.forbidden.username': {
170
+ id: 'registration.forbidden.username',
171
+ defaultMessage: 'Usernames can\'t include words that could be mistaken for course roles. Please choose a different username.',
172
+ description: 'Error message when a user tries to register with a username that contains forbidden words',
173
+ },
164
174
  'registration.tpa.authentication.failure': {
165
175
  id: 'registration.tpa.authentication.failure',
166
176
  defaultMessage: 'We are sorry, you are not authorized to access {platform_name} via this channel. '
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/register/messages.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,qBAAqB,EAAE;QACrB,EAAE,EAAE,qBAAqB;QACzB,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,qBAAqB;KACnC;IACD,eAAe;IACf,6BAA6B,EAAE;QAC7B,EAAE,EAAE,6BAA6B;QACjC,cAAc,EAAE,WAAW;QAC3B,WAAW,EAAE,yCAAyC;KACvD;IACD,0BAA0B,EAAE;QAC1B,EAAE,EAAE,0BAA0B;QAC9B,cAAc,EAAE,OAAO;QACvB,WAAW,EAAE,uDAAuD;KACrE;IACD,6BAA6B,EAAE;QAC7B,EAAE,EAAE,6BAA6B;QACjC,cAAc,EAAE,iBAAiB;QACjC,WAAW,EAAE,yCAAyC;KACvD;IACD,6BAA6B,EAAE;QAC7B,EAAE,EAAE,6BAA6B;QACjC,cAAc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EH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n 'register.page.title': {\n id: 'register.page.title',\n defaultMessage: 'Register | {siteName}',\n description: 'register page title',\n },\n // Field labels\n 'registration.fullname.label': {\n id: 'registration.fullname.label',\n defaultMessage: 'Full name',\n description: 'Label that appears above fullname field',\n },\n 'registration.email.label': {\n id: 'registration.email.label',\n defaultMessage: 'Email',\n description: 'Label that appears above email field on register page',\n },\n 'registration.username.label': {\n id: 'registration.username.label',\n defaultMessage: 'Public username',\n description: 'Label that appears above username field',\n },\n 'registration.password.label': {\n id: 'registration.password.label',\n defaultMessage: 'Password',\n description: 'Label that appears above password field',\n },\n 'registration.country.label': {\n id: 'registration.country.label',\n defaultMessage: 'Country/Region',\n description: 'Placeholder for the country options dropdown.',\n },\n 'registration.opt.in.label': {\n id: 'registration.opt.in.label',\n defaultMessage: 'I agree that {siteName} may send me marketing messages.',\n description: 'Text for opt in option on register page.',\n },\n // Help text\n 'help.text.name': {\n id: 'help.text.name',\n defaultMessage: 'This name will be used by any certificates that you earn.',\n description: 'Help text for fullname field on registration page',\n },\n 'help.text.username.1': {\n id: 'help.text.username.1',\n defaultMessage: 'The name that will identify you in your courses.',\n description: 'Part of help text for username field on registration page',\n },\n 'help.text.username.2': {\n id: 'help.text.username.2',\n defaultMessage: 'This can not be changed later.',\n description: 'Part of help text for username field on registration page',\n },\n 'help.text.email': {\n id: 'help.text.email',\n defaultMessage: 'For account activation and important updates',\n description: 'Help text for email field on registration page',\n },\n // Form buttons\n 'create.account.for.free.button': {\n id: 'create.account.for.free.button',\n defaultMessage: 'Create an account for free',\n description: 'Label text for registration form submission button',\n },\n 'create.account.cta.button': {\n id: 'create.account.cta.button',\n defaultMessage: '{label}',\n description: 'Label text for registration form submission button for those users who are landing through redirections',\n },\n // Institution login\n 'register.institution.login.page.title': {\n id: 'register.institution.login.page.title',\n defaultMessage: 'Register with institution/campus credentials',\n description: 'Heading of institution page',\n },\n // Validation messages\n 'empty.name.field.error': {\n id: 'empty.name.field.error',\n defaultMessage: 'Enter your full name',\n description: 'Error message for empty fullname field',\n },\n 'empty.email.field.error': {\n id: 'empty.email.field.error',\n defaultMessage: 'Enter your email',\n description: 'Error message for empty email field',\n },\n 'empty.username.field.error': {\n id: 'empty.username.field.error',\n defaultMessage: 'Username must be between 2 and 30 characters',\n description: 'Error message for empty username field',\n },\n 'empty.password.field.error': {\n id: 'empty.password.field.error',\n defaultMessage: 'Password criteria has not been met',\n description: 'Error message for empty password field',\n },\n 'empty.country.field.error': {\n id: 'empty.country.field.error',\n defaultMessage: 'Select your country or region of residence',\n description: 'Error message when no country/region is selected',\n },\n 'invalid.country.field.error': {\n id: 'invalid.country.field.error',\n defaultMessage: 'Country must match with an option available in the dropdown.',\n description: 'Error message when country is invalid',\n },\n 'email.do.not.match': {\n id: 'email.do.not.match',\n defaultMessage: 'The email addresses do not match.',\n description: 'Email not match to confirm email',\n },\n 'email.invalid.format.error': {\n id: 'email.invalid.format.error',\n defaultMessage: 'Enter a valid email address',\n description: 'Validation error for invalid email address',\n },\n 'username.validation.message': {\n id: 'username.validation.message',\n defaultMessage: 'Username must be between 2 and 30 characters',\n description: 'Error message for empty username field',\n },\n 'name.validation.message': {\n id: 'name.validation.message',\n defaultMessage: 'Enter a valid name',\n description: 'Validation message that appears when fullname contain URL',\n },\n 'password.validation.message': {\n id: 'password.validation.message',\n defaultMessage: 'Password criteria has not been met',\n description: 'Error message for empty or invalid password',\n },\n 'username.format.validation.message': {\n id: 'username.format.validation.message',\n defaultMessage: 'Usernames can only contain letters (A-Z, a-z), numerals (0-9), underscores (_), and hyphens (-). Usernames cannot contain spaces',\n description: 'Validation message that appears when username format is invalid',\n },\n // Error messages\n 'registration.request.failure.header': {\n id: 'registration.request.failure.header',\n defaultMessage: 'We couldn\\'t create your account.',\n description: 'error message when registration failure.',\n },\n 'registration.empty.form.submission.error': {\n id: 'registration.empty.form.submission.error',\n defaultMessage: 'Please check your responses and try again.',\n description: 'Error message that appears on top of the form when empty form is submitted',\n },\n 'registration.request.server.error': {\n id: 'registration.request.server.error',\n defaultMessage: 'An error has occurred. Try refreshing the page, or check your internet connection.',\n description: 'Error message for internal server error.',\n },\n 'registration.rate.limit.error': {\n id: 'registration.rate.limit.error',\n defaultMessage: 'Too many failed registration attempts. Try again later.',\n description: 'Error message that appears when an anonymous user has made too many failed registration attempts',\n },\n 'registration.tpa.session.expired': {\n id: 'registration.tpa.session.expired',\n defaultMessage: 'Registration using {provider} has timed out.',\n description: 'Error message that appears when a user has not registered in the required timeframe for the registration method they chose.',\n },\n 'registration.tpa.authentication.failure': {\n id: 'registration.tpa.authentication.failure',\n defaultMessage: 'We are sorry, you are not authorized to access {platform_name} via this channel. '\n + 'Please contact your learning administrator or manager in order to access {platform_name}.'\n + '{lineBreak}{lineBreak}Error Details:{lineBreak}{errorMessage}',\n description: 'Error message third party authentication pipeline fails',\n },\n // Terms of Service and Honor Code\n 'terms.of.service.and.honor.code': {\n id: 'terms.of.service.and.honor.code',\n defaultMessage: 'Terms of Service and Honor Code',\n description: 'Text for the hyperlink that redirects user to terms of service and honor code',\n },\n 'privacy.policy': {\n id: 'privacy.policy',\n defaultMessage: 'Privacy Policy',\n description: 'Text for the hyperlink that redirects user to privacy policy',\n },\n 'honor.code': {\n id: 'honor.code',\n defaultMessage: 'Honor Code',\n description: 'Text for the hyperlink that redirects user to the honor code',\n },\n 'terms.of.service': {\n id: 'terms.of.service',\n defaultMessage: 'Terms of Service',\n description: 'Text for the hyperlink that redirects user to the terms of service',\n },\n // miscellaneous strings\n 'registration.username.suggestion.label': {\n id: 'registration.username.suggestion.label',\n defaultMessage: 'Suggested:',\n description: 'Suggested usernames label text.',\n },\n 'did.you.mean.alert.text': {\n id: 'did.you.mean.alert.text',\n defaultMessage: 'Did you mean',\n description: 'Did you mean alert suggestion',\n },\n});\n\nexport default messages;\n"]}
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/register/messages.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,yCAAyC,EAAE;QACzC,EAAE,EAAE,yCAAyC;QAC7C,cAAc,EAAE,mFAAmF;cAC7F,2FAA2F;cAC3F,+DAA+D;QACrE,WAAW,EAAE,yDAAyD;KACvE;IACD,kCAAkC;IAClC,iCAAiC,EAAE;QACjC,EAAE,EAAE,iCAAiC;QACrC,cAAc,EAAE,iCAAiC;QACjD,WAAW,EAAE,+EAA+E;KAC7F;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,gBAAgB;QACpB,cAAc,EAAE,gBAAgB;QAChC,WAAW,EAAE,8DAA8D;KAC5E;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,YAAY;QAChB,cAAc,EAAE,YAAY;QAC5B,WAAW,EAAE,8DAA8D;KAC5E;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,kBAAkB;QACtB,cAAc,EAAE,kBAAkB;QAClC,WAAW,EAAE,oEAAoE;KAClF;IACD,wBAAwB;IACxB,wCAAwC,EAAE;QACxC,EAAE,EAAE,wCAAwC;QAC5C,cAAc,EAAE,YAAY;QAC5B,WAAW,EAAE,iCAAiC;KAC/C;IACD,yBAAyB,EAAE;QACzB,EAAE,EAAE,yBAAyB;QAC7B,cAAc,EAAE,cAAc;QAC9B,WAAW,EAAE,+BAA+B;KAC7C;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n 'register.page.title': {\n id: 'register.page.title',\n defaultMessage: 'Register | {siteName}',\n description: 'register page title',\n },\n // Field labels\n 'registration.fullname.label': {\n id: 'registration.fullname.label',\n defaultMessage: 'Full name',\n description: 'Label that appears above fullname field',\n },\n 'registration.email.label': {\n id: 'registration.email.label',\n defaultMessage: 'Email',\n description: 'Label that appears above email field on register page',\n },\n 'registration.username.label': {\n id: 'registration.username.label',\n defaultMessage: 'Public username',\n description: 'Label that appears above username field',\n },\n 'registration.password.label': {\n id: 'registration.password.label',\n defaultMessage: 'Password',\n description: 'Label that appears above password field',\n },\n 'registration.country.label': {\n id: 'registration.country.label',\n defaultMessage: 'Country/Region',\n description: 'Placeholder for the country options dropdown.',\n },\n 'registration.opt.in.label': {\n id: 'registration.opt.in.label',\n defaultMessage: 'I agree that {siteName} may send me marketing messages.',\n description: 'Text for opt in option on register page.',\n },\n // Help text\n 'help.text.name': {\n id: 'help.text.name',\n defaultMessage: 'This name will be used by any certificates that you earn.',\n description: 'Help text for fullname field on registration page',\n },\n 'help.text.username.1': {\n id: 'help.text.username.1',\n defaultMessage: 'The name that will identify you in your courses.',\n description: 'Part of help text for username field on registration page',\n },\n 'help.text.username.2': {\n id: 'help.text.username.2',\n defaultMessage: 'This can not be changed later.',\n description: 'Part of help text for username field on registration page',\n },\n 'help.text.email': {\n id: 'help.text.email',\n defaultMessage: 'For account activation and important updates',\n description: 'Help text for email field on registration page',\n },\n // Form buttons\n 'create.account.for.free.button': {\n id: 'create.account.for.free.button',\n defaultMessage: 'Create an account for free',\n description: 'Label text for registration form submission button',\n },\n 'create.account.cta.button': {\n id: 'create.account.cta.button',\n defaultMessage: '{label}',\n description: 'Label text for registration form submission button for those users who are landing through redirections',\n },\n // Institution login\n 'register.institution.login.page.title': {\n id: 'register.institution.login.page.title',\n defaultMessage: 'Register with institution/campus credentials',\n description: 'Heading of institution page',\n },\n // Validation messages\n 'empty.name.field.error': {\n id: 'empty.name.field.error',\n defaultMessage: 'Enter your full name',\n description: 'Error message for empty fullname field',\n },\n 'empty.email.field.error': {\n id: 'empty.email.field.error',\n defaultMessage: 'Enter your email',\n description: 'Error message for empty email field',\n },\n 'empty.username.field.error': {\n id: 'empty.username.field.error',\n defaultMessage: 'Username must be between 2 and 30 characters',\n description: 'Error message for empty username field',\n },\n 'empty.password.field.error': {\n id: 'empty.password.field.error',\n defaultMessage: 'Password criteria has not been met',\n description: 'Error message for empty password field',\n },\n 'empty.country.field.error': {\n id: 'empty.country.field.error',\n defaultMessage: 'Select your country or region of residence',\n description: 'Error message when no country/region is selected',\n },\n 'invalid.country.field.error': {\n id: 'invalid.country.field.error',\n defaultMessage: 'Country must match with an option available in the dropdown.',\n description: 'Error message when country is invalid',\n },\n 'email.do.not.match': {\n id: 'email.do.not.match',\n defaultMessage: 'The email addresses do not match.',\n description: 'Email not match to confirm email',\n },\n 'email.invalid.format.error': {\n id: 'email.invalid.format.error',\n defaultMessage: 'Enter a valid email address',\n description: 'Validation error for invalid email address',\n },\n 'username.validation.message': {\n id: 'username.validation.message',\n defaultMessage: 'Username must be between 2 and 30 characters',\n description: 'Error message for empty username field',\n },\n 'name.validation.message': {\n id: 'name.validation.message',\n defaultMessage: 'Enter a valid name',\n description: 'Validation message that appears when fullname contain URL',\n },\n 'name.validation.length.message': {\n id: 'registration.name.validation.length.message',\n defaultMessage: 'Full name cannot be longer than {limit} characters',\n description: 'Validation message that appears when the full name exceeds the character limit',\n },\n 'password.validation.message': {\n id: 'password.validation.message',\n defaultMessage: 'Password criteria has not been met',\n description: 'Error message for empty or invalid password',\n },\n 'username.format.validation.message': {\n id: 'username.format.validation.message',\n defaultMessage: 'Usernames can only contain letters (A-Z, a-z), numerals (0-9), underscores (_), and hyphens (-). Usernames cannot contain spaces',\n description: 'Validation message that appears when username format is invalid',\n },\n // Error messages\n 'registration.request.failure.header': {\n id: 'registration.request.failure.header',\n defaultMessage: 'We couldn\\'t create your account.',\n description: 'error message when registration failure.',\n },\n 'registration.empty.form.submission.error': {\n id: 'registration.empty.form.submission.error',\n defaultMessage: 'Please check your responses and try again.',\n description: 'Error message that appears on top of the form when empty form is submitted',\n },\n 'registration.request.server.error': {\n id: 'registration.request.server.error',\n defaultMessage: 'An error has occurred. Try refreshing the page, or check your internet connection.',\n description: 'Error message for internal server error.',\n },\n 'registration.rate.limit.error': {\n id: 'registration.rate.limit.error',\n defaultMessage: 'Too many failed registration attempts. Try again later.',\n description: 'Error message that appears when an anonymous user has made too many failed registration attempts',\n },\n 'registration.tpa.session.expired': {\n id: 'registration.tpa.session.expired',\n defaultMessage: 'Registration using {provider} has timed out.',\n description: 'Error message that appears when a user has not registered in the required timeframe for the registration method they chose.',\n },\n 'registration.forbidden.username': {\n id: 'registration.forbidden.username',\n defaultMessage: 'Usernames can\\'t include words that could be mistaken for course roles. Please choose a different username.',\n description: 'Error message when a user tries to register with a username that contains forbidden words',\n },\n 'registration.tpa.authentication.failure': {\n id: 'registration.tpa.authentication.failure',\n defaultMessage: 'We are sorry, you are not authorized to access {platform_name} via this channel. '\n + 'Please contact your learning administrator or manager in order to access {platform_name}.'\n + '{lineBreak}{lineBreak}Error Details:{lineBreak}{errorMessage}',\n description: 'Error message third party authentication pipeline fails',\n },\n // Terms of Service and Honor Code\n 'terms.of.service.and.honor.code': {\n id: 'terms.of.service.and.honor.code',\n defaultMessage: 'Terms of Service and Honor Code',\n description: 'Text for the hyperlink that redirects user to terms of service and honor code',\n },\n 'privacy.policy': {\n id: 'privacy.policy',\n defaultMessage: 'Privacy Policy',\n description: 'Text for the hyperlink that redirects user to privacy policy',\n },\n 'honor.code': {\n id: 'honor.code',\n defaultMessage: 'Honor Code',\n description: 'Text for the hyperlink that redirects user to the honor code',\n },\n 'terms.of.service': {\n id: 'terms.of.service',\n defaultMessage: 'Terms of Service',\n description: 'Text for the hyperlink that redirects user to the terms of service',\n },\n // miscellaneous strings\n 'registration.username.suggestion.label': {\n id: 'registration.username.suggestion.label',\n defaultMessage: 'Suggested:',\n description: 'Suggested usernames label text.',\n },\n 'did.you.mean.alert.text': {\n id: 'did.you.mean.alert.text',\n defaultMessage: 'Did you mean',\n description: 'Did you mean alert suggestion',\n },\n});\n\nexport default messages;\n"]}