Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace references of uuid with crypto.randomUUID #12361

Draft
wants to merge 17 commits into
base: latest
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ updates:
update-types: ['version-update:semver-major']
# https://jira.dev.bbc.co.uk/browse/NEWSWORLDSERVICE-2186: Latest version of Emotion contains a memory leak that needs resolved: https://github.com/emotion-js/emotion/issues/3221
- dependency-name: '@emotion/*'
# Opera Mini unsupported packages
- dependency-name: 'uuid' # https://github.com/bbc/simorgh/pull/11840
- dependency-name: '@types/uuid' # https://github.com/bbc/simorgh/pull/11840
# https://jira.dev.bbc.co.uk/browse/NEWSWORLDSERVICE-1478 react-router & react-router-dom
- dependency-name: 'react-router-dom'
- dependency-name: 'react-router'
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .yarn/cache/fsevents-patch-6b67494872-10.zip
Binary file not shown.
Binary file removed .yarn/cache/uuid-npm-3.4.0-4fd8ef88ad-4f2b86432b.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion data/mundo/send/u50853489.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"privacyNotice": {
"default": "<p>Si bien leemos lo mensajes que recibimos, no podemos garantizar que responderemos a todos.</p>\n<p>Los datos personales que proporcione ser&aacute;n procesados por la BBC y cualquier proveedor de servicios relevante del que dependamos para respaldar nuestros sistemas de quejas y de participaci&oacute;n de la audiencia con el fin manejar sus comentarios. La BBC y nuestros proveedores de servicios retendr&aacute;n sus datos de acuerdo con nuestra pol&iacute;tica de retenci&oacute;n y el Reglamento General de Protecci&oacute;n de Datos.</p>\n<p>La BBC procesa sus datos sobre la base de sus intereses leg&iacute;timos como organizaci&oacute;n de medios para responder a los comentarios y preocupaciones de la audiencia. Visite la <a href=\"https://www.bbc.com/mundo/institucional-36400009\">Cl&aacute;usula de privacidad</a> y <a href=\"http://www.bbc.co.uk/usingthebbc/cookies/\">Cookies</a> de la BBC para obtener m&aacute;s informaci&oacute;n sobre c&oacute;mo la BBC maneja sus datos. Si presenta una queja ante la BBC sobre c&oacute;mo manejamos sus datos personales y usted no est&aacute; satisfecho con nuestra respuesta, puede presentar una queja ante la Oficina del Comisionado de Informaci&oacute;n de Reino Unido.</p>",
"url": "https://www.bbc.com/mundo/institucional-36400009",
"additional": ""
"additional": ""
},
"settings": {
"moderationRequired": false,
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"resolutions": {
"@babel/runtime": "7.26.7",
"@optimizely/js-sdk-utils": "0.4.0",
"uuid": "3.4.0",
"[email protected]": "patch:winston@npm:3.8.2#.yarn/patches/winston-npm-3.8.2-2035e9cac4.patch",
"cookie": "0.7.1"
},
Expand Down Expand Up @@ -128,7 +127,6 @@
"react-router-dom": "5.3.4",
"undici": "7.3.0",
"url-parse": "1.5.10",
"uuid": "8.3.2",
"winston": "patch:[email protected]#./patches/winston-file-descriptor.patch"
},
"devDependencies": {
Expand Down Expand Up @@ -192,7 +190,6 @@
"@types/react-router-dom": "5.3.3",
"@types/testing-library__react": "10.2.0",
"@types/url-parse": "^1.4.8",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "8.22.0",
"amphtml-validator": "1.0.38",
Expand Down
4 changes: 2 additions & 2 deletions scripts/bundleSize/bundleSizeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
* We are allowing a variance of -5 on `MIN_SIZE` and +5 on `MAX_SIZE` to avoid the need for frequent changes, as bundle sizes can fluctuate
*/

export const MIN_SIZE = 640 - 5;
export const MAX_SIZE = 1174 + 5;
export const MIN_SIZE = 659 - 5;
export const MAX_SIZE = 1206 + 5;
4 changes: 4 additions & 0 deletions src/app/contexts/UserContext/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ const DummyComponentWithContext = () => (
</UserContextProvider>
);

jest.mock('#app/lib/utilities/getUUID', () =>
jest.fn().mockImplementation(() => '12345678-abcd-1fed-0123-a1b2c3d4e5f6'),
);

describe('UserContext', () => {
beforeEach(() => {
(getCookiePolicy as jest.Mock).mockReturnValue('111');
Expand Down
4 changes: 2 additions & 2 deletions src/app/contexts/UserContext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import React, {
SetStateAction,
useMemo,
} from 'react';
import { v4 as uuid } from 'uuid';
import Cookie from 'js-cookie';
import onClient from '#app/lib/utilities/onClient';
import isOperaProxy from '#app/lib/utilities/isOperaProxy';
import setCookie from '#app/lib/utilities/setCookie';
import getUUID from '#app/lib/utilities/getUUID';
import { getCookiePolicy, personalisationEnabled } from './cookies';
import Chartbeat from './Chartbeat';

Expand All @@ -29,7 +29,7 @@ const cknsMvtCookie = () => {
const cookieValue = Cookie.get(cookieName);

if (!cookieValue) {
const cookieUuid = uuid();
const cookieUuid = getUUID();
setCookie({ name: cookieName, value: cookieUuid });
}
};
Expand Down
Loading
Loading