Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOTFIX] Blank page on latest Chrome version (small) #229

Merged
merged 8 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable max-len */
import { getAllEventAttendees, getEvents } from '../../scripts/esp-controller.js';
import { ALLOWED_ACCOUNT_TYPES } from '../../constants/constants.js';
import { DEV_MODE, LIBS, MILO_CONFIG } from '../../scripts/scripts.js';
import { LIBS } from '../../scripts/scripts.js';
import {
getIcon,
buildNoAccessScreen,
Expand Down Expand Up @@ -418,7 +418,6 @@ function buildBackToDashboardBtn(props, config) {
if (!sidePanel) return;

const url = new URL(`${window.location.origin}${config['event-dashboard-url']}`);
if (DEV_MODE) url.searchParams.set('devMode', true);
const backBtn = createTag('a', { class: 'back-btn', href: url.toString() }, 'Back', { parent: sidePanel });
backBtn.prepend(getIcon('chev-left'));
}
Expand Down Expand Up @@ -554,20 +553,11 @@ export default async function init(el) {
import(`${miloLibs}/features/spectrum-web-components/dist/link.js`),
]);

const { search } = window.location;
const urlParams = new URLSearchParams(search);
const devMode = urlParams.get('devMode');

const config = readBlockConfig(el);
el.innerHTML = '';
buildLoadingScreen(el);
const profile = BlockMediator.get('imsProfile');

if (devMode === 'true' && ['stage', 'local'].includes(MILO_CONFIG.env.name)) {
buildDashboard(el, config);
return;
}

if (profile) {
if (profile.noProfile || !ALLOWED_ACCOUNT_TYPES.includes(profile.account_type)) {
buildNoAccessScreen(el);
Expand Down
9 changes: 1 addition & 8 deletions ecc/blocks/ecc-dashboard/ecc-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
unpublishEvent,
} from '../../scripts/esp-controller.js';
import { ALLOWED_ACCOUNT_TYPES } from '../../constants/constants.js';
import { LIBS, MILO_CONFIG, DEV_MODE } from '../../scripts/scripts.js';
import { LIBS } from '../../scripts/scripts.js';
import { getIcon, buildNoAccessScreen, getEventPageHost, readBlockConfig } from '../../scripts/utils.js';
import { quickFilter } from '../form-handler/data-handler.js';
import BlockMediator from '../../scripts/deps/block-mediator.min.js';
Expand Down Expand Up @@ -388,7 +388,6 @@ function buildStatusTag(event) {
function buildEventTitleTag(config, eventObj) {
const url = new URL(`${window.location.origin}${config['create-form-url']}`);
url.searchParams.set('eventId', eventObj.eventId);
if (DEV_MODE) url.searchParams.set('devMode', true);
const eventTitleTag = createTag('a', { class: 'event-title-link', href: url.toString() }, eventObj.title);
return eventTitleTag;
}
Expand All @@ -407,7 +406,6 @@ function buildRSVPTag(config, eventObj) {

const url = new URL(`${window.location.origin}${config['attendee-dashboard-url']}`);
url.searchParams.set('eventId', eventObj.eventId);
if (DEV_MODE) url.searchParams.set('devMode', true);

const rsvpTag = createTag('a', { class: 'rsvp-tag', href: url }, text);
return rsvpTag;
Expand Down Expand Up @@ -709,11 +707,6 @@ export default async function init(el) {
buildLoadingScreen(el);
const profile = BlockMediator.get('imsProfile');

if (DEV_MODE === true && ['stage', 'local'].includes(MILO_CONFIG.env.name)) {
buildDashboard(el, config);
return;
}

if (profile) {
if (profile.noProfile || !ALLOWED_ACCOUNT_TYPES.includes(profile.account_type)) {
buildNoAccessScreen(el);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-unused-vars */
import { getSeries } from '../../../scripts/esp-controller.js';
import { LIBS, BlockMediator } from '../../../scripts/scripts.js';
import BlockMediator from '../../../scripts/deps/block-mediator.min.js';
import { LIBS } from '../../../scripts/scripts.js';
import { changeInputValue } from '../../../scripts/utils.js';

const { createTag } = await import(`${LIBS}/utils/utils.js`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-disable no-unused-vars */
/* eslint-disable no-use-before-define */
import { getEvents } from '../../../scripts/esp-controller.js';
import { BlockMediator, LIBS } from '../../../scripts/scripts.js';
import BlockMediator from '../../../scripts/deps/block-mediator.min.js';
import { LIBS } from '../../../scripts/scripts.js';
import { changeInputValue } from '../../../scripts/utils.js';

const { createTag, getConfig } = await import(`${LIBS}/utils/utils.js`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/* eslint-disable no-unused-vars */
import { ECC_ENV, LIBS } from '../../../scripts/scripts.js';
import { LIBS } from '../../../scripts/scripts.js';
import HtmlSanitizer from '../../../scripts/deps/html-sanitizer.js';
import { fetchThrottledMemoizedText, getEventPageHost } from '../../../scripts/utils.js';
import { getFilteredCachedResponse } from '../data-handler.js';
import { fetchThrottledMemoizedText, getECCEnv } from '../../../scripts/utils.js';

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

function buildTerms(terms) {
Expand Down Expand Up @@ -37,7 +35,7 @@ async function loadPreview(component, templateId) {

let host;
if (window.location.href.includes('.hlx.')) {
host = window.location.origin.replace(window.location.hostname, `${ECC_ENV}--events-milo--adobecom.hlx.page`);
host = window.location.origin.replace(window.location.hostname, `${getECCEnv()}--events-milo--adobecom.hlx.page`);
} else {
host = window.location.origin;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-unused-vars */
import { createVenue, replaceVenue } from '../../../scripts/esp-controller.js';
import { BlockMediator, ECC_ENV } from '../../../scripts/scripts.js';
import { changeInputValue, getSecret } from '../../../scripts/utils.js';
import BlockMediator from '../../../scripts/deps/block-mediator.min.js';
import { changeInputValue, getECCEnv, getSecret } from '../../../scripts/utils.js';
import { buildErrorMessage } from '../form-handler.js';

function togglePrefillableFieldsHiddenState(component, showPrefilledFields) {
Expand All @@ -18,7 +18,7 @@ function togglePrefillableFieldsHiddenState(component, showPrefilledFields) {

async function loadGoogleMapsAPI(callback) {
const script = document.createElement('script');
const apiKey = await getSecret(`${ECC_ENV}-google-places-api`);
const apiKey = await getSecret(`${getECCEnv()}-google-places-api`);
script.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places&callback=onGoogleMapsApiLoaded`;
script.async = true;
script.defer = true;
Expand Down
9 changes: 1 addition & 8 deletions ecc/blocks/form-handler/form-handler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ALLOWED_ACCOUNT_TYPES } from '../../constants/constants.js';
import { LIBS, MILO_CONFIG, DEV_MODE } from '../../scripts/scripts.js';
import { LIBS } from '../../scripts/scripts.js';
import {
getIcon,
buildNoAccessScreen,
Expand Down Expand Up @@ -859,13 +859,6 @@ export default async function init(el) {

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

if (DEV_MODE === true && ['stage', 'local'].includes(MILO_CONFIG.env.name)) {
buildECCForm(el).then(() => {
el.classList.remove('loading');
});
return;
}

if (profile) {
if (profile.noProfile || !ALLOWED_ACCOUNT_TYPES.includes(profile.account_type)) {
buildNoAccessScreen(el);
Expand Down
Loading
Loading