@capsitech/react-utilities 0.1.11 → 0.1.12

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.
@@ -47,7 +47,7 @@ export declare const getScreenScalingFactor: () => number | null;
47
47
  * If it fails validation, it returns null
48
48
  * @returns {number | null} validated value of screen's colorDepth
49
49
  */
50
- export declare const getScreenColourDepth: () => number | null;
50
+ export declare const getScreenColorDepth: () => number | null;
51
51
  /**
52
52
  * Function that validates the user's window's interior width in pixels, and then returns it.
53
53
  * If it fails validation, it returns null
@@ -118,19 +118,25 @@ export const getScreenScalingFactor = () => validateAndGetScreenDetail(window.de
118
118
  * If it fails validation, it returns null
119
119
  * @returns {number | null} validated value of screen's colorDepth
120
120
  */
121
- export const getScreenColourDepth = () => validateAndGetScreenDetail(screen.colorDepth);
121
+ export const getScreenColorDepth = () => validateAndGetScreenDetail(screen.colorDepth);
122
122
  /**
123
123
  * Function that validates the user's window's interior width in pixels, and then returns it.
124
124
  * If it fails validation, it returns null
125
125
  * @returns {number | null} validated value of window's innerWidth
126
126
  */
127
- export const getWindowWidth = () => validateAndGetScreenDetail(window.innerWidth);
127
+ export const getWindowWidth = () => {
128
+ const pixelRatio = window.devicePixelRatio || 1;
129
+ return validateAndGetScreenDetail(Math.floor(window.innerWidth * pixelRatio));
130
+ };
128
131
  /**
129
132
  * Function that validates the user's window's interior height in pixels, and then returns it.
130
133
  * If it fails validation, it returns null
131
134
  * @returns {number | null} validated value of window's innerHeight
132
135
  */
133
- export const getWindowHeight = () => validateAndGetScreenDetail(window.innerHeight);
136
+ export const getWindowHeight = () => {
137
+ const pixelRatio = window.devicePixelRatio || 1;
138
+ return validateAndGetScreenDetail(Math.floor(window.innerHeight * pixelRatio));
139
+ };
134
140
  /**
135
141
  * The function returns users browser's do not track setting by checking the navigator
136
142
  * and window object for the same
@@ -1,4 +1,4 @@
1
- import { getScreenColourDepth, getScreenHeight, getScreenScalingFactor, getScreenWidth, getTimezone, getWindowHeight, getWindowWidth } from './BrowserInfo';
1
+ import { getScreenColorDepth, getScreenHeight, getScreenScalingFactor, getScreenWidth, getTimezone, getWindowHeight, getWindowWidth } from './BrowserInfo';
2
2
  /**
3
3
  * Enum object of keys for each header in the Map returned by getFraudPreventionHeaders().headers
4
4
  */
@@ -14,14 +14,14 @@ export const fraudPreventionHeadersEnum = {
14
14
  //BROWSER_USER_AGENT: 'Gov-Client-Browser-JS-User-Agent',
15
15
  };
16
16
  const getScreenData = () => {
17
- const screenDetails = `width=${getScreenWidth()}&height=${getScreenHeight()}&scaling-factor=${getScreenScalingFactor()}&colour-depth=${getScreenColourDepth()}`;
17
+ const screenDetails = `width=${getScreenWidth()}&height=${getScreenHeight()}&scaling-factor=${getScreenScalingFactor()}&colour-depth=${getScreenColorDepth()}`;
18
18
  return encodeURI(screenDetails);
19
19
  };
20
20
  export const getScreenDetails = () => {
21
21
  return {
22
22
  width: getScreenWidth(),
23
23
  height: getScreenHeight(),
24
- colorDepth: getScreenColourDepth(),
24
+ colorDepth: getScreenColorDepth(),
25
25
  scalingFactor: getScreenScalingFactor(),
26
26
  };
27
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capsitech/react-utilities",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "A set of javascript utility methods",
5
5
  "main": "lib/index.js",
6
6
  "jsnext:main": "lib/index.js",
@@ -47,9 +47,12 @@
47
47
  "react-dom": ">=18"
48
48
  },
49
49
  "devDependencies": {
50
- "@storybook/addon-docs": "^9.1.2",
51
- "@storybook/addon-webpack5-compiler-babel": "^3.0.6",
52
- "@storybook/react-webpack5": "^9.1.2",
50
+ "@babel/preset-env": "7.28.5",
51
+ "@babel/preset-react": "7.28.5",
52
+ "@babel/preset-typescript": "7.28.5",
53
+ "@storybook/addon-docs": "^10.1.11",
54
+ "@storybook/addon-webpack5-compiler-babel": "^4.0.0",
55
+ "@storybook/react-webpack5": "^10.1.11",
53
56
  "@types/file-saver": "^2.0.7",
54
57
  "@types/lodash": "4.17.20",
55
58
  "@types/qs": "^6",
@@ -61,7 +64,7 @@
61
64
  "react-dom": "^18.3.1",
62
65
  "react-router-dom": "^7.8.1",
63
66
  "rimraf": "6.0.1",
64
- "storybook": "^9.1.2",
67
+ "storybook": "^10.1.11",
65
68
  "typescript": "5.8.3"
66
69
  },
67
70
  "browserslist": {