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: Remove Cookie Sync Interfaces File #961

Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/configAPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
FetchUploader,
XHRUploader,
} from './uploaders';
import { IPixelConfiguration } from './cookieSyncManager.interfaces';
import { IPixelConfiguration } from './cookieSyncManager';

export interface IKitConfigs extends IKitFilterSettings {
name: string;
Expand Down
39 changes: 0 additions & 39 deletions src/cookieSyncManager.interfaces.ts

This file was deleted.

39 changes: 37 additions & 2 deletions src/cookieSyncManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { isEmpty, replaceAmpWithAmpersand, replaceMPID } from './utils';
import { Dictionary, isEmpty, replaceAmpWithAmpersand, replaceMPID } from './utils';
import Constants from './constants';
import { CookieSyncDates, ICookieSyncManager, IPixelConfiguration } from './cookieSyncManager.interfaces';
import { MParticleWebSDK } from './sdkRuntimeModels';
import { MPID } from '@mparticle/web-sdk';
import { IConsentRules } from './consent';
Expand All @@ -10,6 +9,42 @@ const { InformationMessages } = Messages;

export const DAYS_IN_MILLISECONDS = 1000 * 60 * 60 * 24;

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;
performCookieSync: (
url: string,
moduleId: string,
mpid: MPID,
cookieSyncDates: CookieSyncDates,
filteringConsentRuleValues: IConsentRules,
mpidIsNotInCookies: boolean,
requiresConsent: boolean
) => void;
combineUrlWithRedirect: (
mpid: MPID,
pixelUrl: string,
redirectUrl: string
) => string;
}

const hasFrequencyCapExpired = (
frequencyCap: number,
lastSyncDate?: number,
Expand Down
2 changes: 1 addition & 1 deletion src/persistence.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { Dictionary } from './utils';
import { IMinifiedConsentJSONObject } from './consent';
import { UserAttributes } from './identity-user-interfaces';
import { CookieSyncDates } from './cookieSyncManager.interfaces';
import { CookieSyncDates } from './cookieSyncManager';

export type UploadsTable = Dictionary<any>;
export interface iForwardingStatsBatches {
Expand Down
2 changes: 1 addition & 1 deletion src/sdkRuntimeModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
} from './types';
import IntegrationCapture from './integrationCapture';
import { INativeSdkHelpers } from './nativeSdkHelpers.interfaces';
import { ICookieSyncManager, IPixelConfiguration } from './cookieSyncManager.interfaces';
import { ICookieSyncManager, IPixelConfiguration } from './cookieSyncManager';

// TODO: Resolve this with version in @mparticle/web-sdk
export type SDKEventCustomFlags = Dictionary<any>;
Expand Down
2 changes: 1 addition & 1 deletion src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
IGlobalStoreV2MinifiedKeys,
IPersistenceMinified,
} from './persistence.interfaces';
import { CookieSyncDates, IPixelConfiguration } from './cookieSyncManager.interfaces';
import { CookieSyncDates, IPixelConfiguration } from './cookieSyncManager';

// This represents the runtime configuration of the SDK AFTER
// initialization has been complete and all settings and
Expand Down
6 changes: 4 additions & 2 deletions test/jest/cookieSyncManager.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import CookieSyncManager, { DAYS_IN_MILLISECONDS } from '../../src/cookieSyncManager';
import { IPixelConfiguration } from '../../src/cookieSyncManager.interfaces';
import CookieSyncManager, {
DAYS_IN_MILLISECONDS,
IPixelConfiguration,
} from '../../src/cookieSyncManager';
import { MParticleWebSDK } from '../../src/sdkRuntimeModels';
import { testMPID } from '../src/config/constants';

Expand Down
2 changes: 1 addition & 1 deletion test/src/tests-cookie-syncing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fetchMock from 'fetch-mock/esm/client';
import { urls, testMPID, MPConfig, v4LSKey, apiKey } from './config/constants';
import { MParticleWebSDK } from '../../src/sdkRuntimeModels';
import { IMParticleUser } from '../../src/identity-user-interfaces';
import { IPixelConfiguration } from '../../src/cookieSyncManager.interfaces';
import { IPixelConfiguration } from '../../src/cookieSyncManager';
import { IConsentRules } from '../../src/consent';
const { fetchMockSuccess, waitForCondition, hasIdentifyReturned } = Utils;

Expand Down
Loading