@dnanpm/styleguide 3.11.4 → 3.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -283,14 +283,37 @@ const Categories = ({ categories }) => {
|
|
|
283
283
|
const GeneralInformation = ({ generalInformation }) => {
|
|
284
284
|
const { language } = React.useContext(FooterContext.default);
|
|
285
285
|
const currentYear = new Date().getFullYear();
|
|
286
|
-
const
|
|
286
|
+
const COOKIE_SETTINGS_URL = 'cookie-settings';
|
|
287
|
+
const OT_SDK_CLASSNAME = 'ot-sdk-show-settings';
|
|
288
|
+
// TODO after release: Remove redundant `isNewModelUsed` condition and refactor it's usages (STYLE-905)
|
|
289
|
+
const isNewModelUsed = !!generalInformation.mandatoryLinks;
|
|
287
290
|
const typeToClassMap = {
|
|
288
291
|
cookie: 'ot-sdk-show-settings',
|
|
289
292
|
};
|
|
290
|
-
const
|
|
293
|
+
const orderMap = ['privacyPolicy', 'cookieSettings', 'terms'];
|
|
294
|
+
const getOrderedLinks = () => {
|
|
295
|
+
if (isNewModelUsed && Array.isArray(generalInformation.mandatoryLinks)) {
|
|
296
|
+
return generalInformation.mandatoryLinks;
|
|
297
|
+
}
|
|
298
|
+
return orderMap.map(id => new Map(Object.entries(generalInformation)).get(id));
|
|
299
|
+
};
|
|
300
|
+
const getLinkHref = (item) => {
|
|
301
|
+
var _a;
|
|
302
|
+
if (!((_a = item.urls) === null || _a === void 0 ? void 0 : _a[language]))
|
|
303
|
+
return '#!';
|
|
304
|
+
return item.urls[language] !== COOKIE_SETTINGS_URL ? item.urls[language] : '#!';
|
|
305
|
+
};
|
|
306
|
+
const getLinkClassName = (item) => {
|
|
307
|
+
var _a;
|
|
308
|
+
if (isNewModelUsed) {
|
|
309
|
+
return ((_a = item.urls) === null || _a === void 0 ? void 0 : _a[language]) === COOKIE_SETTINGS_URL ? OT_SDK_CLASSNAME : '';
|
|
310
|
+
}
|
|
311
|
+
return item.type ? typeToClassMap[item.type] : '';
|
|
312
|
+
};
|
|
313
|
+
const orderedGeneralInformation = getOrderedLinks();
|
|
291
314
|
return (React__default.default.createElement(GeneralInformationContainer, { "data-testid": "general-information-section" },
|
|
292
315
|
orderedGeneralInformation.map((item, index) => item && (React__default.default.createElement(React.Fragment, { key: `general-information-link-${index}` },
|
|
293
|
-
React__default.default.createElement("a", { href: (item
|
|
316
|
+
React__default.default.createElement("a", { href: getLinkHref(item), className: getLinkClassName(item) }, item.titles[language]),
|
|
294
317
|
React__default.default.createElement("span", { "aria-hidden": "true" }, "|")))),
|
|
295
318
|
"DNA ",
|
|
296
319
|
currentYear));
|
|
@@ -277,14 +277,37 @@ const Categories = ({ categories }) => {
|
|
|
277
277
|
const GeneralInformation = ({ generalInformation }) => {
|
|
278
278
|
const { language } = useContext(FooterContext);
|
|
279
279
|
const currentYear = new Date().getFullYear();
|
|
280
|
-
const
|
|
280
|
+
const COOKIE_SETTINGS_URL = 'cookie-settings';
|
|
281
|
+
const OT_SDK_CLASSNAME = 'ot-sdk-show-settings';
|
|
282
|
+
// TODO after release: Remove redundant `isNewModelUsed` condition and refactor it's usages (STYLE-905)
|
|
283
|
+
const isNewModelUsed = !!generalInformation.mandatoryLinks;
|
|
281
284
|
const typeToClassMap = {
|
|
282
285
|
cookie: 'ot-sdk-show-settings',
|
|
283
286
|
};
|
|
284
|
-
const
|
|
287
|
+
const orderMap = ['privacyPolicy', 'cookieSettings', 'terms'];
|
|
288
|
+
const getOrderedLinks = () => {
|
|
289
|
+
if (isNewModelUsed && Array.isArray(generalInformation.mandatoryLinks)) {
|
|
290
|
+
return generalInformation.mandatoryLinks;
|
|
291
|
+
}
|
|
292
|
+
return orderMap.map(id => new Map(Object.entries(generalInformation)).get(id));
|
|
293
|
+
};
|
|
294
|
+
const getLinkHref = (item) => {
|
|
295
|
+
var _a;
|
|
296
|
+
if (!((_a = item.urls) === null || _a === void 0 ? void 0 : _a[language]))
|
|
297
|
+
return '#!';
|
|
298
|
+
return item.urls[language] !== COOKIE_SETTINGS_URL ? item.urls[language] : '#!';
|
|
299
|
+
};
|
|
300
|
+
const getLinkClassName = (item) => {
|
|
301
|
+
var _a;
|
|
302
|
+
if (isNewModelUsed) {
|
|
303
|
+
return ((_a = item.urls) === null || _a === void 0 ? void 0 : _a[language]) === COOKIE_SETTINGS_URL ? OT_SDK_CLASSNAME : '';
|
|
304
|
+
}
|
|
305
|
+
return item.type ? typeToClassMap[item.type] : '';
|
|
306
|
+
};
|
|
307
|
+
const orderedGeneralInformation = getOrderedLinks();
|
|
285
308
|
return (React__default.createElement(GeneralInformationContainer, { "data-testid": "general-information-section" },
|
|
286
309
|
orderedGeneralInformation.map((item, index) => item && (React__default.createElement(Fragment, { key: `general-information-link-${index}` },
|
|
287
|
-
React__default.createElement("a", { href: (item
|
|
310
|
+
React__default.createElement("a", { href: getLinkHref(item), className: getLinkClassName(item) }, item.titles[language]),
|
|
288
311
|
React__default.createElement("span", { "aria-hidden": "true" }, "|")))),
|
|
289
312
|
"DNA ",
|
|
290
313
|
currentYear));
|