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

refactor: Migrate CookieSyncManager to TypeScript #944

Merged
merged 23 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 22 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: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ test/integrations/requirejs/test-requirejs-bundle.js
browserstack.err
local.log
test/cross-browser-testing/CBT-tests-es5.js
test/cross-browser-testing/CBT-tests.js
test/cross-browser-testing/CBT-tests.js
coverage/
14 changes: 2 additions & 12 deletions src/configAPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
FetchUploader,
XHRUploader,
} from './uploaders';
import { IPixelConfiguration } from './cookieSyncManager.interfaces';

export interface IKitConfigs extends IKitFilterSettings {
name: string;
Expand Down Expand Up @@ -65,17 +66,6 @@ export interface IConsentRuleValue {
hasConsented: boolean;
}

export interface IPixelConfig {
name: string;
moduleId: number;
esId: number;
isDebug: boolean;
isProduction: boolean;
settings: Dictionary;
frequencyCap: number;
pixelUrl: string;
redirectUrl: string;
}

export interface IConfigResponse {
appName: string;
Expand All @@ -85,7 +75,7 @@ export interface IConfigResponse {
secureServiceUrl: string;
minWebviewBridgeVersion: number;
workspaceToken: string;
pixelConfigs: IPixelConfig[];
pixelConfigs: IPixelConfiguration[];
flags: SDKEventCustomFlags;
}

Expand Down
4 changes: 4 additions & 0 deletions src/consent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export interface SDKConsentApi {
createConsentState: (consentState?: ConsentState) => ConsentState;
ConsentSerialization: IConsentSerialization;
createPrivacyConsent: ICreatePrivacyConsentFunction;
isEnabledForUserConsent: (
consentRules: IConsentRules,
user: IMParticleUser
) => boolean;
alexs-mparticle marked this conversation as resolved.
Show resolved Hide resolved
}

export interface IConsentSerialization {
Expand Down
44 changes: 30 additions & 14 deletions src/cookieSyncManager.interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
import { MPID } from "@mparticle/web-sdk";
import { Dictionary } from "./utils";
import { IConsentRules } from "./consent";
import { MPID } from '@mparticle/web-sdk';
import { Dictionary } from './utils';
import { IConsentRules } from './consent';

export type CookieSyncDates = Dictionary<number>;

export interface IPixelConfiguration {
name?: string;
moduleId: number;
esId?: number;
isDebug?: boolean;
isProduction?: boolean;
settings: Dictionary<string>;
frequencyCap: number;
pixelUrl: string;
redirectUrl: string;
filteringConsentRuleValues?: IConsentRules;
}
export interface ICookieSyncManager {
attemptCookieSync: (previousMPID: MPID, mpid: MPID, mpidIsNotInCookies: boolean) => void;
attemptCookieSync: (
previousMPID: MPID,
mpid: MPID,
mpidIsNotInCookies?: boolean
) => void;
performCookieSync: (
url: string,
moduleId: number,
moduleId: string,
mpid: MPID,
alexs-mparticle marked this conversation as resolved.
Show resolved Hide resolved
cookieSyncDates: Dictionary<number>,
cookieSyncDates: CookieSyncDates,
filteringConsentRuleValues: IConsentRules,
mpidIsNotInCookies: boolean,
requiresConsent: boolean
) => void;
replaceAmpWithAmpersand: (string: string) => string;
replaceMPID: (string: string, mpid: MPID) => string;

/**
* @deprecated replaceAmp has been deprecated, use replaceAmpersandWithAmp instead
*/
replaceAmp: (string: string) => string;
}
combineUrlWithRedirect: (
mpid: MPID,
pixelUrl: string,
redirectUrl: string
) => string;
}
204 changes: 0 additions & 204 deletions src/cookieSyncManager.js

This file was deleted.

Loading
Loading