@anywayseo/tools 4.2.2 → 5.1.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 (76) hide show
  1. package/dist/components/base/index.d.ts +1 -0
  2. package/dist/components/base/link/index.d.ts +2 -0
  3. package/dist/components/base/link/utils.d.ts +1 -0
  4. package/dist/components/game-info/utils.d.ts +2 -2
  5. package/dist/components/index.cjs +3 -1
  6. package/dist/components/index.mjs +3 -1
  7. package/dist/components/layout/header/locale-switcher/icons/earth/index.d.ts +2 -0
  8. package/dist/components/layout/header/locale-switcher/icons/france/index.d.ts +2 -0
  9. package/dist/components/layout/header/locale-switcher/icons/germany/index.d.ts +2 -0
  10. package/dist/components/layout/header/locale-switcher/icons/globe/index.d.ts +2 -0
  11. package/dist/components/layout/header/locale-switcher/icons/index.d.ts +6 -0
  12. package/dist/components/layout/header/locale-switcher/icons/italy/index.d.ts +2 -0
  13. package/dist/components/layout/header/locale-switcher/icons/russia/index.d.ts +2 -0
  14. package/dist/components/layout/header/locale-switcher/index.d.ts +8 -0
  15. package/dist/components/layout/header/locale-switcher/utils.d.ts +2 -0
  16. package/dist/components/layout/header/navigation/desktop/index.d.ts +1 -1
  17. package/dist/components/layout/header/navigation/index.d.ts +1 -1
  18. package/dist/components/layout/header/navigation/mobile/index.d.ts +1 -1
  19. package/dist/components/seo/index.d.ts +2 -3
  20. package/dist/hooks/index.cjs +4 -2
  21. package/dist/hooks/index.d.ts +1 -0
  22. package/dist/hooks/index.mjs +4 -2
  23. package/dist/hooks/use-localization/index.d.ts +9 -0
  24. package/dist/i18n/index.cjs +11 -5
  25. package/dist/i18n/index.d.ts +3 -2
  26. package/dist/i18n/index.mjs +11 -5
  27. package/dist/i18n/resources/fr/index.d.ts +112 -0
  28. package/dist/index-At00w6EN.js +9 -0
  29. package/dist/index-B9GEoC68.js +63 -0
  30. package/dist/{index-DAbZBo7_.mjs → index-BCuXOiT9.mjs} +201 -67
  31. package/dist/{index-BPLxhZG_.js → index-BHfpWNqh.js} +183 -73
  32. package/dist/{index-DF_u_tzx.js → index-BIdYBT1G.js} +7 -3
  33. package/dist/{index-MpNfBHkQ.mjs → index-BJRvnR8Q.mjs} +1 -5
  34. package/dist/index-BRVKhbs6.mjs +6 -0
  35. package/dist/index-BmaWfWLV.mjs +10 -0
  36. package/dist/{index-BV0hDmYP.js → index-BnmGE5_x.js} +3 -2
  37. package/dist/{index-DPO0aIC3.mjs → index-Bu4S7kG8.mjs} +7 -10
  38. package/dist/index-BzbpMLDD.mjs +23 -0
  39. package/dist/{index-DVcQxWMZ.js → index-C6MG_f24.js} +0 -4
  40. package/dist/{index-BE9gNdXx.mjs → index-CACDltm3.mjs} +183 -73
  41. package/dist/index-CYr1ct1t.js +93 -0
  42. package/dist/index-CbuiYkSg.js +5 -0
  43. package/dist/{index-CcsbqDXL.mjs → index-CrmmG8yy.mjs} +7 -3
  44. package/dist/{index-N8nXj4-i.js → index-D0yXUsJz.js} +220 -86
  45. package/dist/{index-DuQjQMNN.js → index-D34TfBTR.js} +7 -10
  46. package/dist/{index-CkTgVjZS.mjs → index-QazOxABc.mjs} +3 -2
  47. package/dist/index-WFgDSB1A.js +22 -0
  48. package/dist/index-cQqALZIW.mjs +94 -0
  49. package/dist/index-tJcccH0B.mjs +64 -0
  50. package/dist/index.cjs +43 -31
  51. package/dist/index.mjs +33 -21
  52. package/dist/providers/index.cjs +4 -2
  53. package/dist/providers/index.d.ts +1 -0
  54. package/dist/providers/index.mjs +5 -3
  55. package/dist/providers/page-provider/index.d.ts +11 -0
  56. package/dist/providers/site-provider/index.d.ts +5 -4
  57. package/dist/types/api/index.d.ts +2 -2
  58. package/dist/types/components/icon/index.d.ts +2 -0
  59. package/dist/types/components/index.d.ts +2 -0
  60. package/dist/types/components/locale-switcher/index.d.ts +5 -0
  61. package/dist/types/components/navigation/index.d.ts +9 -10
  62. package/dist/types/i18n/index.d.ts +7 -1
  63. package/dist/types/site/index.d.ts +15 -13
  64. package/dist/utils/api/index.d.ts +5 -0
  65. package/dist/utils/date/index.d.ts +4 -3
  66. package/dist/utils/index.cjs +23 -16
  67. package/dist/utils/index.d.ts +1 -0
  68. package/dist/utils/index.mjs +16 -9
  69. package/dist/utils/navigation/index.d.ts +2 -2
  70. package/dist/utils/numbers/index.d.ts +3 -3
  71. package/package.json +1 -1
  72. package/dist/components/layout/header/navigation/types.d.ts +0 -4
  73. package/dist/index-BClxYYix.js +0 -40
  74. package/dist/index-BNb-P8a6.mjs +0 -17
  75. package/dist/index-BhsXlbd8.js +0 -16
  76. package/dist/index-Ca_M-II5.mjs +0 -41
@@ -1,9 +1,9 @@
1
- import { Currency, LanguageCode } from '../../types';
1
+ import { Currency, ILocale } from '../../types';
2
2
  import { PercentFormatType } from './types';
3
3
  export declare function round(number: number, precision: number): number;
4
4
  export declare function toFixedTwo(number: number): number;
5
5
  type FormatNumberOptions = {
6
- locale?: LanguageCode;
6
+ locale?: ILocale['code'];
7
7
  precision?: number;
8
8
  hasTrailingZeros?: boolean;
9
9
  hasSign?: boolean;
@@ -16,5 +16,5 @@ type FormatNumberOptions = {
16
16
  });
17
17
  export declare function formatNumber(number: number, options?: FormatNumberOptions): string;
18
18
  export declare function parseNumber(value: string): number | null;
19
- export declare function getCurrencySymbol(currencyCode: Currency): string;
19
+ export declare function getCurrencySymbol(currencyCode: Currency, locale?: ILocale['code']): string;
20
20
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@anywayseo/tools",
3
3
  "description": "Shared UI Components and Modules",
4
- "version": "4.2.2",
4
+ "version": "5.1.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -1,4 +0,0 @@
1
- import { INavItem } from '../../../../types';
2
- export type NavigationProps = {
3
- menu: INavItem[];
4
- };
@@ -1,40 +0,0 @@
1
- "use strict";
2
- const DUMMY_PAGE_TYPE = "DUMMY";
3
- function isValidPath(value) {
4
- return typeof value === "string" && (value === "" || value.startsWith("/"));
5
- }
6
- function isValidType(value) {
7
- return typeof value === "string" && value !== DUMMY_PAGE_TYPE;
8
- }
9
- function transformNavItems(items, parentPath = "") {
10
- if (!items || !items.length) {
11
- return [];
12
- }
13
- const transformed = [];
14
- items.forEach((item) => {
15
- var _a;
16
- if (item && item.title && isValidType(item.type) && isValidPath(item.path)) {
17
- let path = `${parentPath}${item.path}`;
18
- let children = [];
19
- if ((_a = item.items) == null ? void 0 : _a.length) {
20
- path = "";
21
- children = transformNavItems(item.items, path);
22
- }
23
- transformed.push({ label: item.title, path, children });
24
- }
25
- });
26
- return transformed;
27
- }
28
- function transformSiteNavigation(strapiNavigation) {
29
- if (!strapiNavigation) {
30
- return null;
31
- }
32
- const navGroups = strapiNavigation.items;
33
- const headerNav = navGroups == null ? void 0 : navGroups.find((item) => (item == null ? void 0 : item.slug) === "header-navigation");
34
- const footerNav = navGroups == null ? void 0 : navGroups.find((item) => (item == null ? void 0 : item.slug) === "footer-navigation");
35
- return {
36
- header: transformNavItems(headerNav == null ? void 0 : headerNav.items),
37
- footer: transformNavItems(footerNav == null ? void 0 : footerNav.items)
38
- };
39
- }
40
- exports.transformSiteNavigation = transformSiteNavigation;
@@ -1,17 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { createContext, useContext } from "react";
3
- const SiteContext = createContext(null);
4
- const SiteProvider = ({ children, ...value }) => {
5
- return /* @__PURE__ */ jsx(SiteContext.Provider, { value, children });
6
- };
7
- function useSiteContext() {
8
- const context = useContext(SiteContext);
9
- if (!context) {
10
- throw new Error("useSiteContext must be used within SiteProvider");
11
- }
12
- return context;
13
- }
14
- export {
15
- SiteProvider as S,
16
- useSiteContext as u
17
- };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- const jsxRuntime = require("react/jsx-runtime");
3
- const react = require("react");
4
- const SiteContext = react.createContext(null);
5
- const SiteProvider = ({ children, ...value }) => {
6
- return /* @__PURE__ */ jsxRuntime.jsx(SiteContext.Provider, { value, children });
7
- };
8
- function useSiteContext() {
9
- const context = react.useContext(SiteContext);
10
- if (!context) {
11
- throw new Error("useSiteContext must be used within SiteProvider");
12
- }
13
- return context;
14
- }
15
- exports.SiteProvider = SiteProvider;
16
- exports.useSiteContext = useSiteContext;
@@ -1,41 +0,0 @@
1
- const DUMMY_PAGE_TYPE = "DUMMY";
2
- function isValidPath(value) {
3
- return typeof value === "string" && (value === "" || value.startsWith("/"));
4
- }
5
- function isValidType(value) {
6
- return typeof value === "string" && value !== DUMMY_PAGE_TYPE;
7
- }
8
- function transformNavItems(items, parentPath = "") {
9
- if (!items || !items.length) {
10
- return [];
11
- }
12
- const transformed = [];
13
- items.forEach((item) => {
14
- var _a;
15
- if (item && item.title && isValidType(item.type) && isValidPath(item.path)) {
16
- let path = `${parentPath}${item.path}`;
17
- let children = [];
18
- if ((_a = item.items) == null ? void 0 : _a.length) {
19
- path = "";
20
- children = transformNavItems(item.items, path);
21
- }
22
- transformed.push({ label: item.title, path, children });
23
- }
24
- });
25
- return transformed;
26
- }
27
- function transformSiteNavigation(strapiNavigation) {
28
- if (!strapiNavigation) {
29
- return null;
30
- }
31
- const navGroups = strapiNavigation.items;
32
- const headerNav = navGroups == null ? void 0 : navGroups.find((item) => (item == null ? void 0 : item.slug) === "header-navigation");
33
- const footerNav = navGroups == null ? void 0 : navGroups.find((item) => (item == null ? void 0 : item.slug) === "footer-navigation");
34
- return {
35
- header: transformNavItems(headerNav == null ? void 0 : headerNav.items),
36
- footer: transformNavItems(footerNav == null ? void 0 : footerNav.items)
37
- };
38
- }
39
- export {
40
- transformSiteNavigation as t
41
- };