Skip to content

Commit

Permalink
smaller fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyundai committed Sep 26, 2024
1 parent e6c73e6 commit f6e2149
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 62 deletions.
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 { ALLOWED_ACCOUNT_TYPES, DEV_MODE } from '../../constants/constants.js';
import { LIBS } from '../../scripts/scripts.js';
import {
getIcon,
buildNoAccessScreen,
Expand Down Expand Up @@ -563,7 +563,7 @@ export default async function init(el) {
buildLoadingScreen(el);
const profile = BlockMediator.get('imsProfile');

if (devMode === 'true' && ['stage', 'local'].includes(MILO_CONFIG.env.name)) {
if (devMode === 'true' && ['stage', 'local'].includes(window.miloConfig.env.name)) {
buildDashboard(el, config);
return;
}
Expand Down
6 changes: 3 additions & 3 deletions ecc/blocks/ecc-dashboard/ecc-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
publishEvent,
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 { ALLOWED_ACCOUNT_TYPES, DEV_MODE } from '../../constants/constants.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 @@ -709,7 +709,7 @@ export default async function init(el) {
buildLoadingScreen(el);
const profile = BlockMediator.get('imsProfile');

if (DEV_MODE === true && ['stage', 'local'].includes(MILO_CONFIG.env.name)) {
if (DEV_MODE === true && ['stage', 'local'].includes(window.miloConfig.env.name)) {
buildDashboard(el, config);
return;
}
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 } 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, `${window.miloConfig.eccEnv}--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,6 @@
/* eslint-disable no-unused-vars */
import { createVenue, replaceVenue } from '../../../scripts/esp-controller.js';
import BlockMediator from '../../../scripts/deps/block-mediator.min.js';
import { ECC_ENV } from '../../../scripts/scripts.js';
import { changeInputValue, getSecret } from '../../../scripts/utils.js';
import { buildErrorMessage } from '../form-handler.js';

Expand All @@ -19,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(`${window.miloConfig.eccEnv}-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
6 changes: 3 additions & 3 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 { ALLOWED_ACCOUNT_TYPES, DEV_MODE } from '../../constants/constants.js';
import { LIBS } from '../../scripts/scripts.js';
import {
getIcon,
buildNoAccessScreen,
Expand Down Expand Up @@ -859,7 +859,7 @@ export default async function init(el) {

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

if (DEV_MODE === true && ['stage', 'local'].includes(MILO_CONFIG.env.name)) {
if (DEV_MODE === true && ['stage', 'local'].includes(window.miloConfig.env.name)) {
buildECCForm(el).then(() => {
el.classList.remove('loading');
});
Expand Down
1 change: 1 addition & 0 deletions ecc/constants/constants.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export const LINK_REGEX = '^https:\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,63}(:[0-9]{1,5})?(\\/.*)?$';
export const ALLOWED_ACCOUNT_TYPES = ['type3', 'type2e'];
export const DEV_MODE = new URLSearchParams(window.location.search).has('devMode');
Loading

0 comments on commit f6e2149

Please sign in to comment.