Replace crypto.randomUUID with a dependency (3165)

This commit is contained in:
Daniel Dudzic 2024-05-27 11:33:34 +02:00
parent 9a17964967
commit a3c610bc1c
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
2 changed files with 4 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import widgetBuilder from "../Renderer/WidgetBuilder";
import merge from "deepmerge"; import merge from "deepmerge";
import {keysToCamelCase} from "./Utils"; import {keysToCamelCase} from "./Utils";
import {getCurrentPaymentMethod} from "./CheckoutMethodState"; import {getCurrentPaymentMethod} from "./CheckoutMethodState";
import { v4 as uuidv4 } from 'uuid';
// This component may be used by multiple modules. This assures that options are shared between all instances. // This component may be used by multiple modules. This assures that options are shared between all instances.
let options = window.ppcpWidgetBuilder = window.ppcpWidgetBuilder || { let options = window.ppcpWidgetBuilder = window.ppcpWidgetBuilder || {
@ -63,7 +64,7 @@ export const loadPaypalScript = (config, onLoaded, onError = null) => {
// Axo SDK options // Axo SDK options
const sdkClientToken = config?.axo?.sdk_client_token; const sdkClientToken = config?.axo?.sdk_client_token;
const uuid = self.crypto.randomUUID(); const uuid = uuidv4().replace(/-/g, '');
if(sdkClientToken) { if(sdkClientToken) {
scriptOptions['data-sdk-client-token'] = sdkClientToken; scriptOptions['data-sdk-client-token'] = sdkClientToken;
scriptOptions['data-client-metadata-id'] = uuid; scriptOptions['data-client-metadata-id'] = uuid;

View file

@ -94,6 +94,7 @@
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"playwright": "^1.43.0", "playwright": "^1.43.0",
"run-s": "^0.0.0" "run-s": "^0.0.0",
"uuid": "^9.0.1"
} }
} }