next-seo.js 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107
  1. var React = require('react');
  2. var Head = require('next/head');
  3. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  4. var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
  5. var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
  6. function _extends() {
  7. _extends = Object.assign ? Object.assign.bind() : function (target) {
  8. for (var i = 1; i < arguments.length; i++) {
  9. var source = arguments[i];
  10. for (var key in source) {
  11. if (Object.prototype.hasOwnProperty.call(source, key)) {
  12. target[key] = source[key];
  13. }
  14. }
  15. }
  16. return target;
  17. };
  18. return _extends.apply(this, arguments);
  19. }
  20. function _objectWithoutPropertiesLoose(source, excluded) {
  21. if (source == null) return {};
  22. var target = {};
  23. var sourceKeys = Object.keys(source);
  24. var key, i;
  25. for (i = 0; i < sourceKeys.length; i++) {
  26. key = sourceKeys[i];
  27. if (excluded.indexOf(key) >= 0) continue;
  28. target[key] = source[key];
  29. }
  30. return target;
  31. }
  32. var _excluded$x = ["keyOverride"];
  33. var defaults = {
  34. templateTitle: '',
  35. noindex: false,
  36. nofollow: false,
  37. defaultOpenGraphImageWidth: 0,
  38. defaultOpenGraphImageHeight: 0,
  39. defaultOpenGraphVideoWidth: 0,
  40. defaultOpenGraphVideoHeight: 0
  41. };
  42. var buildOpenGraphMediaTags = function buildOpenGraphMediaTags(mediaType, media, _temp) {
  43. if (media === void 0) {
  44. media = [];
  45. }
  46. var _ref = _temp === void 0 ? {} : _temp,
  47. defaultWidth = _ref.defaultWidth,
  48. defaultHeight = _ref.defaultHeight;
  49. return media.reduce(function (tags, medium, index) {
  50. tags.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  51. key: "og:" + mediaType + ":0" + index,
  52. property: "og:" + mediaType,
  53. content: medium.url
  54. }));
  55. if (medium.alt) {
  56. tags.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  57. key: "og:" + mediaType + ":alt0" + index,
  58. property: "og:" + mediaType + ":alt",
  59. content: medium.alt
  60. }));
  61. }
  62. if (medium.secureUrl) {
  63. tags.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  64. key: "og:" + mediaType + ":secure_url0" + index,
  65. property: "og:" + mediaType + ":secure_url",
  66. content: medium.secureUrl.toString()
  67. }));
  68. }
  69. if (medium.type) {
  70. tags.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  71. key: "og:" + mediaType + ":type0" + index,
  72. property: "og:" + mediaType + ":type",
  73. content: medium.type.toString()
  74. }));
  75. }
  76. if (medium.width) {
  77. tags.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  78. key: "og:" + mediaType + ":width0" + index,
  79. property: "og:" + mediaType + ":width",
  80. content: medium.width.toString()
  81. }));
  82. } else if (defaultWidth) {
  83. tags.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  84. key: "og:" + mediaType + ":width0" + index,
  85. property: "og:" + mediaType + ":width",
  86. content: defaultWidth.toString()
  87. }));
  88. }
  89. if (medium.height) {
  90. tags.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  91. key: "og:" + mediaType + ":height" + index,
  92. property: "og:" + mediaType + ":height",
  93. content: medium.height.toString()
  94. }));
  95. } else if (defaultHeight) {
  96. tags.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  97. key: "og:" + mediaType + ":height" + index,
  98. property: "og:" + mediaType + ":height",
  99. content: defaultHeight.toString()
  100. }));
  101. }
  102. return tags;
  103. }, []);
  104. };
  105. var buildTags = function buildTags(config) {
  106. var _config$openGraph, _config$openGraph3, _config$additionalLin;
  107. var tagsToRender = [];
  108. if (config.titleTemplate) {
  109. defaults.templateTitle = config.titleTemplate;
  110. }
  111. var updatedTitle = '';
  112. if (config.title) {
  113. updatedTitle = config.title;
  114. if (defaults.templateTitle) {
  115. updatedTitle = defaults.templateTitle.replace(/%s/g, function () {
  116. return updatedTitle;
  117. });
  118. }
  119. } else if (config.defaultTitle) {
  120. updatedTitle = config.defaultTitle;
  121. }
  122. if (updatedTitle) {
  123. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("title", {
  124. key: "title"
  125. }, updatedTitle));
  126. }
  127. var noindex = config.noindex || defaults.noindex || config.dangerouslySetAllPagesToNoIndex;
  128. var nofollow = config.nofollow || defaults.nofollow || config.dangerouslySetAllPagesToNoFollow;
  129. var robotsParams = '';
  130. if (config.robotsProps) {
  131. var _config$robotsProps = config.robotsProps,
  132. nosnippet = _config$robotsProps.nosnippet,
  133. maxSnippet = _config$robotsProps.maxSnippet,
  134. maxImagePreview = _config$robotsProps.maxImagePreview,
  135. maxVideoPreview = _config$robotsProps.maxVideoPreview,
  136. noarchive = _config$robotsProps.noarchive,
  137. noimageindex = _config$robotsProps.noimageindex,
  138. notranslate = _config$robotsProps.notranslate,
  139. unavailableAfter = _config$robotsProps.unavailableAfter;
  140. robotsParams = "" + (nosnippet ? ',nosnippet' : '') + (maxSnippet ? ",max-snippet:" + maxSnippet : '') + (maxImagePreview ? ",max-image-preview:" + maxImagePreview : '') + (noarchive ? ',noarchive' : '') + (unavailableAfter ? ",unavailable_after:" + unavailableAfter : '') + (noimageindex ? ',noimageindex' : '') + (maxVideoPreview ? ",max-video-preview:" + maxVideoPreview : '') + (notranslate ? ',notranslate' : '');
  141. }
  142. if (noindex || nofollow) {
  143. if (config.dangerouslySetAllPagesToNoIndex) {
  144. defaults.noindex = true;
  145. }
  146. if (config.dangerouslySetAllPagesToNoFollow) {
  147. defaults.nofollow = true;
  148. }
  149. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  150. key: "robots",
  151. name: "robots",
  152. content: (noindex ? 'noindex' : 'index') + "," + (nofollow ? 'nofollow' : 'follow') + robotsParams
  153. }));
  154. } else {
  155. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  156. key: "robots",
  157. name: "robots",
  158. content: "index,follow" + robotsParams
  159. }));
  160. }
  161. if (config.description) {
  162. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  163. key: "description",
  164. name: "description",
  165. content: config.description
  166. }));
  167. }
  168. if (config.themeColor) {
  169. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  170. key: "theme-color",
  171. name: "theme-color",
  172. content: config.themeColor
  173. }));
  174. }
  175. if (config.mobileAlternate) {
  176. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("link", {
  177. rel: "alternate",
  178. key: "mobileAlternate",
  179. media: config.mobileAlternate.media,
  180. href: config.mobileAlternate.href
  181. }));
  182. }
  183. if (config.languageAlternates && config.languageAlternates.length > 0) {
  184. config.languageAlternates.forEach(function (languageAlternate) {
  185. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("link", {
  186. rel: "alternate",
  187. key: "languageAlternate-" + languageAlternate.hrefLang,
  188. hrefLang: languageAlternate.hrefLang,
  189. href: languageAlternate.href
  190. }));
  191. });
  192. }
  193. if (config.twitter) {
  194. if (config.twitter.cardType) {
  195. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  196. key: "twitter:card",
  197. name: "twitter:card",
  198. content: config.twitter.cardType
  199. }));
  200. }
  201. if (config.twitter.site) {
  202. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  203. key: "twitter:site",
  204. name: "twitter:site",
  205. content: config.twitter.site
  206. }));
  207. }
  208. if (config.twitter.handle) {
  209. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  210. key: "twitter:creator",
  211. name: "twitter:creator",
  212. content: config.twitter.handle
  213. }));
  214. }
  215. }
  216. if (config.facebook) {
  217. if (config.facebook.appId) {
  218. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  219. key: "fb:app_id",
  220. property: "fb:app_id",
  221. content: config.facebook.appId
  222. }));
  223. }
  224. }
  225. if ((_config$openGraph = config.openGraph) != null && _config$openGraph.title || updatedTitle) {
  226. var _config$openGraph2;
  227. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  228. key: "og:title",
  229. property: "og:title",
  230. content: ((_config$openGraph2 = config.openGraph) == null ? void 0 : _config$openGraph2.title) || updatedTitle
  231. }));
  232. }
  233. if ((_config$openGraph3 = config.openGraph) != null && _config$openGraph3.description || config.description) {
  234. var _config$openGraph4;
  235. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  236. key: "og:description",
  237. property: "og:description",
  238. content: ((_config$openGraph4 = config.openGraph) == null ? void 0 : _config$openGraph4.description) || config.description
  239. }));
  240. }
  241. if (config.openGraph) {
  242. if (config.openGraph.url || config.canonical) {
  243. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  244. key: "og:url",
  245. property: "og:url",
  246. content: config.openGraph.url || config.canonical
  247. }));
  248. }
  249. if (config.openGraph.type) {
  250. var type = config.openGraph.type.toLowerCase();
  251. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  252. key: "og:type",
  253. property: "og:type",
  254. content: type
  255. }));
  256. if (type === 'profile' && config.openGraph.profile) {
  257. if (config.openGraph.profile.firstName) {
  258. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  259. key: "profile:first_name",
  260. property: "profile:first_name",
  261. content: config.openGraph.profile.firstName
  262. }));
  263. }
  264. if (config.openGraph.profile.lastName) {
  265. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  266. key: "profile:last_name",
  267. property: "profile:last_name",
  268. content: config.openGraph.profile.lastName
  269. }));
  270. }
  271. if (config.openGraph.profile.username) {
  272. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  273. key: "profile:username",
  274. property: "profile:username",
  275. content: config.openGraph.profile.username
  276. }));
  277. }
  278. if (config.openGraph.profile.gender) {
  279. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  280. key: "profile:gender",
  281. property: "profile:gender",
  282. content: config.openGraph.profile.gender
  283. }));
  284. }
  285. } else if (type === 'book' && config.openGraph.book) {
  286. if (config.openGraph.book.authors && config.openGraph.book.authors.length) {
  287. config.openGraph.book.authors.forEach(function (author, index) {
  288. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  289. key: "book:author:0" + index,
  290. property: "book:author",
  291. content: author
  292. }));
  293. });
  294. }
  295. if (config.openGraph.book.isbn) {
  296. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  297. key: "book:isbn",
  298. property: "book:isbn",
  299. content: config.openGraph.book.isbn
  300. }));
  301. }
  302. if (config.openGraph.book.releaseDate) {
  303. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  304. key: "book:release_date",
  305. property: "book:release_date",
  306. content: config.openGraph.book.releaseDate
  307. }));
  308. }
  309. if (config.openGraph.book.tags && config.openGraph.book.tags.length) {
  310. config.openGraph.book.tags.forEach(function (tag, index) {
  311. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  312. key: "book:tag:0" + index,
  313. property: "book:tag",
  314. content: tag
  315. }));
  316. });
  317. }
  318. } else if (type === 'article' && config.openGraph.article) {
  319. if (config.openGraph.article.publishedTime) {
  320. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  321. key: "article:published_time",
  322. property: "article:published_time",
  323. content: config.openGraph.article.publishedTime
  324. }));
  325. }
  326. if (config.openGraph.article.modifiedTime) {
  327. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  328. key: "article:modified_time",
  329. property: "article:modified_time",
  330. content: config.openGraph.article.modifiedTime
  331. }));
  332. }
  333. if (config.openGraph.article.expirationTime) {
  334. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  335. key: "article:expiration_time",
  336. property: "article:expiration_time",
  337. content: config.openGraph.article.expirationTime
  338. }));
  339. }
  340. if (config.openGraph.article.authors && config.openGraph.article.authors.length) {
  341. config.openGraph.article.authors.forEach(function (author, index) {
  342. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  343. key: "article:author:0" + index,
  344. property: "article:author",
  345. content: author
  346. }));
  347. });
  348. }
  349. if (config.openGraph.article.section) {
  350. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  351. key: "article:section",
  352. property: "article:section",
  353. content: config.openGraph.article.section
  354. }));
  355. }
  356. if (config.openGraph.article.tags && config.openGraph.article.tags.length) {
  357. config.openGraph.article.tags.forEach(function (tag, index) {
  358. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  359. key: "article:tag:0" + index,
  360. property: "article:tag",
  361. content: tag
  362. }));
  363. });
  364. }
  365. } else if ((type === 'video.movie' || type === 'video.episode' || type === 'video.tv_show' || type === 'video.other') && config.openGraph.video) {
  366. if (config.openGraph.video.actors && config.openGraph.video.actors.length) {
  367. config.openGraph.video.actors.forEach(function (actor, index) {
  368. if (actor.profile) {
  369. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  370. key: "video:actor:0" + index,
  371. property: "video:actor",
  372. content: actor.profile
  373. }));
  374. }
  375. if (actor.role) {
  376. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  377. key: "video:actor:role:0" + index,
  378. property: "video:actor:role",
  379. content: actor.role
  380. }));
  381. }
  382. });
  383. }
  384. if (config.openGraph.video.directors && config.openGraph.video.directors.length) {
  385. config.openGraph.video.directors.forEach(function (director, index) {
  386. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  387. key: "video:director:0" + index,
  388. property: "video:director",
  389. content: director
  390. }));
  391. });
  392. }
  393. if (config.openGraph.video.writers && config.openGraph.video.writers.length) {
  394. config.openGraph.video.writers.forEach(function (writer, index) {
  395. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  396. key: "video:writer:0" + index,
  397. property: "video:writer",
  398. content: writer
  399. }));
  400. });
  401. }
  402. if (config.openGraph.video.duration) {
  403. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  404. key: "video:duration",
  405. property: "video:duration",
  406. content: config.openGraph.video.duration.toString()
  407. }));
  408. }
  409. if (config.openGraph.video.releaseDate) {
  410. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  411. key: "video:release_date",
  412. property: "video:release_date",
  413. content: config.openGraph.video.releaseDate
  414. }));
  415. }
  416. if (config.openGraph.video.tags && config.openGraph.video.tags.length) {
  417. config.openGraph.video.tags.forEach(function (tag, index) {
  418. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  419. key: "video:tag:0" + index,
  420. property: "video:tag",
  421. content: tag
  422. }));
  423. });
  424. }
  425. if (config.openGraph.video.series) {
  426. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  427. key: "video:series",
  428. property: "video:series",
  429. content: config.openGraph.video.series
  430. }));
  431. }
  432. }
  433. }
  434. // images
  435. if (config.defaultOpenGraphImageWidth) {
  436. defaults.defaultOpenGraphImageWidth = config.defaultOpenGraphImageWidth;
  437. }
  438. if (config.defaultOpenGraphImageHeight) {
  439. defaults.defaultOpenGraphImageHeight = config.defaultOpenGraphImageHeight;
  440. }
  441. if (config.openGraph.images && config.openGraph.images.length) {
  442. tagsToRender.push.apply(tagsToRender, buildOpenGraphMediaTags('image', config.openGraph.images, {
  443. defaultWidth: defaults.defaultOpenGraphImageWidth,
  444. defaultHeight: defaults.defaultOpenGraphImageHeight
  445. }));
  446. }
  447. // videos
  448. if (config.defaultOpenGraphVideoWidth) {
  449. defaults.defaultOpenGraphVideoWidth = config.defaultOpenGraphVideoWidth;
  450. }
  451. if (config.defaultOpenGraphVideoHeight) {
  452. defaults.defaultOpenGraphVideoHeight = config.defaultOpenGraphVideoHeight;
  453. }
  454. if (config.openGraph.videos && config.openGraph.videos.length) {
  455. tagsToRender.push.apply(tagsToRender, buildOpenGraphMediaTags('video', config.openGraph.videos, {
  456. defaultWidth: defaults.defaultOpenGraphVideoWidth,
  457. defaultHeight: defaults.defaultOpenGraphVideoHeight
  458. }));
  459. }
  460. // audio
  461. if (config.openGraph.audio) {
  462. tagsToRender.push.apply(tagsToRender, buildOpenGraphMediaTags('audio', config.openGraph.audio));
  463. }
  464. if (config.openGraph.locale) {
  465. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  466. key: "og:locale",
  467. property: "og:locale",
  468. content: config.openGraph.locale
  469. }));
  470. }
  471. if (config.openGraph.siteName || config.openGraph.site_name) {
  472. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", {
  473. key: "og:site_name",
  474. property: "og:site_name",
  475. content: config.openGraph.siteName || config.openGraph.site_name
  476. }));
  477. }
  478. }
  479. if (config.canonical) {
  480. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("link", {
  481. rel: "canonical",
  482. href: config.canonical,
  483. key: "canonical"
  484. }));
  485. }
  486. if (config.additionalMetaTags && config.additionalMetaTags.length > 0) {
  487. config.additionalMetaTags.forEach(function (_ref2) {
  488. var _ref3, _ref4;
  489. var keyOverride = _ref2.keyOverride,
  490. tag = _objectWithoutPropertiesLoose(_ref2, _excluded$x);
  491. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("meta", _extends({
  492. key: "meta:" + ((_ref3 = (_ref4 = keyOverride != null ? keyOverride : tag.name) != null ? _ref4 : tag.property) != null ? _ref3 : tag.httpEquiv)
  493. }, tag)));
  494. });
  495. }
  496. if ((_config$additionalLin = config.additionalLinkTags) != null && _config$additionalLin.length) {
  497. config.additionalLinkTags.forEach(function (tag) {
  498. var _tag$keyOverride;
  499. tagsToRender.push( /*#__PURE__*/React__default["default"].createElement("link", _extends({
  500. key: "link" + ((_tag$keyOverride = tag.keyOverride) != null ? _tag$keyOverride : tag.href) + tag.rel
  501. }, tag)));
  502. });
  503. }
  504. return tagsToRender;
  505. };
  506. var WithHead = function WithHead(props) {
  507. return /*#__PURE__*/React__default["default"].createElement(Head__default["default"], null, buildTags(props));
  508. };
  509. var DefaultSeo = function DefaultSeo(_ref) {
  510. var title = _ref.title,
  511. titleTemplate = _ref.titleTemplate,
  512. defaultTitle = _ref.defaultTitle,
  513. themeColor = _ref.themeColor,
  514. _ref$dangerouslySetAl = _ref.dangerouslySetAllPagesToNoIndex,
  515. dangerouslySetAllPagesToNoIndex = _ref$dangerouslySetAl === void 0 ? false : _ref$dangerouslySetAl,
  516. _ref$dangerouslySetAl2 = _ref.dangerouslySetAllPagesToNoFollow,
  517. dangerouslySetAllPagesToNoFollow = _ref$dangerouslySetAl2 === void 0 ? false : _ref$dangerouslySetAl2,
  518. description = _ref.description,
  519. canonical = _ref.canonical,
  520. facebook = _ref.facebook,
  521. openGraph = _ref.openGraph,
  522. additionalMetaTags = _ref.additionalMetaTags,
  523. twitter = _ref.twitter,
  524. defaultOpenGraphImageWidth = _ref.defaultOpenGraphImageWidth,
  525. defaultOpenGraphImageHeight = _ref.defaultOpenGraphImageHeight,
  526. defaultOpenGraphVideoWidth = _ref.defaultOpenGraphVideoWidth,
  527. defaultOpenGraphVideoHeight = _ref.defaultOpenGraphVideoHeight,
  528. mobileAlternate = _ref.mobileAlternate,
  529. languageAlternates = _ref.languageAlternates,
  530. additionalLinkTags = _ref.additionalLinkTags,
  531. robotsProps = _ref.robotsProps;
  532. return /*#__PURE__*/React__default["default"].createElement(WithHead, {
  533. title: title,
  534. titleTemplate: titleTemplate,
  535. defaultTitle: defaultTitle,
  536. themeColor: themeColor,
  537. dangerouslySetAllPagesToNoIndex: dangerouslySetAllPagesToNoIndex,
  538. dangerouslySetAllPagesToNoFollow: dangerouslySetAllPagesToNoFollow,
  539. description: description,
  540. canonical: canonical,
  541. facebook: facebook,
  542. openGraph: openGraph,
  543. additionalMetaTags: additionalMetaTags,
  544. twitter: twitter,
  545. defaultOpenGraphImageWidth: defaultOpenGraphImageWidth,
  546. defaultOpenGraphImageHeight: defaultOpenGraphImageHeight,
  547. defaultOpenGraphVideoWidth: defaultOpenGraphVideoWidth,
  548. defaultOpenGraphVideoHeight: defaultOpenGraphVideoHeight,
  549. mobileAlternate: mobileAlternate,
  550. languageAlternates: languageAlternates,
  551. additionalLinkTags: additionalLinkTags,
  552. robotsProps: robotsProps
  553. });
  554. };
  555. var NextSeo = function NextSeo(_ref) {
  556. var title = _ref.title,
  557. themeColor = _ref.themeColor,
  558. _ref$noindex = _ref.noindex,
  559. noindex = _ref$noindex === void 0 ? false : _ref$noindex,
  560. nofollow = _ref.nofollow,
  561. robotsProps = _ref.robotsProps,
  562. description = _ref.description,
  563. canonical = _ref.canonical,
  564. openGraph = _ref.openGraph,
  565. facebook = _ref.facebook,
  566. twitter = _ref.twitter,
  567. additionalMetaTags = _ref.additionalMetaTags,
  568. titleTemplate = _ref.titleTemplate,
  569. defaultTitle = _ref.defaultTitle,
  570. mobileAlternate = _ref.mobileAlternate,
  571. languageAlternates = _ref.languageAlternates,
  572. additionalLinkTags = _ref.additionalLinkTags,
  573. _ref$useAppDir = _ref.useAppDir,
  574. useAppDir = _ref$useAppDir === void 0 ? false : _ref$useAppDir;
  575. return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, useAppDir ? buildTags({
  576. title: title,
  577. themeColor: themeColor,
  578. noindex: noindex,
  579. nofollow: nofollow,
  580. robotsProps: robotsProps,
  581. description: description,
  582. canonical: canonical,
  583. facebook: facebook,
  584. openGraph: openGraph,
  585. additionalMetaTags: additionalMetaTags,
  586. twitter: twitter,
  587. titleTemplate: titleTemplate,
  588. defaultTitle: defaultTitle,
  589. mobileAlternate: mobileAlternate,
  590. languageAlternates: languageAlternates,
  591. additionalLinkTags: additionalLinkTags
  592. }) : /*#__PURE__*/React__default["default"].createElement(WithHead, {
  593. title: title,
  594. themeColor: themeColor,
  595. noindex: noindex,
  596. nofollow: nofollow,
  597. robotsProps: robotsProps,
  598. description: description,
  599. canonical: canonical,
  600. facebook: facebook,
  601. openGraph: openGraph,
  602. additionalMetaTags: additionalMetaTags,
  603. twitter: twitter,
  604. titleTemplate: titleTemplate,
  605. defaultTitle: defaultTitle,
  606. mobileAlternate: mobileAlternate,
  607. languageAlternates: languageAlternates,
  608. additionalLinkTags: additionalLinkTags
  609. }));
  610. };
  611. var toJson = function toJson(type, jsonld) {
  612. var data = jsonld;
  613. if (Array.isArray(data) && data.length === 1) {
  614. data = _extends({}, jsonld[0]);
  615. }
  616. var jsonLdObject = Array.isArray(data) ? data.map(function (item) {
  617. return formatObjectForSchema(type, item);
  618. }) : formatObjectForSchema(type, data);
  619. return {
  620. __html: JSON.stringify(jsonLdObject, safeJsonLdReplacer)
  621. };
  622. };
  623. var formatObjectForSchema = function formatObjectForSchema(type, jsonld) {
  624. var _jsonld$id = jsonld.id,
  625. id = _jsonld$id === void 0 ? undefined : _jsonld$id;
  626. var updated = _extends({}, id ? {
  627. '@id': jsonld.id
  628. } : {}, jsonld);
  629. delete updated.id;
  630. return _extends({
  631. '@context': 'https://schema.org',
  632. '@type': type
  633. }, updated);
  634. };
  635. var ESCAPE_ENTITIES = Object.freeze({
  636. '&': '&amp;',
  637. '<': '&lt;',
  638. '>': '&gt;',
  639. '"': '&quot;',
  640. "'": '&apos;'
  641. });
  642. var ESCAPE_REGEX = new RegExp("[" + Object.keys(ESCAPE_ENTITIES).join('') + "]", 'g');
  643. var ESCAPE_REPLACER = function ESCAPE_REPLACER(t) {
  644. return ESCAPE_ENTITIES[t];
  645. };
  646. /**
  647. * A replacer for JSON.stringify to strip JSON-LD of illegal HTML entities
  648. * per https://www.w3.org/TR/json-ld11/#restrictions-for-contents-of-json-ld-script-elements
  649. */
  650. var safeJsonLdReplacer = function () {
  651. // Replace per https://www.w3.org/TR/json-ld11/#restrictions-for-contents-of-json-ld-script-elements
  652. // Solution from https://stackoverflow.com/a/5499821/864313
  653. return function (_, value) {
  654. switch (typeof value) {
  655. case 'object':
  656. // Omit null values.
  657. if (value === null) {
  658. return undefined;
  659. }
  660. return value;
  661. // JSON.stringify will recursively call replacer.
  662. case 'number':
  663. case 'boolean':
  664. case 'bigint':
  665. return value;
  666. // These values are not risky.
  667. case 'string':
  668. return value.replace(ESCAPE_REGEX, ESCAPE_REPLACER);
  669. default:
  670. {
  671. // JSON.stringify will remove this element.
  672. return undefined;
  673. }
  674. }
  675. };
  676. }();
  677. var _excluded$w = ["type", "keyOverride", "scriptKey", "scriptId", "dataArray", "useAppDir"];
  678. function JsonLd(_ref) {
  679. var _ref$type = _ref.type,
  680. type = _ref$type === void 0 ? 'Thing' : _ref$type,
  681. keyOverride = _ref.keyOverride,
  682. scriptKey = _ref.scriptKey,
  683. _ref$scriptId = _ref.scriptId,
  684. scriptId = _ref$scriptId === void 0 ? undefined : _ref$scriptId,
  685. dataArray = _ref.dataArray,
  686. _ref$useAppDir = _ref.useAppDir,
  687. useAppDir = _ref$useAppDir === void 0 ? false : _ref$useAppDir,
  688. rest = _objectWithoutPropertiesLoose(_ref, _excluded$w);
  689. var JsonLdScript = function JsonLdScript() {
  690. return /*#__PURE__*/React__default["default"].createElement("script", {
  691. type: "application/ld+json",
  692. id: scriptId,
  693. "data-testid": scriptId,
  694. dangerouslySetInnerHTML: toJson(type, dataArray === undefined ? _extends({}, rest) : dataArray),
  695. key: "jsonld-" + scriptKey + (keyOverride ? "-" + keyOverride : '')
  696. });
  697. };
  698. if (useAppDir) {
  699. return /*#__PURE__*/React__default["default"].createElement(JsonLdScript, null);
  700. }
  701. return /*#__PURE__*/React__default["default"].createElement(Head__default["default"], null, JsonLdScript());
  702. }
  703. /**
  704. * Generate author information
  705. * @param author
  706. * @returns
  707. */
  708. function generateAuthorInfo(author) {
  709. if (typeof author === 'string') {
  710. return {
  711. '@type': 'Person',
  712. name: author
  713. };
  714. } else if (!!author.name) {
  715. var _author$type;
  716. return {
  717. '@type': (_author$type = author == null ? void 0 : author.type) != null ? _author$type : 'Person',
  718. name: author.name,
  719. url: author == null ? void 0 : author.url
  720. };
  721. }
  722. return;
  723. }
  724. function setAuthor(author) {
  725. if (Array.isArray(author)) {
  726. return author.map(function (item) {
  727. return generateAuthorInfo(item);
  728. }).filter(function (item) {
  729. return !!item;
  730. });
  731. } else if (author) {
  732. return generateAuthorInfo(author);
  733. }
  734. return;
  735. }
  736. function setImage(image) {
  737. if (image) {
  738. return {
  739. '@type': 'ImageObject',
  740. url: image
  741. };
  742. }
  743. return undefined;
  744. }
  745. function setPublisher(publisherName, publisherLogo) {
  746. if (!publisherName) {
  747. return undefined;
  748. }
  749. return {
  750. '@type': 'Organization',
  751. name: publisherName,
  752. logo: setImage(publisherLogo)
  753. };
  754. }
  755. function setReviewRating(rating) {
  756. if (rating) {
  757. return _extends({}, rating, {
  758. '@type': 'Rating'
  759. });
  760. }
  761. return undefined;
  762. }
  763. var _excluded$v = ["reviewRating", "author", "publisher"];
  764. function setReviews(reviews) {
  765. function mapReview(_ref) {
  766. var reviewRating = _ref.reviewRating,
  767. author = _ref.author,
  768. publisher = _ref.publisher,
  769. rest = _objectWithoutPropertiesLoose(_ref, _excluded$v);
  770. return _extends({}, rest, {
  771. '@type': 'Review'
  772. }, author && {
  773. author: setAuthor(author)
  774. }, reviewRating && {
  775. reviewRating: setReviewRating(reviewRating)
  776. }, publisher && {
  777. publisher: setPublisher(publisher.name)
  778. });
  779. }
  780. if (Array.isArray(reviews)) {
  781. return reviews.map(mapReview);
  782. } else if (reviews) {
  783. return mapReview(reviews);
  784. }
  785. return undefined;
  786. }
  787. function setNutrition(calories) {
  788. if (calories) {
  789. return {
  790. '@type': 'NutritionInformation',
  791. calories: calories + " calories"
  792. };
  793. }
  794. return undefined;
  795. }
  796. function setAggregateRating(aggregateRating) {
  797. if (aggregateRating) {
  798. return {
  799. '@type': 'AggregateRating',
  800. ratingCount: aggregateRating.ratingCount,
  801. reviewCount: aggregateRating.reviewCount,
  802. bestRating: aggregateRating.bestRating,
  803. ratingValue: aggregateRating.ratingValue
  804. };
  805. }
  806. return undefined;
  807. }
  808. function setClip(clips) {
  809. function mapClip(clip) {
  810. return _extends({}, clip, {
  811. '@type': 'Clip'
  812. });
  813. }
  814. if (Array.isArray(clips)) {
  815. return clips.map(mapClip);
  816. } else if (clips) {
  817. return mapClip(clips);
  818. }
  819. return undefined;
  820. }
  821. function setInteractionStatistic(watchCount) {
  822. if (watchCount) {
  823. return {
  824. '@type': 'InteractionCounter',
  825. interactionType: 'https://schema.org/WatchAction',
  826. userInteractionCount: watchCount
  827. };
  828. }
  829. return undefined;
  830. }
  831. function setBroadcastEvent(publication) {
  832. function mapBroadcastEvent(publication) {
  833. return _extends({}, publication, {
  834. '@type': 'BroadcastEvent'
  835. });
  836. }
  837. if (publication) {
  838. if (Array.isArray(publication)) {
  839. return publication.map(mapBroadcastEvent);
  840. }
  841. return mapBroadcastEvent(publication);
  842. }
  843. return undefined;
  844. }
  845. var _excluded$u = ["thumbnailUrls", "hasPart", "watchCount", "publication"];
  846. function setVideo(video, setContext) {
  847. if (setContext === void 0) {
  848. setContext = false;
  849. }
  850. function mapVideo(_ref, context) {
  851. var thumbnailUrls = _ref.thumbnailUrls,
  852. hasPart = _ref.hasPart,
  853. watchCount = _ref.watchCount,
  854. publication = _ref.publication,
  855. rest = _objectWithoutPropertiesLoose(_ref, _excluded$u);
  856. return _extends({}, rest, {
  857. '@type': 'VideoObject'
  858. }, context && {
  859. '@context': 'https://schema.org'
  860. }, {
  861. thumbnailUrl: thumbnailUrls,
  862. hasPart: setClip(hasPart),
  863. interactionStatistic: setInteractionStatistic(watchCount),
  864. publication: setBroadcastEvent(publication)
  865. });
  866. }
  867. if (video) {
  868. return mapVideo(video, setContext);
  869. }
  870. return undefined;
  871. }
  872. function setInstruction(instruction) {
  873. if (instruction) {
  874. return _extends({}, instruction, {
  875. '@type': 'HowToStep'
  876. });
  877. }
  878. return undefined;
  879. }
  880. var _excluded$t = ["type", "keyOverride", "ofType", "data"],
  881. _excluded2$1 = ["authorName", "images", "yields", "category", "calories", "aggregateRating", "video", "ingredients", "instructions", "cuisine"];
  882. function CarouselJsonLd(_ref) {
  883. var _ref$type = _ref.type,
  884. type = _ref$type === void 0 ? 'Carousel' : _ref$type,
  885. keyOverride = _ref.keyOverride,
  886. ofType = _ref.ofType,
  887. data = _ref.data,
  888. rest = _objectWithoutPropertiesLoose(_ref, _excluded$t);
  889. function generateList(data, ofType) {
  890. switch (ofType) {
  891. case 'default':
  892. return data.map(function (item, index) {
  893. return {
  894. '@type': 'ListItem',
  895. position: "" + (index + 1),
  896. url: item.url
  897. };
  898. });
  899. case 'course':
  900. return data.map(function (item, index) {
  901. return {
  902. '@type': 'ListItem',
  903. position: "" + (index + 1),
  904. item: {
  905. '@context': 'https://schema.org',
  906. '@type': 'Course',
  907. url: item.url,
  908. name: item.courseName,
  909. description: item.description,
  910. provider: {
  911. '@type': 'Organization',
  912. name: item.providerName,
  913. sameAs: item.providerUrl
  914. }
  915. }
  916. };
  917. });
  918. case 'movie':
  919. return data.map(function (item, index) {
  920. return {
  921. '@type': 'ListItem',
  922. position: "" + (index + 1),
  923. item: {
  924. '@context': 'https://schema.org',
  925. '@type': 'Movie',
  926. name: item.name,
  927. url: item.url,
  928. image: item.image,
  929. dateCreated: item.dateCreated,
  930. director: item.director ? Array.isArray(item.director) ? item.director.map(function (director) {
  931. return {
  932. '@type': 'Person',
  933. name: director.name
  934. };
  935. }) : {
  936. '@type': 'Person',
  937. name: item.director.name
  938. } : undefined,
  939. review: setReviews(item.review)
  940. }
  941. };
  942. });
  943. case 'recipe':
  944. return data.map(function (_ref2, index) {
  945. var authorName = _ref2.authorName,
  946. images = _ref2.images,
  947. yields = _ref2.yields,
  948. category = _ref2.category,
  949. calories = _ref2.calories,
  950. aggregateRating = _ref2.aggregateRating,
  951. video = _ref2.video,
  952. ingredients = _ref2.ingredients,
  953. instructions = _ref2.instructions,
  954. cuisine = _ref2.cuisine,
  955. rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
  956. return {
  957. '@type': 'ListItem',
  958. position: "" + (index + 1),
  959. item: _extends({
  960. '@context': 'https://schema.org',
  961. '@type': 'Recipe'
  962. }, rest, {
  963. author: setAuthor(authorName),
  964. image: images,
  965. recipeYield: yields,
  966. recipeCategory: category,
  967. recipeCuisine: cuisine,
  968. nutrition: setNutrition(calories),
  969. aggregateRating: setAggregateRating(aggregateRating),
  970. video: setVideo(video),
  971. recipeIngredient: ingredients,
  972. recipeInstructions: instructions.map(setInstruction)
  973. })
  974. };
  975. });
  976. }
  977. }
  978. var jsonLdData = _extends({
  979. '@type': 'ItemList',
  980. itemListElement: generateList(data, ofType)
  981. }, rest);
  982. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  983. type: type,
  984. keyOverride: keyOverride
  985. }, jsonLdData, {
  986. scriptKey: "Carousel"
  987. }));
  988. }
  989. var _excluded$s = ["type", "keyOverride", "url", "title", "images", "section", "dateCreated", "datePublished", "dateModified", "authorName", "authorType", "publisherName", "publisherLogo", "body", "isAccessibleForFree"];
  990. function NewsArticleJsonLd(_ref) {
  991. var _ref$type = _ref.type,
  992. type = _ref$type === void 0 ? 'NewsArticle' : _ref$type,
  993. keyOverride = _ref.keyOverride,
  994. url = _ref.url,
  995. title = _ref.title,
  996. images = _ref.images,
  997. section = _ref.section,
  998. dateCreated = _ref.dateCreated,
  999. datePublished = _ref.datePublished,
  1000. dateModified = _ref.dateModified,
  1001. authorName = _ref.authorName,
  1002. publisherName = _ref.publisherName,
  1003. publisherLogo = _ref.publisherLogo,
  1004. body = _ref.body,
  1005. isAccessibleForFree = _ref.isAccessibleForFree,
  1006. rest = _objectWithoutPropertiesLoose(_ref, _excluded$s);
  1007. var data = _extends({}, rest, {
  1008. mainEntityOfPage: {
  1009. '@type': 'WebPage',
  1010. '@id': url
  1011. },
  1012. headline: title,
  1013. image: images,
  1014. articleSection: section,
  1015. dateCreated: dateCreated || datePublished,
  1016. datePublished: datePublished,
  1017. dateModified: dateModified || datePublished,
  1018. author: setAuthor(authorName),
  1019. publisher: setPublisher(publisherName, publisherLogo),
  1020. articleBody: body,
  1021. isAccessibleForFree: isAccessibleForFree
  1022. });
  1023. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1024. type: type,
  1025. keyOverride: keyOverride
  1026. }, data, {
  1027. scriptKey: "NewsArticle"
  1028. }));
  1029. }
  1030. var _excluded$r = ["type", "keyOverride", "baseSalary", "hiringOrganization", "applicantLocationRequirements", "experienceRequirements", "jobLocation"];
  1031. function JobPostingJsonLd(_ref) {
  1032. var _ref$type = _ref.type,
  1033. type = _ref$type === void 0 ? 'JobPosting' : _ref$type,
  1034. keyOverride = _ref.keyOverride,
  1035. baseSalary = _ref.baseSalary,
  1036. hiringOrganization = _ref.hiringOrganization,
  1037. applicantLocationRequirements = _ref.applicantLocationRequirements,
  1038. experienceRequirements = _ref.experienceRequirements,
  1039. jobLocation = _ref.jobLocation,
  1040. rest = _objectWithoutPropertiesLoose(_ref, _excluded$r);
  1041. function setBaseSalary(baseSalary) {
  1042. if (baseSalary) {
  1043. return {
  1044. '@type': 'MonetaryAmount',
  1045. currency: baseSalary.currency,
  1046. value: _extends({
  1047. '@type': 'QuantitativeValue',
  1048. unitText: baseSalary.unitText
  1049. }, Array.isArray(baseSalary.value) ? {
  1050. minValue: baseSalary.value[0],
  1051. maxValue: baseSalary.value[1]
  1052. } : {
  1053. value: baseSalary.value
  1054. })
  1055. };
  1056. }
  1057. return undefined;
  1058. }
  1059. function setHiringOrganization(org) {
  1060. return {
  1061. '@type': 'Organization',
  1062. name: org.name,
  1063. sameAs: org.sameAs,
  1064. logo: org.logo
  1065. };
  1066. }
  1067. function setJobLocation(location) {
  1068. if (location) {
  1069. return {
  1070. '@type': 'Place',
  1071. address: {
  1072. '@type': 'PostalAddress',
  1073. addressCountry: location.addressCountry,
  1074. addressLocality: location.addressLocality,
  1075. addressRegion: location.addressRegion,
  1076. postalCode: location.postalCode,
  1077. streetAddress: location.streetAddress
  1078. }
  1079. };
  1080. }
  1081. return undefined;
  1082. }
  1083. function setApplicantLocationRequirements(requirements) {
  1084. if (requirements) {
  1085. return {
  1086. '@type': 'Country',
  1087. name: requirements
  1088. };
  1089. }
  1090. return undefined;
  1091. }
  1092. function setOccupationalExperienceRequirements(requirements) {
  1093. if (requirements) {
  1094. return {
  1095. '@type': requirements['@type'] ? requirements['@type'] : 'OccupationalExperienceRequirements',
  1096. monthsOfExperience: requirements.minimumMonthsOfExperience
  1097. };
  1098. }
  1099. return undefined;
  1100. }
  1101. function setEducationalOccupationalCredential(requirements) {
  1102. if (requirements) {
  1103. return {
  1104. '@type': requirements['@type'] ? requirements['@type'] : 'EducationalOccupationalCredential',
  1105. credentialCategory: requirements.credentialCategory
  1106. };
  1107. }
  1108. return undefined;
  1109. }
  1110. var data = _extends({}, rest, {
  1111. baseSalary: setBaseSalary(baseSalary),
  1112. hiringOrganization: setHiringOrganization(hiringOrganization),
  1113. jobLocation: setJobLocation(jobLocation),
  1114. applicantLocationRequirements: setApplicantLocationRequirements(applicantLocationRequirements),
  1115. experienceRequirements: setOccupationalExperienceRequirements(experienceRequirements == null ? void 0 : experienceRequirements.occupational),
  1116. educationRequirements: setEducationalOccupationalCredential(experienceRequirements == null ? void 0 : experienceRequirements.educational),
  1117. experienceInPlaceOfEducation: experienceRequirements == null ? void 0 : experienceRequirements.experienceInPlaceOfEducation
  1118. });
  1119. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1120. type: type,
  1121. keyOverride: keyOverride
  1122. }, data, {
  1123. scriptKey: "JobPosting"
  1124. }));
  1125. }
  1126. function setAddress(address) {
  1127. if (!address) return undefined;
  1128. if (!Array.isArray(address)) return toPostalAddress(address);
  1129. // If array of one address, replace with single address
  1130. if (address.length === 1) return toPostalAddress(address[0]);
  1131. // If array, return mapped array of PostalAddresses
  1132. return address.map(toPostalAddress);
  1133. }
  1134. function toPostalAddress(address) {
  1135. if (typeof address === 'string') return address;
  1136. return _extends({
  1137. '@type': 'PostalAddress'
  1138. }, address);
  1139. }
  1140. function setGeo(geo) {
  1141. if (geo) {
  1142. return _extends({}, geo, {
  1143. '@type': 'GeoCoordinates'
  1144. });
  1145. }
  1146. return undefined;
  1147. }
  1148. function setAction(action) {
  1149. if (action) {
  1150. return {
  1151. '@type': action.actionType,
  1152. name: action.actionName,
  1153. target: action.target
  1154. };
  1155. }
  1156. return undefined;
  1157. }
  1158. function setGeoCircle(geoCircle) {
  1159. if (geoCircle) {
  1160. return {
  1161. '@type': 'GeoCircle',
  1162. geoMidpoint: {
  1163. '@type': 'GeoCoordinates',
  1164. latitude: geoCircle.geoMidpoint.latitude,
  1165. longitude: geoCircle.geoMidpoint.longitude
  1166. },
  1167. geoRadius: geoCircle.geoRadius
  1168. };
  1169. }
  1170. return undefined;
  1171. }
  1172. function setOffer(offer) {
  1173. function setPriceSpecification(priceSpecification) {
  1174. if (priceSpecification) {
  1175. return {
  1176. '@type': priceSpecification.type,
  1177. priceCurrency: priceSpecification.priceCurrency,
  1178. price: priceSpecification.price
  1179. };
  1180. }
  1181. return undefined;
  1182. }
  1183. function setItemOffered(itemOffered) {
  1184. if (itemOffered) {
  1185. return _extends({}, itemOffered, {
  1186. '@type': 'Service'
  1187. });
  1188. }
  1189. return undefined;
  1190. }
  1191. if (offer) {
  1192. return _extends({}, offer, {
  1193. '@type': 'Offer',
  1194. priceSpecification: setPriceSpecification(offer.priceSpecification),
  1195. itemOffered: setItemOffered(offer.itemOffered)
  1196. });
  1197. }
  1198. return undefined;
  1199. }
  1200. function setOpeningHours(openingHours) {
  1201. if (openingHours) {
  1202. return _extends({}, openingHours, {
  1203. '@type': 'OpeningHoursSpecification'
  1204. });
  1205. }
  1206. return undefined;
  1207. }
  1208. var _excluded$q = ["type", "keyOverride", "address", "geo", "rating", "review", "action", "areaServed", "makesOffer", "openingHours", "images"];
  1209. function LocalBusinessJsonLd(_ref) {
  1210. var _ref$type = _ref.type,
  1211. type = _ref$type === void 0 ? 'LocalBusiness' : _ref$type,
  1212. keyOverride = _ref.keyOverride,
  1213. address = _ref.address,
  1214. geo = _ref.geo,
  1215. rating = _ref.rating,
  1216. review = _ref.review,
  1217. action = _ref.action,
  1218. areaServed = _ref.areaServed,
  1219. makesOffer = _ref.makesOffer,
  1220. openingHours = _ref.openingHours,
  1221. images = _ref.images,
  1222. rest = _objectWithoutPropertiesLoose(_ref, _excluded$q);
  1223. var data = _extends({}, rest, {
  1224. image: images,
  1225. address: setAddress(address),
  1226. geo: setGeo(geo),
  1227. aggregateRating: setAggregateRating(rating),
  1228. review: setReviews(review),
  1229. potentialAction: setAction(action),
  1230. areaServed: areaServed && areaServed.map(setGeoCircle),
  1231. makesOffer: makesOffer == null ? void 0 : makesOffer.map(setOffer),
  1232. openingHoursSpecification: Array.isArray(openingHours) ? openingHours.map(setOpeningHours) : setOpeningHours(openingHours)
  1233. });
  1234. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1235. type: type,
  1236. keyOverride: keyOverride
  1237. }, data, {
  1238. scriptKey: "LocalBusiness"
  1239. }));
  1240. }
  1241. var _excluded$p = ["type", "keyOverride", "mainEntity"],
  1242. _excluded2 = ["upvoteCount"];
  1243. function QAPageJsonLd(_ref) {
  1244. var _mainEntity$author, _mainEntity$acceptedA, _mainEntity$acceptedA2;
  1245. var _ref$type = _ref.type,
  1246. type = _ref$type === void 0 ? 'QAPage' : _ref$type,
  1247. keyOverride = _ref.keyOverride,
  1248. mainEntity = _ref.mainEntity,
  1249. rest = _objectWithoutPropertiesLoose(_ref, _excluded$p);
  1250. var data = _extends({}, rest, {
  1251. mainEntity: _extends({}, mainEntity, {
  1252. '@type': 'Question',
  1253. author: setAuthor((_mainEntity$author = mainEntity.author) == null ? void 0 : _mainEntity$author.name)
  1254. }, mainEntity.acceptedAnswer && {
  1255. acceptedAnswer: _extends({}, mainEntity.acceptedAnswer, {
  1256. '@type': 'Answer',
  1257. author: setAuthor((_mainEntity$acceptedA = mainEntity.acceptedAnswer) == null ? void 0 : (_mainEntity$acceptedA2 = _mainEntity$acceptedA.author) == null ? void 0 : _mainEntity$acceptedA2.name)
  1258. })
  1259. }, mainEntity.suggestedAnswer && {
  1260. suggestedAnswer: mainEntity.suggestedAnswer.map(function (_ref2) {
  1261. var _rest$author;
  1262. var upvoteCount = _ref2.upvoteCount,
  1263. rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
  1264. return _extends({}, rest, {
  1265. '@type': 'Answer',
  1266. upvoteCount: upvoteCount || 0,
  1267. author: setAuthor((_rest$author = rest.author) == null ? void 0 : _rest$author.name)
  1268. });
  1269. })
  1270. })
  1271. });
  1272. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1273. type: type,
  1274. keyOverride: keyOverride
  1275. }, data, {
  1276. scriptKey: "QAPage"
  1277. }));
  1278. }
  1279. function setItemListElements(items) {
  1280. if (items && items.length) {
  1281. return items.map(function (item) {
  1282. return {
  1283. '@type': 'ListItem',
  1284. position: item.position,
  1285. item: {
  1286. '@id': item.item,
  1287. name: item.name
  1288. }
  1289. };
  1290. });
  1291. }
  1292. return undefined;
  1293. }
  1294. var _excluded$o = ["type", "keyOverride", "breadcrumb"];
  1295. function ProfilePageJsonLd(_ref) {
  1296. var _ref$type = _ref.type,
  1297. type = _ref$type === void 0 ? 'ProfilePage' : _ref$type,
  1298. keyOverride = _ref.keyOverride,
  1299. breadcrumb = _ref.breadcrumb,
  1300. rest = _objectWithoutPropertiesLoose(_ref, _excluded$o);
  1301. var data = _extends({}, rest, {
  1302. breadcrumb: Array.isArray(breadcrumb) ? {
  1303. '@type': 'BreadcrumbList',
  1304. itemListElement: setItemListElements(breadcrumb)
  1305. } : breadcrumb
  1306. });
  1307. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1308. type: type,
  1309. keyOverride: keyOverride
  1310. }, data, {
  1311. scriptKey: "ProfilePage"
  1312. }));
  1313. }
  1314. var _excluded$n = ["type", "keyOverride", "potentialActions"];
  1315. function SiteLinksSearchBoxJsonLd(_ref) {
  1316. var _ref$type = _ref.type,
  1317. type = _ref$type === void 0 ? 'WebSite' : _ref$type,
  1318. keyOverride = _ref.keyOverride,
  1319. potentialActions = _ref.potentialActions,
  1320. rest = _objectWithoutPropertiesLoose(_ref, _excluded$n);
  1321. function setPotentialAction(action) {
  1322. if (action) {
  1323. var target = action.target,
  1324. queryInput = action.queryInput;
  1325. return {
  1326. '@type': 'SearchAction',
  1327. target: target + "={" + queryInput + "}",
  1328. 'query-input': "required name=" + queryInput
  1329. };
  1330. }
  1331. return undefined;
  1332. }
  1333. var data = _extends({}, rest, {
  1334. potentialAction: potentialActions.map(setPotentialAction)
  1335. });
  1336. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1337. type: type,
  1338. keyOverride: keyOverride
  1339. }, data, {
  1340. scriptKey: "jsonld-siteLinksSearchBox"
  1341. }));
  1342. }
  1343. var _excluded$m = ["type", "keyOverride", "authorName", "images", "yields", "category", "cuisine", "calories", "aggregateRating", "video", "ingredients", "instructions"];
  1344. function RecipeJsonLd(_ref) {
  1345. var _ref$type = _ref.type,
  1346. type = _ref$type === void 0 ? 'Recipe' : _ref$type,
  1347. keyOverride = _ref.keyOverride,
  1348. authorName = _ref.authorName,
  1349. images = _ref.images,
  1350. yields = _ref.yields,
  1351. category = _ref.category,
  1352. cuisine = _ref.cuisine,
  1353. calories = _ref.calories,
  1354. aggregateRating = _ref.aggregateRating,
  1355. video = _ref.video,
  1356. ingredients = _ref.ingredients,
  1357. instructions = _ref.instructions,
  1358. rest = _objectWithoutPropertiesLoose(_ref, _excluded$m);
  1359. var data = _extends({}, rest, {
  1360. author: setAuthor(authorName),
  1361. image: images,
  1362. recipeYield: yields,
  1363. recipeCategory: category,
  1364. recipeCuisine: cuisine,
  1365. nutrition: setNutrition(calories),
  1366. aggregateRating: setAggregateRating(aggregateRating),
  1367. video: setVideo(video),
  1368. recipeIngredient: ingredients,
  1369. recipeInstructions: instructions ? instructions.map(setInstruction) : undefined
  1370. });
  1371. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1372. type: type,
  1373. keyOverride: keyOverride
  1374. }, data, {
  1375. scriptKey: "recipe"
  1376. }));
  1377. }
  1378. function setLocation(location) {
  1379. if (!location) {
  1380. return undefined;
  1381. }
  1382. if (typeof location === 'string') {
  1383. return location;
  1384. }
  1385. if ('url' in location) {
  1386. return setVirtualLocation(location);
  1387. } else {
  1388. return setPlace(location);
  1389. }
  1390. }
  1391. function setVirtualLocation(location) {
  1392. return _extends({}, location, {
  1393. '@type': 'VirtualLocation'
  1394. });
  1395. }
  1396. function setPlace(location) {
  1397. return _extends({}, location, {
  1398. address: setAddress(location.address),
  1399. '@type': 'Place'
  1400. });
  1401. }
  1402. var _excluded$l = ["type"];
  1403. function setPerformer(performer) {
  1404. if (performer) {
  1405. var type = performer.type,
  1406. restPerformer = _objectWithoutPropertiesLoose(performer, _excluded$l);
  1407. return _extends({}, restPerformer, {
  1408. '@type': type || 'PerformingGroup'
  1409. });
  1410. }
  1411. return undefined;
  1412. }
  1413. var _excluded$k = ["seller"];
  1414. function setOffers(offers) {
  1415. function mapOffer(_ref) {
  1416. var seller = _ref.seller,
  1417. rest = _objectWithoutPropertiesLoose(_ref, _excluded$k);
  1418. return _extends({}, rest, {
  1419. '@type': 'Offer'
  1420. }, seller && {
  1421. seller: {
  1422. '@type': 'Organization',
  1423. name: seller.name
  1424. }
  1425. });
  1426. }
  1427. if (Array.isArray(offers)) {
  1428. return offers.map(mapOffer);
  1429. } else if (offers) {
  1430. return mapOffer(offers);
  1431. }
  1432. return undefined;
  1433. }
  1434. function setAggregateOffer(aggregateOffer) {
  1435. if (aggregateOffer) {
  1436. return {
  1437. '@type': 'AggregateOffer',
  1438. priceCurrency: aggregateOffer.priceCurrency,
  1439. highPrice: aggregateOffer.highPrice,
  1440. lowPrice: aggregateOffer.lowPrice,
  1441. offerCount: aggregateOffer.offerCount,
  1442. offers: setOffers(aggregateOffer.offers)
  1443. };
  1444. }
  1445. return undefined;
  1446. }
  1447. var _excluded$j = ["type"];
  1448. function setOrganizer(organizer) {
  1449. if (organizer) {
  1450. var type = organizer.type,
  1451. restOrganizer = _objectWithoutPropertiesLoose(organizer, _excluded$j);
  1452. return _extends({}, restOrganizer, {
  1453. '@type': type || 'Person'
  1454. });
  1455. }
  1456. return undefined;
  1457. }
  1458. var _excluded$i = ["type", "keyOverride", "location", "images", "offers", "aggregateOffer", "performers", "organizer", "eventStatus", "eventAttendanceMode"];
  1459. function EventJsonLd(_ref) {
  1460. var _ref$type = _ref.type,
  1461. type = _ref$type === void 0 ? 'Event' : _ref$type,
  1462. keyOverride = _ref.keyOverride,
  1463. location = _ref.location,
  1464. images = _ref.images,
  1465. offers = _ref.offers,
  1466. aggregateOffer = _ref.aggregateOffer,
  1467. performers = _ref.performers,
  1468. organizer = _ref.organizer,
  1469. eventStatus = _ref.eventStatus,
  1470. eventAttendanceMode = _ref.eventAttendanceMode,
  1471. rest = _objectWithoutPropertiesLoose(_ref, _excluded$i);
  1472. var data = _extends({}, rest, {
  1473. location: setLocation(location),
  1474. image: images,
  1475. offers: offers ? setOffers(offers) : setAggregateOffer(aggregateOffer),
  1476. performer: Array.isArray(performers) ? performers.map(setPerformer) : setPerformer(performers),
  1477. organizer: Array.isArray(organizer) ? organizer.map(setOrganizer) : setOrganizer(organizer),
  1478. eventStatus: eventStatus ? "https://schema.org/" + eventStatus : undefined,
  1479. eventAttendanceMode: eventAttendanceMode ? "https://schema.org/" + eventAttendanceMode : undefined
  1480. });
  1481. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1482. type: type,
  1483. keyOverride: keyOverride
  1484. }, data, {
  1485. scriptKey: "Event"
  1486. }));
  1487. }
  1488. function setContactPoint(contactPoint) {
  1489. if (contactPoint) {
  1490. return _extends({}, contactPoint, {
  1491. '@type': 'ContactPoint'
  1492. });
  1493. }
  1494. return undefined;
  1495. }
  1496. var _excluded$h = ["type", "keyOverride", "contactPoint"];
  1497. function CorporateContactJsonLd(_ref) {
  1498. var _ref$type = _ref.type,
  1499. type = _ref$type === void 0 ? 'Organization' : _ref$type,
  1500. keyOverride = _ref.keyOverride,
  1501. contactPoint = _ref.contactPoint,
  1502. rest = _objectWithoutPropertiesLoose(_ref, _excluded$h);
  1503. var data = _extends({}, rest, {
  1504. contactPoint: contactPoint.map(setContactPoint)
  1505. });
  1506. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1507. type: type,
  1508. keyOverride: keyOverride
  1509. }, data, {
  1510. scriptKey: "CorporateContact"
  1511. }));
  1512. }
  1513. function setCreativeWork(creativeWork) {
  1514. if (creativeWork) {
  1515. return _extends({}, creativeWork, {
  1516. '@type': 'CreativeWork'
  1517. });
  1518. }
  1519. return undefined;
  1520. }
  1521. var _excluded$g = ["type", "keyOverride", "hasPart"];
  1522. function CollectionPageJsonLd(_ref) {
  1523. var _ref$type = _ref.type,
  1524. type = _ref$type === void 0 ? 'CollectionPage' : _ref$type,
  1525. keyOverride = _ref.keyOverride,
  1526. hasPart = _ref.hasPart,
  1527. rest = _objectWithoutPropertiesLoose(_ref, _excluded$g);
  1528. var data = _extends({}, rest, {
  1529. hasPart: hasPart.map(setCreativeWork)
  1530. });
  1531. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1532. type: type,
  1533. keyOverride: keyOverride
  1534. }, data, {
  1535. scriptKey: "CollectionPage"
  1536. }));
  1537. }
  1538. function setManufacturer(manufacturer) {
  1539. if (manufacturer && (manufacturer.manufacturerName || manufacturer.manufacturerLogo)) {
  1540. return {
  1541. '@type': 'Organization',
  1542. name: manufacturer.manufacturerName,
  1543. logo: setImage(manufacturer.manufacturerLogo)
  1544. };
  1545. }
  1546. return undefined;
  1547. }
  1548. function setBrand(brand) {
  1549. if (brand) {
  1550. return {
  1551. '@type': 'Brand',
  1552. name: brand
  1553. };
  1554. }
  1555. return undefined;
  1556. }
  1557. var _excluded$f = ["type", "keyOverride", "images", "brand", "reviews", "aggregateRating", "manufacturerLogo", "manufacturerName", "offers", "aggregateOffer", "productName"];
  1558. function ProductJsonLd(_ref) {
  1559. var _ref$type = _ref.type,
  1560. type = _ref$type === void 0 ? 'Product' : _ref$type,
  1561. keyOverride = _ref.keyOverride,
  1562. images = _ref.images,
  1563. brand = _ref.brand,
  1564. reviews = _ref.reviews,
  1565. aggregateRating = _ref.aggregateRating,
  1566. manufacturerLogo = _ref.manufacturerLogo,
  1567. manufacturerName = _ref.manufacturerName,
  1568. offers = _ref.offers,
  1569. aggregateOffer = _ref.aggregateOffer,
  1570. productName = _ref.productName,
  1571. rest = _objectWithoutPropertiesLoose(_ref, _excluded$f);
  1572. var data = _extends({}, rest, {
  1573. image: images,
  1574. brand: setBrand(brand),
  1575. review: setReviews(reviews),
  1576. aggregateRating: setAggregateRating(aggregateRating),
  1577. manufacturer: setManufacturer({
  1578. manufacturerLogo: manufacturerLogo,
  1579. manufacturerName: manufacturerName
  1580. }),
  1581. offers: offers ? setOffers(offers) : setAggregateOffer(aggregateOffer),
  1582. name: productName
  1583. });
  1584. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1585. type: type,
  1586. keyOverride: keyOverride
  1587. }, data, {
  1588. scriptKey: "Product"
  1589. }));
  1590. }
  1591. var _excluded$e = ["type", "keyOverride", "priceCurrency", "price", "aggregateRating", "review"];
  1592. function SoftwareAppJsonLd(_ref) {
  1593. var _ref$type = _ref.type,
  1594. type = _ref$type === void 0 ? 'SoftwareApplication' : _ref$type,
  1595. keyOverride = _ref.keyOverride,
  1596. priceCurrency = _ref.priceCurrency,
  1597. price = _ref.price,
  1598. aggregateRating = _ref.aggregateRating,
  1599. review = _ref.review,
  1600. rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
  1601. var data = _extends({}, rest, {
  1602. offers: {
  1603. '@type': 'Offer',
  1604. price: price,
  1605. priceCurrency: priceCurrency
  1606. },
  1607. aggregateRating: setAggregateRating(aggregateRating),
  1608. review: setReviews(review)
  1609. });
  1610. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1611. type: type,
  1612. keyOverride: keyOverride
  1613. }, data, {
  1614. scriptKey: "SoftwareApp"
  1615. }));
  1616. }
  1617. var _excluded$d = ["type", "keyOverride"];
  1618. function VideoJsonLd(_ref) {
  1619. var _ref$type = _ref.type,
  1620. type = _ref$type === void 0 ? 'Video' : _ref$type,
  1621. keyOverride = _ref.keyOverride,
  1622. rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
  1623. var data = setVideo(rest, true);
  1624. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1625. type: type,
  1626. keyOverride: keyOverride
  1627. }, data, {
  1628. scriptKey: "Video"
  1629. }));
  1630. }
  1631. function setProducer(producer) {
  1632. if (producer) {
  1633. return {
  1634. '@type': 'Organization',
  1635. sameAs: producer.url,
  1636. name: producer.name
  1637. };
  1638. }
  1639. return undefined;
  1640. }
  1641. function setProvider(provider) {
  1642. if (provider) {
  1643. return {
  1644. '@type': provider.type || 'Organization',
  1645. name: provider.name,
  1646. sameAs: provider.url
  1647. };
  1648. }
  1649. return undefined;
  1650. }
  1651. var _excluded$c = ["type", "keyOverride", "aggregateRating", "trailer", "reviews", "image", "authorName", "provider", "producerName", "producerUrl", "offers", "operatingSystemName", "platformName", "translatorName", "languageName", "genreName", "publisherName"];
  1652. function VideoGameJsonLd(_ref) {
  1653. var _ref$type = _ref.type,
  1654. type = _ref$type === void 0 ? 'VideoGame' : _ref$type,
  1655. keyOverride = _ref.keyOverride,
  1656. aggregateRating = _ref.aggregateRating,
  1657. trailer = _ref.trailer,
  1658. reviews = _ref.reviews,
  1659. image = _ref.image,
  1660. authorName = _ref.authorName,
  1661. provider = _ref.provider,
  1662. producerName = _ref.producerName,
  1663. producerUrl = _ref.producerUrl,
  1664. offers = _ref.offers,
  1665. operatingSystemName = _ref.operatingSystemName,
  1666. platformName = _ref.platformName,
  1667. translatorName = _ref.translatorName,
  1668. languageName = _ref.languageName,
  1669. genreName = _ref.genreName,
  1670. publisherName = _ref.publisherName,
  1671. rest = _objectWithoutPropertiesLoose(_ref, _excluded$c);
  1672. var data = _extends({}, rest, {
  1673. aggregateRating: setAggregateRating(aggregateRating),
  1674. trailer: setVideo(trailer),
  1675. review: setReviews(reviews),
  1676. image: setImage(image),
  1677. author: setAuthor(authorName),
  1678. provider: setProvider(provider),
  1679. producer: setProducer({
  1680. name: producerName,
  1681. url: producerUrl
  1682. }),
  1683. offers: setOffers(offers),
  1684. operatingSystem: operatingSystemName,
  1685. gamePlatform: platformName,
  1686. translator: translatorName,
  1687. inLanguage: languageName,
  1688. genre: genreName,
  1689. publisher: publisherName
  1690. });
  1691. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1692. type: type,
  1693. keyOverride: keyOverride
  1694. }, data, {
  1695. scriptKey: "VideoGame"
  1696. }));
  1697. }
  1698. function setContactPoints(contactPoint) {
  1699. if (contactPoint && contactPoint.length) {
  1700. return contactPoint.map(function (contactPoint) {
  1701. return _extends({
  1702. '@type': 'ContactPoint'
  1703. }, contactPoint);
  1704. });
  1705. }
  1706. return undefined;
  1707. }
  1708. var _excluded$b = ["type", "keyOverride", "address", "contactPoints", "contactPoint"];
  1709. function OrganizationJsonLd(_ref) {
  1710. var _ref$type = _ref.type,
  1711. type = _ref$type === void 0 ? 'Organization' : _ref$type,
  1712. keyOverride = _ref.keyOverride,
  1713. address = _ref.address,
  1714. contactPoints = _ref.contactPoints,
  1715. contactPoint = _ref.contactPoint,
  1716. rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
  1717. var data = _extends({}, rest, {
  1718. address: setAddress(address),
  1719. contactPoint: setContactPoints(contactPoint || contactPoints)
  1720. });
  1721. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1722. type: type,
  1723. keyOverride: keyOverride
  1724. }, data, {
  1725. scriptKey: "organization"
  1726. }));
  1727. }
  1728. function setQuestions(questions) {
  1729. if (questions && questions.length) {
  1730. return questions.map(function (question) {
  1731. return {
  1732. '@type': 'Question',
  1733. name: question.questionName,
  1734. acceptedAnswer: {
  1735. '@type': 'Answer',
  1736. text: question.acceptedAnswerText
  1737. }
  1738. };
  1739. });
  1740. }
  1741. return undefined;
  1742. }
  1743. var _excluded$a = ["type", "keyOverride", "mainEntity"];
  1744. function FAQPageJsonLd(_ref) {
  1745. var _ref$type = _ref.type,
  1746. type = _ref$type === void 0 ? 'FAQPage' : _ref$type,
  1747. keyOverride = _ref.keyOverride,
  1748. mainEntity = _ref.mainEntity,
  1749. rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
  1750. var data = _extends({}, rest, {
  1751. mainEntity: setQuestions(mainEntity)
  1752. });
  1753. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1754. type: type,
  1755. keyOverride: keyOverride
  1756. }, data, {
  1757. scriptKey: "faq-page"
  1758. }));
  1759. }
  1760. var _excluded$9 = ["type", "keyOverride"];
  1761. function LogoJsonLd(_ref) {
  1762. var _ref$type = _ref.type,
  1763. type = _ref$type === void 0 ? 'Organization' : _ref$type,
  1764. keyOverride = _ref.keyOverride,
  1765. rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
  1766. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1767. type: type,
  1768. keyOverride: keyOverride
  1769. }, rest, {
  1770. scriptKey: "Logo"
  1771. }));
  1772. }
  1773. var _excluded$8 = ["type", "keyOverride"];
  1774. function DatasetJsonLd(_ref) {
  1775. var _ref$type = _ref.type,
  1776. type = _ref$type === void 0 ? 'Dataset' : _ref$type,
  1777. keyOverride = _ref.keyOverride,
  1778. rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
  1779. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1780. type: type,
  1781. keyOverride: keyOverride
  1782. }, rest, {
  1783. scriptKey: "dataset"
  1784. }));
  1785. }
  1786. var _excluded$7 = ["type", "keyOverride", "courseName", "provider"];
  1787. function CourseJsonLd(_ref) {
  1788. var _ref$type = _ref.type,
  1789. type = _ref$type === void 0 ? 'Course' : _ref$type,
  1790. keyOverride = _ref.keyOverride,
  1791. courseName = _ref.courseName,
  1792. provider = _ref.provider,
  1793. rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
  1794. var data = _extends({
  1795. name: courseName
  1796. }, rest, {
  1797. provider: setProvider(provider)
  1798. });
  1799. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1800. type: type,
  1801. keyOverride: keyOverride
  1802. }, data, {
  1803. scriptKey: "course"
  1804. }));
  1805. }
  1806. var _excluded$6 = ["type", "keyOverride", "itemListElements"];
  1807. function BreadCrumbJsonLd(_ref) {
  1808. var _ref$type = _ref.type,
  1809. type = _ref$type === void 0 ? 'BreadcrumbList' : _ref$type,
  1810. keyOverride = _ref.keyOverride,
  1811. itemListElements = _ref.itemListElements,
  1812. rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
  1813. var data = _extends({}, rest, {
  1814. itemListElement: setItemListElements(itemListElements)
  1815. });
  1816. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1817. type: type,
  1818. keyOverride: keyOverride
  1819. }, data, {
  1820. scriptKey: "breadcrumb"
  1821. }));
  1822. }
  1823. var _excluded$5 = ["type", "id", "keyOverride", "aggregateRating"];
  1824. function BrandJsonLd(_ref) {
  1825. var _ref$type = _ref.type,
  1826. type = _ref$type === void 0 ? 'Brand' : _ref$type,
  1827. id = _ref.id,
  1828. keyOverride = _ref.keyOverride,
  1829. aggregateRating = _ref.aggregateRating,
  1830. rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
  1831. var data = _extends({
  1832. aggregateRating: setAggregateRating(aggregateRating),
  1833. '@id': id
  1834. }, rest);
  1835. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1836. type: type,
  1837. keyOverride: keyOverride
  1838. }, data, {
  1839. scriptKey: "brand"
  1840. }));
  1841. }
  1842. var _excluded$4 = ["type", "keyOverride", "url", "title", "images", "datePublished", "dateModified", "authorName", "publisherName", "publisherLogo", "description", "isAccessibleForFree"];
  1843. function ArticleJsonLd(_ref) {
  1844. var _ref$type = _ref.type,
  1845. type = _ref$type === void 0 ? 'Article' : _ref$type,
  1846. keyOverride = _ref.keyOverride,
  1847. url = _ref.url,
  1848. title = _ref.title,
  1849. images = _ref.images,
  1850. datePublished = _ref.datePublished,
  1851. dateModified = _ref.dateModified,
  1852. authorName = _ref.authorName,
  1853. _ref$publisherName = _ref.publisherName,
  1854. publisherName = _ref$publisherName === void 0 ? undefined : _ref$publisherName,
  1855. _ref$publisherLogo = _ref.publisherLogo,
  1856. publisherLogo = _ref$publisherLogo === void 0 ? undefined : _ref$publisherLogo,
  1857. description = _ref.description,
  1858. isAccessibleForFree = _ref.isAccessibleForFree,
  1859. rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
  1860. var data = _extends({
  1861. datePublished: datePublished,
  1862. description: description,
  1863. mainEntityOfPage: {
  1864. '@type': 'WebPage',
  1865. '@id': url
  1866. },
  1867. headline: title,
  1868. image: images,
  1869. dateModified: dateModified || datePublished,
  1870. author: setAuthor(authorName),
  1871. publisher: setPublisher(publisherName, publisherLogo),
  1872. isAccessibleForFree: isAccessibleForFree
  1873. }, rest);
  1874. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1875. type: type,
  1876. keyOverride: keyOverride
  1877. }, data, {
  1878. scriptKey: "article"
  1879. }));
  1880. }
  1881. function setReviewedBy(reviewedBy) {
  1882. if (reviewedBy) {
  1883. return _extends({
  1884. '@type': (reviewedBy == null ? void 0 : reviewedBy.type) || 'Organization'
  1885. }, reviewedBy);
  1886. }
  1887. return undefined;
  1888. }
  1889. var _excluded$3 = ["keyOverride", "reviewedBy"];
  1890. function WebPageJsonLd(_ref) {
  1891. var keyOverride = _ref.keyOverride,
  1892. reviewedBy = _ref.reviewedBy,
  1893. rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
  1894. var data = _extends({}, rest, {
  1895. reviewedBy: setReviewedBy(reviewedBy)
  1896. });
  1897. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1898. keyOverride: keyOverride
  1899. }, data, {
  1900. type: "WebPage",
  1901. scriptKey: "WebPage"
  1902. }));
  1903. }
  1904. var _excluded$2 = ["type", "keyOverride"];
  1905. function SocialProfileJsonLd(_ref) {
  1906. var type = _ref.type,
  1907. keyOverride = _ref.keyOverride,
  1908. rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
  1909. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1910. type: type,
  1911. keyOverride: keyOverride
  1912. }, rest, {
  1913. scriptKey: "social"
  1914. }));
  1915. }
  1916. function setCost(cost) {
  1917. if (cost) {
  1918. return _extends({}, cost, {
  1919. '@type': 'MonetaryAmount'
  1920. });
  1921. }
  1922. return undefined;
  1923. }
  1924. function setSupply(supply) {
  1925. if (supply) {
  1926. return supply.map(function (supplyItem) {
  1927. return {
  1928. '@type': 'HowToSupply',
  1929. name: supplyItem
  1930. };
  1931. });
  1932. }
  1933. return undefined;
  1934. }
  1935. function setTool(tool) {
  1936. if (tool) {
  1937. return tool.map(function (toolItem) {
  1938. return {
  1939. '@type': 'HowToTool',
  1940. name: toolItem
  1941. };
  1942. });
  1943. }
  1944. return undefined;
  1945. }
  1946. function setStep(step) {
  1947. if (step) {
  1948. return step.map(function (stepElement) {
  1949. var itemListElement = stepElement.itemListElement,
  1950. image = stepElement.image;
  1951. var currentListElements = itemListElement == null ? void 0 : itemListElement.map(function (_ref) {
  1952. var type = _ref.type,
  1953. text = _ref.text;
  1954. return {
  1955. '@type': type,
  1956. text: text
  1957. };
  1958. });
  1959. return _extends({}, stepElement, {
  1960. '@type': 'HowToStep',
  1961. itemListElement: currentListElements,
  1962. image: setImage(image)
  1963. });
  1964. });
  1965. }
  1966. return undefined;
  1967. }
  1968. var _excluded$1 = ["type", "keyOverride", "image", "estimatedCost", "supply", "tool", "step"];
  1969. function howToJsonLd(_ref) {
  1970. var _ref$type = _ref.type,
  1971. type = _ref$type === void 0 ? 'HowTo' : _ref$type,
  1972. keyOverride = _ref.keyOverride,
  1973. image = _ref.image,
  1974. estimatedCost = _ref.estimatedCost,
  1975. supply = _ref.supply,
  1976. tool = _ref.tool,
  1977. step = _ref.step,
  1978. rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
  1979. var data = _extends({}, rest, {
  1980. image: setImage(image),
  1981. estimatedCost: setCost(estimatedCost),
  1982. supply: setSupply(supply),
  1983. tool: setTool(tool),
  1984. step: setStep(step)
  1985. });
  1986. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({
  1987. type: type,
  1988. keyOverride: keyOverride
  1989. }, data, {
  1990. scriptKey: "howTo"
  1991. }));
  1992. }
  1993. var _excluded = ["keyOverride", "images"];
  1994. function ImageJsonLd(_ref) {
  1995. var keyOverride = _ref.keyOverride,
  1996. images = _ref.images,
  1997. rest = _objectWithoutPropertiesLoose(_ref, _excluded);
  1998. return /*#__PURE__*/React__default["default"].createElement(JsonLd, _extends({}, rest, {
  1999. type: "ImageObject",
  2000. keyOverride: keyOverride,
  2001. dataArray: images,
  2002. scriptKey: "image"
  2003. }));
  2004. }
  2005. exports.ArticleJsonLd = ArticleJsonLd;
  2006. exports.BrandJsonLd = BrandJsonLd;
  2007. exports.BreadcrumbJsonLd = BreadCrumbJsonLd;
  2008. exports.CarouselJsonLd = CarouselJsonLd;
  2009. exports.CollectionPageJsonLd = CollectionPageJsonLd;
  2010. exports.CorporateContactJsonLd = CorporateContactJsonLd;
  2011. exports.CourseJsonLd = CourseJsonLd;
  2012. exports.DatasetJsonLd = DatasetJsonLd;
  2013. exports.DefaultSeo = DefaultSeo;
  2014. exports.EventJsonLd = EventJsonLd;
  2015. exports.FAQPageJsonLd = FAQPageJsonLd;
  2016. exports.HowToJsonLd = howToJsonLd;
  2017. exports.ImageJsonLd = ImageJsonLd;
  2018. exports.JobPostingJsonLd = JobPostingJsonLd;
  2019. exports.LocalBusinessJsonLd = LocalBusinessJsonLd;
  2020. exports.LogoJsonLd = LogoJsonLd;
  2021. exports.NewsArticleJsonLd = NewsArticleJsonLd;
  2022. exports.NextSeo = NextSeo;
  2023. exports.OrganizationJsonLd = OrganizationJsonLd;
  2024. exports.ProductJsonLd = ProductJsonLd;
  2025. exports.ProfilePageJsonLd = ProfilePageJsonLd;
  2026. exports.QAPageJsonLd = QAPageJsonLd;
  2027. exports.RecipeJsonLd = RecipeJsonLd;
  2028. exports.SiteLinksSearchBoxJsonLd = SiteLinksSearchBoxJsonLd;
  2029. exports.SocialProfileJsonLd = SocialProfileJsonLd;
  2030. exports.SoftwareAppJsonLd = SoftwareAppJsonLd;
  2031. exports.VideoGameJsonLd = VideoGameJsonLd;
  2032. exports.VideoJsonLd = VideoJsonLd;
  2033. exports.WebPageJsonLd = WebPageJsonLd;