@@ -8,8 +8,9 @@ const ejs = require('ejs');
88const express = require ( 'express' ) ;
99const nocache = require ( 'nocache' ) ;
1010const { JSDOM } = require ( 'jsdom' ) ;
11- const fs = require ( 'fs' ) ;
12- const path = require ( 'path' ) ;
11+ const axios = require ( 'axios' ) ;
12+ const crypto = require ( 'crypto' ) ;
13+ const util = require ( 'util' ) ;
1314
1415const app = express ( ) ;
1516const port = process . env . PORT || 3034 ;
@@ -30,8 +31,6 @@ let uid2Sdk = null;
3031let dom = null ;
3132
3233async function initializeSDK ( ) {
33- const crypto = require ( 'crypto' ) ;
34-
3534 // Create a virtual DOM environment
3635 dom = new JSDOM ( '<!DOCTYPE html><html><body></body></html>' , {
3736 url : 'http://localhost' ,
@@ -55,15 +54,13 @@ async function initializeSDK() {
5554 } ) ;
5655
5756 // Polyfill TextEncoder and TextDecoder (required by the SDK)
58- const util = require ( 'util' ) ;
5957 global . TextEncoder = util . TextEncoder ;
6058 global . TextDecoder = util . TextDecoder ;
6159 dom . window . TextEncoder = util . TextEncoder ;
6260 dom . window . TextDecoder = util . TextDecoder ;
6361
6462 // Load the UID2 SDK script from CDN
6563 try {
66- const axios = require ( 'axios' ) ;
6764 const response = await axios . get ( uidJsSdkUrl ) ;
6865
6966 // Execute the SDK code in the jsdom context
0 commit comments