@anywayseo/tools 1.0.0 → 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-NWY9BnRg.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-Dfw_EKZ6.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,
@@ -7,9 +7,10 @@ import "@mdx-js/react";
7
7
  import { u as useSiteMetadataContext } from "./index-Bs4zA1wD.mjs";
8
8
  import { useRef, useState, useLayoutEffect, Fragment as Fragment$1, useEffect } from "react";
9
9
  import { u as usePrimaryColors } from "./index-xuSxvz5z.mjs";
10
+ import { keyframes } from "@emotion/react";
10
11
  import { a as GameCharacteristic } from "./index-Bh5idiRE.mjs";
11
12
  import { t } from "i18next";
12
- 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";
13
14
  import { Link } from "gatsby";
14
15
  const ONE_LINE_HEIGHT = 24;
15
16
  const Bio = ({ content, maxLines = 1 }) => {
@@ -231,10 +232,19 @@ const GameDemoContent = ({ src, isFullscreen, isLoaded, onLoad, onToggleFullscre
231
232
  /* @__PURE__ */ jsx(AbsoluteCenter, { children: /* @__PURE__ */ jsx(Spinner, { size: "xl", thickness: "0.6rem", display: isLoaded ? "none" : "block", color: "brand.100" }) })
232
233
  ] });
233
234
  };
234
- const pulsing = "_pulsing_u8aju_1";
235
- const styles = {
236
- pulsing
237
- };
235
+ const pulse = keyframes`
236
+ 0% {
237
+ box-shadow: 0 0 0 0 var(--chakra-colors-brand-100);
238
+ }
239
+
240
+ 50% {
241
+ box-shadow: 0 0 0 0.8rem rgba(0, 0, 0, 0);
242
+ }
243
+
244
+ 100% {
245
+ box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
246
+ }
247
+ `;
238
248
  const GameDemoPreview = ({ gameName, onPlay }) => {
239
249
  const { gamePreviewImageData } = useSiteMetadataContext();
240
250
  const { t: t2 } = useTranslation("gameDemo");
@@ -247,8 +257,8 @@ const GameDemoPreview = ({ gameName, onPlay }) => {
247
257
  size: { base: "sm", md: "lg" },
248
258
  color: "gray.200",
249
259
  bgColor: "brand.500",
260
+ animation: `${pulse} 2s infinite linear`,
250
261
  _hover: { bgColor: "brand.200", color: "gray.700" },
251
- className: styles.pulsing,
252
262
  onClick: onPlay,
253
263
  children: t2("action.playForFree")
254
264
  }
@@ -318,8 +328,14 @@ function getGameInfoItemValue(key, value, currency) {
318
328
  if (key === GameCharacteristic.Rtp) {
319
329
  formattedValue = formatNumber(value, { percent: "real", precision: 3 });
320
330
  }
321
- if (key === GameCharacteristic.MinBet || key === GameCharacteristic.MaxBet || key === GameCharacteristic.MaxWin && typeof value === "number") {
322
- 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
+ }
323
339
  }
324
340
  if (key === GameCharacteristic.Compatibility || key === GameCharacteristic.BonusFeatures && typeof value !== "string") {
325
341
  formattedValue = stringifyArray(value);
@@ -8,9 +8,10 @@ require("@mdx-js/react");
8
8
  const index = require("./index-D96zh94V.js");
9
9
  const react = require("react");
10
10
  const index$1 = require("./index-IpSV-c71.js");
11
+ const react$2 = require("@emotion/react");
11
12
  const i18n = require("./index-DB1dS9cp.js");
12
13
  const i18n$1 = require("i18next");
13
- const index$2 = require("./index-JMmaWcmu.js");
14
+ const index$2 = require("./index-C68DPwvx.js");
14
15
  const gatsby = require("gatsby");
15
16
  const ONE_LINE_HEIGHT = 24;
16
17
  const Bio = ({ content, maxLines = 1 }) => {
@@ -232,10 +233,19 @@ const GameDemoContent = ({ src, isFullscreen, isLoaded, onLoad, onToggleFullscre
232
233
  /* @__PURE__ */ jsxRuntime.jsx(react$1.AbsoluteCenter, { children: /* @__PURE__ */ jsxRuntime.jsx(react$1.Spinner, { size: "xl", thickness: "0.6rem", display: isLoaded ? "none" : "block", color: "brand.100" }) })
233
234
  ] });
234
235
  };
235
- const pulsing = "_pulsing_u8aju_1";
236
- const styles = {
237
- pulsing
238
- };
236
+ const pulse = react$2.keyframes`
237
+ 0% {
238
+ box-shadow: 0 0 0 0 var(--chakra-colors-brand-100);
239
+ }
240
+
241
+ 50% {
242
+ box-shadow: 0 0 0 0.8rem rgba(0, 0, 0, 0);
243
+ }
244
+
245
+ 100% {
246
+ box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
247
+ }
248
+ `;
239
249
  const GameDemoPreview = ({ gameName, onPlay }) => {
240
250
  const { gamePreviewImageData } = index.useSiteMetadataContext();
241
251
  const { t } = reactI18next.useTranslation("gameDemo");
@@ -248,8 +258,8 @@ const GameDemoPreview = ({ gameName, onPlay }) => {
248
258
  size: { base: "sm", md: "lg" },
249
259
  color: "gray.200",
250
260
  bgColor: "brand.500",
261
+ animation: `${pulse} 2s infinite linear`,
251
262
  _hover: { bgColor: "brand.200", color: "gray.700" },
252
- className: styles.pulsing,
253
263
  onClick: onPlay,
254
264
  children: t("action.playForFree")
255
265
  }
@@ -319,8 +329,14 @@ function getGameInfoItemValue(key, value, currency) {
319
329
  if (key === i18n.GameCharacteristic.Rtp) {
320
330
  formattedValue = index$2.formatNumber(value, { percent: "real", precision: 3 });
321
331
  }
322
- if (key === i18n.GameCharacteristic.MinBet || key === i18n.GameCharacteristic.MaxBet || key === i18n.GameCharacteristic.MaxWin && typeof value === "number") {
323
- 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
+ }
324
340
  }
325
341
  if (key === i18n.GameCharacteristic.Compatibility || key === i18n.GameCharacteristic.BonusFeatures && typeof value !== "string") {
326
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-NWY9BnRg.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-Dfw_EKZ6.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.0",
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"
package/dist/style.css DELETED
@@ -1,15 +0,0 @@
1
- ._pulsing_u8aju_1 {
2
- animation: _pulse_u8aju_1 2s infinite linear;
3
- }
4
-
5
- @keyframes _pulse_u8aju_1 {
6
- 0% {
7
- box-shadow: 0 0 0 0 var(--chakra-colors-brand-100);
8
- }
9
- 50% {
10
- box-shadow: 0 0 0 0.8rem rgba(0, 0, 0, 0);
11
- }
12
- 100% {
13
- box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
14
- }
15
- }