Skip to content

Commit

Permalink
Merge pull request #259 from adobecom/dev
Browse files Browse the repository at this point in the history
Dev to Stage | Oct 16
  • Loading branch information
apganapa-adobe authored Oct 19, 2024
2 parents 64b53fe + 0dfff85 commit 65a821e
Show file tree
Hide file tree
Showing 13 changed files with 277 additions and 199 deletions.
34 changes: 11 additions & 23 deletions ecc/blocks/attendee-management-table/attendee-management-table.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* eslint-disable max-len */
import { getAllEventAttendees, getEvents } from '../../scripts/esp-controller.js';
import { ALLOWED_ACCOUNT_TYPES } from '../../constants/constants.js';
import { LIBS } from '../../scripts/scripts.js';
import {
getIcon,
buildNoAccessScreen,
camelToSentenceCase,
readBlockConfig,
signIn,
getECCEnv,
} from '../../scripts/utils.js';
import BlockMediator from '../../scripts/deps/block-mediator.min.js';
import { SearchablePicker } from '../../components/searchable-picker/searchable-picker.js';
import { FilterMenu } from '../../components/filter-menu/filter-menu.js';
import { initProfileLogicTree } from '../../scripts/event-apis.js';

const { createTag } = await import(`${LIBS}/utils/utils.js`);

Expand Down Expand Up @@ -565,27 +565,15 @@ export default async function init(el) {
return;
}

const profile = BlockMediator.get('imsProfile');

if (profile) {
if (profile.noProfile || !ALLOWED_ACCOUNT_TYPES.includes(profile.account_type)) {
initProfileLogicTree({
noProfile: () => {
signIn();
},
noAccessProfile: () => {
buildNoAccessScreen(el);
} else {
},
validProfile: () => {
buildDashboard(el, config);
}

return;
}

if (!profile) {
const unsubscribe = BlockMediator.subscribe('imsProfile', ({ newValue }) => {
if (newValue?.noProfile || !ALLOWED_ACCOUNT_TYPES.includes(newValue.account_type)) {
buildNoAccessScreen(el);
} else {
buildDashboard(el, config);
}

unsubscribe();
});
}
},
});
}
42 changes: 18 additions & 24 deletions ecc/blocks/ecc-dashboard/ecc-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ import {
publishEvent,
unpublishEvent,
} from '../../scripts/esp-controller.js';
import { ALLOWED_ACCOUNT_TYPES } from '../../constants/constants.js';
import { LIBS } from '../../scripts/scripts.js';
import { getIcon, buildNoAccessScreen, getEventPageHost, readBlockConfig, getECCEnv } from '../../scripts/utils.js';
import {
getIcon,
buildNoAccessScreen,
getEventPageHost,
readBlockConfig,
signIn,
getECCEnv,
} from '../../scripts/utils.js';
import { quickFilter } from '../form-handler/data-handler.js';
import BlockMediator from '../../scripts/deps/block-mediator.min.js';
import { initProfileLogicTree } from '../../scripts/event-apis.js';

const { createTag } = await import(`${LIBS}/utils/utils.js`);

Expand Down Expand Up @@ -713,27 +719,15 @@ export default async function init(el) {
return;
}

const profile = BlockMediator.get('imsProfile');

if (profile) {
if (profile.noProfile || !ALLOWED_ACCOUNT_TYPES.includes(profile.account_type)) {
initProfileLogicTree({
noProfile: () => {
signIn();
},
noAccessProfile: () => {
buildNoAccessScreen(el);
} else {
},
validProfile: () => {
buildDashboard(el, config);
}

return;
}

if (!profile) {
const unsubscribe = BlockMediator.subscribe('imsProfile', ({ newValue }) => {
if (newValue?.noProfile || !ALLOWED_ACCOUNT_TYPES.includes(newValue.account_type)) {
buildNoAccessScreen(el);
} else {
buildDashboard(el, config);
}

unsubscribe();
});
}
},
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function onSubmit(component, props) {
const checkbox = component.querySelector('#checkbox-community');

if (checkbox.checked) {
const communityTopicUrl = component.querySelector('#community-url-details').value;
const communityTopicUrl = component.querySelector('#community-url-details')?.value?.trim();
props.payload = { ...props.payload, communityTopicUrl };
} else {
const tempPayload = { ...props.payload };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ function prefillFields(component, props) {
export function onSubmit(component, props) {
if (component.closest('.fragment')?.classList.contains('hidden')) return;

const attendeeLimitVal = component.querySelector('#attendee-count-input')?.value;
const attendeeLimitVal = component.querySelector('#attendee-count-input')?.value?.trim();
const allowWaitlisting = component.querySelector('#registration-allow-waitlist')?.checked;
const contactHost = component.querySelector('#registration-contact-host')?.checked;
const hostEmail = component.querySelector('#event-host-email-input')?.value;
const hostEmail = component.querySelector('#event-host-email-input')?.value?.trim();
const rsvpDescription = component.querySelector('#rsvp-form-detail-description')?.value;

const attendeeLimit = Number.isNaN(+attendeeLimitVal) ? null : +attendeeLimitVal;
Expand Down
Loading

0 comments on commit 65a821e

Please sign in to comment.