@aarhus-university/au-lib-react-components 9.11.8 → 9.11.12

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 (141) hide show
  1. package/.eslintrc +18 -18
  2. package/README.md +20 -20
  3. package/babel.config.js +6 -6
  4. package/build/dev.html +328 -328
  5. package/build/umd/all.css +2 -2
  6. package/build/umd/all.js +1 -1
  7. package/build/umd/alphabox.js +1 -1
  8. package/build/umd/auAuth.js +1 -1
  9. package/build/umd/databox.js +2 -2
  10. package/build/umd/databox.js.LICENSE.txt +5 -5
  11. package/build/umd/diagramme.js +1 -1
  12. package/build/umd/flowbox.js +1 -1
  13. package/build/umd/news.js +1 -1
  14. package/build/umd/universe.js +1 -1
  15. package/package.json +60 -60
  16. package/src/all.js +3 -3
  17. package/src/app.js +263 -263
  18. package/src/components/AUAlertComponent.js +158 -158
  19. package/src/components/AUAmountComponent.js +84 -84
  20. package/src/components/AUBannerComponent.js +99 -99
  21. package/src/components/AUCalendarComponent.js +393 -393
  22. package/src/components/AUCollapsibleComponent.js +173 -173
  23. package/src/components/AUDatepickerComponent.js +105 -105
  24. package/src/components/AUDiagrammeComponent.js +310 -310
  25. package/src/components/AUFilterCheckboxComponent.js +122 -122
  26. package/src/components/AUFocusComponent.js +55 -55
  27. package/src/components/AUModalComponent.js +94 -94
  28. package/src/components/AUPaginationComponent.js +103 -103
  29. package/src/components/AUSpinnerComponent.js +125 -125
  30. package/src/components/AutoSuggestComponent.js +132 -132
  31. package/src/components/alphabox/AlphaBoxComponent.js +140 -140
  32. package/src/components/alphabox/AlphaBoxContentComponent.js +125 -125
  33. package/src/components/context/AUUserContextComponent.js +91 -91
  34. package/src/components/context/ImpersonateComponent.js +54 -54
  35. package/src/components/databox/DataBoxAlphabetComponent.js +144 -144
  36. package/src/components/databox/DataBoxAssociationComponent.js +122 -122
  37. package/src/components/databox/DataBoxButtonComponent.js +153 -153
  38. package/src/components/databox/DataBoxComponent.js +297 -297
  39. package/src/components/databox/DataBoxGroupingComponent.js +62 -62
  40. package/src/components/databox/DataBoxSearchResultComponent.js +40 -40
  41. package/src/components/databox/DataBoxStackedAssociationComponent.js +58 -58
  42. package/src/components/databox/DataBoxSuggestionComponent.js +39 -39
  43. package/src/components/delphinus/AUAlertComponent.js +85 -85
  44. package/src/components/delphinus/AUCalendarComponent.js +487 -487
  45. package/src/components/delphinus/AUContentToggleComponent.js +32 -32
  46. package/src/components/delphinus/AUDatepickerComponent.js +164 -164
  47. package/src/components/delphinus/AULoginComponent.js +65 -65
  48. package/src/components/delphinus/AUModalComponent.js +89 -88
  49. package/src/components/delphinus/AUSpinnerComponent.js +77 -114
  50. package/src/components/delphinus/AUSubNavComponent.js +53 -53
  51. package/src/components/delphinus/AUTabbedContentComponent.js +150 -150
  52. package/src/components/delphinus/AUTableComponent.js +28 -28
  53. package/src/components/delphinus/AUToastComponent.js +91 -91
  54. package/src/components/delphinus/AUToolbarComponent.js +48 -48
  55. package/src/components/delphinus/hooks.js +28 -26
  56. package/src/components/flowbox/FlowBoxComponent.js +126 -126
  57. package/src/components/flowbox/FlowBoxPhoneComponent.js +106 -106
  58. package/src/components/form/AUMobilePrefixComponent.js +18 -18
  59. package/src/components/form/AUReceiptComponent.js +40 -40
  60. package/src/components/form/AUSubmitButtonContainerComponent.js +39 -39
  61. package/src/components/news/EventLayout1Component.js +94 -94
  62. package/src/components/news/EventLayout2Component.js +90 -90
  63. package/src/components/news/EventLayout3Component.js +68 -68
  64. package/src/components/news/NewsCategoriesComponent.js +21 -21
  65. package/src/components/news/NewsCollageBannerComponent.js +71 -71
  66. package/src/components/news/NewsCollageBannerRSSComponent.js +79 -79
  67. package/src/components/news/NewsColumnsComponent.js +125 -125
  68. package/src/components/news/NewsLanguageChangeComponent.js +74 -74
  69. package/src/components/news/NewsLayout1Component.js +80 -80
  70. package/src/components/news/NewsLayout2Component.js +80 -80
  71. package/src/components/news/NewsLayout3Component.js +81 -81
  72. package/src/components/news/NewsLayout4Component.js +80 -80
  73. package/src/components/news/NewsLayout5Component.js +61 -61
  74. package/src/components/news/NewsLayout6Component.js +55 -55
  75. package/src/components/news/NewsLayout7Component.js +58 -58
  76. package/src/components/news/NewsLayout8Component.js +57 -57
  77. package/src/components/news/NewsListComponent.js +291 -291
  78. package/src/components/news/NewsPopUpComponent.js +591 -591
  79. package/src/components/news/NewsRSSComponent.js +74 -74
  80. package/src/components/news/NewsSocialComponent.js +104 -104
  81. package/src/components/news/NewsSubHeaderComponent.js +19 -19
  82. package/src/components/password/AUChangePasswordComponent.js +177 -177
  83. package/src/components/password/AUCurrentPasswordComponent.js +72 -72
  84. package/src/components/password/AUNewPasswordComponent.js +143 -143
  85. package/src/components/password/AUPasswordActions.js +101 -101
  86. package/src/components/password/AUPasswordHooks.js +47 -47
  87. package/src/components/password/AUPasswordReducer.js +78 -78
  88. package/src/components/password/AUPasswordRequirementsComponent.js +29 -29
  89. package/src/components/profile/AUProfileActions.js +128 -128
  90. package/src/components/profile/AUProfileAvatar2016Component.js +99 -99
  91. package/src/components/profile/AUProfileAvatarComponent.js +83 -83
  92. package/src/components/profile/AUProfileAvatarV2Component.js +91 -91
  93. package/src/components/profile/AUProfileAvatarV3Component.js +79 -79
  94. package/src/components/profile/AUProfileContainerComponent.js +283 -283
  95. package/src/components/profile/AUProfileHooks.js +30 -30
  96. package/src/components/profile/AUProfileItemComponent.js +54 -54
  97. package/src/components/profile/AUProfileLanguageComponent.js +131 -131
  98. package/src/components/profile/AUProfileLoginComponent.js +41 -41
  99. package/src/components/profile/AUProfileMailComponent.js +307 -307
  100. package/src/components/profile/AUProfileMobileComponent.js +164 -164
  101. package/src/components/profile/AUProfileNameComponent.js +253 -253
  102. package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
  103. package/src/components/profile/AUProfileReducer.js +230 -230
  104. package/src/components/profile/AUProfileWidgetComponent.js +95 -95
  105. package/src/components/profile/AUProfileWidgetV2Component.js +116 -116
  106. package/src/components/profile/AUProfileWidgetV3Component.js +129 -129
  107. package/src/components/universe/StaffTopComponent.js +362 -362
  108. package/src/components/universe/StudentTopComponent.js +137 -137
  109. package/src/components/universe/UniverseContainerComponent.js +62 -62
  110. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  111. package/src/config/webpack.dev.config.js +47 -47
  112. package/src/config/webpack.umd.config.js +85 -85
  113. package/src/index.js +6 -6
  114. package/src/lib/au-alphabox.js +102 -102
  115. package/src/lib/au-auth.js +227 -227
  116. package/src/lib/au-databox.js +403 -403
  117. package/src/lib/au-diagramme.js +87 -87
  118. package/src/lib/au-flowbox.js +95 -95
  119. package/src/lib/au-news.js +371 -371
  120. package/src/lib/helpers.js +216 -216
  121. package/src/lib/i18n.js +601 -601
  122. package/src/lib/menu.js +10 -10
  123. package/src/lib/tracking.js +65 -65
  124. package/src/lib/universe.js +9 -9
  125. package/src/lib/urlHandler.js +63 -63
  126. package/src/lib/validation.js +181 -181
  127. package/src/lib/wrapping.js +16 -16
  128. package/src/styles/_settings.scss +10 -10
  129. package/src/styles/alert.scss +39 -39
  130. package/src/styles/alphabox.scss +208 -208
  131. package/src/styles/app.scss +13 -13
  132. package/src/styles/autosuggest.scss +57 -57
  133. package/src/styles/calendar.scss +111 -111
  134. package/src/styles/databox.scss +563 -563
  135. package/src/styles/diagramme.scss +119 -119
  136. package/src/styles/filtercheckbox.scss +4 -4
  137. package/src/styles/flowbox.scss +72 -72
  138. package/src/styles/maps.scss +395 -395
  139. package/src/styles/modal.scss +34 -34
  140. package/src/styles/pagination.scss +10 -10
  141. package/src/styles/spinner.scss +30 -30
@@ -1,78 +1,78 @@
1
- import {
2
- PATCH_PASSWORD,
3
- DISMISS_MESSAGES,
4
- SET_SAVED,
5
- SAVING_PASSWORD,
6
- SENDING_MAIL,
7
- SEND_MAIL,
8
- GET_TOKEN_STATUS,
9
- } from './AUPasswordActions';
10
-
11
- export const initialState = {
12
- password: {
13
- saving: false,
14
- saved: false,
15
- validToken: true,
16
- },
17
- messages: [],
18
- };
19
-
20
- export const reducer = (state = initialState, action) => {
21
- const nextState = { ...state };
22
-
23
- switch (action.type) {
24
- case DISMISS_MESSAGES: {
25
- nextState.messages = [];
26
- return nextState;
27
- }
28
- case SET_SAVED: {
29
- const prevPassword = { ...nextState.password };
30
- nextState.password = Object.assign(prevPassword, {
31
- saved: false,
32
- });
33
- return nextState;
34
- }
35
- case SENDING_MAIL:
36
- case SAVING_PASSWORD: {
37
- const prevPassword = { ...nextState.password };
38
- nextState.password = Object.assign(prevPassword, { saving: true, saved: false });
39
- return nextState;
40
- }
41
- case SEND_MAIL:
42
- case PATCH_PASSWORD: {
43
- const { result } = action;
44
- const prevPassword = { ...nextState.password };
45
- if (result.password) {
46
- nextState.password = Object.assign(prevPassword, {
47
- saving: false,
48
- saved: true,
49
- });
50
- } else if (result.error) {
51
- const {
52
- errorType,
53
- errorMessageDa,
54
- errorMessageEn,
55
- lang,
56
- } = result.error;
57
- nextState.messages = [{
58
- type: errorType,
59
- message: lang === 'da' ? errorMessageDa : errorMessageEn,
60
- }];
61
- nextState.password = Object.assign(prevPassword, { saving: false });
62
- }
63
- return nextState;
64
- }
65
- case GET_TOKEN_STATUS: {
66
- const { result } = action;
67
- const prevPassword = { ...nextState.password };
68
- nextState.password = Object.assign(prevPassword, {
69
- validToken: result.token,
70
- });
71
-
72
- return nextState;
73
- }
74
- default: {
75
- return null;
76
- }
77
- }
78
- };
1
+ import {
2
+ PATCH_PASSWORD,
3
+ DISMISS_MESSAGES,
4
+ SET_SAVED,
5
+ SAVING_PASSWORD,
6
+ SENDING_MAIL,
7
+ SEND_MAIL,
8
+ GET_TOKEN_STATUS,
9
+ } from './AUPasswordActions';
10
+
11
+ export const initialState = {
12
+ password: {
13
+ saving: false,
14
+ saved: false,
15
+ validToken: true,
16
+ },
17
+ messages: [],
18
+ };
19
+
20
+ export const reducer = (state = initialState, action) => {
21
+ const nextState = { ...state };
22
+
23
+ switch (action.type) {
24
+ case DISMISS_MESSAGES: {
25
+ nextState.messages = [];
26
+ return nextState;
27
+ }
28
+ case SET_SAVED: {
29
+ const prevPassword = { ...nextState.password };
30
+ nextState.password = Object.assign(prevPassword, {
31
+ saved: false,
32
+ });
33
+ return nextState;
34
+ }
35
+ case SENDING_MAIL:
36
+ case SAVING_PASSWORD: {
37
+ const prevPassword = { ...nextState.password };
38
+ nextState.password = Object.assign(prevPassword, { saving: true, saved: false });
39
+ return nextState;
40
+ }
41
+ case SEND_MAIL:
42
+ case PATCH_PASSWORD: {
43
+ const { result } = action;
44
+ const prevPassword = { ...nextState.password };
45
+ if (result.password) {
46
+ nextState.password = Object.assign(prevPassword, {
47
+ saving: false,
48
+ saved: true,
49
+ });
50
+ } else if (result.error) {
51
+ const {
52
+ errorType,
53
+ errorMessageDa,
54
+ errorMessageEn,
55
+ lang,
56
+ } = result.error;
57
+ nextState.messages = [{
58
+ type: errorType,
59
+ message: lang === 'da' ? errorMessageDa : errorMessageEn,
60
+ }];
61
+ nextState.password = Object.assign(prevPassword, { saving: false });
62
+ }
63
+ return nextState;
64
+ }
65
+ case GET_TOKEN_STATUS: {
66
+ const { result } = action;
67
+ const prevPassword = { ...nextState.password };
68
+ nextState.password = Object.assign(prevPassword, {
69
+ validToken: result.token,
70
+ });
71
+
72
+ return nextState;
73
+ }
74
+ default: {
75
+ return null;
76
+ }
77
+ }
78
+ };
@@ -1,29 +1,29 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { passwordLabels } from '../../lib/i18n';
4
-
5
- const AUPasswordRequirementsComponents = ({ lang }) => (
6
- <div className="row__item row__item--basis-25">
7
- <div className="box box--constrain-width theme--background-secondary row__item-content">
8
- <h2 className="text--default-size text--pull">{passwordLabels[lang].requirementsHeader}</h2>
9
- <ul className="list--dense">
10
- <li>{passwordLabels[lang].requirement1}</li>
11
- <li>{passwordLabels[lang].requirement2}</li>
12
- <li>{passwordLabels[lang].requirement3}</li>
13
- <li>
14
- {passwordLabels[lang].requirement4}
15
- &nbsp;
16
- <span className="u-avoid-wrap">
17
- {'~!@#$%^&*_-+=`|(){}[]:;"\'<>,.?/'}
18
- </span>
19
- </li>
20
- </ul>
21
- </div>
22
- </div>
23
- );
24
-
25
- AUPasswordRequirementsComponents.propTypes = {
26
- lang: PropTypes.string.isRequired,
27
- };
28
- AUPasswordRequirementsComponents.displayName = 'AUPasswordRequirementsComponents';
29
- export default AUPasswordRequirementsComponents;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { passwordLabels } from '../../lib/i18n';
4
+
5
+ const AUPasswordRequirementsComponents = ({ lang }) => (
6
+ <div className="row__item row__item--basis-25">
7
+ <div className="box box--constrain-width theme--background-secondary row__item-content">
8
+ <h2 className="text--default-size text--pull">{passwordLabels[lang].requirementsHeader}</h2>
9
+ <ul className="list--dense">
10
+ <li>{passwordLabels[lang].requirement1}</li>
11
+ <li>{passwordLabels[lang].requirement2}</li>
12
+ <li>{passwordLabels[lang].requirement3}</li>
13
+ <li>
14
+ {passwordLabels[lang].requirement4}
15
+ &nbsp;
16
+ <span className="u-avoid-wrap">
17
+ {'~!@#$%^&*_-+=`|(){}[]:;"\'<>,.?/'}
18
+ </span>
19
+ </li>
20
+ </ul>
21
+ </div>
22
+ </div>
23
+ );
24
+
25
+ AUPasswordRequirementsComponents.propTypes = {
26
+ lang: PropTypes.string.isRequired,
27
+ };
28
+ AUPasswordRequirementsComponents.displayName = 'AUPasswordRequirementsComponents';
29
+ export default AUPasswordRequirementsComponents;
@@ -1,128 +1,128 @@
1
- /* eslint-disable import/prefer-default-export */
2
- export const GET_BASIC_USER = 'GET_BASIC_USER';
3
- export const SAVING_USER = 'SAVING_USER';
4
- export const PATCH_NAME = 'PATCH_NAME';
5
- export const PATCH_MAIL = 'PATCH_MAIL';
6
- export const PATCH_MOBILE = 'PATCH_MOBILE';
7
- export const PATCH_LANGUAGE = 'PATCH_LANGUAGE';
8
- export const PATCH_NEXTOFKIN = 'PATCH_NEXTOFKIN';
9
- export const DISMISS_MESSAGES = 'DISMISS_MESSAGES';
10
- export const SET_SAVED = 'SET_SAVED';
11
- export const GET_WORKMAIL_DOMAIN = 'GET_WORKMAIL_DOMAIN';
12
-
13
- export const getActionCreators = () => {
14
- const actionCreators = {
15
- getBasicUser: (callback) => async (dispatch) => { // Tror simpelthen ikke det her er i brug...
16
- callback((ok, status, json) => {
17
- const result = {};
18
- result[ok ? 'user' : 'error'] = json;
19
- result.status = status;
20
- dispatch({
21
- type: GET_BASIC_USER,
22
- result,
23
- });
24
- });
25
- },
26
- getWorkMailDomain: () => async (dispatch) => {
27
- const url = '/v1/person/getworkmaildomain';
28
- const response = await fetch(url);
29
- const json = await response.json();
30
- const result = {};
31
- result[response.ok ? 'user' : 'error'] = response.ok ? {
32
- workMailDomain: json
33
- } : json;
34
- result.status = response.status;
35
- dispatch({
36
- type: GET_WORKMAIL_DOMAIN,
37
- result,
38
- });
39
- },
40
- clear: () => (dispatch) => {
41
- dispatch({
42
- type: SET_SAVED,
43
- });
44
- },
45
- dismissMessages: () => (dispatch) => {
46
- dispatch({
47
- type: DISMISS_MESSAGES,
48
- });
49
- },
50
- patchName: (data, callback) => async (dispatch) => {
51
- dispatch({
52
- type: SAVING_USER,
53
- });
54
-
55
- callback(data, (ok, status, json) => {
56
- const result = {};
57
- result[ok ? 'user' : 'error'] = json;
58
- result.status = status;
59
- dispatch({
60
- type: PATCH_NAME,
61
- result,
62
- });
63
- });
64
- },
65
- patchMail: (data, callback) => async (dispatch) => {
66
- dispatch({
67
- type: SAVING_USER,
68
- });
69
-
70
- callback(data, (ok, status, json) => {
71
- const result = {};
72
- result[ok ? 'user' : 'error'] = json;
73
- result.status = status;
74
- dispatch({
75
- type: PATCH_MAIL,
76
- result,
77
- });
78
- });
79
- },
80
- patchMobile: (data, callback) => async (dispatch) => {
81
- dispatch({
82
- type: SAVING_USER,
83
- });
84
-
85
- callback(data, (ok, status, json) => {
86
- const result = {};
87
- result[ok ? 'user' : 'error'] = json;
88
- result.status = status;
89
- dispatch({
90
- type: PATCH_MOBILE,
91
- result,
92
- });
93
- });
94
- },
95
- patchLanguage: (data, callback) => async (dispatch) => {
96
- dispatch({
97
- type: SAVING_USER,
98
- });
99
-
100
- callback(data, (ok, status, json) => {
101
- const result = {};
102
- result[ok ? 'user' : 'error'] = json;
103
- result.status = status;
104
- dispatch({
105
- type: PATCH_LANGUAGE,
106
- result,
107
- });
108
- });
109
- },
110
- patchNextOfKin: (data, callback) => async (dispatch) => {
111
- dispatch({
112
- type: SAVING_USER,
113
- });
114
-
115
- callback(data, (ok, status, json) => {
116
- const result = {};
117
- result[ok ? 'user' : 'error'] = json;
118
- result.status = status;
119
- dispatch({
120
- type: PATCH_NEXTOFKIN,
121
- result,
122
- });
123
- });
124
- },
125
- };
126
-
127
- return actionCreators;
128
- };
1
+ /* eslint-disable import/prefer-default-export */
2
+ export const GET_BASIC_USER = 'GET_BASIC_USER';
3
+ export const SAVING_USER = 'SAVING_USER';
4
+ export const PATCH_NAME = 'PATCH_NAME';
5
+ export const PATCH_MAIL = 'PATCH_MAIL';
6
+ export const PATCH_MOBILE = 'PATCH_MOBILE';
7
+ export const PATCH_LANGUAGE = 'PATCH_LANGUAGE';
8
+ export const PATCH_NEXTOFKIN = 'PATCH_NEXTOFKIN';
9
+ export const DISMISS_MESSAGES = 'DISMISS_MESSAGES';
10
+ export const SET_SAVED = 'SET_SAVED';
11
+ export const GET_WORKMAIL_DOMAIN = 'GET_WORKMAIL_DOMAIN';
12
+
13
+ export const getActionCreators = () => {
14
+ const actionCreators = {
15
+ getBasicUser: (callback) => async (dispatch) => { // Tror simpelthen ikke det her er i brug...
16
+ callback((ok, status, json) => {
17
+ const result = {};
18
+ result[ok ? 'user' : 'error'] = json;
19
+ result.status = status;
20
+ dispatch({
21
+ type: GET_BASIC_USER,
22
+ result,
23
+ });
24
+ });
25
+ },
26
+ getWorkMailDomain: () => async (dispatch) => {
27
+ const url = '/v1/person/getworkmaildomain';
28
+ const response = await fetch(url);
29
+ const json = await response.json();
30
+ const result = {};
31
+ result[response.ok ? 'user' : 'error'] = response.ok ? {
32
+ workMailDomain: json
33
+ } : json;
34
+ result.status = response.status;
35
+ dispatch({
36
+ type: GET_WORKMAIL_DOMAIN,
37
+ result,
38
+ });
39
+ },
40
+ clear: () => (dispatch) => {
41
+ dispatch({
42
+ type: SET_SAVED,
43
+ });
44
+ },
45
+ dismissMessages: () => (dispatch) => {
46
+ dispatch({
47
+ type: DISMISS_MESSAGES,
48
+ });
49
+ },
50
+ patchName: (data, callback) => async (dispatch) => {
51
+ dispatch({
52
+ type: SAVING_USER,
53
+ });
54
+
55
+ callback(data, (ok, status, json) => {
56
+ const result = {};
57
+ result[ok ? 'user' : 'error'] = json;
58
+ result.status = status;
59
+ dispatch({
60
+ type: PATCH_NAME,
61
+ result,
62
+ });
63
+ });
64
+ },
65
+ patchMail: (data, callback) => async (dispatch) => {
66
+ dispatch({
67
+ type: SAVING_USER,
68
+ });
69
+
70
+ callback(data, (ok, status, json) => {
71
+ const result = {};
72
+ result[ok ? 'user' : 'error'] = json;
73
+ result.status = status;
74
+ dispatch({
75
+ type: PATCH_MAIL,
76
+ result,
77
+ });
78
+ });
79
+ },
80
+ patchMobile: (data, callback) => async (dispatch) => {
81
+ dispatch({
82
+ type: SAVING_USER,
83
+ });
84
+
85
+ callback(data, (ok, status, json) => {
86
+ const result = {};
87
+ result[ok ? 'user' : 'error'] = json;
88
+ result.status = status;
89
+ dispatch({
90
+ type: PATCH_MOBILE,
91
+ result,
92
+ });
93
+ });
94
+ },
95
+ patchLanguage: (data, callback) => async (dispatch) => {
96
+ dispatch({
97
+ type: SAVING_USER,
98
+ });
99
+
100
+ callback(data, (ok, status, json) => {
101
+ const result = {};
102
+ result[ok ? 'user' : 'error'] = json;
103
+ result.status = status;
104
+ dispatch({
105
+ type: PATCH_LANGUAGE,
106
+ result,
107
+ });
108
+ });
109
+ },
110
+ patchNextOfKin: (data, callback) => async (dispatch) => {
111
+ dispatch({
112
+ type: SAVING_USER,
113
+ });
114
+
115
+ callback(data, (ok, status, json) => {
116
+ const result = {};
117
+ result[ok ? 'user' : 'error'] = json;
118
+ result.status = status;
119
+ dispatch({
120
+ type: PATCH_NEXTOFKIN,
121
+ result,
122
+ });
123
+ });
124
+ },
125
+ };
126
+
127
+ return actionCreators;
128
+ };
@@ -1,99 +1,99 @@
1
- /* eslint-env browser */
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import AUProfileWidgetComponent from './AUProfileWidgetComponent';
5
- import AUUserContextComponent from '../context/AUUserContextComponent';
6
-
7
- const AUProfileAvatar2016Component = ({
8
- lang,
9
- user,
10
- settings,
11
- toggled,
12
- onToggle,
13
- onLoad,
14
- profileLabels,
15
- logoutUri,
16
- }) => {
17
- const {
18
- chosenFirstNames,
19
- chosenLastName,
20
- auId,
21
- studentNumber,
22
- } = user;
23
-
24
- const content = (
25
- <div className={`sub-nav${toggled ? ' sub-nav--toggled' : ''}`}>
26
- <button
27
- id="profile-menu-toggle"
28
- type="button"
29
- aria-label={toggled ? `${profileLabels[lang].profileFor} ${chosenFirstNames} ${chosenLastName}` : profileLabels[lang].myProfile}
30
- aria-expanded={toggled}
31
- onClick={() => {
32
- onToggle();
33
- }}
34
- >
35
- {chosenFirstNames || profileLabels[lang].myProfile}
36
- </button>
37
- {
38
- toggled && (
39
- <AUProfileWidgetComponent
40
- lang={lang}
41
- name={`${chosenFirstNames} ${chosenLastName}`}
42
- auid={auId}
43
- studentNumber={studentNumber}
44
- settings={settings}
45
- profileLabels={profileLabels}
46
- logoutUri={logoutUri}
47
- />
48
- )
49
- }
50
- </div>
51
- );
52
-
53
- if (auId === 0) {
54
- return null;
55
- }
56
-
57
- return (
58
- <AUUserContextComponent
59
- auid={auId}
60
- loggedIn
61
- contextKey="staff-user"
62
- handleContext={(userContext) => {
63
- onLoad(userContext);
64
- }}
65
- handleError={(status, json) => {
66
- console.log(status, json);
67
- }}
68
- spinner={false}
69
- emptyComponent={content}
70
- clearCache={false}
71
- >
72
- {content}
73
- </AUUserContextComponent>
74
- );
75
- };
76
-
77
- AUProfileAvatar2016Component.propTypes = {
78
- lang: PropTypes.string.isRequired,
79
- user: PropTypes.shape({
80
- chosenFirstNames: PropTypes.string.isRequired,
81
- chosenLastName: PropTypes.string.isRequired,
82
- preferredLanguage: PropTypes.string.isRequired,
83
- auId: PropTypes.number.isRequired,
84
- studentNumber: PropTypes.string.isRequired,
85
- }).isRequired,
86
- auAuth: PropTypes.shape({}).isRequired,
87
- settings: PropTypes.arrayOf(PropTypes.shape({
88
- url: PropTypes.string.isRequired,
89
- text: PropTypes.string.isRequired,
90
- })).isRequired,
91
- toggled: PropTypes.bool.isRequired,
92
- onToggle: PropTypes.func.isRequired,
93
- onLoad: PropTypes.func.isRequired,
94
- profileLabels: PropTypes.shape({}).isRequired,
95
- logoutUri: PropTypes.string.isRequired,
96
- };
97
-
98
- AUProfileAvatar2016Component.displayName = 'AUProfileAvatar2016Component';
99
- export default AUProfileAvatar2016Component;
1
+ /* eslint-env browser */
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import AUProfileWidgetComponent from './AUProfileWidgetComponent';
5
+ import AUUserContextComponent from '../context/AUUserContextComponent';
6
+
7
+ const AUProfileAvatar2016Component = ({
8
+ lang,
9
+ user,
10
+ settings,
11
+ toggled,
12
+ onToggle,
13
+ onLoad,
14
+ profileLabels,
15
+ logoutUri,
16
+ }) => {
17
+ const {
18
+ chosenFirstNames,
19
+ chosenLastName,
20
+ auId,
21
+ studentNumber,
22
+ } = user;
23
+
24
+ const content = (
25
+ <div className={`sub-nav${toggled ? ' sub-nav--toggled' : ''}`}>
26
+ <button
27
+ id="profile-menu-toggle"
28
+ type="button"
29
+ aria-label={toggled ? `${profileLabels[lang].profileFor} ${chosenFirstNames} ${chosenLastName}` : profileLabels[lang].myProfile}
30
+ aria-expanded={toggled}
31
+ onClick={() => {
32
+ onToggle();
33
+ }}
34
+ >
35
+ {chosenFirstNames || profileLabels[lang].myProfile}
36
+ </button>
37
+ {
38
+ toggled && (
39
+ <AUProfileWidgetComponent
40
+ lang={lang}
41
+ name={`${chosenFirstNames} ${chosenLastName}`}
42
+ auid={auId}
43
+ studentNumber={studentNumber}
44
+ settings={settings}
45
+ profileLabels={profileLabels}
46
+ logoutUri={logoutUri}
47
+ />
48
+ )
49
+ }
50
+ </div>
51
+ );
52
+
53
+ if (auId === 0) {
54
+ return null;
55
+ }
56
+
57
+ return (
58
+ <AUUserContextComponent
59
+ auid={auId}
60
+ loggedIn
61
+ contextKey="staff-user"
62
+ handleContext={(userContext) => {
63
+ onLoad(userContext);
64
+ }}
65
+ handleError={(status, json) => {
66
+ console.log(status, json);
67
+ }}
68
+ spinner={false}
69
+ emptyComponent={content}
70
+ clearCache={false}
71
+ >
72
+ {content}
73
+ </AUUserContextComponent>
74
+ );
75
+ };
76
+
77
+ AUProfileAvatar2016Component.propTypes = {
78
+ lang: PropTypes.string.isRequired,
79
+ user: PropTypes.shape({
80
+ chosenFirstNames: PropTypes.string.isRequired,
81
+ chosenLastName: PropTypes.string.isRequired,
82
+ preferredLanguage: PropTypes.string.isRequired,
83
+ auId: PropTypes.number.isRequired,
84
+ studentNumber: PropTypes.string.isRequired,
85
+ }).isRequired,
86
+ auAuth: PropTypes.shape({}).isRequired,
87
+ settings: PropTypes.arrayOf(PropTypes.shape({
88
+ url: PropTypes.string.isRequired,
89
+ text: PropTypes.string.isRequired,
90
+ })).isRequired,
91
+ toggled: PropTypes.bool.isRequired,
92
+ onToggle: PropTypes.func.isRequired,
93
+ onLoad: PropTypes.func.isRequired,
94
+ profileLabels: PropTypes.shape({}).isRequired,
95
+ logoutUri: PropTypes.string.isRequired,
96
+ };
97
+
98
+ AUProfileAvatar2016Component.displayName = 'AUProfileAvatar2016Component';
99
+ export default AUProfileAvatar2016Component;