@anywayseo/tools 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/components/index.cjs +3 -3
  2. package/dist/components/index.mjs +3 -3
  3. package/dist/components/seo/href-langs/index.d.ts +2 -2
  4. package/dist/components/seo/index.d.ts +2 -8
  5. package/dist/components/seo/open-graph/index.d.ts +8 -0
  6. package/dist/components/seo/utils.d.ts +2 -2
  7. package/dist/hooks/index.cjs +1 -1
  8. package/dist/hooks/index.mjs +1 -1
  9. package/dist/i18n/index.cjs +24 -12
  10. package/dist/i18n/index.mjs +24 -12
  11. package/dist/i18n/resources/bn/index.d.ts +331 -0
  12. package/dist/i18n/resources/cs/index.d.ts +331 -0
  13. package/dist/i18n/resources/el/index.d.ts +331 -0
  14. package/dist/i18n/resources/hu/index.d.ts +331 -0
  15. package/dist/i18n/resources/nb/index.d.ts +331 -0
  16. package/dist/i18n/resources/nl/index.d.ts +331 -0
  17. package/dist/i18n/resources/pl/index.d.ts +331 -0
  18. package/dist/i18n/resources/ro/index.d.ts +331 -0
  19. package/dist/i18n/resources/sr/index.d.ts +331 -0
  20. package/dist/i18n/resources/sv/index.d.ts +331 -0
  21. package/dist/i18n/resources/tr/index.d.ts +331 -0
  22. package/dist/i18n/resources/uz/index.d.ts +331 -0
  23. package/dist/{index-C7buhUOk.mjs → index-2sU4ya6z.mjs} +3 -3
  24. package/dist/{index-CUDzMwnz.mjs → index-B--qmL1V.mjs} +29 -20
  25. package/dist/{index-U-DmPFa7.mjs → index-B5WurBlm.mjs} +1 -1
  26. package/dist/{index-DJSBjQzq.js → index-BAxlqkw0.js} +2 -2
  27. package/dist/{index-BJsA8Upb.js → index-BKWX6mIo.js} +29 -20
  28. package/dist/{index-C1kr7Vd-.mjs → index-BS5T9Il4.mjs} +1 -1
  29. package/dist/{index-0AAkKSsc.mjs → index-BTfTkIed.mjs} +63 -9
  30. package/dist/{index-BhzKUTPZ.mjs → index-BtS01kyg.mjs} +45 -33
  31. package/dist/{index-RzByAgHO.mjs → index-C6A-3gBz.mjs} +4577 -432
  32. package/dist/{index-CBRFCYhV.js → index-CMLDQbgR.js} +4577 -432
  33. package/dist/{index-CVv755RW.js → index-CuIVcnIS.js} +1 -1
  34. package/dist/{index-BSAasfl2.js → index-CxuOu0E2.js} +3 -3
  35. package/dist/{index-DZc8PJET.js → index-DAPaiozu.js} +1 -1
  36. package/dist/{index-BU1gLt1p.js → index-DHKoOk4o.js} +54 -0
  37. package/dist/{index-B5SWTYZm.js → index-ISfgFSXE.js} +45 -33
  38. package/dist/{index-B5C9u9UE.mjs → index-TcBorTSf.mjs} +2 -2
  39. package/dist/index.cjs +11 -9
  40. package/dist/index.mjs +20 -18
  41. package/dist/layout/header/locale-switcher/icons/bangladesh/index.d.ts +2 -0
  42. package/dist/layout/header/locale-switcher/icons/belgium/index.d.ts +2 -0
  43. package/dist/layout/header/locale-switcher/icons/canada/index.d.ts +2 -0
  44. package/dist/layout/header/locale-switcher/icons/czechia/index.d.ts +2 -0
  45. package/dist/layout/header/locale-switcher/icons/greece/index.d.ts +2 -0
  46. package/dist/layout/header/locale-switcher/icons/hungary/index.d.ts +2 -0
  47. package/dist/layout/header/locale-switcher/icons/index.d.ts +20 -1
  48. package/dist/layout/header/locale-switcher/icons/india/index.d.ts +2 -0
  49. package/dist/layout/header/locale-switcher/icons/morocco/index.d.ts +2 -0
  50. package/dist/layout/header/locale-switcher/icons/netherlands/index.d.ts +2 -0
  51. package/dist/layout/header/locale-switcher/icons/nigeria/index.d.ts +2 -0
  52. package/dist/layout/header/locale-switcher/icons/norway/index.d.ts +2 -0
  53. package/dist/layout/header/locale-switcher/icons/poland/index.d.ts +2 -0
  54. package/dist/layout/header/locale-switcher/icons/romania/index.d.ts +2 -0
  55. package/dist/layout/header/locale-switcher/icons/serbia/index.d.ts +2 -0
  56. package/dist/layout/header/locale-switcher/icons/south-africa/index.d.ts +2 -0
  57. package/dist/layout/header/locale-switcher/icons/sweden/index.d.ts +2 -0
  58. package/dist/layout/header/locale-switcher/icons/switzerland/index.d.ts +2 -0
  59. package/dist/layout/header/locale-switcher/icons/turkey/index.d.ts +2 -0
  60. package/dist/layout/header/locale-switcher/icons/uzbekistan/index.d.ts +2 -0
  61. package/dist/layout/index.cjs +392 -48
  62. package/dist/layout/index.mjs +392 -48
  63. package/dist/providers/index.cjs +2 -2
  64. package/dist/providers/index.mjs +2 -2
  65. package/dist/types/api/strapi-page.d.ts +13 -12
  66. package/dist/types/content/seo/index.d.ts +56 -3
  67. package/dist/types/i18n/index.d.ts +1 -1
  68. package/dist/types/index.d.ts +1 -1
  69. package/dist/types/seo/index.d.ts +2 -0
  70. package/dist/types/seo/open-graph/index.d.ts +11 -0
  71. package/dist/utils/api/strapi-guards.d.ts +2 -1
  72. package/dist/utils/api/strapi-seo.d.ts +2 -13
  73. package/dist/utils/index.cjs +5 -3
  74. package/dist/utils/index.d.ts +1 -1
  75. package/dist/utils/index.mjs +14 -12
  76. package/dist/utils/seo/index.d.ts +2 -0
  77. package/dist/utils/{json-ld → seo/json-ld}/index.d.ts +1 -1
  78. package/dist/utils/seo/open-graph/index.d.ts +15 -0
  79. package/package.json +1 -1
  80. package/dist/components/seo/types.d.ts +0 -14
  81. /package/dist/types/{json-ld → seo/json-ld}/index.d.ts +0 -0
@@ -2,18 +2,18 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useColorModeValue, Flex, Text, Box, Collapse, Button, Stack, Center as Center$1, SimpleGrid, Card, CardBody, CardFooter, CardHeader, Heading, Popover, PopoverTrigger, Portal, PopoverContent, PopoverBody, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, LinkBox, LinkOverlay, IconButton, AbsoluteCenter, Spinner, Alert, AlertIcon, AlertTitle, AlertDescription, useDisclosure, Divider, Circle, List as List$1, ListItem, useToast, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, ListIcon, TableContainer, Table as Table$1, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, TabPanels, TabPanel } from "@chakra-ui/react";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import { useMDXComponents } from "@mdx-js/react";
5
- import { u as usePageContext, I as Image, L as Link, a as useSiteContext } from "./index-U-DmPFa7.mjs";
5
+ import { u as usePageContext, I as Image, L as Link, a as useSiteContext } from "./index-B5WurBlm.mjs";
6
6
  import "./index-BJRvnR8Q.mjs";
7
- import { b as GameCharacteristic, G as GameVolatility } from "./index-RzByAgHO.mjs";
7
+ import { b as GameCharacteristic, G as GameVolatility } from "./index-C6A-3gBz.mjs";
8
8
  import { AtSignIcon, TimeIcon, CalendarIcon, StarIcon, CloseIcon, ViewOffIcon, ViewIcon, EmailIcon, WarningIcon, CheckCircleIcon } from "@chakra-ui/icons";
9
9
  import "react-medium-image-zoom";
10
10
  import { useRef, useState, useLayoutEffect, Fragment as Fragment$1, useMemo } from "react";
11
- import { d as SocialNetworks, L as LinkButton, R as Rating } from "./index-C7buhUOk.mjs";
11
+ import { d as SocialNetworks, L as LinkButton, R as Rating } from "./index-2sU4ya6z.mjs";
12
12
  import { a as Heading2, H as Heading1, P as Paragraph, U as Unordered, O as Ordered } from "./index-BEjKnOZA.mjs";
13
13
  import { a as buildCanonicalUrl } from "./index-CQC6DRGf.mjs";
14
- import { k as getSeededRandomComparator, r as randomComparator, g as getCurrencySymbol, c as buildGraph, d as buildOrganizationSchema, e as buildWebsiteSchema, f as getEntitySchema, h as buildWebpageSchema, i as isStrapiContent } from "./index-0AAkKSsc.mjs";
14
+ import { m as getSeededRandomComparator, r as randomComparator, g as getCurrencySymbol, d as buildGraph, e as buildOrganizationSchema, f as buildWebsiteSchema, h as getEntitySchema, j as buildWebpageSchema, l as buildOpenGraphMeta, i as isStrapiContent } from "./index-BTfTkIed.mjs";
15
15
  import { f as formatDate, b as formatNumber, a as getCurrentMonth, g as getCurrentYear } from "./index-BPthShL-.mjs";
16
- import { u as usePrimaryColors } from "./index-C1kr7Vd-.mjs";
16
+ import { u as usePrimaryColors } from "./index-BS5T9Il4.mjs";
17
17
  import { t } from "i18next";
18
18
  import Markdown from "react-markdown";
19
19
  const ArticleMetaIconMap = {
@@ -950,26 +950,12 @@ const ProsCons = ({ items, ...boxProps }) => {
950
950
  /* @__PURE__ */ jsx(ProsConsCard, { itemType: "cons", items: cons })
951
951
  ] });
952
952
  };
953
- function buildPlaceholders(siteName, lang) {
954
- return {
955
- siteName,
956
- currentYear: getCurrentYear(lang),
957
- currentMonth: getCurrentMonth(lang)
958
- };
959
- }
960
- function replacePlaceholders(text, placeholders) {
961
- Object.entries(placeholders).forEach(([placeholder, replacement]) => {
962
- const regex = new RegExp(`{{${placeholder}}}`, "g");
963
- text = text.replace(regex, replacement);
964
- });
965
- return text;
966
- }
967
- function getSeoMetaItem(item, placeholders) {
968
- if (typeof item === "string") {
969
- return replacePlaceholders(item, placeholders);
953
+ const HrefLangs = ({ siteName, hrefLangs }) => {
954
+ if (!(hrefLangs == null ? void 0 : hrefLangs.length)) {
955
+ return null;
970
956
  }
971
- return item(placeholders);
972
- }
957
+ return hrefLangs.map(({ href, hrefLang }, index) => /* @__PURE__ */ jsx("link", { rel: "alternate", hrefLang, href: buildCanonicalUrl(siteName, href) }, index));
958
+ };
973
959
  const JsonLd = ({ schemas }) => {
974
960
  const graph = buildGraph(schemas);
975
961
  if (!graph.length) {
@@ -989,18 +975,42 @@ const JsonLd = ({ schemas }) => {
989
975
  }
990
976
  );
991
977
  };
992
- const HrefLangs = ({ siteName, hrefLangs }) => {
993
- return hrefLangs.map(({ href, hrefLang }, index) => /* @__PURE__ */ jsx("link", { rel: "alternate", hrefLang, href: buildCanonicalUrl(siteName, href) }, index));
978
+ const OpenGraph = ({ meta, options }) => {
979
+ const { withTwitterCard = true } = options ?? {};
980
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
981
+ meta.map(({ property, content }, index) => /* @__PURE__ */ jsx("meta", { property, content }, index)),
982
+ withTwitterCard && /* @__PURE__ */ jsx("meta", { name: "twitter:card", content: "summary_large_image" })
983
+ ] });
994
984
  };
985
+ function buildPlaceholders(siteName, lang) {
986
+ return {
987
+ siteName,
988
+ currentYear: getCurrentYear(lang),
989
+ currentMonth: getCurrentMonth(lang)
990
+ };
991
+ }
992
+ function replacePlaceholders(text, placeholders) {
993
+ Object.entries(placeholders).forEach(([placeholder, replacement]) => {
994
+ const regex = new RegExp(`{{${placeholder}}}`, "g");
995
+ text = text.replace(regex, replacement);
996
+ });
997
+ return text.trim();
998
+ }
999
+ function getSeoMetaItem(item, placeholders) {
1000
+ if (typeof item === "string") {
1001
+ return replacePlaceholders(item, placeholders);
1002
+ }
1003
+ return item(placeholders);
1004
+ }
995
1005
  const Seo = ({
996
1006
  children,
997
1007
  pathname,
998
- locale,
999
- title,
1000
- description,
1008
+ lang: locale,
1009
+ meta,
1001
1010
  canonicalUrl,
1002
- hrefLangs = [],
1003
- structuredData
1011
+ hrefLangs,
1012
+ structuredData,
1013
+ openGraph
1004
1014
  }) => {
1005
1015
  const { metadata: siteMetadata, logo: siteLogo, localization } = useSiteContext();
1006
1016
  const { name: siteName, seo: siteSeo } = siteMetadata;
@@ -1010,14 +1020,15 @@ const Seo = ({
1010
1020
  const placeholders = buildPlaceholders(siteName, lang);
1011
1021
  const siteUrl = buildCanonicalUrl(siteName);
1012
1022
  const pageUrl = buildCanonicalUrl(siteName, pathname);
1013
- const pageTitle = getSeoMetaItem(title ?? defaultTitle, placeholders);
1014
- const pageDescription = getSeoMetaItem(description ?? defaultDescription, placeholders);
1023
+ const pageTitle = getSeoMetaItem((meta == null ? void 0 : meta.title) ?? defaultTitle, placeholders);
1024
+ const pageDescription = getSeoMetaItem((meta == null ? void 0 : meta.description) ?? defaultDescription, placeholders);
1015
1025
  const siteData = { url: siteUrl, name: siteName, logo: siteLogo };
1016
1026
  const pageData = { url: pageUrl, title: pageTitle, description: pageDescription };
1017
1027
  const organizationSchema = buildOrganizationSchema({ site: siteData, lang });
1018
1028
  const websiteSchema = buildWebsiteSchema({ site: siteData, lang });
1019
1029
  const entitySchema = getEntitySchema({ site: siteData, page: pageData, structuredData });
1020
1030
  const webpageSchema = buildWebpageSchema({ site: siteData, page: pageData, lang }, entitySchema);
1031
+ const openGraphMeta = buildOpenGraphMeta({ site: siteData, page: pageData, content: openGraph == null ? void 0 : openGraph.content, lang });
1021
1032
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1022
1033
  /* @__PURE__ */ jsx("html", { lang }),
1023
1034
  /* @__PURE__ */ jsx("title", { children: pageTitle }),
@@ -1025,6 +1036,7 @@ const Seo = ({
1025
1036
  /* @__PURE__ */ jsx("link", { rel: "canonical", href: canonicalUrl ?? pageUrl }),
1026
1037
  /* @__PURE__ */ jsx(HrefLangs, { siteName, hrefLangs }),
1027
1038
  /* @__PURE__ */ jsx(JsonLd, { schemas: { organization: organizationSchema, website: websiteSchema, webpage: webpageSchema } }),
1039
+ /* @__PURE__ */ jsx(OpenGraph, { meta: openGraphMeta, options: openGraph == null ? void 0 : openGraph.options }),
1028
1040
  children
1029
1041
  ] });
1030
1042
  };