@anywayseo/tools 1.0.1 → 1.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.
@@ -1,2 +1,2 @@
1
1
  import { Currency, GameCharacteristic } from '../../types';
2
- export declare function getGameInfoItemValue(key: GameCharacteristic, value: unknown, currency: Currency): string;
2
+ export declare function getGameInfoItemValue(key: GameCharacteristic, value: unknown, currency: Currency | Currency[]): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-alye-Zt-.js");
3
+ const index = require("../index-C1AoeBP2.js");
4
4
  exports.Author = index.Author;
5
5
  exports.ContactForm = index.ContactForm;
6
6
  exports.ExpertTip = index.ExpertTip;
@@ -1,4 +1,4 @@
1
- import { A, C, E, F, a, G, b, H, L, P, S } from "../index-D5QkKj_Z.mjs";
1
+ import { A, C, E, F, a, G, b, H, L, P, S } from "../index-Bv4g3xBH.mjs";
2
2
  export {
3
3
  A as Author,
4
4
  C as ContactForm,
@@ -10,7 +10,7 @@ import { u as usePrimaryColors } from "./index-xuSxvz5z.mjs";
10
10
  import { keyframes } from "@emotion/react";
11
11
  import { a as GameCharacteristic } from "./index-Bh5idiRE.mjs";
12
12
  import { t } from "i18next";
13
- import { b as formatNumber, f as formatDate, c as getDomain, g as getCurrentYear, a as getCurrentMonth } from "./index-BtWxmLHW.mjs";
13
+ import { b as formatNumber, c as getCurrencySymbol, f as formatDate, d as getDomain, g as getCurrentYear, a as getCurrentMonth } from "./index-jhNgIknB.mjs";
14
14
  import { Link } from "gatsby";
15
15
  const ONE_LINE_HEIGHT = 24;
16
16
  const Bio = ({ content, maxLines = 1 }) => {
@@ -328,8 +328,14 @@ function getGameInfoItemValue(key, value, currency) {
328
328
  if (key === GameCharacteristic.Rtp) {
329
329
  formattedValue = formatNumber(value, { percent: "real", precision: 3 });
330
330
  }
331
- if (key === GameCharacteristic.MinBet || key === GameCharacteristic.MaxBet || key === GameCharacteristic.MaxWin && typeof value === "number") {
332
- formattedValue = formatNumber(value, { currency });
331
+ if ((key === GameCharacteristic.MinBet || key === GameCharacteristic.MaxBet || key === GameCharacteristic.MaxWin) && typeof value === "number") {
332
+ if (Array.isArray(currency)) {
333
+ const [primary, ...secondaries] = currency || ["USD"];
334
+ const primaryValue = formatNumber(value, { currency: primary });
335
+ formattedValue = secondaries.length ? `${primaryValue} (${secondaries.map((currency2) => getCurrencySymbol(currency2)).join(", ")})` : primaryValue;
336
+ } else {
337
+ formattedValue = formatNumber(value, { currency });
338
+ }
333
339
  }
334
340
  if (key === GameCharacteristic.Compatibility || key === GameCharacteristic.BonusFeatures && typeof value !== "string") {
335
341
  formattedValue = stringifyArray(value);
@@ -11,7 +11,7 @@ const index$1 = require("./index-IpSV-c71.js");
11
11
  const react$2 = require("@emotion/react");
12
12
  const i18n = require("./index-DB1dS9cp.js");
13
13
  const i18n$1 = require("i18next");
14
- const index$2 = require("./index-JMmaWcmu.js");
14
+ const index$2 = require("./index-C68DPwvx.js");
15
15
  const gatsby = require("gatsby");
16
16
  const ONE_LINE_HEIGHT = 24;
17
17
  const Bio = ({ content, maxLines = 1 }) => {
@@ -329,8 +329,14 @@ function getGameInfoItemValue(key, value, currency) {
329
329
  if (key === i18n.GameCharacteristic.Rtp) {
330
330
  formattedValue = index$2.formatNumber(value, { percent: "real", precision: 3 });
331
331
  }
332
- if (key === i18n.GameCharacteristic.MinBet || key === i18n.GameCharacteristic.MaxBet || key === i18n.GameCharacteristic.MaxWin && typeof value === "number") {
333
- formattedValue = index$2.formatNumber(value, { currency });
332
+ if ((key === i18n.GameCharacteristic.MinBet || key === i18n.GameCharacteristic.MaxBet || key === i18n.GameCharacteristic.MaxWin) && typeof value === "number") {
333
+ if (Array.isArray(currency)) {
334
+ const [primary, ...secondaries] = currency || ["USD"];
335
+ const primaryValue = index$2.formatNumber(value, { currency: primary });
336
+ formattedValue = secondaries.length ? `${primaryValue} (${secondaries.map((currency2) => index$2.getCurrencySymbol(currency2)).join(", ")})` : primaryValue;
337
+ } else {
338
+ formattedValue = index$2.formatNumber(value, { currency });
339
+ }
334
340
  }
335
341
  if (key === i18n.GameCharacteristic.Compatibility || key === i18n.GameCharacteristic.BonusFeatures && typeof value !== "string") {
336
342
  formattedValue = stringifyArray(value);
@@ -65,12 +65,22 @@ function parseNumber(value) {
65
65
  }
66
66
  return parsedNumber;
67
67
  }
68
+ function getCurrencySymbol(currencyCode) {
69
+ const symbol = 0 .toLocaleString(i18n.language, {
70
+ style: "currency",
71
+ currency: currencyCode,
72
+ minimumFractionDigits: 0,
73
+ maximumFractionDigits: 0
74
+ }).replace(/\d/g, "").trim();
75
+ return symbol;
76
+ }
68
77
  const protocolRegex = /^https?:\/\//;
69
78
  function getDomain(url) {
70
79
  return url.replace(protocolRegex, "");
71
80
  }
72
81
  exports.formatDate = formatDate;
73
82
  exports.formatNumber = formatNumber;
83
+ exports.getCurrencySymbol = getCurrencySymbol;
74
84
  exports.getCurrentMonth = getCurrentMonth;
75
85
  exports.getCurrentYear = getCurrentYear;
76
86
  exports.getDomain = getDomain;
@@ -64,6 +64,15 @@ function parseNumber(value) {
64
64
  }
65
65
  return parsedNumber;
66
66
  }
67
+ function getCurrencySymbol(currencyCode) {
68
+ const symbol = 0 .toLocaleString(i18n.language, {
69
+ style: "currency",
70
+ currency: currencyCode,
71
+ minimumFractionDigits: 0,
72
+ maximumFractionDigits: 0
73
+ }).replace(/\d/g, "").trim();
74
+ return symbol;
75
+ }
67
76
  const protocolRegex = /^https?:\/\//;
68
77
  function getDomain(url) {
69
78
  return url.replace(protocolRegex, "");
@@ -71,7 +80,8 @@ function getDomain(url) {
71
80
  export {
72
81
  getCurrentMonth as a,
73
82
  formatNumber as b,
74
- getDomain as c,
83
+ getCurrencySymbol as c,
84
+ getDomain as d,
75
85
  formatDate as f,
76
86
  getCurrentYear as g,
77
87
  parseNumber as p,
package/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-alye-Zt-.js");
3
+ const index = require("./index-C1AoeBP2.js");
4
4
  const index$1 = require("./index-IpSV-c71.js");
5
5
  const i18n$1 = require("./index-DB1dS9cp.js");
6
6
  const index$2 = require("./index-BWuTDC6H.js");
7
7
  const index$3 = require("./index-D96zh94V.js");
8
- const index$4 = require("./index-JMmaWcmu.js");
8
+ const index$4 = require("./index-C68DPwvx.js");
9
9
  const i18n = require("i18next");
10
10
  exports.Author = index.Author;
11
11
  exports.ContactForm = index.ContactForm;
@@ -27,6 +27,7 @@ exports.SiteMetadataProvider = index$3.SiteMetadataProvider;
27
27
  exports.useSiteMetadataContext = index$3.useSiteMetadataContext;
28
28
  exports.formatDate = index$4.formatDate;
29
29
  exports.formatNumber = index$4.formatNumber;
30
+ exports.getCurrencySymbol = index$4.getCurrencySymbol;
30
31
  exports.getCurrentMonth = index$4.getCurrentMonth;
31
32
  exports.getCurrentYear = index$4.getCurrentYear;
32
33
  exports.getDomain = index$4.getDomain;
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { A, C, E, F, a, G, b, H, L, P, S } from "./index-D5QkKj_Z.mjs";
1
+ import { A, C, E, F, a, G, b, H, L, P, S } from "./index-Bv4g3xBH.mjs";
2
2
  import { u } from "./index-xuSxvz5z.mjs";
3
3
  import { a as a2, G as G2, r } from "./index-Bh5idiRE.mjs";
4
4
  import { M } from "./index-wbMOJRW_.mjs";
5
5
  import { S as S2, u as u2 } from "./index-Bs4zA1wD.mjs";
6
- import { f, b as b2, a as a3, g, c, p, r as r2, t } from "./index-BtWxmLHW.mjs";
6
+ import { f, b as b2, c, a as a3, g, d, p, r as r2, t } from "./index-jhNgIknB.mjs";
7
7
  import { default as default2 } from "i18next";
8
8
  export {
9
9
  A as Author,
@@ -23,9 +23,10 @@ export {
23
23
  S2 as SiteMetadataProvider,
24
24
  f as formatDate,
25
25
  b2 as formatNumber,
26
+ c as getCurrencySymbol,
26
27
  a3 as getCurrentMonth,
27
28
  g as getCurrentYear,
28
- c as getDomain,
29
+ d as getDomain,
29
30
  default2 as i18n,
30
31
  p as parseNumber,
31
32
  r as resources,
@@ -43,8 +43,8 @@ export interface IGameInfo {
43
43
  [GameCharacteristic.Volatility]: GameVolatility;
44
44
  [GameCharacteristic.ReelsNumber]: number | string;
45
45
  [GameCharacteristic.PayLines]: number | string;
46
- [GameCharacteristic.MinBet]: number;
47
- [GameCharacteristic.MaxBet]: number;
46
+ [GameCharacteristic.MinBet]: number | string;
47
+ [GameCharacteristic.MaxBet]: number | string;
48
48
  [GameCharacteristic.MaxWin]: number | string;
49
49
  [GameCharacteristic.Compatibility]: GamePlatform[];
50
50
  }>;
@@ -1,2 +1,2 @@
1
1
  export type LanguageCode = 'en' | 'it';
2
- export type Currency = 'USD' | 'EUR';
2
+ export type Currency = 'USD' | 'EUR' | 'GBP';
@@ -5,6 +5,6 @@ export interface ISiteMetadata {
5
5
  description: string;
6
6
  siteUrl: string;
7
7
  lang: LanguageCode;
8
- currency: Currency;
8
+ currency: Currency | Currency[];
9
9
  footerMenuLinks: INavigationItem[];
10
10
  }
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-JMmaWcmu.js");
3
+ const index = require("../index-C68DPwvx.js");
4
4
  exports.formatDate = index.formatDate;
5
5
  exports.formatNumber = index.formatNumber;
6
+ exports.getCurrencySymbol = index.getCurrencySymbol;
6
7
  exports.getCurrentMonth = index.getCurrentMonth;
7
8
  exports.getCurrentYear = index.getCurrentYear;
8
9
  exports.getDomain = index.getDomain;
@@ -1,10 +1,11 @@
1
- import { f, b, a, g, c, p, r, t } from "../index-BtWxmLHW.mjs";
1
+ import { f, b, c, a, g, d, p, r, t } from "../index-jhNgIknB.mjs";
2
2
  export {
3
3
  f as formatDate,
4
4
  b as formatNumber,
5
+ c as getCurrencySymbol,
5
6
  a as getCurrentMonth,
6
7
  g as getCurrentYear,
7
- c as getDomain,
8
+ d as getDomain,
8
9
  p as parseNumber,
9
10
  r as round,
10
11
  t as toFixedTwo
@@ -16,4 +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
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": "1.0.1",
4
+ "version": "1.1.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -64,6 +64,7 @@
64
64
  }
65
65
  },
66
66
  "scripts": {
67
+ "start": "npm pack",
67
68
  "build": "tsc -b && vite build",
68
69
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
69
70
  "prepack": "npm run build"