diff --git a/src/cookieSyncManager.interfaces.ts b/src/cookieSyncManager.interfaces.ts new file mode 100644 index 000000000..1f471a5b9 --- /dev/null +++ b/src/cookieSyncManager.interfaces.ts @@ -0,0 +1,23 @@ +import { MPID } from "@mparticle/web-sdk"; +import { Dictionary } from "./utils"; +import { IConsentRules } from "./consent"; + +export interface ICookieSyncManager { + attemptCookieSync: (previousMPID: MPID, mpid: MPID, mpidIsNotInCookies: boolean) => void; + performCookieSync: ( + url: string, + moduleId: number, + mpid: MPID, + cookieSyncDates: Dictionary, + 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; +} \ No newline at end of file diff --git a/src/cookieSyncManager.js b/src/cookieSyncManager.js index 0eadf9201..b5026149a 100644 --- a/src/cookieSyncManager.js +++ b/src/cookieSyncManager.js @@ -146,8 +146,15 @@ export default function cookieSyncManager(mpInstance) { }; // Private - // TODO: Rename function to replaceAmpWithAmpersand + /** + * @deprecated replaceAmp has been deprecated, use replaceAmpersandWithAmp instead + */ this.replaceAmp = function(string) { + return this.replaceAmpWithAmpersand(string); + }; + + // Private + this.replaceAmpWithAmpersand = function(string) { return string.replace(/&/g, '&'); }; diff --git a/src/sdkRuntimeModels.ts b/src/sdkRuntimeModels.ts index 8bf74bfbd..9f6c5a9c2 100644 --- a/src/sdkRuntimeModels.ts +++ b/src/sdkRuntimeModels.ts @@ -31,6 +31,7 @@ import { } from './identity-user-interfaces'; import { IIdentityType } from './types.interfaces'; import IntegrationCapture from './integrationCapture'; +import { ICookieSyncManager } from './cookieSyncManager.interfaces'; // TODO: Resolve this with version in @mparticle/web-sdk export type SDKEventCustomFlags = Dictionary; @@ -158,6 +159,7 @@ export interface MParticleWebSDK { Logger: SDKLoggerApi; MPSideloadedKit: IMPSideloadedKit; _APIClient: any; // TODO: Set up API Client + _CookieSyncManager: ICookieSyncManager; _Store: IStore; _Forwarders: any; _Helpers: SDKHelpersApi;