@anywayseo/tools 4.2.2 → 5.0.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 (74) 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 +6 -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-N8nXj4-i.js → index-3nQCWHPU.js} +219 -86
  29. package/dist/index-At00w6EN.js +9 -0
  30. package/dist/{index-BPLxhZG_.js → index-BHfpWNqh.js} +183 -73
  31. package/dist/{index-MpNfBHkQ.mjs → index-BJRvnR8Q.mjs} +1 -5
  32. package/dist/index-BRVKhbs6.mjs +6 -0
  33. package/dist/index-BmaWfWLV.mjs +10 -0
  34. package/dist/{index-BV0hDmYP.js → index-BnmGE5_x.js} +3 -2
  35. package/dist/{index-DPO0aIC3.mjs → index-Bu4S7kG8.mjs} +7 -10
  36. package/dist/{index-DVcQxWMZ.js → index-C6MG_f24.js} +0 -4
  37. package/dist/{index-BE9gNdXx.mjs → index-CACDltm3.mjs} +183 -73
  38. package/dist/index-CYr1ct1t.js +93 -0
  39. package/dist/index-CbuiYkSg.js +5 -0
  40. package/dist/index-Cc85xj4h.mjs +27 -0
  41. package/dist/index-D1bJmcpz.js +49 -0
  42. package/dist/{index-DuQjQMNN.js → index-D34TfBTR.js} +7 -10
  43. package/dist/{index-CcsbqDXL.mjs → index-DVAydNYV.mjs} +7 -3
  44. package/dist/index-DnvTeCy9.mjs +50 -0
  45. package/dist/index-DqGO34ef.js +26 -0
  46. package/dist/{index-DF_u_tzx.js → index-Dur8aLpm.js} +7 -3
  47. package/dist/{index-CkTgVjZS.mjs → index-QazOxABc.mjs} +3 -2
  48. package/dist/{index-DAbZBo7_.mjs → index-X2ihbchG.mjs} +200 -67
  49. package/dist/index-cQqALZIW.mjs +94 -0
  50. package/dist/index.cjs +41 -31
  51. package/dist/index.mjs +30 -20
  52. package/dist/providers/index.cjs +2 -2
  53. package/dist/providers/index.mjs +2 -2
  54. package/dist/providers/site-provider/index.d.ts +11 -5
  55. package/dist/types/api/index.d.ts +2 -2
  56. package/dist/types/components/icon/index.d.ts +2 -0
  57. package/dist/types/components/index.d.ts +2 -0
  58. package/dist/types/components/locale-switcher/index.d.ts +5 -0
  59. package/dist/types/components/navigation/index.d.ts +9 -10
  60. package/dist/types/i18n/index.d.ts +7 -1
  61. package/dist/types/site/index.d.ts +15 -13
  62. package/dist/utils/api/index.d.ts +5 -0
  63. package/dist/utils/date/index.d.ts +4 -3
  64. package/dist/utils/index.cjs +23 -16
  65. package/dist/utils/index.d.ts +1 -0
  66. package/dist/utils/index.mjs +16 -9
  67. package/dist/utils/navigation/index.d.ts +2 -2
  68. package/dist/utils/numbers/index.d.ts +3 -3
  69. package/package.json +1 -1
  70. package/dist/components/layout/header/navigation/types.d.ts +0 -4
  71. package/dist/index-BClxYYix.js +0 -40
  72. package/dist/index-BNb-P8a6.mjs +0 -17
  73. package/dist/index-BhsXlbd8.js +0 -16
  74. package/dist/index-Ca_M-II5.mjs +0 -41
package/dist/index.cjs CHANGED
@@ -1,14 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-N8nXj4-i.js");
4
- const index$1 = require("./index-BV0hDmYP.js");
5
- const i18n$1 = require("./index-BPLxhZG_.js");
6
- const index$2 = require("./index-DF_u_tzx.js");
7
- const index$3 = require("./index-BhsXlbd8.js");
8
- const index$4 = require("./index-DVcQxWMZ.js");
9
- const index$5 = require("./index-DuQjQMNN.js");
10
- const index$6 = require("./index-BClxYYix.js");
11
- const i18n = require("i18next");
3
+ const index = require("./index-3nQCWHPU.js");
4
+ const index$1 = require("./index-D1bJmcpz.js");
5
+ const index$2 = require("./index-DqGO34ef.js");
6
+ const index$3 = require("./index-BnmGE5_x.js");
7
+ const i18n = require("./i18n/index.cjs");
8
+ const index$4 = require("./index-Dur8aLpm.js");
9
+ const index$5 = require("./index-BHfpWNqh.js");
10
+ const index$6 = require("./index-C6MG_f24.js");
11
+ const index$7 = require("./index-CYr1ct1t.js");
12
+ const index$8 = require("./index-D34TfBTR.js");
13
+ const index$9 = require("./index-At00w6EN.js");
14
+ const index$a = require("./index-CbuiYkSg.js");
12
15
  exports.Author = index.Author;
13
16
  exports.AuthorCard = index.AuthorCard;
14
17
  exports.BonusCard = index.BonusCard;
@@ -34,25 +37,32 @@ exports.StrapiContentRenderer = index.StrapiContentRenderer;
34
37
  exports.Table = index.Table;
35
38
  exports.Tabs = index.Tabs;
36
39
  exports.Tip = index.Tip;
37
- exports.usePrimaryColors = index$1.usePrimaryColors;
38
- exports.GameCharacteristic = i18n$1.GameCharacteristic;
39
- exports.GameVolatility = i18n$1.GameVolatility;
40
- exports.resources = i18n$1.resources;
41
- exports.MdxProvider = index$2.MdxProvider;
42
- exports.SiteProvider = index$3.SiteProvider;
43
- exports.useSiteContext = index$3.useSiteContext;
44
- exports.Animation = index$4.Animation;
45
- exports.DARK_THEME_COLOR = index$4.DARK_THEME_COLOR;
46
- exports.LIGHT_THEME_COLOR = index$4.LIGHT_THEME_COLOR;
47
- exports.formatDate = index$5.formatDate;
48
- exports.formatNumber = index$5.formatNumber;
49
- exports.getCurrencySymbol = index$5.getCurrencySymbol;
50
- exports.getCurrentMonth = index$5.getCurrentMonth;
51
- exports.getCurrentYear = index$5.getCurrentYear;
52
- exports.getSeededRandomComparator = index$5.getSeededRandomComparator;
53
- exports.parseNumber = index$5.parseNumber;
54
- exports.randomComparator = index$5.randomComparator;
55
- exports.round = index$5.round;
56
- exports.toFixedTwo = index$5.toFixedTwo;
57
- exports.transformSiteNavigation = index$6.transformSiteNavigation;
58
- exports.i18n = i18n;
40
+ exports.Link = index$1.Link;
41
+ exports.SiteProvider = index$1.SiteProvider;
42
+ exports.useSiteContext = index$1.useSiteContext;
43
+ exports.useLocalization = index$2.useLocalization;
44
+ exports.usePrimaryColors = index$3.usePrimaryColors;
45
+ exports.DEFAULT_LANGUAGE = i18n.DEFAULT_LANGUAGE;
46
+ exports.resources = i18n.resources;
47
+ exports.MdxProvider = index$4.MdxProvider;
48
+ exports.GameCharacteristic = index$5.GameCharacteristic;
49
+ exports.GameVolatility = index$5.GameVolatility;
50
+ exports.Animation = index$6.Animation;
51
+ exports.getLocale = index$7.getLocale;
52
+ exports.getLocales = index$7.getLocales;
53
+ exports.getNavigation = index$7.getNavigation;
54
+ exports.getSiteName = index$7.getSiteName;
55
+ exports.formatDate = index$8.formatDate;
56
+ exports.formatNumber = index$8.formatNumber;
57
+ exports.getCurrencySymbol = index$8.getCurrencySymbol;
58
+ exports.getCurrentMonth = index$8.getCurrentMonth;
59
+ exports.getCurrentYear = index$8.getCurrentYear;
60
+ exports.getSeededRandomComparator = index$8.getSeededRandomComparator;
61
+ exports.parseNumber = index$8.parseNumber;
62
+ exports.randomComparator = index$8.randomComparator;
63
+ exports.round = index$8.round;
64
+ exports.toFixedTwo = index$8.toFixedTwo;
65
+ exports.buildPath = index$9.buildPath;
66
+ exports.isRelativePath = index$9.isRelativePath;
67
+ exports.DARK_THEME_COLOR = index$a.DARK_THEME_COLOR;
68
+ exports.LIGHT_THEME_COLOR = index$a.LIGHT_THEME_COLOR;
package/dist/index.mjs CHANGED
@@ -1,12 +1,15 @@
1
- import { k, A, B, a, l, C, F, b, c, G, d, e, f, m, H, L, n, g, N, P, S, h, T, i, j } from "./index-DAbZBo7_.mjs";
2
- import { u } from "./index-CkTgVjZS.mjs";
3
- import { a as a2, G as G2, r } from "./index-BE9gNdXx.mjs";
4
- import { M } from "./index-CcsbqDXL.mjs";
5
- import { S as S2, u as u2 } from "./index-BNb-P8a6.mjs";
6
- import { A as A2, D, L as L2 } from "./index-MpNfBHkQ.mjs";
7
- import { f as f2, b as b2, c as c2, a as a3, g as g2, e as e2, p, d as d2, r as r2, t } from "./index-DPO0aIC3.mjs";
8
- import { t as t2 } from "./index-Ca_M-II5.mjs";
9
- import { default as default2 } from "i18next";
1
+ import { k, A, B, a, l, C, F, b, c, G, d, e, f, m, H, L, n, g, N, P, S, h, T, i, j } from "./index-X2ihbchG.mjs";
2
+ import { L as L2, S as S2, u } from "./index-DnvTeCy9.mjs";
3
+ import { u as u2 } from "./index-Cc85xj4h.mjs";
4
+ import { u as u3 } from "./index-QazOxABc.mjs";
5
+ import { DEFAULT_LANGUAGE, resources } from "./i18n/index.mjs";
6
+ import { M } from "./index-DVAydNYV.mjs";
7
+ import { a as a2, G as G2 } from "./index-CACDltm3.mjs";
8
+ import { A as A2 } from "./index-BJRvnR8Q.mjs";
9
+ import { b as b2, c as c2, g as g2, a as a3 } from "./index-cQqALZIW.mjs";
10
+ import { f as f2, b as b3, c as c3, a as a4, g as g3, e as e2, p, d as d2, r, t } from "./index-Bu4S7kG8.mjs";
11
+ import { b as b4, i as i2 } from "./index-BmaWfWLV.mjs";
12
+ import { D, L as L3 } from "./index-BRVKhbs6.mjs";
10
13
  export {
11
14
  A2 as Animation,
12
15
  k as Author,
@@ -16,6 +19,7 @@ export {
16
19
  l as Center,
17
20
  C as ContactForm,
18
21
  D as DARK_THEME_COLOR,
22
+ DEFAULT_LANGUAGE,
19
23
  F as Faq,
20
24
  b as FeatureCard,
21
25
  c as FeatureCardGrid,
@@ -27,8 +31,9 @@ export {
27
31
  G2 as GameVolatility,
28
32
  m as Grid,
29
33
  H as HowTo,
30
- L2 as LIGHT_THEME_COLOR,
34
+ L3 as LIGHT_THEME_COLOR,
31
35
  L as Layout,
36
+ L2 as Link,
32
37
  n as LinkButton,
33
38
  g as List,
34
39
  M as MdxProvider,
@@ -40,19 +45,24 @@ export {
40
45
  T as Table,
41
46
  i as Tabs,
42
47
  j as Tip,
48
+ b4 as buildPath,
43
49
  f2 as formatDate,
44
- b2 as formatNumber,
45
- c2 as getCurrencySymbol,
46
- a3 as getCurrentMonth,
47
- g2 as getCurrentYear,
50
+ b3 as formatNumber,
51
+ c3 as getCurrencySymbol,
52
+ a4 as getCurrentMonth,
53
+ g3 as getCurrentYear,
54
+ b2 as getLocale,
55
+ c2 as getLocales,
56
+ g2 as getNavigation,
48
57
  e2 as getSeededRandomComparator,
49
- default2 as i18n,
58
+ a3 as getSiteName,
59
+ i2 as isRelativePath,
50
60
  p as parseNumber,
51
61
  d2 as randomComparator,
52
- r as resources,
53
- r2 as round,
62
+ resources,
63
+ r as round,
54
64
  t as toFixedTwo,
55
- t2 as transformSiteNavigation,
56
- u as usePrimaryColors,
57
- u2 as useSiteContext
65
+ u2 as useLocalization,
66
+ u3 as usePrimaryColors,
67
+ u as useSiteContext
58
68
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-DF_u_tzx.js");
4
- const index$1 = require("../index-BhsXlbd8.js");
3
+ const index = require("../index-Dur8aLpm.js");
4
+ const index$1 = require("../index-D1bJmcpz.js");
5
5
  exports.MdxProvider = index.MdxProvider;
6
6
  exports.SiteProvider = index$1.SiteProvider;
7
7
  exports.useSiteContext = index$1.useSiteContext;
@@ -1,5 +1,5 @@
1
- import { M } from "../index-CcsbqDXL.mjs";
2
- import { S, u } from "../index-BNb-P8a6.mjs";
1
+ import { M } from "../index-DVAydNYV.mjs";
2
+ import { S, u } from "../index-DnvTeCy9.mjs";
3
3
  export {
4
4
  M as MdxProvider,
5
5
  S as SiteProvider,
@@ -1,10 +1,16 @@
1
1
  import { FC, PropsWithChildren } from 'react';
2
- import { ISiteConfigs, ISiteMetadata } from '../../types';
3
- interface ISiteContext {
2
+ import { ILocale, ISiteConfig, ISiteLocalization, ISiteMetadata, ISiteNavigation } from '../../types';
3
+ interface ISiteContextInput {
4
4
  metadata: ISiteMetadata;
5
- configs?: ISiteConfigs;
5
+ navigation: ISiteNavigation;
6
+ localization: ISiteLocalization;
7
+ config: ISiteConfig;
6
8
  }
7
- type SiteMetadataProviderProps = ISiteContext;
8
- declare const SiteProvider: FC<PropsWithChildren<SiteMetadataProviderProps>>;
9
+ interface ISiteContext extends ISiteContextInput {
10
+ localization: ISiteLocalization & {
11
+ currentLocale: ILocale;
12
+ };
13
+ }
14
+ declare const SiteProvider: FC<PropsWithChildren<ISiteContextInput>>;
9
15
  export default SiteProvider;
10
16
  export declare function useSiteContext(): ISiteContext;
@@ -2,7 +2,7 @@ export interface IStrapiNavigation {
2
2
  readonly items: ReadonlyArray<IStrapiNavigationGroup | null> | null;
3
3
  }
4
4
  export interface IStrapiNavigationGroup {
5
- readonly name: string | null;
5
+ readonly locale: string | null;
6
6
  readonly slug: string | null;
7
7
  readonly items: ReadonlyArray<IStrapiNavigationItem | null> | null;
8
8
  }
@@ -11,6 +11,6 @@ export interface IStrapiNavigationItem {
11
11
  readonly title: string | null;
12
12
  readonly slug: string | null;
13
13
  readonly path: string | null;
14
- readonly menuAttached: boolean | null;
15
14
  readonly items: ReadonlyArray<IStrapiNavigationItem | null> | null;
15
+ readonly menuAttached?: boolean | null;
16
16
  }
@@ -0,0 +1,2 @@
1
+ import { FC, SVGProps } from 'react';
2
+ export type IconComponent = FC<SVGProps<SVGSVGElement>>;
@@ -7,8 +7,10 @@ export * from './game-card';
7
7
  export * from './game-info';
8
8
  export * from './grid';
9
9
  export * from './how-to';
10
+ export * from './icon';
10
11
  export * from './image';
11
12
  export * from './link';
13
+ export * from './locale-switcher';
12
14
  export * from './navigation';
13
15
  export * from './pros-cons';
14
16
  export * from './strapi-component';
@@ -0,0 +1,5 @@
1
+ import { ILocale } from '../../i18n';
2
+ import { IconComponent } from '../icon';
3
+ export interface ILocaleMenuItem extends ILocale {
4
+ icon: IconComponent;
5
+ }
@@ -1,13 +1,12 @@
1
- type Path = `/${string}`;
2
- type EmptyPath = '';
3
- type IndexPath = '/';
4
- export interface INavItem<P extends Path = Path> {
5
- path: P | EmptyPath;
1
+ import { ILocale } from '../../i18n';
2
+ export interface INavItem {
3
+ slug: string;
6
4
  label: string;
7
- children?: ISubNavItem[];
5
+ children?: Omit<INavItem, 'children'>[];
8
6
  }
9
- export interface ISubNavItem<P extends Path = Path> {
10
- path: P | IndexPath;
11
- label: string;
7
+ export interface INavigation {
8
+ [locale: ILocale['code']]: INavItem[] | undefined;
12
9
  }
13
- export {};
10
+ export type NavigationProps = {
11
+ menu: INavItem[];
12
+ };
@@ -1,2 +1,8 @@
1
- export type LanguageCode = 'en' | 'it' | 'de' | 'ru';
1
+ export type LanguageCode = 'en' | 'it' | 'de' | 'fr' | 'ru';
2
2
  export type Currency = 'USD' | 'EUR' | 'GBP' | 'RUB';
3
+ type LocaleCode = string;
4
+ export interface ILocale {
5
+ code: LocaleCode;
6
+ name: string;
7
+ }
8
+ export {};
@@ -1,35 +1,37 @@
1
1
  import { ReactNode } from 'react';
2
- import { Image, INavItem } from '../components';
2
+ import { Image, INavigation } from '../components';
3
3
  import { ISeo } from '../content';
4
- import { Currency, LanguageCode } from '../i18n';
4
+ import { Currency, ILocale } from '../i18n';
5
5
  interface ISiteHeaderConfig {
6
- navigation?: INavItem[];
7
6
  toolbar?: ReactNode;
8
7
  }
9
8
  interface ISiteFooterConfig {
10
- navigation?: INavItem[];
11
9
  extra?: ReactNode;
12
10
  showDisclaimer?: boolean;
13
11
  }
14
12
  interface ISiteThemeConfig {
15
13
  isInvertedColor?: boolean;
16
14
  }
17
- export interface ISiteConfigs {
15
+ export interface ISiteConfig {
16
+ theme?: ISiteThemeConfig;
18
17
  header?: ISiteHeaderConfig;
19
18
  footer?: ISiteFooterConfig;
20
- theme?: ISiteThemeConfig;
19
+ }
20
+ export interface ISiteNavigation {
21
+ header: INavigation;
22
+ footer: INavigation;
23
+ }
24
+ export interface ISiteLocalization {
25
+ currency: Currency | Currency[];
26
+ defaultLocale: ILocale;
27
+ locales: ILocale[];
21
28
  }
22
29
  export interface ISiteMetadata {
23
30
  name: string;
24
- logo: Image;
25
- lang: LanguageCode;
26
- currency: Currency | Currency[];
31
+ lang: ILocale['code'];
27
32
  seo: ISeo;
33
+ logo: Image;
28
34
  /** Planned */
29
35
  favicon?: Image;
30
36
  }
31
- export interface ISiteNavigation {
32
- header: INavItem[];
33
- footer: INavItem[];
34
- }
35
37
  export {};
@@ -0,0 +1,5 @@
1
+ import { ILocale, ISiteNavigation, IStrapiNavigation } from '../../types';
2
+ export declare function getNavigation(fallback: ISiteNavigation, strapiNavigation?: IStrapiNavigation | null): ISiteNavigation;
3
+ export declare function getSiteName(url?: string | null): string;
4
+ export declare function getLocale(defaultLocaleCode: ILocale['code'], locales?: ILocale[] | null): ILocale;
5
+ export declare function getLocales(defaultLocaleCode: ILocale['code'], locales?: ILocale[] | null): ILocale[];
@@ -1,8 +1,9 @@
1
- export declare function getCurrentYear(): string;
2
- export declare function getCurrentMonth(): string;
1
+ import { ILocale } from '../../types';
2
+ export declare function getCurrentYear(locale?: ILocale['code']): string;
3
+ export declare function getCurrentMonth(locale?: ILocale['code']): string;
3
4
  interface IFormatDateOptions {
4
5
  value: string | number | Date;
5
- locale?: string;
6
+ locale?: ILocale['code'];
6
7
  options?: Intl.DateTimeFormatOptions;
7
8
  }
8
9
  export declare function formatDate({ value, locale, options }: IFormatDateOptions): string;
@@ -1,19 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-DVcQxWMZ.js");
4
- const index$1 = require("../index-DuQjQMNN.js");
5
- const index$2 = require("../index-BClxYYix.js");
3
+ const index = require("../index-C6MG_f24.js");
4
+ const index$1 = require("../index-CYr1ct1t.js");
5
+ const index$2 = require("../index-D34TfBTR.js");
6
+ const index$3 = require("../index-At00w6EN.js");
7
+ const index$4 = require("../index-CbuiYkSg.js");
6
8
  exports.Animation = index.Animation;
7
- exports.DARK_THEME_COLOR = index.DARK_THEME_COLOR;
8
- exports.LIGHT_THEME_COLOR = index.LIGHT_THEME_COLOR;
9
- exports.formatDate = index$1.formatDate;
10
- exports.formatNumber = index$1.formatNumber;
11
- exports.getCurrencySymbol = index$1.getCurrencySymbol;
12
- exports.getCurrentMonth = index$1.getCurrentMonth;
13
- exports.getCurrentYear = index$1.getCurrentYear;
14
- exports.getSeededRandomComparator = index$1.getSeededRandomComparator;
15
- exports.parseNumber = index$1.parseNumber;
16
- exports.randomComparator = index$1.randomComparator;
17
- exports.round = index$1.round;
18
- exports.toFixedTwo = index$1.toFixedTwo;
19
- exports.transformSiteNavigation = index$2.transformSiteNavigation;
9
+ exports.getLocale = index$1.getLocale;
10
+ exports.getLocales = index$1.getLocales;
11
+ exports.getNavigation = index$1.getNavigation;
12
+ exports.getSiteName = index$1.getSiteName;
13
+ exports.formatDate = index$2.formatDate;
14
+ exports.formatNumber = index$2.formatNumber;
15
+ exports.getCurrencySymbol = index$2.getCurrencySymbol;
16
+ exports.getCurrentMonth = index$2.getCurrentMonth;
17
+ exports.getCurrentYear = index$2.getCurrentYear;
18
+ exports.getSeededRandomComparator = index$2.getSeededRandomComparator;
19
+ exports.parseNumber = index$2.parseNumber;
20
+ exports.randomComparator = index$2.randomComparator;
21
+ exports.round = index$2.round;
22
+ exports.toFixedTwo = index$2.toFixedTwo;
23
+ exports.buildPath = index$3.buildPath;
24
+ exports.isRelativePath = index$3.isRelativePath;
25
+ exports.DARK_THEME_COLOR = index$4.DARK_THEME_COLOR;
26
+ exports.LIGHT_THEME_COLOR = index$4.LIGHT_THEME_COLOR;
@@ -1,4 +1,5 @@
1
1
  export * from './animation';
2
+ export * from './api';
2
3
  export * from './date';
3
4
  export * from './navigation';
4
5
  export * from './numbers';
@@ -1,19 +1,26 @@
1
- import { A, D, L } from "../index-MpNfBHkQ.mjs";
2
- import { f, b, c, a, g, e, p, d, r, t } from "../index-DPO0aIC3.mjs";
3
- import { t as t2 } from "../index-Ca_M-II5.mjs";
1
+ import { A } from "../index-BJRvnR8Q.mjs";
2
+ import { b, c, g, a } from "../index-cQqALZIW.mjs";
3
+ import { f, b as b2, c as c2, a as a2, g as g2, e, p, d, r, t } from "../index-Bu4S7kG8.mjs";
4
+ import { b as b3, i } from "../index-BmaWfWLV.mjs";
5
+ import { D, L } from "../index-BRVKhbs6.mjs";
4
6
  export {
5
7
  A as Animation,
6
8
  D as DARK_THEME_COLOR,
7
9
  L as LIGHT_THEME_COLOR,
10
+ b3 as buildPath,
8
11
  f as formatDate,
9
- b as formatNumber,
10
- c as getCurrencySymbol,
11
- a as getCurrentMonth,
12
- g as getCurrentYear,
12
+ b2 as formatNumber,
13
+ c2 as getCurrencySymbol,
14
+ a2 as getCurrentMonth,
15
+ g2 as getCurrentYear,
16
+ b as getLocale,
17
+ c as getLocales,
18
+ g as getNavigation,
13
19
  e as getSeededRandomComparator,
20
+ a as getSiteName,
21
+ i as isRelativePath,
14
22
  p as parseNumber,
15
23
  d as randomComparator,
16
24
  r as round,
17
- t as toFixedTwo,
18
- t2 as transformSiteNavigation
25
+ t as toFixedTwo
19
26
  };
@@ -1,2 +1,2 @@
1
- import { ISiteNavigation, IStrapiNavigation } from '../../types';
2
- export declare function transformSiteNavigation(strapiNavigation: IStrapiNavigation): ISiteNavigation | null;
1
+ export declare function buildPath(slug: string, parentSlug: string): string;
2
+ export declare function isRelativePath(path?: string): boolean;
@@ -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.0.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
- };