@openeventkit/event-site 2.0.94 → 2.0.96

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openeventkit/event-site",
3
3
  "description": "Event Site",
4
- "version": "2.0.94",
4
+ "version": "2.0.96",
5
5
  "author": "Tipit LLC",
6
6
  "dependencies": {
7
7
  "@mui/base": "^5.0.0-alpha.114",
@@ -121,7 +121,7 @@
121
121
  "stream-browserify": "^3.0.0",
122
122
  "stream-chat": "^2.7.2",
123
123
  "stream-chat-react": "3.1.7",
124
- "summit-registration-lite": "5.0.21",
124
+ "summit-registration-lite": "5.0.22",
125
125
  "superagent": "8.0.9",
126
126
  "sweetalert2": "^9.17.0",
127
127
  "upcoming-events-widget": "3.0.5",
@@ -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
- customErrorHandler
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
- customErrorHandler
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
-
@@ -6,5 +6,7 @@ module.exports = `
6
6
  rejectedText: String
7
7
  rejectText: String
8
8
  rejectCTALabel: String
9
+ alreadyAcceptedInvitationError: String
10
+ alreadyRejectedInvitationError: String
9
11
  }
10
- `;
12
+ `;
@@ -1,7 +1,7 @@
1
1
  {
2
- "title": "Invitation rejection",
3
- "notFoundText": "Invitation not found.",
4
- "rejectedText": "You have rejected your invitation. ",
5
- "rejectText": "Be certain. This is your last chance to purchase this ticket...",
6
- "rejectCTALabel": "Reject"
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
+ }
@@ -30,6 +30,8 @@ export const appQuery = graphql`
30
30
  rejectedText
31
31
  rejectText
32
32
  rejectCTALabel
33
+ alreadyAcceptedInvitationError
34
+ alreadyRejectedInvitationError
33
35
  }
34
36
  }
35
37
  `;
@@ -24,6 +24,8 @@ $color_horizontal_rule_dark: #7B7B7B;
24
24
  $color_horizontal_rule_light: #E5E5E5;
25
25
  $color_text_input_hints_light:#7B7B7B;
26
26
  $color_text_input_hints_dark:#7B7B7B;
27
+ $color_button_background_color:#ffffff;
28
+ $color_button_color:#000000;
27
29
 
28
30
  :root {
29
31
  --color_primary: #{$color_primary};
@@ -45,6 +47,8 @@ $color_text_input_hints_dark:#7B7B7B;
45
47
  --color_text_input_hints: #{$color_text_input_hints_light};
46
48
  --color_horizontal_rule: #{$color_horizontal_rule_light};
47
49
  --color_icon_light: #{$color_icon_light};
50
+ --color_button_background_color: #{$color_button_background_color};
51
+ --color_button_color: #{$color_button_color};
48
52
  }
49
53
 
50
54
  html[data-theme="DARK"] {
@@ -61,4 +65,4 @@ html[data-theme="DARK"] {
61
65
  --color_input_border_color: #{$color_input_border_color_dark} !important;
62
66
  --color_text_input_hints: #{$color_text_input_hints_dark} !important;
63
67
  --color_horizontal_rule: #{$color_horizontal_rule_dark};
64
- }
68
+ }
@@ -1,4 +1,4 @@
1
- import React, {useEffect, useState, useCallback, useRef} from "react";
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
- .finally(() => {
26
- setLoaded(true)
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
- .finally(() => {
35
- setRejecting(false);
36
- });
61
+ .catch(invitationErrorhandler)
62
+ .finally(() => {
63
+ setRejecting(false);
64
+ });
37
65
  }
38
66
 
39
67
  const getMessage = () => {
40
- if (!invitationToken) {
41
- return (
42
- <>
43
- <div>Missing token.</div>
44
- </>
45
- );
46
- }
47
- else if (loaded) {
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
- <div>{rejectedStr}</div>
82
+ <div>{error}</div>
59
83
  </>
60
- )
61
- } else {
84
+ );
85
+ }
86
+
87
+ if (invitation.status === 'Rejected') {
62
88
  return (
63
- <>
64
- <div>{rejectStr}</div>
65
- <button className="button is-large" onClick={rejectInvitation} disabled={rejecting}>
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
- } else {
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}`}>