@openeventkit/event-site 2.1.50 → 2.1.51
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/gatsby-node.js +21 -4
- package/package.json +3 -3
- package/src/cms/config/collections/configurationsCollection/siteSettings/index.js +21 -0
- package/src/cms/config/collections/configurationsCollection/siteSettings/typeDefs.js +5 -0
- package/src/cms/config/collections/contentPagesCollection/index.js +11 -1
- package/src/cms/config/collections/contentPagesCollection/typeDefs.js +1 -0
- package/src/cms/config/collections/defaultPagesCollection/marketingPage/index.js +2 -6
- package/src/cms/config/collections/defaultPagesCollection/marketingPage/typeDefs.js +0 -1
- package/src/cms/preview-templates/ContentPagePreview.js +12 -1
- package/src/components/AuthComponent.js +2 -1
- package/src/components/MarketingHero/MainColumn.js +23 -11
- package/src/components/RegisterButton.js +59 -0
- package/src/components/RegistrationFormShortcode.js +82 -0
- package/src/components/RegistrationModalComponent.js +124 -0
- package/src/content/marketing-page/index.json +1 -2
- package/src/content/site-settings/index.json +1 -1
- package/src/content/sponsors.json +1 -1
- package/src/pages/index.js +0 -1
- package/src/styles/colors.scss +11 -11
- package/src/styles/register-page.module.scss +23 -0
- package/src/templates/content-page/shortcodes.js +3 -5
- package/src/templates/register-page.js +96 -0
- package/src/utils/registrationConstants.js +7 -0
- package/src/utils/useRegistrationWidgetProps.js +204 -0
- package/src/utils/useSiteSettings.js +4 -0
- package/src/components/RegistrationLiteComponent.js +0 -293
- package/src/templates/login-page.js +0 -49
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import * as Sentry from "@sentry/react";
|
|
4
|
-
import { navigate, withPrefix } from "gatsby";
|
|
5
|
-
import { connect } from "react-redux";
|
|
6
|
-
import URI from "urijs";
|
|
7
|
-
import { StyledSwal as Swal } from "@utils/alerts";
|
|
8
|
-
import {ERROR_TYPE_ERROR, ERROR_TYPE_VALIDATION, ERROR_TYPE_PAYMENT} from "summit-registration-lite/dist/utils/constants";
|
|
9
|
-
import FragmentParser from "openstack-uicore-foundation/lib/utils/fragment-parser";
|
|
10
|
-
import { doLogin, passwordlessStart, getAccessToken } from "openstack-uicore-foundation/lib/security/methods"
|
|
11
|
-
import { doLogout } from "openstack-uicore-foundation/lib/security/actions"
|
|
12
|
-
import { getUserProfile, setPasswordlessLogin, setUserOrder, checkOrderData } from "../actions/user-actions";
|
|
13
|
-
import { getThirdPartyProviders } from "../actions/base-actions";
|
|
14
|
-
import { checkRequireExtraQuestionsByAttendee } from "../actions/user-actions";
|
|
15
|
-
import { getExtraQuestions } from "../actions/summit-actions";
|
|
16
|
-
|
|
17
|
-
import IconButton from "./IconButton";
|
|
18
|
-
import iconButtonStyles from "./IconButton/styles.module.scss";
|
|
19
|
-
|
|
20
|
-
import { SentryFallbackFunction } from "./SentryErrorComponent";
|
|
21
|
-
// these two libraries are client-side only
|
|
22
|
-
import RegistrationLiteWidget from "summit-registration-lite/dist";
|
|
23
|
-
import "summit-registration-lite/dist/index.css";
|
|
24
|
-
import useSiteSettings from "@utils/useSiteSettings";
|
|
25
|
-
import usePaymentSettings from "@utils/usePaymentSettings";
|
|
26
|
-
import useMarketingSettings, { MARKETING_SETTINGS_KEYS } from "@utils/useMarketingSettings";
|
|
27
|
-
import { getEnvVariable, SUMMIT_API_BASE_URL, OAUTH2_CLIENT_ID, REGISTRATION_BASE_URL, SUPPORT_EMAIL, TENANT_ID } from "@utils/envVariables";
|
|
28
|
-
import { userHasAccessLevel, VIRTUAL_ACCESS_LEVEL } from "@utils/authorizedGroups";
|
|
29
|
-
import { validateIdentityProviderButtons } from "@utils/loginUtils";
|
|
30
|
-
import { triggerTagManagerTrackEvent } from "@utils/eventTriggers";
|
|
31
|
-
|
|
32
|
-
const RegistrationLiteComponent = ({
|
|
33
|
-
registrationProfile,
|
|
34
|
-
userProfile,
|
|
35
|
-
attendee,
|
|
36
|
-
getThirdPartyProviders,
|
|
37
|
-
availableThirdPartyProviders,
|
|
38
|
-
getUserProfile,
|
|
39
|
-
setPasswordlessLogin,
|
|
40
|
-
setUserOrder,
|
|
41
|
-
checkOrderData,
|
|
42
|
-
loadingProfile,
|
|
43
|
-
loadingIDP,
|
|
44
|
-
summit,
|
|
45
|
-
colorSettings,
|
|
46
|
-
marketingPageSettings,
|
|
47
|
-
allowsNativeAuth,
|
|
48
|
-
allowsOtpAuth,
|
|
49
|
-
checkRequireExtraQuestionsByAttendee,
|
|
50
|
-
getExtraQuestions,
|
|
51
|
-
children,
|
|
52
|
-
ignoreAutoOpen
|
|
53
|
-
}) => {
|
|
54
|
-
const [isActive, setIsActive] = useState(false);
|
|
55
|
-
const [initialEmailValue, setInitialEmailValue] = useState("");
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
const fragmentParser = new FragmentParser();
|
|
59
|
-
if(!ignoreAutoOpen) {
|
|
60
|
-
setIsActive(fragmentParser.getParam("registration"));
|
|
61
|
-
}
|
|
62
|
-
const paramInitialEmailValue = fragmentParser.getParam("email");
|
|
63
|
-
if (paramInitialEmailValue)
|
|
64
|
-
setInitialEmailValue(paramInitialEmailValue);
|
|
65
|
-
}, []);
|
|
66
|
-
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
if (!availableThirdPartyProviders.length) getThirdPartyProviders();
|
|
69
|
-
}, [availableThirdPartyProviders]);
|
|
70
|
-
|
|
71
|
-
const getBackURL = () => {
|
|
72
|
-
let backUrl = "/#registration=1";
|
|
73
|
-
return URI.encode(backUrl);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const handleOpenPopup = () => {
|
|
77
|
-
const { registerButton } = marketingPageSettings.hero.buttons;
|
|
78
|
-
if(registerButton?.externalRegistrationLink){
|
|
79
|
-
window.location = registerButton.externalRegistrationLink;
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
setIsActive(true);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const onClickLogin = (provider) => {
|
|
86
|
-
doLogin(getBackURL(), provider, null, null, null, getEnvVariable(TENANT_ID));
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const handleCompanyError = () => {
|
|
90
|
-
console.log("company error...")
|
|
91
|
-
Swal.fire("ERROR", "Hold on. Your session expired!.", "error").then(() => {
|
|
92
|
-
// save current location and summit slug, for further redirect logic
|
|
93
|
-
window.localStorage.setItem("post_logout_redirect_path", new URI(window.location.href).pathname());
|
|
94
|
-
doLogout();
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const getPasswordlessCode = (email) => {
|
|
99
|
-
const params = {
|
|
100
|
-
connection: "email",
|
|
101
|
-
send: "code",
|
|
102
|
-
redirect_uri: `${window.location.origin}/auth/callback`,
|
|
103
|
-
email,
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
return passwordlessStart(params)
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const loginPasswordless = (code, email) => {
|
|
110
|
-
const params = {
|
|
111
|
-
connection: "email",
|
|
112
|
-
otp: code,
|
|
113
|
-
email
|
|
114
|
-
};
|
|
115
|
-
return setPasswordlessLogin(params);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const handleOnError = (e) => {
|
|
119
|
-
// this is a basic implementation using swal
|
|
120
|
-
const {type, msg, exception} = e;
|
|
121
|
-
let icon = 'error';
|
|
122
|
-
let title = 'ERROR';
|
|
123
|
-
switch(type){
|
|
124
|
-
case ERROR_TYPE_ERROR:
|
|
125
|
-
icon = 'error';
|
|
126
|
-
title = 'Error';
|
|
127
|
-
break
|
|
128
|
-
case ERROR_TYPE_VALIDATION:
|
|
129
|
-
icon = 'warning';
|
|
130
|
-
title = 'Warning'
|
|
131
|
-
break;
|
|
132
|
-
case ERROR_TYPE_PAYMENT:
|
|
133
|
-
title = 'Payment Error'
|
|
134
|
-
icon = 'warning';
|
|
135
|
-
break;
|
|
136
|
-
default:
|
|
137
|
-
icon = 'error';
|
|
138
|
-
title = 'Error';
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
Swal.fire(title, msg, icon)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const { getSettingByKey } = useMarketingSettings();
|
|
145
|
-
|
|
146
|
-
const inPersonDisclaimer = getSettingByKey(MARKETING_SETTINGS_KEYS.registrationInPersonDisclaimer);
|
|
147
|
-
const allowPromoCodes = !!Number(getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteAllowPromoCodes));
|
|
148
|
-
const companyDDLPlaceholder = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteCompanyDDLPlaceholder);
|
|
149
|
-
const showCompanyInputDefaultOptions = !!Number(getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteShowCompanyInputDefaultOptions));
|
|
150
|
-
const showCompanyInput = !!Number(getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteShowCompanyInput));
|
|
151
|
-
const initialOrderComplete1stParagraph = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteInitialOrderComplete1stParagraph);
|
|
152
|
-
const initialOrderComplete2ndParagraph = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteInitialOrderComplete2ndParagraph);
|
|
153
|
-
const initialOrderCompleteButton = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteInitialOrderCompleteButton);
|
|
154
|
-
const orderCompleteTitle = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteOrderCompleteTitle);
|
|
155
|
-
const orderComplete1stParagraph = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteOrderComplete1stParagraph);
|
|
156
|
-
const orderComplete2ndParagraph = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteOrderComplete2ndParagraph);
|
|
157
|
-
const orderCompleteButton = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteOrderCompleteButton);
|
|
158
|
-
const noAllowedTicketsMessage = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteNoAllowedTicketsMessage);
|
|
159
|
-
|
|
160
|
-
const siteSettings = useSiteSettings();
|
|
161
|
-
|
|
162
|
-
const paymentSettings = usePaymentSettings();
|
|
163
|
-
|
|
164
|
-
const widgetProps = {
|
|
165
|
-
apiBaseUrl: getEnvVariable(SUMMIT_API_BASE_URL),
|
|
166
|
-
clientId: getEnvVariable(OAUTH2_CLIENT_ID),
|
|
167
|
-
summitData: summit,
|
|
168
|
-
profileData: registrationProfile,
|
|
169
|
-
marketingData: colorSettings,
|
|
170
|
-
loginOptions: validateIdentityProviderButtons(siteSettings?.identityProviderButtons, availableThirdPartyProviders),
|
|
171
|
-
loading: loadingProfile || loadingIDP,
|
|
172
|
-
// only show info if its not a recent purchase
|
|
173
|
-
ticketOwned: userProfile?.summit_tickets?.length > 0,
|
|
174
|
-
hasVIRTUAL_ACCESS_LEVEL: userHasAccessLevel(userProfile?.summit_tickets, VIRTUAL_ACCESS_LEVEL),
|
|
175
|
-
ownedTickets: attendee?.ticket_types || [],
|
|
176
|
-
authUser: (provider) => onClickLogin(provider),
|
|
177
|
-
getPasswordlessCode: getPasswordlessCode,
|
|
178
|
-
loginWithCode: (code, email) => loginPasswordless(code, email).then( () => navigate("/#registration=1")),
|
|
179
|
-
getAccessToken: getAccessToken,
|
|
180
|
-
closeWidget: () => {
|
|
181
|
-
// reload user profile
|
|
182
|
-
getUserProfile().catch((e) => console.log("getUserProfile error. Not logged in?"));
|
|
183
|
-
setIsActive(false);
|
|
184
|
-
},
|
|
185
|
-
goToExtraQuestions: (attendeeId) => {
|
|
186
|
-
navigate(`/a/extra-questions${attendeeId ? `/#attendee=${attendeeId}` : ''}`);
|
|
187
|
-
},
|
|
188
|
-
goToEvent: () => navigate("/a/"),
|
|
189
|
-
goToRegistration: () => navigate(`${getEnvVariable(REGISTRATION_BASE_URL)}/a/${summit.slug}`),
|
|
190
|
-
goToMyOrders: () => navigate("/a/my-tickets"),
|
|
191
|
-
completedExtraQuestions: async (attendee) => {
|
|
192
|
-
if (!attendee) return true;
|
|
193
|
-
await getExtraQuestions(attendee?.id);
|
|
194
|
-
return checkRequireExtraQuestionsByAttendee(attendee);
|
|
195
|
-
},
|
|
196
|
-
onPurchaseComplete: (order) => {
|
|
197
|
-
// check if it"s necessary to update profile
|
|
198
|
-
setUserOrder(order).then(()=> checkOrderData(order));
|
|
199
|
-
},
|
|
200
|
-
trackEvent: triggerTagManagerTrackEvent,
|
|
201
|
-
inPersonDisclaimer: inPersonDisclaimer,
|
|
202
|
-
handleCompanyError: () => handleCompanyError,
|
|
203
|
-
allowsNativeAuth: allowsNativeAuth,
|
|
204
|
-
allowsOtpAuth: allowsOtpAuth,
|
|
205
|
-
providerOptions: {
|
|
206
|
-
fonts: [{ cssSrc: withPrefix("/fonts/fonts.css") }],
|
|
207
|
-
style: { base: { fontFamily: `"Nunito Sans", sans-serif`, fontWeight: 300 } }
|
|
208
|
-
},
|
|
209
|
-
loginInitialEmailInputValue: initialEmailValue,
|
|
210
|
-
authErrorCallback: (error) => {
|
|
211
|
-
// we have an auth Error, perform logout
|
|
212
|
-
const fragment = window?.location?.hash;
|
|
213
|
-
return navigate("/auth/logout", {
|
|
214
|
-
state: {
|
|
215
|
-
backUrl: "/" + fragment
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
},
|
|
219
|
-
allowPromoCodes: allowPromoCodes,
|
|
220
|
-
companyDDLPlaceholder: companyDDLPlaceholder,
|
|
221
|
-
supportEmail: summit.support_email || getEnvVariable(SUPPORT_EMAIL),
|
|
222
|
-
initialOrderComplete1stParagraph: initialOrderComplete1stParagraph,
|
|
223
|
-
initialOrderComplete2ndParagraph: initialOrderComplete2ndParagraph,
|
|
224
|
-
initialOrderCompleteButton: initialOrderCompleteButton,
|
|
225
|
-
orderCompleteTitle: orderCompleteTitle,
|
|
226
|
-
orderComplete1stParagraph: orderComplete1stParagraph,
|
|
227
|
-
orderComplete2ndParagraph: orderComplete2ndParagraph,
|
|
228
|
-
orderCompleteButton: orderCompleteButton,
|
|
229
|
-
noAllowedTicketsMessage: noAllowedTicketsMessage,
|
|
230
|
-
showCompanyInput: showCompanyInput,
|
|
231
|
-
showCompanyInputDefaultOptions: showCompanyInputDefaultOptions,
|
|
232
|
-
idpLogoLight: siteSettings?.idpLogo?.idpLogoLight?.publicURL,
|
|
233
|
-
idpLogoDark: siteSettings?.idpLogo?.idpLogoDark?.publicURL,
|
|
234
|
-
idpLogoAlt: siteSettings?.idpLogo?.idpLogoAlt,
|
|
235
|
-
hidePostalCode: paymentSettings?.hidePostalCode,
|
|
236
|
-
successfulPaymentReturnUrl: `${window.location.origin}/a/my-tickets/`,
|
|
237
|
-
onError: handleOnError,
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
const { registerButton } = marketingPageSettings.hero.buttons;
|
|
241
|
-
|
|
242
|
-
return (
|
|
243
|
-
<>
|
|
244
|
-
{children ?
|
|
245
|
-
React.cloneElement(children, { onClick: handleOpenPopup })
|
|
246
|
-
:
|
|
247
|
-
registerButton.display &&
|
|
248
|
-
<IconButton
|
|
249
|
-
className={iconButtonStyles.register}
|
|
250
|
-
iconClass="fa fa-2x fa-edit"
|
|
251
|
-
buttonText={registerButton.text}
|
|
252
|
-
onClick={handleOpenPopup}
|
|
253
|
-
disabled={isActive}
|
|
254
|
-
/>
|
|
255
|
-
}
|
|
256
|
-
<Sentry.ErrorBoundary fallback={SentryFallbackFunction({componentName: "Registration Lite"})}>
|
|
257
|
-
{isActive && <RegistrationLiteWidget {...widgetProps} />}
|
|
258
|
-
</Sentry.ErrorBoundary>
|
|
259
|
-
</>
|
|
260
|
-
)
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
RegistrationLiteComponent.defaultProps = {
|
|
264
|
-
ignoreAutoOpen: false,
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
RegistrationLiteComponent.propTypes = {
|
|
268
|
-
ignoreAutoOpen: PropTypes.bool,
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
const mapStateToProps = ({userState, summitState, settingState}) => ({
|
|
272
|
-
registrationProfile: userState.idpProfile,
|
|
273
|
-
userProfile: userState.userProfile,
|
|
274
|
-
attendee: userState.attendee,
|
|
275
|
-
loadingProfile: userState.loading,
|
|
276
|
-
loadingIDP: userState.loadingIDP,
|
|
277
|
-
availableThirdPartyProviders: summitState.third_party_providers,
|
|
278
|
-
allowsNativeAuth: summitState.allows_native_auth,
|
|
279
|
-
allowsOtpAuth: summitState.allows_otp_auth,
|
|
280
|
-
summit: summitState.summit,
|
|
281
|
-
colorSettings: settingState.colorSettings,
|
|
282
|
-
marketingPageSettings: settingState.marketingPageSettings
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
export default connect(mapStateToProps, {
|
|
286
|
-
getThirdPartyProviders,
|
|
287
|
-
getUserProfile,
|
|
288
|
-
setPasswordlessLogin,
|
|
289
|
-
setUserOrder,
|
|
290
|
-
checkOrderData,
|
|
291
|
-
checkRequireExtraQuestionsByAttendee,
|
|
292
|
-
getExtraQuestions,
|
|
293
|
-
})(RegistrationLiteComponent);
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React, {useMemo} from "react";
|
|
2
|
-
import { connect } from "react-redux";
|
|
3
|
-
import { navigate } from "gatsby";
|
|
4
|
-
|
|
5
|
-
import Layout from "../components/Layout";
|
|
6
|
-
import AuthComponent from "../components/AuthComponent";
|
|
7
|
-
|
|
8
|
-
import { getDefaultLocation } from "@utils/loginUtils";
|
|
9
|
-
import {userHasAccessLevel, VIRTUAL_ACCESS_LEVEL} from "@utils/authorizedGroups";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export const LoginPageTemplate = ({ loggedUserState, eventRedirect, location, userProfile }) => {
|
|
13
|
-
|
|
14
|
-
// we store this calculation to use it later
|
|
15
|
-
const hasVirtualBadge = useMemo(() =>
|
|
16
|
-
userProfile ? userHasAccessLevel(userProfile.summit_tickets, VIRTUAL_ACCESS_LEVEL) : false,
|
|
17
|
-
[userProfile]);
|
|
18
|
-
|
|
19
|
-
if (loggedUserState.isLoggedUser) {
|
|
20
|
-
let defaultPath = getDefaultLocation(eventRedirect, hasVirtualBadge);
|
|
21
|
-
navigate(defaultPath);
|
|
22
|
-
return null
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<React.Fragment>
|
|
27
|
-
<AuthComponent location={location} />
|
|
28
|
-
</React.Fragment>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const LoginPage = ({ loggedUserState, location, userProfile }) => {
|
|
33
|
-
return (
|
|
34
|
-
<Layout>
|
|
35
|
-
<LoginPageTemplate
|
|
36
|
-
loggedUserState={loggedUserState}
|
|
37
|
-
location={location}
|
|
38
|
-
userProfile={userProfile}
|
|
39
|
-
/>
|
|
40
|
-
</Layout>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default connect(state => ({
|
|
45
|
-
loggedUserState: state.loggedUserState,
|
|
46
|
-
// TODO: move to site settings i/o marketing page settings
|
|
47
|
-
eventRedirect: state.settingState.marketingPageSettings.eventRedirect,
|
|
48
|
-
userProfile: state.userState.userProfile,
|
|
49
|
-
}), null)(LoginPage)
|