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

MWPW-155709: Fixes events in-person live banner #169

Merged
merged 3 commits into from
Aug 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
2 changes: 1 addition & 1 deletion dist/app.css

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions dist/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Chimera UI Libraries - Build 0.17.0 (8/6/2024, 14:40:22)
* Chimera UI Libraries - Build 0.17.1 (8/24/2024, 10:17:04)
*
*/
/******/ (function(modules) { // webpackBootstrap
Expand Down Expand Up @@ -276,7 +276,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getGlobalNavHeight = exports.getLinkTarget = exports.getEventBanner = exports.getCurrentDate = exports.isDateAfterInterval = exports.isDateBeforeInterval = exports.isDateWithinInterval = exports.qs = exports.mergeDeep = exports.setByPath = exports.debounce = exports.getSelectedItemsCount = exports.getByPath = exports.template = exports.getEndNumber = exports.getStartNumber = exports.getPageStartEnd = exports.generateRange = exports.stopPropagation = exports.isAtleastOneFilterSelected = exports.isNullish = exports.parseToPrimitive = exports.isObject = exports.mapObject = exports.sanitizeText = exports.sortByKey = exports.intersection = exports.isSuperset = exports.chainFromIterable = exports.chain = exports.removeDuplicatesByKey = exports.truncateList = exports.truncateString = exports.readInclusionsFromLocalStorage = exports.readBookmarksFromLocalStorage = exports.saveBookmarksToLocalStorage = undefined;
exports.getSearchParam = exports.getGlobalNavHeight = exports.getLinkTarget = exports.getEventBanner = exports.getCurrentDate = exports.isDateAfterInterval = exports.isDateBeforeInterval = exports.isDateWithinInterval = exports.qs = exports.mergeDeep = exports.setByPath = exports.debounce = exports.getSelectedItemsCount = exports.getByPath = exports.template = exports.getEndNumber = exports.getStartNumber = exports.getPageStartEnd = exports.generateRange = exports.stopPropagation = exports.isAtleastOneFilterSelected = exports.isNullish = exports.parseToPrimitive = exports.isObject = exports.mapObject = exports.sanitizeText = exports.sortByKey = exports.intersection = exports.isSuperset = exports.chainFromIterable = exports.chain = exports.removeDuplicatesByKey = exports.truncateList = exports.truncateString = exports.readInclusionsFromLocalStorage = exports.readBookmarksFromLocalStorage = exports.saveBookmarksToLocalStorage = undefined;

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

Expand Down Expand Up @@ -924,6 +924,12 @@ var getGlobalNavHeight = exports.getGlobalNavHeight = function getGlobalNavHeigh
return isBacom || headerWrapper && headerWrapper.classList.contains('feds-header-wrapper--sticky') ? header.offsetHeight + offSet : offSet;
};

var getSearchParam = exports.getSearchParam = function getSearchParam(url, param) {
if (!url || !url.startsWith('http') || !param) return null;
var urlObj = new URL(url);
return urlObj.searchParams.get(param);
};

/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
Expand Down Expand Up @@ -46867,7 +46873,7 @@ var Card = function Card(props) {
* isInPerson
* @type {Boolean}
*/
var isInPerson = (0, _Helpers.hasTag)(/events\/session-format\/in-person/, tags);
var isInPerson = (0, _Helpers.hasTag)(/events\/session-format\/in-person/, tags) || (0, _Helpers.hasTag)(/e505\/3ssk/, tags);

/**
* Extends infobits with the configuration data
Expand Down Expand Up @@ -46926,10 +46932,10 @@ var Card = function Card(props) {
var showFooter = isOneHalf || isProduct || isText;
var showFooterLeft = !isProduct;
var showFooterCenter = !isProduct;
var isEventsCard = origin === 'Events';
var hideBanner = false;
var eventBanner = '';
var hideOnDemandDates = hideDateInterval && (0, _general.isDateAfterInterval)((0, _general.getCurrentDate)(), endDate);
var isEventsCard = (0, _general.getSearchParam)(getConfig('collection', 'endpoint'), 'originSelection') === 'events';

if (isHalfHeight && isGated && !isRegistered) {
bannerDescriptionToUse = bannerMap.register.description;
Expand All @@ -46955,7 +46961,7 @@ var Card = function Card(props) {
// Events card custom banners
if (isEventsCard) {
hideBanner = isInPerson && eventBanner === bannerMap.onDemand;
bannerDescriptionToUse = eventBanner === bannerMap.live ? 'Live Today' : bannerDescriptionToUse;
bannerDescriptionToUse = isInPerson && eventBanner === bannerMap.live ? 'Live Today' : bannerDescriptionToUse;
}

var hasBanner = bannerDescriptionToUse && bannerFontColorToUse && bannerBackgroundColorToUse && !hideBanner;
Expand Down
6 changes: 3 additions & 3 deletions dist/main.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/main.source.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions react/src/js/components/Consonant/Cards/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import CardFooter from './CardFooter/CardFooter';
import prettyFormatDate from '../Helpers/prettyFormat';
import { INFOBIT_TYPE } from '../Helpers/constants';
import { hasTag } from '../Helpers/Helpers';
import { getEventBanner, getLinkTarget, isDateBeforeInterval, isDateAfterInterval, getCurrentDate } from '../Helpers/general';
import { getEventBanner, getLinkTarget, isDateBeforeInterval, isDateAfterInterval, getCurrentDate, getSearchParam } from '../Helpers/general';
import { useConfig, useRegistered } from '../Helpers/hooks';
import {
stylesType,
Expand Down Expand Up @@ -229,7 +229,8 @@ const Card = (props) => {
* isInPerson
* @type {Boolean}
*/
const isInPerson = hasTag(/events\/session-format\/in-person/, tags);
const isInPerson = hasTag(/events\/session-format\/in-person/, tags)
|| hasTag(/e505\/3ssk/, tags);

/**
* Extends infobits with the configuration data
Expand Down Expand Up @@ -291,10 +292,10 @@ const Card = (props) => {
const showFooter = isOneHalf || isProduct || isText;
const showFooterLeft = !isProduct;
const showFooterCenter = !isProduct;
const isEventsCard = origin === 'Events';
let hideBanner = false;
let eventBanner = '';
const hideOnDemandDates = hideDateInterval && isDateAfterInterval(getCurrentDate(), endDate);
const isEventsCard = getSearchParam(getConfig('collection', 'endpoint'), 'originSelection') === 'events';

if (isHalfHeight && isGated && !isRegistered) {
bannerDescriptionToUse = bannerMap.register.description;
Expand All @@ -320,7 +321,7 @@ const Card = (props) => {
// Events card custom banners
if (isEventsCard) {
hideBanner = isInPerson && eventBanner === bannerMap.onDemand;
bannerDescriptionToUse = eventBanner === bannerMap.live
bannerDescriptionToUse = isInPerson && eventBanner === bannerMap.live
? 'Live Today'
: bannerDescriptionToUse;
}
Expand Down
6 changes: 6 additions & 0 deletions react/src/js/components/Consonant/Helpers/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,3 +548,9 @@ export const getGlobalNavHeight = () => {
? header.offsetHeight + offSet
: offSet;
};

export const getSearchParam = (url, param) => {
if (!url || !url.startsWith('http') || !param) return null;
const urlObj = new URL(url);
return urlObj.searchParams.get(param);
};
Loading