next-seo.module.js 66 KB

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