@openeventkit/event-site 2.0.94 → 2.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/actions/user-actions.js +3 -8
- package/src/cms/config/collections/defaultPagesCollection/invitationsRejectPage/index.js +12 -1
- package/src/cms/config/collections/defaultPagesCollection/invitationsRejectPage/typeDefs.js +3 -1
- package/src/content/invitations-reject-page/index.json +6 -6
- package/src/pages/a/[...].js +2 -0
- package/src/templates/invitations-reject-page.js +66 -36
package/package.json
CHANGED
|
@@ -22,6 +22,7 @@ import axios from "axios";
|
|
|
22
22
|
import { navigate } from 'gatsby';
|
|
23
23
|
import { customErrorHandler, customBadgeHandler, voidErrorHandler } from '../utils/customErrorHandler';
|
|
24
24
|
import { getEnvVariable, SUMMIT_API_BASE_URL, SUMMIT_ID } from "../utils/envVariables";
|
|
25
|
+
import expiredToken from "../utils/expiredToken";
|
|
25
26
|
|
|
26
27
|
export const GET_DISQUS_SSO = 'GET_DISQUS_SSO';
|
|
27
28
|
export const GET_USER_PROFILE = 'GET_USER_PROFILE';
|
|
@@ -586,7 +587,6 @@ export const doVirtualCheckIn = (attendee) => async (dispatch, getState) => {
|
|
|
586
587
|
});
|
|
587
588
|
};
|
|
588
589
|
|
|
589
|
-
|
|
590
590
|
/**
|
|
591
591
|
* Get invitation by token to allow reject
|
|
592
592
|
* @param token
|
|
@@ -594,12 +594,11 @@ export const doVirtualCheckIn = (attendee) => async (dispatch, getState) => {
|
|
|
594
594
|
*/
|
|
595
595
|
export const getInvitation = (token) => async (dispatch) => {
|
|
596
596
|
dispatch(startLoading());
|
|
597
|
-
|
|
598
597
|
return getRequest(
|
|
599
598
|
createAction(REQUEST_INVITATION),
|
|
600
599
|
createAction(RECEIVE_INVITATION),
|
|
601
600
|
`${window.API_BASE_URL}/api/public/v1/summits/${window.SUMMIT_ID}/registration-invitations/${token}`,
|
|
602
|
-
|
|
601
|
+
null
|
|
603
602
|
)({})(dispatch)
|
|
604
603
|
.finally(() => dispatch(stopLoading()));
|
|
605
604
|
}
|
|
@@ -611,17 +610,13 @@ export const getInvitation = (token) => async (dispatch) => {
|
|
|
611
610
|
*/
|
|
612
611
|
export const rejectInvitation = (token) => async (dispatch) => {
|
|
613
612
|
dispatch(startLoading());
|
|
614
|
-
|
|
615
613
|
return deleteRequest(
|
|
616
614
|
null,
|
|
617
615
|
createAction(REJECT_INVITATION),
|
|
618
616
|
`${window.API_BASE_URL}/api/public/v1/summits/${window.SUMMIT_ID}/registration-invitations/${token}/reject`,
|
|
619
617
|
{},
|
|
620
|
-
|
|
618
|
+
null
|
|
621
619
|
)({})(dispatch)
|
|
622
|
-
.then(() => {
|
|
623
|
-
//redirect ?
|
|
624
|
-
})
|
|
625
620
|
.finally(() => dispatch(stopLoading()));
|
|
626
621
|
}
|
|
627
622
|
|
|
@@ -38,8 +38,19 @@ const invitationsRejectPage = {
|
|
|
38
38
|
required: false,
|
|
39
39
|
default: "Reject Invitation"
|
|
40
40
|
}),
|
|
41
|
+
stringField({
|
|
42
|
+
label: "Already Accepted Invitation Error",
|
|
43
|
+
name: "alreadyAcceptedInvitationError",
|
|
44
|
+
required: false,
|
|
45
|
+
default: "This invitation has already been accepted. Please contact the event organizer if you feel this is an error."
|
|
46
|
+
}),
|
|
47
|
+
stringField({
|
|
48
|
+
label: "Already Rejected Invitation Error",
|
|
49
|
+
name: "alreadyRejectedInvitationError",
|
|
50
|
+
required: false,
|
|
51
|
+
default: "This invitation has already been declined. Please contact the event organizer if you feel this is an error."
|
|
52
|
+
}),
|
|
41
53
|
]
|
|
42
54
|
};
|
|
43
55
|
|
|
44
56
|
export default invitationsRejectPage;
|
|
45
|
-
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"title": "Invitation
|
|
3
|
-
"notFoundText": "
|
|
4
|
-
"rejectedText": "You have
|
|
5
|
-
"rejectText": "
|
|
6
|
-
"rejectCTALabel": "
|
|
7
|
-
}
|
|
2
|
+
"title": "Decline Invitation",
|
|
3
|
+
"notFoundText": "Sorry, we cannot locate your invitation. Please email for additional assistance.",
|
|
4
|
+
"rejectedText": "Thank you. You have declined this invitation.",
|
|
5
|
+
"rejectText": "Are you sure? Last chance to get your ticket!",
|
|
6
|
+
"rejectCTALabel": "Decline"
|
|
7
|
+
}
|
package/src/pages/a/[...].js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useEffect, useState
|
|
1
|
+
import React, {useEffect, useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import {connect} from "react-redux";
|
|
4
4
|
import Layout from "../components/Layout";
|
|
@@ -10,72 +10,102 @@ import styles from "../styles/invitation-reject.module.scss";
|
|
|
10
10
|
|
|
11
11
|
const InvitationsRejectPage = ({data, location, invitationToken, invitation, loading, ...props}) => {
|
|
12
12
|
const [loaded, setLoaded] = useState(false);
|
|
13
|
+
const [error, setError] = useState(null);
|
|
13
14
|
const [rejecting, setRejecting] = useState(false);
|
|
14
|
-
const {invitationsRejectPageJson: {title, notFoundText, rejectedText, rejectText, rejectCTALabel}} = data;
|
|
15
|
+
const {invitationsRejectPageJson: {title, notFoundText, rejectedText, rejectText, rejectCTALabel, alreadyAcceptedInvitationError, alreadyRejectedInvitationError}} = data;
|
|
15
16
|
const titleStr = title || "Reject invitation"
|
|
16
17
|
const rejectStr = rejectText || "To reject please click on the button below."
|
|
17
18
|
const rejectCTA = rejectCTALabel || "Reject"
|
|
18
19
|
const notFoundStr = notFoundText || "Invitation not found."
|
|
19
20
|
const rejectedStr = rejectedText || "Invitation has already been rejected."
|
|
20
21
|
|
|
22
|
+
const invitationErrorhandler = (e) => {
|
|
23
|
+
const { res } = e;
|
|
24
|
+
let code = res.status;
|
|
25
|
+
switch(code){
|
|
26
|
+
case 404:
|
|
27
|
+
setError(notFoundStr)
|
|
28
|
+
break;
|
|
29
|
+
case 412: {
|
|
30
|
+
const response = res?.body;
|
|
31
|
+
let apiErrors = '';
|
|
32
|
+
response.errors.forEach(val => apiErrors += val + '\n');
|
|
33
|
+
switch (response.code) {
|
|
34
|
+
case 1:
|
|
35
|
+
apiErrors = alreadyAcceptedInvitationError || apiErrors;
|
|
36
|
+
break;
|
|
37
|
+
case 2:
|
|
38
|
+
apiErrors = alreadyRejectedInvitationError || apiErrors;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
setError(apiErrors);
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
21
47
|
useEffect(() => {
|
|
22
48
|
setLoaded(false);
|
|
23
49
|
if (invitationToken) {
|
|
24
50
|
props.getInvitation(invitationToken)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
51
|
+
.catch(invitationErrorhandler)
|
|
52
|
+
.finally(() => {
|
|
53
|
+
setLoaded(true)
|
|
54
|
+
});
|
|
28
55
|
}
|
|
29
56
|
}, []);
|
|
30
57
|
|
|
31
58
|
const rejectInvitation = () => {
|
|
32
59
|
setRejecting(true);
|
|
33
60
|
props.rejectInvitation(invitationToken)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
61
|
+
.catch(invitationErrorhandler)
|
|
62
|
+
.finally(() => {
|
|
63
|
+
setRejecting(false);
|
|
64
|
+
});
|
|
37
65
|
}
|
|
38
66
|
|
|
39
67
|
const getMessage = () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
68
|
+
|
|
69
|
+
if (!invitationToken) {
|
|
70
|
+
return (
|
|
71
|
+
<>
|
|
72
|
+
<div>Missing token.</div>
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!loaded) return null;
|
|
78
|
+
|
|
48
79
|
if (!invitation) {
|
|
49
|
-
return (
|
|
50
|
-
<>
|
|
51
|
-
<div>{notFoundStr}</div>
|
|
52
|
-
</>
|
|
53
|
-
);
|
|
54
|
-
} else {
|
|
55
|
-
if (invitation.status === 'Rejected') {
|
|
56
80
|
return (
|
|
57
81
|
<>
|
|
58
|
-
|
|
82
|
+
<div>{error}</div>
|
|
59
83
|
</>
|
|
60
|
-
)
|
|
61
|
-
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (invitation.status === 'Rejected') {
|
|
62
88
|
return (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{rejectCTA}
|
|
67
|
-
</button>
|
|
68
|
-
</>
|
|
89
|
+
<>
|
|
90
|
+
<div>{rejectedStr}</div>
|
|
91
|
+
</>
|
|
69
92
|
)
|
|
70
|
-
|
|
93
|
+
}
|
|
71
94
|
|
|
95
|
+
if (invitation.status === 'Pending') {
|
|
96
|
+
return (
|
|
97
|
+
<>
|
|
98
|
+
<div>{rejectStr}</div>
|
|
99
|
+
<button className="button is-large" onClick={rejectInvitation} disabled={rejecting}>
|
|
100
|
+
{rejectCTA}
|
|
101
|
+
</button>
|
|
102
|
+
</>
|
|
103
|
+
)
|
|
72
104
|
}
|
|
73
|
-
|
|
105
|
+
|
|
74
106
|
return null;
|
|
75
|
-
}
|
|
76
107
|
}
|
|
77
108
|
|
|
78
|
-
|
|
79
109
|
return (
|
|
80
110
|
<Layout location={location}>
|
|
81
111
|
<div className={`container ${styles.container}`}>
|