Skip to content

Commit

Permalink
Merge pull request #98 from IABTechLab/llp-UID2-3970-fix-type-errors
Browse files Browse the repository at this point in the history
Add type information for well-known window properties.
  • Loading branch information
lionell-pack-ttd authored Aug 19, 2024
2 parents a09ef80 + c4d4042 commit 4805cfb
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/euidSdk.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { EventType, CallbackHandler } from './callbackManager';
import { CallbackContainer, sdkAssertErrorText, SdkBase, SDKSetup } from './sdkBase';
import { ProductDetails } from './product';
import { UidSecureSignalProviderType } from './secureSignal_types';

export * from './exports';

Expand Down Expand Up @@ -51,6 +52,7 @@ export class EUID extends SdkBase {
declare global {
interface Window {
__euid: EUID | SDKSetup | undefined;
__euidSecureSignalProvider?: UidSecureSignalProviderType;
}
}
export function assertEUID(sdk: typeof window.__euid): asserts sdk is EUID {
Expand Down
3 changes: 2 additions & 1 deletion src/secureSignalEuid.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { isDebugModeOn, UidSecureSignalProvider } from './secureSignal_shared';
import { UidSecureSignalProviderType } from './secureSignal_types';

const INTEG_BASE_URL = 'https://cdn.integ.euid.eu/';

declare global {
interface Window {
getEuidAdvertisingToken?: () => Promise<string | null | undefined>;
__euidSecureSignalProvider?: UidSecureSignalProvider;
__euidSecureSignalProvider?: UidSecureSignalProviderType;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/secureSignalUid2.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { isDebugModeOn, UidSecureSignalProvider } from './secureSignal_shared';
import { UidSecureSignalProviderType } from './secureSignal_types';

const INTEG_BASE_URL = 'https://cdn.integ.uidapi.com/';

declare global {
interface Window {
getUid2AdvertisingToken?: () => Promise<string | null | undefined>;
__uid2SecureSignalProvider?: UidSecureSignalProvider;
__uid2SecureSignalProvider?: UidSecureSignalProviderType;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/secureSignal_shared.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { UidSecureSignalProviderType } from './secureSignal_types';

const MAXIMUM_RETRY = 3;
export class UidSecureSignalProvider {
export class UidSecureSignalProvider implements UidSecureSignalProviderType {
debug: boolean;
isEuid: boolean;

Expand Down Expand Up @@ -73,9 +75,7 @@ export class UidSecureSignalProvider {

async function attempt(error?: unknown) {
if (attempts >= retries) {
window.__uid2SecureSignalProvider?.logging(
`getUidAdvertisingTokenWithRetry failed with error after retry: ${error}`
);
that.logging(`getUidAdvertisingTokenWithRetry failed with error after retry: ${error}`);

reject(error);
return;
Expand Down
3 changes: 3 additions & 0 deletions src/secureSignal_types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface UidSecureSignalProviderType {
registerSecureSignalProvider: () => void;
}
2 changes: 2 additions & 0 deletions src/uid2Sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { isBase64Hash } from './hashedDii';
import { hashAndEncodeIdentifier, hashIdentifier } from './encoding/hash';
import { CallbackContainer, sdkAssertErrorText, SdkBase, SDKSetup } from './sdkBase';
import { ProductDetails } from './product';
import { UidSecureSignalProviderType } from './secureSignal_types';

export * from './exports';

Expand Down Expand Up @@ -100,6 +101,7 @@ declare global {
interface Window {
__uid2: UID2 | SDKSetup | undefined;
__uid2Helper: UID2Helper | undefined;
__uid2SecureSignalProvider?: UidSecureSignalProviderType;
}
}

Expand Down

0 comments on commit 4805cfb

Please sign in to comment.