@openeventkit/event-site 1.0.18 → 1.0.20

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": "1.0.18",
4
+ "version": "1.0.20",
5
5
  "author": "Tipit LLC",
6
6
  "dependencies": {
7
7
  "@mui/base": "^5.0.0-alpha.114",
@@ -116,7 +116,7 @@
116
116
  "stream-browserify": "^3.0.0",
117
117
  "stream-chat": "^2.7.2",
118
118
  "stream-chat-react": "3.1.7",
119
- "summit-registration-lite": "4.0.9",
119
+ "summit-registration-lite": "^4.0.11",
120
120
  "superagent": "8.0.9",
121
121
  "sweetalert2": "^9.17.0",
122
122
  "upcoming-events-widget": "2.0.8",
@@ -26,195 +26,209 @@ import { SentryFallbackFunction } from "./SentryErrorComponent";
26
26
  import styles from "../styles/marketing-hero.module.scss"
27
27
 
28
28
  const RegistrationLiteComponent = ({
29
- registrationProfile,
30
- userProfile,
31
- attendee,
32
- getThirdPartyProviders,
33
- thirdPartyProviders,
34
- getUserProfile,
35
- setPasswordlessLogin,
36
- setUserOrder,
37
- checkOrderData,
38
- loadingProfile,
39
- loadingIDP,
40
- summit,
41
- colorSettings,
42
- marketingPageSettings,
43
- allowsNativeAuth,
44
- allowsOtpAuth,
45
- checkRequireExtraQuestionsByAttendee,
46
- getExtraQuestions,
47
- children,
48
- }) => {
49
- const [isActive, setIsActive] = useState(false);
50
- const [initialEmailValue, setInitialEmailValue] = useState("");
51
-
52
- useEffect(() => {
53
- const fragmentParser = new FragmentParser();
54
- setIsActive(fragmentParser.getParam("registration"));
55
- const paramInitialEmailValue = fragmentParser.getParam("email");
56
- if (paramInitialEmailValue)
57
- setInitialEmailValue(paramInitialEmailValue);
58
- }, []);
59
-
60
- useEffect(() => {
61
- if (!thirdPartyProviders.length) getThirdPartyProviders();
62
- }, [thirdPartyProviders]);
63
-
64
- const getBackURL = () => {
65
- let backUrl = "/#registration=1";
66
- return URI.encode(backUrl);
67
- };
68
-
69
- const handleOpenPopup = () => {
70
- setIsActive(true);
71
- }
72
-
73
- const onClickLogin = (provider) => {
74
- doLogin(getBackURL(), provider);
75
- };
76
-
77
- const handleCompanyError = () => {
78
- console.log("company error...")
79
- Swal.fire("ERROR", "Hold on. Your session expired!.", "error").then(() => {
80
- // save current location and summit slug, for further redirect logic
81
- window.localStorage.setItem("post_logout_redirect_path", new URI(window.location.href).pathname());
82
- doLogout();
83
- });
84
- }
85
-
86
- const getPasswordlessCode = (email) => {
87
- const params = {
88
- connection: "email",
89
- send: "code",
90
- redirect_uri: `${window.location.origin}/auth/callback`,
91
- email,
29
+ registrationProfile,
30
+ userProfile,
31
+ attendee,
32
+ getThirdPartyProviders,
33
+ thirdPartyProviders,
34
+ getUserProfile,
35
+ setPasswordlessLogin,
36
+ setUserOrder,
37
+ checkOrderData,
38
+ loadingProfile,
39
+ loadingIDP,
40
+ summit,
41
+ colorSettings,
42
+ marketingPageSettings,
43
+ allowsNativeAuth,
44
+ allowsOtpAuth,
45
+ checkRequireExtraQuestionsByAttendee,
46
+ getExtraQuestions,
47
+ children,
48
+ }) => {
49
+ const [isActive, setIsActive] = useState(false);
50
+ const [initialEmailValue, setInitialEmailValue] = useState("");
51
+
52
+ useEffect(() => {
53
+ const fragmentParser = new FragmentParser();
54
+ setIsActive(fragmentParser.getParam("registration"));
55
+ const paramInitialEmailValue = fragmentParser.getParam("email");
56
+ if (paramInitialEmailValue)
57
+ setInitialEmailValue(paramInitialEmailValue);
58
+ }, []);
59
+
60
+ useEffect(() => {
61
+ if (!thirdPartyProviders.length) getThirdPartyProviders();
62
+ }, [thirdPartyProviders]);
63
+
64
+ const getBackURL = () => {
65
+ let backUrl = "/#registration=1";
66
+ return URI.encode(backUrl);
92
67
  };
93
68
 
94
- return passwordlessStart(params)
95
- };
69
+ const handleOpenPopup = () => {
70
+ setIsActive(true);
71
+ }
96
72
 
97
- const loginPasswordless = (code, email) => {
98
- const params = {
99
- connection: "email",
100
- otp: code,
101
- email
73
+ const onClickLogin = (provider) => {
74
+ doLogin(getBackURL(), provider);
102
75
  };
103
- return setPasswordlessLogin(params);
104
- };
105
-
106
- const { getSettingByKey } = useMarketingSettings();
107
-
108
- const inPersonDisclaimer = getSettingByKey(MARKETING_SETTINGS_KEYS.registrationInPersonDisclaimer);
109
- const allowPromoCodes = !!Number(getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteAllowPromoCodes));
110
- const companyInputPlaceholder = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteCompanyInputPlaceholder);
111
- const companyDDLPlaceholder = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteCompanyDDLPlaceholder);
112
-
113
- const widgetProps = {
114
- apiBaseUrl: getEnvVariable(SUMMIT_API_BASE_URL),
115
- clientId: getEnvVariable(OAUTH2_CLIENT_ID),
116
- summitData: summit,
117
- profileData: registrationProfile,
118
- marketingData: colorSettings,
119
- loginOptions: formatThirdPartyProviders(thirdPartyProviders),
120
- loading: loadingProfile || loadingIDP,
121
- // only show info if its not a recent purchase
122
- ticketOwned: userProfile?.summit_tickets?.length > 0,
123
- hasVirtualAccessLevel: userHasAccessLevel(userProfile?.summit_tickets, VirtualAccessLevel),
124
- ownedTickets: attendee?.ticket_types || [],
125
- authUser: (provider) => onClickLogin(provider),
126
- getPasswordlessCode: getPasswordlessCode,
127
- loginWithCode: (code, email) => loginPasswordless(code, email).then( () => navigate("/#registration=1")),
128
- getAccessToken: getAccessToken,
129
- closeWidget: () => {
130
- // reload user profile
131
- getUserProfile().catch((e) => console.log("getUserProfile error. Not logged in?"));
132
- setIsActive(false);
133
- },
134
- goToExtraQuestions: () => {
135
- navigate("/a/extra-questions");
136
- },
137
- goToEvent: () => navigate("/a/"),
138
- goToRegistration: () => navigate(`${getEnvVariable(REGISTRATION_BASE_URL)}/a/${summit.slug}`),
139
- goToMyOrders: () => navigate("/a/my-tickets"),
140
- completedExtraQuestions: async (order) => {
141
- const currentUserTicket = order?.tickets.find(t => t?.owner?.email == userProfile?.email);
142
- const currentAttendee = attendee ? attendee : (currentUserTicket ? currentUserTicket?.owner : null);
143
- if(!currentAttendee) return true;
144
- await getExtraQuestions();
145
- return checkRequireExtraQuestionsByAttendee(currentAttendee);
146
- },
147
- onPurchaseComplete: (order) => {
148
- // check if it"s necessary to update profile
149
- setUserOrder(order).then(()=> checkOrderData(order));
150
- },
151
- inPersonDisclaimer: inPersonDisclaimer,
152
- handleCompanyError: () => handleCompanyError,
153
- allowsNativeAuth: allowsNativeAuth,
154
- allowsOtpAuth: allowsOtpAuth,
155
- stripeOptions: {
156
- fonts: [{ cssSrc: withPrefix("/fonts/fonts.css") }],
157
- style: { base: { fontFamily: `"Nunito Sans", sans-serif`, fontWeight: 300 } }
158
- },
159
- loginInitialEmailInputValue: initialEmailValue,
160
- authErrorCallback: (error) => {
161
- // we have an auth Error, perform logout
162
- const fragment = window?.location?.hash;
163
- return navigate("/auth/logout", {
164
- state: {
165
- backUrl: "/" + fragment
166
- }
167
- });
168
- },
169
- allowPromoCodes: allowPromoCodes,
170
- companyInputPlaceholder: companyInputPlaceholder,
171
- companyDDLPlaceholder: companyDDLPlaceholder,
172
- supportEmail: getEnvVariable(SUPPORT_EMAIL),
173
- };
174
-
175
- const { registerButton } = marketingPageSettings.hero.buttons;
176
-
177
- return (
178
- <>
179
- {children ?
180
- React.cloneElement(children, { onClick: handleOpenPopup })
181
- :
182
- registerButton.display &&
183
- <button className={`${styles.button} button is-large`} disabled={isActive}
184
- onClick={handleOpenPopup}>
185
- <i className={`fa fa-2x fa-edit icon is-large`}/>
186
- <b>{registerButton.text}</b>
187
- </button>
188
- }
189
- <Sentry.ErrorBoundary fallback={SentryFallbackFunction({componentName: "Registration Lite"})}>
190
- {isActive && <RegistrationLiteWidget {...widgetProps} />}
191
- </Sentry.ErrorBoundary>
192
- </>
193
- )
76
+
77
+ const handleCompanyError = () => {
78
+ console.log("company error...")
79
+ Swal.fire("ERROR", "Hold on. Your session expired!.", "error").then(() => {
80
+ // save current location and summit slug, for further redirect logic
81
+ window.localStorage.setItem("post_logout_redirect_path", new URI(window.location.href).pathname());
82
+ doLogout();
83
+ });
84
+ }
85
+
86
+ const getPasswordlessCode = (email) => {
87
+ const params = {
88
+ connection: "email",
89
+ send: "code",
90
+ redirect_uri: `${window.location.origin}/auth/callback`,
91
+ email,
92
+ };
93
+
94
+ return passwordlessStart(params)
95
+ };
96
+
97
+ const loginPasswordless = (code, email) => {
98
+ const params = {
99
+ connection: "email",
100
+ otp: code,
101
+ email
102
+ };
103
+ return setPasswordlessLogin(params);
104
+ };
105
+
106
+ const { getSettingByKey } = useMarketingSettings();
107
+
108
+ const inPersonDisclaimer = getSettingByKey(MARKETING_SETTINGS_KEYS.registrationInPersonDisclaimer);
109
+ const allowPromoCodes = !!Number(getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteAllowPromoCodes));
110
+ const companyInputPlaceholder = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteCompanyInputPlaceholder);
111
+ const companyDDLPlaceholder = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteCompanyDDLPlaceholder);
112
+ const initialOrderComplete1stParagraph = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteInitialOrderComplete1stParagraph)
113
+ const initialOrderComplete2ndParagraph = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteInitialOrderComplete2ndParagraph)
114
+ const initialOrderCompleteButton = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteInitialOrderCompleteButton)
115
+ const orderComplete1stParagraph = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteOrderComplete1stParagraph)
116
+ const orderComplete2ndParagraph = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteOrderComplete2ndParagraph)
117
+ const orderCompleteButton = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteOrderCompleteButton)
118
+ const noAllowedTicketsMessage = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteNoAllowedTicketsMessage);
119
+
120
+ const widgetProps = {
121
+ apiBaseUrl: getEnvVariable(SUMMIT_API_BASE_URL),
122
+ clientId: getEnvVariable(OAUTH2_CLIENT_ID),
123
+ summitData: summit,
124
+ profileData: registrationProfile,
125
+ marketingData: colorSettings,
126
+ loginOptions: formatThirdPartyProviders(thirdPartyProviders),
127
+ loading: loadingProfile || loadingIDP,
128
+ // only show info if its not a recent purchase
129
+ ticketOwned: userProfile?.summit_tickets?.length > 0,
130
+ hasVirtualAccessLevel: userHasAccessLevel(userProfile?.summit_tickets, VirtualAccessLevel),
131
+ ownedTickets: attendee?.ticket_types || [],
132
+ authUser: (provider) => onClickLogin(provider),
133
+ getPasswordlessCode: getPasswordlessCode,
134
+ loginWithCode: (code, email) => loginPasswordless(code, email).then( () => navigate("/#registration=1")),
135
+ getAccessToken: getAccessToken,
136
+ closeWidget: () => {
137
+ // reload user profile
138
+ getUserProfile().catch((e) => console.log("getUserProfile error. Not logged in?"));
139
+ setIsActive(false);
140
+ },
141
+ goToExtraQuestions: () => {
142
+ navigate("/a/extra-questions");
143
+ },
144
+ goToEvent: () => navigate("/a/"),
145
+ goToRegistration: () => navigate(`${getEnvVariable(REGISTRATION_BASE_URL)}/a/${summit.slug}`),
146
+ goToMyOrders: () => navigate("/a/my-tickets"),
147
+ completedExtraQuestions: async (order) => {
148
+ const currentUserTicket = order?.tickets.find(t => t?.owner?.email == userProfile?.email);
149
+ const currentAttendee = attendee ? attendee : (currentUserTicket ? currentUserTicket?.owner : null);
150
+ if(!currentAttendee) return true;
151
+ await getExtraQuestions();
152
+ return checkRequireExtraQuestionsByAttendee(currentAttendee);
153
+ },
154
+ onPurchaseComplete: (order) => {
155
+ // check if it"s necessary to update profile
156
+ setUserOrder(order).then(()=> checkOrderData(order));
157
+ },
158
+ inPersonDisclaimer: inPersonDisclaimer,
159
+ handleCompanyError: () => handleCompanyError,
160
+ allowsNativeAuth: allowsNativeAuth,
161
+ allowsOtpAuth: allowsOtpAuth,
162
+ stripeOptions: {
163
+ fonts: [{ cssSrc: withPrefix("/fonts/fonts.css") }],
164
+ style: { base: { fontFamily: `"Nunito Sans", sans-serif`, fontWeight: 300 } }
165
+ },
166
+ loginInitialEmailInputValue: initialEmailValue,
167
+ authErrorCallback: (error) => {
168
+ // we have an auth Error, perform logout
169
+ const fragment = window?.location?.hash;
170
+ return navigate("/auth/logout", {
171
+ state: {
172
+ backUrl: "/" + fragment
173
+ }
174
+ });
175
+ },
176
+ allowPromoCodes: allowPromoCodes,
177
+ companyInputPlaceholder: companyInputPlaceholder,
178
+ companyDDLPlaceholder: companyDDLPlaceholder,
179
+ supportEmail: getEnvVariable(SUPPORT_EMAIL),
180
+ initialOrderComplete1stParagraph: initialOrderComplete1stParagraph,
181
+ initialOrderComplete2ndParagraph: initialOrderComplete2ndParagraph,
182
+ initialOrderCompleteButton: initialOrderCompleteButton,
183
+ orderComplete1stParagraph: orderComplete1stParagraph,
184
+ orderComplete2ndParagraph: orderComplete2ndParagraph,
185
+ orderCompleteButton: orderCompleteButton,
186
+ noAllowedTicketsMessage: noAllowedTicketsMessage
187
+ };
188
+
189
+ const { registerButton } = marketingPageSettings.hero.buttons;
190
+
191
+ return (
192
+ <>
193
+ {children ?
194
+ React.cloneElement(children, { onClick: handleOpenPopup })
195
+ :
196
+ registerButton.display &&
197
+ <button className={`${styles.button} button is-large`} disabled={isActive}
198
+ onClick={handleOpenPopup}>
199
+ <i className={`fa fa-2x fa-edit icon is-large`}/>
200
+ <b>{registerButton.text}</b>
201
+ </button>
202
+ }
203
+ <Sentry.ErrorBoundary fallback={SentryFallbackFunction({componentName: "Registration Lite"})}>
204
+ {isActive && <RegistrationLiteWidget {...widgetProps} />}
205
+ </Sentry.ErrorBoundary>
206
+ </>
207
+ )
194
208
  };
195
209
 
196
210
  const mapStateToProps = ({userState, summitState, settingState}) => {
197
- return ({
198
- registrationProfile: userState.idpProfile,
199
- userProfile: userState.userProfile,
200
- attendee: userState.attendee,
201
- loadingProfile: userState.loading,
202
- loadingIDP: userState.loadingIDP,
203
- thirdPartyProviders: summitState.third_party_providers,
204
- allowsNativeAuth: summitState.allows_native_auth,
205
- allowsOtpAuth: summitState.allows_otp_auth,
206
- summit: summitState.summit,
207
- colorSettings: settingState.colorSettings,
208
- marketingPageSettings: settingState.marketingPageSettings
209
- })
211
+ return ({
212
+ registrationProfile: userState.idpProfile,
213
+ userProfile: userState.userProfile,
214
+ attendee: userState.attendee,
215
+ loadingProfile: userState.loading,
216
+ loadingIDP: userState.loadingIDP,
217
+ thirdPartyProviders: summitState.third_party_providers,
218
+ allowsNativeAuth: summitState.allows_native_auth,
219
+ allowsOtpAuth: summitState.allows_otp_auth,
220
+ summit: summitState.summit,
221
+ colorSettings: settingState.colorSettings,
222
+ marketingPageSettings: settingState.marketingPageSettings
223
+ })
210
224
  };
211
225
 
212
226
  export default connect(mapStateToProps, {
213
- getThirdPartyProviders,
214
- getUserProfile,
215
- setPasswordlessLogin,
216
- setUserOrder,
217
- checkOrderData,
218
- checkRequireExtraQuestionsByAttendee,
219
- getExtraQuestions,
220
- })(RegistrationLiteComponent);
227
+ getThirdPartyProviders,
228
+ getUserProfile,
229
+ setPasswordlessLogin,
230
+ setUserOrder,
231
+ checkOrderData,
232
+ checkRequireExtraQuestionsByAttendee,
233
+ getExtraQuestions,
234
+ })(RegistrationLiteComponent);
@@ -0,0 +1 @@
1
+ {}
@@ -1 +1,17 @@
1
- {"widgets":{"chat":{"showQA":false,"showHelp":false,"defaultScope":"page"},"schedule":{"allowClick":true}},"favicons":{"favicon180":"/img/favicon.png","favicon32":"/img/favicon.png","favicon16":"/img/favicon.png"},"staticJsonFilesBuildTime":[{"file":"src/data/summit.json","build_time":1685583800464},{"file":"src/data/events.json","build_time":1685583805439},{"file":"src/data/events.idx.json","build_time":1685583805444},{"file":"src/data/speakers.json","build_time":1685583806489},{"file":"src/data/speakers.idx.json","build_time":1685583806490},{"file":"src/data/voteable-presentations.json","build_time":1685583806896}],"lastBuild":1685583806897}
1
+ {
2
+ "widgets": {
3
+ "chat": {
4
+ "showQA": false,
5
+ "showHelp": false,
6
+ "defaultScope": "page"
7
+ },
8
+ "schedule": {
9
+ "allowClick": true
10
+ }
11
+ },
12
+ "favicons": {
13
+ "favicon180": "/img/favicon.png",
14
+ "favicon32": "/img/favicon.png",
15
+ "favicon16": "/img/favicon.png"
16
+ }
17
+ }
@@ -11,7 +11,14 @@ export const MARKETING_SETTINGS_KEYS = {
11
11
  activityCtaText: "ACTIVITY_CTA_TEXT",
12
12
  regLiteAllowPromoCodes: "REG_LITE_ALLOW_PROMO_CODES",
13
13
  regLiteCompanyInputPlaceholder: "REG_LITE_COMPANY_INPUT_PLACEHOLDER",
14
- regLiteCompanyDDLPlaceholder: "REG_LITE_COMPANY_DDL_PLACEHOLDER"
14
+ regLiteCompanyDDLPlaceholder: "REG_LITE_COMPANY_DDL_PLACEHOLDER",
15
+ regLiteInitialOrderComplete1stParagraph: "REG_LITE_INITIAL_ORDER_COMPLETE_STEP_1ST_PARAGRAPH",
16
+ regLiteInitialOrderComplete2ndParagraph: "REG_LITE_INITIAL_ORDER_COMPLETE_STEP_2ND_PARAGRAPH",
17
+ regLiteInitialOrderCompleteButton: "REG_LITE_INITIAL_ORDER_COMPLETE_BTN_LABEL",
18
+ regLiteOrderComplete1stParagraph: "REG_LITE_ORDER_COMPLETE_STEP_1ST_PARAGRAPH",
19
+ regLiteOrderComplete2ndParagraph: "REG_LITE_ORDER_COMPLETE_STEP_2ND_PARAGRAPH",
20
+ regLiteOrderCompleteButton: "REG_LITE_ORDER_COMPLETE_BTN_LABEL",
21
+ regLiteNoAllowedTicketsMessage: "REG_LITE_NO_ALLOWED_TICKETS_MESSAGE",
15
22
  }
16
23
 
17
24
  const marketingSettingsQuery = graphql`