@openeventkit/event-site 2.0.91 → 2.0.93

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-browser.js CHANGED
@@ -44,28 +44,24 @@ export const onClientEntry = () => {
44
44
  },
45
45
  release: process.env.GATSBY_SENTRY_RELEASE,
46
46
  integrations: [
47
-
48
- new RewriteFramesIntegration
49
- (
50
- {
51
- iteratee: (frame) => {
52
- // @see https://github.com/getsentry/sentry-javascript/blob/f46f5660114ee625af6e4db895565ae4a36558ae/packages/integrations/src/rewriteframes.ts#L70
53
- // rewrite frames to remove the dynamic hash version to match the abs_path
54
- if (!frame.filename) {
55
- return frame;
56
- }
57
- const isComponentFrame = /component---src-pages-(\w*)-js(-\w*).js/.test(frame.filename);
58
- if(isComponentFrame){
59
- frame.filename = frame.filename.replace(/(component---src-pages-(\w*)-js)(-\w*).js$/,'$1.js')
60
- }
61
- const isAppFrame = /app(-\w*).js/.test(frame.filename);
62
- if(isAppFrame){
63
- frame.filename = frame.filename.replace(/app(-\w*).js$/,'app.js')
64
- }
65
- return frame;
66
- }
47
+ new RewriteFramesIntegration({
48
+ iteratee: (frame) => {
49
+ // @see https://github.com/getsentry/sentry-javascript/blob/f46f5660114ee625af6e4db895565ae4a36558ae/packages/integrations/src/rewriteframes.ts#L70
50
+ // rewrite frames to remove the dynamic hash version to match the abs_path
51
+ if (!frame.filename) {
52
+ return frame;
53
+ }
54
+ const isComponentFrame = /component---src-pages-(\w*)-js(-\w*).js/.test(frame.filename);
55
+ if(isComponentFrame){
56
+ frame.filename = frame.filename.replace(/(component---src-pages-(\w*)-js)(-\w*).js$/,'$1.js')
57
+ }
58
+ const isAppFrame = /app(-\w*).js/.test(frame.filename);
59
+ if(isAppFrame){
60
+ frame.filename = frame.filename.replace(/app(-\w*).js$/,'app.js')
61
+ }
62
+ return frame;
67
63
  }
68
- ),
64
+ }),
69
65
  new Sentry.Replay()
70
66
  ],
71
67
  });
package/gatsby-config.js CHANGED
@@ -71,22 +71,6 @@ const plugins = [
71
71
  }
72
72
  }
73
73
  },
74
- {
75
- // Add image assets before markdown or json files
76
- resolve: "gatsby-source-filesystem",
77
- options: {
78
- path: `${__dirname}/static/img`,
79
- name: "uploads"
80
- }
81
- },
82
- {
83
- // Add image assets before markdown or json files
84
- resolve: "gatsby-source-filesystem",
85
- options: {
86
- path: `${__dirname}/src/img`,
87
- name: "images"
88
- }
89
- },
90
74
  {
91
75
  // Add font assets before markdown or json files
92
76
  resolve: "gatsby-source-filesystem",
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.91",
4
+ "version": "2.0.93",
5
5
  "author": "Tipit LLC",
6
6
  "dependencies": {
7
7
  "@mui/base": "^5.0.0-alpha.114",
@@ -65,7 +65,7 @@
65
65
  "idtoken-verifier": "^2.2.2",
66
66
  "image-size": "^1.0.1",
67
67
  "immutability-helper": "2.9.1",
68
- "immutable": "^3.7.6",
68
+ "immutable": "^5.0.0-beta.5",
69
69
  "jsdom": "^16.2.2",
70
70
  "lite-schedule-widget": "3.0.3",
71
71
  "live-event-widget": "4.0.2",
@@ -91,6 +91,7 @@
91
91
  "react-final-form": "6.5.9",
92
92
  "react-i18next": "^11.16.9",
93
93
  "react-iframe-comm": "^1.2.2",
94
+ "react-immutable-proptypes": "^2.2.0",
94
95
  "react-laag": "^2.0.5",
95
96
  "react-masonry-css": "^1.0.14",
96
97
  "react-medium-image-zoom": "^4.3.5",
@@ -120,7 +121,7 @@
120
121
  "stream-browserify": "^3.0.0",
121
122
  "stream-chat": "^2.7.2",
122
123
  "stream-chat-react": "3.1.7",
123
- "summit-registration-lite": "5.0.19",
124
+ "summit-registration-lite": "5.0.21",
124
125
  "superagent": "8.0.9",
125
126
  "sweetalert2": "^9.17.0",
126
127
  "upcoming-events-widget": "3.0.5",
@@ -1,9 +1,8 @@
1
- if (typeof window !== 'undefined') {
2
-
3
- // add admin.css
4
- const link = document.createElement('link')
5
- link.type = 'text/css'
6
- link.rel = 'stylesheet'
7
- link.href = '/admin/admin.css'
8
- document.head.appendChild(link)
1
+ if (typeof window !== "undefined") {
2
+ // add admin.css
3
+ const link = document.createElement("link");
4
+ link.type = "text/css";
5
+ link.rel = "stylesheet";
6
+ link.href = "/admin/admin.css";
7
+ document.head.appendChild(link);
9
8
  }
package/src/cms/cms.js CHANGED
@@ -6,6 +6,7 @@ import "./cms-utils";
6
6
  import { Widget as FileRelationWidget } from "@ncwidgets/file-relation";
7
7
  import { Widget as IdWidget } from "@ncwidgets/id";
8
8
 
9
+ import IdentityProviderParamControl from "./widgets/IdentityProviderParamControl";
9
10
  import ContentPagePreview from "./preview-templates/ContentPagePreview";
10
11
 
11
12
  CMS.init({ config });
@@ -13,4 +14,5 @@ CMS.init({ config });
13
14
  CMS.registerWidget(IdWidget);
14
15
  CMS.registerWidget(FileRelationWidget);
15
16
 
17
+ CMS.registerWidget("identityProviderParam", IdentityProviderParamControl);
16
18
  CMS.registerPreviewTemplate("contentPages", ContentPagePreview);
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  booleanField,
3
+ numberField,
3
4
  stringField,
4
5
  textField,
5
6
  imageField,
6
7
  selectField,
7
8
  selectOption,
8
9
  objectField,
10
+ listField,
9
11
  fileField
10
12
  } from "../../../fields";
11
13
 
@@ -14,12 +16,17 @@ import {
14
16
  CMS_FONT_FILE_PATH
15
17
  } from "@utils/filePath";
16
18
 
19
+ import {
20
+ getEnvVariable,
21
+ IDP_BASE_URL
22
+ } from "@utils/envVariables";
23
+
17
24
  const FONT_FORMATS = {
18
25
  truetype: "ttf",
19
26
  opentype: "otf",
20
27
  woff: "woff",
21
28
  woff2: "woff2",
22
- eot: "eot",
29
+ eot: "eot"
23
30
  };
24
31
 
25
32
  const getFontFormatOptions = () =>
@@ -169,6 +176,47 @@ const siteSettings = {
169
176
  }),
170
177
  ]
171
178
  }),
179
+ listField({
180
+ label: "Identity Provider Buttons",
181
+ name: "identityProviderButtons",
182
+ summary: "{{providerLabel}}",
183
+ fields: [
184
+ stringField({
185
+ label: "Button Color",
186
+ name: "buttonColor",
187
+ required: true
188
+ }),
189
+ stringField({
190
+ label: "Button Border Color",
191
+ name: "buttonBorderColor"
192
+ }),
193
+ stringField({
194
+ label: "Provider Label",
195
+ name: "providerLabel",
196
+ required: true
197
+ }),
198
+ {
199
+ widget: "identityProviderParam",
200
+ label: "Provider Param",
201
+ name: "providerParam",
202
+ endpoint: `${getEnvVariable(IDP_BASE_URL)}/oauth2/.well-known/openid-configuration`,
203
+ required: false
204
+ },
205
+ imageField({
206
+ label: "Provider Logo",
207
+ name: "providerLogo",
208
+ required: true
209
+ }),
210
+ numberField({
211
+ label: "Provider Logo Size",
212
+ name: "providerLogoSize",
213
+ default: 20,
214
+ valueType: "float",
215
+ min: 0,
216
+ required: true
217
+ })
218
+ ]
219
+ })
172
220
  ]
173
221
  };
174
222
 
@@ -21,9 +21,18 @@ module.exports = `
21
21
  schedule: Schedule
22
22
  chat: Chat
23
23
  }
24
+ type IdentityProviderButton {
25
+ buttonColor: String
26
+ buttonBorderColor: String
27
+ providerLabel: String
28
+ providerParam: String
29
+ providerLogo: File @fileByRelativePath
30
+ providerLogoSize: Float
31
+ }
24
32
  type SiteSettingsJson implements Node {
25
33
  siteMetadata: SiteMetadata
26
34
  favicon: Favicon
27
35
  widgets: Widgets
36
+ identityProviderButtons: [IdentityProviderButton]
28
37
  }
29
38
  `;
@@ -34,12 +34,14 @@ export const numberField = ({
34
34
  label = "Number",
35
35
  name = "number",
36
36
  required = false,
37
+ valueType,
37
38
  ...rest
38
39
  } = {}) => ({
39
40
  label,
40
41
  name,
41
42
  required,
42
43
  widget: "number",
44
+ ...(valueType ? { value_type: valueType } : {}),
43
45
  ...rest
44
46
  });
45
47
 
@@ -32,7 +32,7 @@ const config = {
32
32
  collections: collections
33
33
  };
34
34
 
35
- if (!!CMS_BACKEND_REPO && !!CMS_BACKEND_BRANCH) {
35
+ if (!CMS_BACKEND_REPO || !CMS_BACKEND_BRANCH) {
36
36
  config.local_backend = true;
37
37
  }
38
38
 
@@ -0,0 +1,85 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import CMS from "netlify-cms-app";
3
+ import PropTypes from "prop-types";
4
+ import ImmutablePropTypes from "react-immutable-proptypes";
5
+ import { List } from "immutable";
6
+
7
+ const StringControl = CMS.getWidget("string").control;
8
+ const SelectControl = CMS.getWidget("select").control;
9
+
10
+ const IdentityProviderParamControl = ({
11
+ onChange,
12
+ value,
13
+ forID,
14
+ classNameWrapper,
15
+ setActiveStyle,
16
+ setInactiveStyle,
17
+ field
18
+ }) => {
19
+ const [options, setOptions] = useState([]);
20
+ const [loading, setLoading] = useState(true);
21
+ const [error, setError] = useState(null);
22
+
23
+ useEffect(() => {
24
+ const fetchOptions = async () => {
25
+ try {
26
+ const response = await fetch(field.get("endpoint"));
27
+ const data = await response.json();
28
+ const fetchedOptions = data.third_party_identity_providers || [];
29
+
30
+ setOptions(fetchedOptions.map(option => ({ label: option, value: option })));
31
+ setLoading(false);
32
+ } catch (error) {
33
+ console.error("Error fetching OpenID configuration:", error);
34
+ setError(error);
35
+ setLoading(false);
36
+ }
37
+ };
38
+
39
+ fetchOptions();
40
+ }, [field]);
41
+
42
+ if (loading) {
43
+ return <div>Loading options...</div>;
44
+ }
45
+
46
+ if (error || !Array.isArray(options) || options.length === 0) {
47
+ return (
48
+ <StringControl
49
+ forID={forID}
50
+ value={value || ""}
51
+ onChange={onChange}
52
+ classNameWrapper={classNameWrapper}
53
+ setActiveStyle={setActiveStyle}
54
+ setInactiveStyle={setInactiveStyle}
55
+ field={field}
56
+ />
57
+ );
58
+ }
59
+
60
+ return (
61
+ <SelectControl
62
+ forID={forID}
63
+ value={value || ""}
64
+ onChange={onChange}
65
+ classNameWrapper={classNameWrapper}
66
+ setActiveStyle={setActiveStyle}
67
+ setInactiveStyle={setInactiveStyle}
68
+ field={field.set("options", List(options))}
69
+ />
70
+ );
71
+ };
72
+
73
+ IdentityProviderParamControl.propTypes = {
74
+ onChange: PropTypes.func.isRequired,
75
+ value: PropTypes.node,
76
+ forID: PropTypes.string.isRequired,
77
+ classNameWrapper: PropTypes.string.isRequired,
78
+ setActiveStyle: PropTypes.func.isRequired,
79
+ setInactiveStyle: PropTypes.func.isRequired,
80
+ field: ImmutablePropTypes.contains({
81
+ endpoint: PropTypes.string.isRequired
82
+ }).isRequired
83
+ };
84
+
85
+ export default IdentityProviderParamControl;
@@ -9,7 +9,7 @@ import FragmentParser from "openstack-uicore-foundation/lib/utils/fragment-parse
9
9
  import { doLogin, passwordlessStart } from 'openstack-uicore-foundation/lib/security/methods'
10
10
  import { setPasswordlessLogin, setUserOrder, checkOrderData } from "../actions/user-actions";
11
11
  import { getThirdPartyProviders } from "../actions/base-actions";
12
- import { formatThirdPartyProviders } from "../utils/loginUtils";
12
+ import { validateIdentityProviderButtons } from "../utils/loginUtils";
13
13
  import 'summit-registration-lite/dist/index.css';
14
14
  import styles from '../styles/login-button.module.scss'
15
15
  import PropTypes from 'prop-types'
@@ -19,9 +19,11 @@ import { PHASES } from "@utils/phasesUtils";
19
19
  import { getDefaultLocation } from "@utils/loginUtils";
20
20
  import { userHasAccessLevel, VirtualAccessLevel } from "../utils/authorizedGroups";
21
21
 
22
+ import useSiteSettings from "@utils/useSiteSettings";
23
+
22
24
  const AuthComponent = ({
23
25
  getThirdPartyProviders,
24
- thirdPartyProviders,
26
+ availableThirdPartyProviders,
25
27
  setPasswordlessLogin,
26
28
  summit,
27
29
  marketingPageSettings,
@@ -61,8 +63,8 @@ const AuthComponent = ({
61
63
  }, []);
62
64
 
63
65
  useEffect(() => {
64
- if (!thirdPartyProviders.length) getThirdPartyProviders();
65
- }, [thirdPartyProviders]);
66
+ if (!availableThirdPartyProviders.length) getThirdPartyProviders();
67
+ }, [availableThirdPartyProviders]);
66
68
 
67
69
  const getBackURL = (encode = true) => {
68
70
  let backUrl = location.state?.backUrl
@@ -131,8 +133,10 @@ const AuthComponent = ({
131
133
  });
132
134
  }
133
135
 
136
+ const siteSettings = useSiteSettings();
137
+
134
138
  const loginComponentProps = {
135
- loginOptions: formatThirdPartyProviders(thirdPartyProviders),
139
+ loginOptions: validateIdentityProviderButtons(siteSettings?.identityProviderButtons, availableThirdPartyProviders),
136
140
  login: (provider) => onClickLogin(provider),
137
141
  getLoginCode: (email) => sendCode(email),
138
142
  allowsNativeAuth: allowsNativeAuth,
@@ -210,7 +214,7 @@ const mapStateToProps = ({ userState, summitState, settingState, clockState, log
210
214
  return ({
211
215
  loadingProfile: userState.loading,
212
216
  loadingIDP: userState.loadingIDP,
213
- thirdPartyProviders: summitState.third_party_providers,
217
+ availableThirdPartyProviders: summitState.third_party_providers,
214
218
  allowsNativeAuth: summitState.allows_native_auth,
215
219
  allowsOtpAuth: summitState.allows_otp_auth,
216
220
  summit: summitState.summit,
@@ -14,7 +14,7 @@ import {doLogout} from "openstack-uicore-foundation/lib/security/actions"
14
14
  import {getEnvVariable, SUMMIT_API_BASE_URL, OAUTH2_CLIENT_ID, REGISTRATION_BASE_URL, SUPPORT_EMAIL} from "../utils/envVariables"
15
15
  import {getUserProfile, setPasswordlessLogin, setUserOrder, checkOrderData} from "../actions/user-actions";
16
16
  import {getThirdPartyProviders} from "../actions/base-actions";
17
- import {formatThirdPartyProviders} from "../utils/loginUtils";
17
+ import { validateIdentityProviderButtons } from "../utils/loginUtils";
18
18
  import Swal from "sweetalert2";
19
19
  import {checkRequireExtraQuestionsByAttendee} from "../actions/user-actions";
20
20
  import {userHasAccessLevel, VirtualAccessLevel} from "../utils/authorizedGroups";
@@ -22,32 +22,33 @@ import {userHasAccessLevel, VirtualAccessLevel} from "../utils/authorizedGroups"
22
22
  import { getExtraQuestions } from "../actions/summit-actions";
23
23
 
24
24
  import useMarketingSettings, { MARKETING_SETTINGS_KEYS } from "@utils/useMarketingSettings";
25
+ import useSiteSettings from "@utils/useSiteSettings";
25
26
  import { SentryFallbackFunction } from "./SentryErrorComponent";
26
27
 
27
- import styles from "../styles/marketing-hero.module.scss"
28
+ import styles from "../styles/marketing-hero.module.scss";
28
29
 
29
30
  const RegistrationLiteComponent = ({
30
- registrationProfile,
31
- userProfile,
32
- attendee,
33
- getThirdPartyProviders,
34
- thirdPartyProviders,
35
- getUserProfile,
36
- setPasswordlessLogin,
37
- setUserOrder,
38
- checkOrderData,
39
- loadingProfile,
40
- loadingIDP,
41
- summit,
42
- colorSettings,
43
- marketingPageSettings,
44
- allowsNativeAuth,
45
- allowsOtpAuth,
46
- checkRequireExtraQuestionsByAttendee,
47
- getExtraQuestions,
48
- children,
49
- ignoreAutoOpen
50
- }) => {
31
+ registrationProfile,
32
+ userProfile,
33
+ attendee,
34
+ getThirdPartyProviders,
35
+ availableThirdPartyProviders,
36
+ getUserProfile,
37
+ setPasswordlessLogin,
38
+ setUserOrder,
39
+ checkOrderData,
40
+ loadingProfile,
41
+ loadingIDP,
42
+ summit,
43
+ colorSettings,
44
+ marketingPageSettings,
45
+ allowsNativeAuth,
46
+ allowsOtpAuth,
47
+ checkRequireExtraQuestionsByAttendee,
48
+ getExtraQuestions,
49
+ children,
50
+ ignoreAutoOpen
51
+ }) => {
51
52
  const [isActive, setIsActive] = useState(false);
52
53
  const [initialEmailValue, setInitialEmailValue] = useState("");
53
54
 
@@ -62,8 +63,8 @@ const RegistrationLiteComponent = ({
62
63
  }, []);
63
64
 
64
65
  useEffect(() => {
65
- if (!thirdPartyProviders.length) getThirdPartyProviders();
66
- }, [thirdPartyProviders]);
66
+ if (!availableThirdPartyProviders.length) getThirdPartyProviders();
67
+ }, [availableThirdPartyProviders]);
67
68
 
68
69
  const getBackURL = () => {
69
70
  let backUrl = "/#registration=1";
@@ -122,13 +123,15 @@ const RegistrationLiteComponent = ({
122
123
  const orderCompleteButton = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteOrderCompleteButton);
123
124
  const noAllowedTicketsMessage = getSettingByKey(MARKETING_SETTINGS_KEYS.regLiteNoAllowedTicketsMessage);
124
125
 
126
+ const siteSettings = useSiteSettings();
127
+
125
128
  const widgetProps = {
126
129
  apiBaseUrl: getEnvVariable(SUMMIT_API_BASE_URL),
127
130
  clientId: getEnvVariable(OAUTH2_CLIENT_ID),
128
131
  summitData: summit,
129
132
  profileData: registrationProfile,
130
133
  marketingData: colorSettings,
131
- loginOptions: formatThirdPartyProviders(thirdPartyProviders),
134
+ loginOptions: validateIdentityProviderButtons(siteSettings?.identityProviderButtons, availableThirdPartyProviders),
132
135
  loading: loadingProfile || loadingIDP,
133
136
  // only show info if its not a recent purchase
134
137
  ticketOwned: userProfile?.summit_tickets?.length > 0,
@@ -219,22 +222,19 @@ RegistrationLiteComponent.propTypes = {
219
222
  ignoreAutoOpen: PropTypes.bool,
220
223
  };
221
224
 
222
-
223
- const mapStateToProps = ({userState, summitState, settingState}) => {
224
- return ({
225
- registrationProfile: userState.idpProfile,
226
- userProfile: userState.userProfile,
227
- attendee: userState.attendee,
228
- loadingProfile: userState.loading,
229
- loadingIDP: userState.loadingIDP,
230
- thirdPartyProviders: summitState.third_party_providers,
231
- allowsNativeAuth: summitState.allows_native_auth,
232
- allowsOtpAuth: summitState.allows_otp_auth,
233
- summit: summitState.summit,
234
- colorSettings: settingState.colorSettings,
235
- marketingPageSettings: settingState.marketingPageSettings
236
- })
237
- };
225
+ const mapStateToProps = ({userState, summitState, settingState}) => ({
226
+ registrationProfile: userState.idpProfile,
227
+ userProfile: userState.userProfile,
228
+ attendee: userState.attendee,
229
+ loadingProfile: userState.loading,
230
+ loadingIDP: userState.loadingIDP,
231
+ availableThirdPartyProviders: summitState.third_party_providers,
232
+ allowsNativeAuth: summitState.allows_native_auth,
233
+ allowsOtpAuth: summitState.allows_otp_auth,
234
+ summit: summitState.summit,
235
+ colorSettings: settingState.colorSettings,
236
+ marketingPageSettings: settingState.marketingPageSettings
237
+ });
238
238
 
239
239
  export default connect(mapStateToProps, {
240
240
  getThirdPartyProviders,
@@ -13,7 +13,7 @@ const Seo = ({ title, description, location, children }) => {
13
13
  } = useSiteMetadata();
14
14
 
15
15
  const siteSettings = useSiteSettings();
16
- const image = siteSettings.siteMetadata?.image
16
+ const image = siteSettings?.siteMetadata?.image
17
17
 
18
18
  const siteUrl = getEnvVariable(SITE_URL);
19
19
  const siteUrlInfo = siteUrl ? new URL(siteUrl) : null;
@@ -12,5 +12,34 @@
12
12
  },
13
13
  "favicon": {
14
14
  "asset": "icon.png"
15
- }
15
+ },
16
+ "identityProviderButtons": [
17
+ {
18
+ "buttonColor": "#082238",
19
+ "providerLabel": "Continue with FNid",
20
+ "providerLogo": "logo_fn.svg",
21
+ "providerLogoSize": 27
22
+ },
23
+ {
24
+ "buttonColor": "#0A66C2",
25
+ "providerLabel": "Sign in with LinkedIn",
26
+ "providerParam": "linkedin",
27
+ "providerLogo": "logo_linkedin.svg",
28
+ "providerLogoSize": 18
29
+ },
30
+ {
31
+ "buttonColor": "#000000",
32
+ "providerLabel": "Sign in with Apple",
33
+ "providerParam": "apple",
34
+ "providerLogoSize": 17,
35
+ "providerLogo": "logo_apple.svg"
36
+ },
37
+ {
38
+ "buttonColor": "#1877F2",
39
+ "providerLabel": "Login with Facebook",
40
+ "providerParam": "facebook",
41
+ "providerLogo": "logo_facebook.svg",
42
+ "providerLogoSize": 20
43
+ }
44
+ ]
16
45
  }
@@ -1 +1 @@
1
- [{"id":228,"created":1691602669,"last_edited":1691602669,"order":1,"summit_id":49,"is_published":false,"side_image":null,"header_image":null,"header_image_mobile":null,"carousel_advertise_image":null,"marquee":"","intro":"","external_link":"","video_link":"","chat_link":"","featured_event_id":0,"header_image_alt_text":"","side_image_alt_text":"","header_image_mobile_alt_text":"","carousel_advertise_image_alt_text":"","show_logo_in_event_page":true,"members":[90654],"company":{"id":3,"created":1580138376,"last_edited":1580138376,"name":"Tipit , LLC","url":null,"display_on_site":false,"featured":false,"city":null,"state":null,"country":null,"description":null,"industry":null,"contributions":null,"contact_email":null,"member_level":"None","admin_email":null,"overview":null,"products":null,"commitment":null,"commitment_author":null,"logo":null,"big_logo":null,"color":"#f0f0ee","sponsorships":[616],"project_sponsorships":[]},"sponsorship":{"id":2048,"widget_title":"","lobby_template":null,"expo_hall_template":null,"sponsor_page_template":null,"event_page_template":null,"sponsor_page_use_disqus_widget":false,"sponsor_page_use_live_event_widget":false,"sponsor_page_use_schedule_widget":false,"sponsor_page_use_banner_widget":false,"badge_image":null,"badge_image_alt_text":"","summit_id":49,"order":1,"should_display_on_expo_hall_page":false,"should_display_on_lobby_page":false,"type":{"id":3,"created":1579890943,"last_edited":1579890943,"name":"Gold","label":"not sure??","order":3,"size":"Medium"}},"ads":[],"materials":[],"social_networks":[]}]
1
+ []
@@ -1,7 +1,7 @@
1
1
  import { START_LOADING, STOP_LOADING } from "openstack-uicore-foundation/lib/utils/actions";
2
2
  import { LOGOUT_USER } from "openstack-uicore-foundation/lib/security/actions";
3
3
  import { RESET_STATE, GET_THIRD_PARTY_PROVIDERS, SYNC_DATA } from "../actions/base-actions-definitions";
4
- import { GET_EXTRA_QUESTIONS } from '../actions/user-actions';
4
+ import { GET_EXTRA_QUESTIONS } from "../actions/user-actions";
5
5
 
6
6
  import summitData from "data/summit.json";
7
7
 
@@ -90,4 +90,4 @@ exports.SPONSORS_FILE_PATH = SPONSORS_FILE_PATH;
90
90
  exports.CMS_FONT_FILE_PATH = CMS_FONT_FILE_PATH;
91
91
  exports.PAYMENTS_FILE_PATH = PAYMENTS_FILE_PATH;
92
92
  exports.APPLE_PAY_DOMAIN_FILE_PATH = APPLE_PAY_DOMAIN_FILE_PATH;
93
- exports.APPLE_PAY_DOMAIN_FILE_NAME = APPLE_PAY_DOMAIN_FILE_NAME;
93
+ exports.APPLE_PAY_DOMAIN_FILE_NAME = APPLE_PAY_DOMAIN_FILE_NAME;
@@ -1,20 +1,55 @@
1
- import { getEnvVariable, AUTHORIZED_DEFAULT_PATH } from './envVariables'
1
+ import {
2
+ getEnvVariable,
3
+ AUTHORIZED_DEFAULT_PATH
4
+ } from "./envVariables";
2
5
 
3
- export const getDefaultLocation = (eventRedirect, hasVirtualAccess = false) => {
4
- const defaultRedirect = hasVirtualAccess ? '/a/' : '/';
5
- return eventRedirect ? `/a/event/${eventRedirect}` : getEnvVariable(AUTHORIZED_DEFAULT_PATH) ? getEnvVariable(AUTHORIZED_DEFAULT_PATH) : defaultRedirect;
6
+ export const getDefaultLocation = (
7
+ eventRedirect,
8
+ hasVirtualAccess = false
9
+ ) => {
10
+ const defaultRedirect = hasVirtualAccess ? "/a/" : "/";
11
+ return eventRedirect ? `/a/event/${eventRedirect}` : getEnvVariable(AUTHORIZED_DEFAULT_PATH) ? getEnvVariable(AUTHORIZED_DEFAULT_PATH) : defaultRedirect;
6
12
  }
7
13
 
8
- export const formatThirdPartyProviders = (providersArray) => {
9
- const providers = [
10
- { button_color: '#082238', provider_label: 'Sign in with FNid', provider_param: '', provider_logo: '../img/logo_fn.svg', provider_logo_size: 35 },
11
- ];
14
+ const buttonPropertyMapping = {
15
+ buttonColor: "button_color",
16
+ buttonBorderColor: "button_border_color",
17
+ providerLabel: "provider_label",
18
+ providerParam: "provider_param",
19
+ providerLogo: "provider_logo",
20
+ providerLogoSize: "provider_logo_size"
21
+ };
12
22
 
13
- const thirdPartyProviders = [
14
- { button_color: '#1877F2', provider_label: 'Login with Facebook', provider_param: 'facebook', provider_logo: '../img/third-party-idp/logo_facebook.svg', provider_logo_size: 22 },
15
- { button_color: '#0A66C2', provider_label: 'Sign in with LinkedIn', provider_param: 'linkedin', provider_logo: '../img/third-party-idp/logo_linkedin.svg', provider_logo_size: 21 },
16
- { button_border_color:'var(--color_input_border_color)', button_color: '#000000', provider_label: 'Sign in with Apple', provider_param: 'apple', provider_logo: '../img/third-party-idp/logo_apple.svg', provider_logo_size: 19 }
17
- ];
23
+ const mapIdentityProviderButtonProperties = (button) => {
24
+ const formattedButton = {};
25
+ for (const key in button) {
26
+ const mappedKey = buttonPropertyMapping[key] || key;
27
+ formattedButton[mappedKey] = key === "providerLogo" ? button[key]?.publicURL : button[key];
28
+ }
29
+ return formattedButton;
30
+ };
18
31
 
19
- return [...providers, ...thirdPartyProviders.filter(p => providersArray && providersArray.includes(p.provider_param))];
20
- };
32
+ /**
33
+ * Validates identity provider buttons provided in CMS with those social providers available through IDP API.
34
+ * Filters out invalid or disabled buttons.
35
+ * @param {Array} indentityProviderButtons Array of identity provider buttons provided by CMS.
36
+ * @param {Array} availableSocialProviders Array of available social providers provided by IDP API.
37
+ * @returns {Array} Filtered array of identity provider buttons.
38
+ */
39
+ export const validateIdentityProviderButtons = (
40
+ identityProviderButtons,
41
+ availableSocialProviders
42
+ ) => {
43
+ if (!identityProviderButtons || !availableSocialProviders) {
44
+ return [];
45
+ }
46
+ const filteredButtons = identityProviderButtons
47
+ .map(mapIdentityProviderButtonProperties)
48
+ .filter(button =>
49
+ // default identity provider has no providerParam set
50
+ !button[buttonPropertyMapping.providerParam] ||
51
+ availableSocialProviders.includes(button[buttonPropertyMapping.providerParam])
52
+ );
53
+
54
+ return filteredButtons;
55
+ };
@@ -28,6 +28,16 @@ const siteSettingsQuery = graphql`
28
28
  allowClick
29
29
  }
30
30
  }
31
+ identityProviderButtons {
32
+ buttonColor
33
+ buttonBorderColor
34
+ providerLabel
35
+ providerParam
36
+ providerLogo {
37
+ publicURL
38
+ }
39
+ providerLogoSize
40
+ }
31
41
  }
32
42
  }
33
43
  `;