Skip to content

Commit

Permalink
Merge pull request #285 from adobecom/dev
Browse files Browse the repository at this point in the history
[CHORE] updating Oregon temporary endpoints (#281) dev -> stage
  • Loading branch information
apganapa-adobe authored Nov 11, 2024
2 parents 0833cc9 + c18f1cb commit 1078efb
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable no-unused-vars */
import {
addSpeakerToEvent,
getSpeaker,
getSpeakers,
updateSpeakerInEvent,
removeSpeakerFromEvent,
getEventSpeaker,
} from '../../../scripts/esp-controller.js';
import { getFilteredCachedResponse } from '../data-handler.js';

Expand Down Expand Up @@ -120,10 +120,10 @@ export async function onRespUpdate(_component, _props) {
async function prefillProfiles(props) {
const d = await props.eventDataResp;
if (d?.eventId && d.seriesId) {
const { seriesId } = d;
const { eventId, seriesId } = d;
try {
// eslint-disable-next-line max-len
const speakers = await Promise.all(d.speakers.map(async (sp) => getSpeaker(seriesId, sp.speakerId)));
const speakers = await Promise.all(d.speakers.map(async (sp) => getEventSpeaker(seriesId, eventId, sp.speakerId)));
for (let idx = 0; idx < d.speakers.length; idx += 1) {
// eslint-disable-next-line max-len
d.speakers[idx] = { ...d.speakers[idx], type: d.speakers[idx].speakerType, ...speakers[idx] };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function togglePrefillableFieldsHiddenState(component) {
async function loadGoogleMapsAPI(callback) {
const script = document.createElement('script');
const apiKey = await getSecret(`${getEventServiceEnv()}-google-places-api`);
script.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places&callback=onGoogleMapsApiLoaded`;
script.src = `https://maps.googleapis.com/maps/api/js?loading=async&key=${apiKey}&libraries=places&callback=onGoogleMapsApiLoaded`;
script.async = true;
script.defer = true;
window.onGoogleMapsApiLoaded = callback;
Expand Down
7 changes: 5 additions & 2 deletions ecc/components/profile/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@ export class Profile extends LitElement {

profile.isPlaceholder = false;
profile.socialMedia = profile.socialMedia.filter((sm) => sm.link !== '');

const sProfile = { ...profile };
delete sProfile.type;
let respJson;
if (this.profile.speakerId) {
respJson = await updateSpeaker(profile, this.seriesId);
respJson = await updateSpeaker(sProfile, this.seriesId);
} else {
respJson = await createSpeaker(profile, this.seriesId);
respJson = await createSpeaker(sProfile, this.seriesId);
}

if (respJson.error) {
Expand Down
Binary file added ecc/img/favicons/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ecc/img/favicons/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ecc/img/favicons/favicon-180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed ecc/img/favicons/favicon-192.png
Binary file not shown.
Binary file removed ecc/img/favicons/favicon-512.png
Binary file not shown.
Binary file modified ecc/img/favicons/favicon.ico
Binary file not shown.
1 change: 0 additions & 1 deletion ecc/img/favicons/favicon.svg

This file was deleted.

21 changes: 16 additions & 5 deletions ecc/img/favicons/favicon.webmanifest
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"name": "Milo College",
"display": "standalone",
"name": "",
"short_name": "",
"icons": [
{ "src": "/img/favicons/favicon-192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/img/favicons/favicon-512.png", "sizes": "512x512", "type": "image/png" }
]
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
37 changes: 32 additions & 5 deletions ecc/scripts/esp-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const API_CONFIG = {
esp: {
dev: { host: 'https://wcms-events-service-platform-deploy-ethos102-stage-caff5f.stage.cloud.adobe.io' },
dev02: { host: 'https://wcms-events-service-platform-deploy-ethos102-stage-c81eb6.stage.cloud.adobe.io' },
stage: { host: 'https://events-service-platform-stage.adobe.io' },
stage: { host: 'https://events-service-platform-stage-or2.adobe.io' },
stage02: { host: 'https://events-service-platform-stage02.adobe.io' },
prod: { host: 'https://events-service-platform.adobe.io' },
},
Expand Down Expand Up @@ -163,15 +163,15 @@ export async function uploadImage(file, configs, tracker, imageId = null) {
function convertToNSpeaker(profile) {
const {
// eslint-disable-next-line max-len
speakerId, firstName, lastName, title, company, bio, socialMedia, creationTime, modificationTime,
speakerId, firstName, lastName, title, type, bio, socialMedia, creationTime, modificationTime,
} = profile;

return {
speakerId,
firstName,
lastName,
title,
company,
type,
bio,
socialLinks: socialMedia,
creationTime,
Expand All @@ -182,15 +182,15 @@ function convertToNSpeaker(profile) {
function convertToSpeaker(speaker) {
const {
// eslint-disable-next-line max-len
speakerId, firstName, lastName, title, company, bio, socialLinks, creationTime, modificationTime, photo,
speakerId, firstName, lastName, title, type, bio, socialLinks, creationTime, modificationTime, photo,
} = speaker;

return {
speakerId,
firstName,
lastName,
title,
company,
type,
bio,
photo,
socialMedia: socialLinks || [],
Expand Down Expand Up @@ -553,6 +553,33 @@ export async function getSpeaker(seriesId, speakerId) {
}
}

export async function getEventSpeaker(seriesId, eventId, speakerId) {
const { host } = API_CONFIG.esp[getEventServiceEnv()];
const options = await constructRequestOptions('GET');

const seriesSpeaker = await getSpeaker(seriesId, speakerId);

if (seriesSpeaker.error) {
window.lana?.log('Failed to get event speaker details. Status:', seriesSpeaker.status, 'Error:', seriesSpeaker);
return { status: seriesSpeaker.status, error: seriesSpeaker.error.message };
}

try {
const response = await fetch(`${host}/v1/events/${eventId}/speakers/${speakerId}`, options);
const data = await response.json();

if (!response.ok) {
window.lana?.log('Failed to get event speaker details. Status:', response.status, 'Error:', data);
return { status: response.status, error: data };
}

return convertToSpeaker({ ...seriesSpeaker, type: data.speakerType });
} catch (error) {
window.lana?.log('Failed to get event speaker details. Error:', error);
return { status: 'Network Error', error: error.message };
}
}

export async function updateSpeaker(profile, seriesId) {
const nSpeaker = convertToNSpeaker(profile);
const { host } = API_CONFIG.esp[getEventServiceEnv()];
Expand Down

0 comments on commit 1078efb

Please sign in to comment.