Skip to content

Commit 0e9cbfe

Browse files
Address PR Comments
1 parent e2c6d5c commit 0e9cbfe

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

src/cookieSyncManager.interfaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { MPID } from '@mparticle/web-sdk';
22
import { Dictionary } from './utils';
33
import { IConsentRules } from './consent';
44

5+
export type CookieSyncDates = Dictionary<number>;
56
export interface ICookieSyncManager {
67
attemptCookieSync: (
78
previousMPID: MPID,
@@ -12,7 +13,7 @@ export interface ICookieSyncManager {
1213
url: string,
1314
moduleId: string,
1415
mpid: MPID,
15-
cookieSyncDates: Dictionary<number>,
16+
cookieSyncDates: CookieSyncDates,
1617
filteringConsentRuleValues: IConsentRules,
1718
mpidIsNotInCookies: boolean,
1819
requiresConsent: boolean

src/cookieSyncManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { isEmpty, replaceAmpWithAmpersand, replaceMPID } from './utils';
22
import Constants from './constants';
3-
import { ICookieSyncManager } from './cookieSyncManager.interfaces';
3+
import { CookieSyncDates, ICookieSyncManager } from './cookieSyncManager.interfaces';
44
import { MParticleWebSDK } from './sdkRuntimeModels';
5-
import { Dictionary, MPID } from '@mparticle/web-sdk';
5+
import { MPID } from '@mparticle/web-sdk';
66
import { IConsentRules } from './consent';
77

88
const { Messages } = Constants;
@@ -143,7 +143,7 @@ export default function CookieSyncManager(
143143
url: string,
144144
moduleId: string,
145145
mpid: MPID,
146-
cookieSyncDates: Dictionary<number>,
146+
cookieSyncDates: CookieSyncDates,
147147
filteringConsentRuleValues: IConsentRules,
148148
mpidIsNotInCookies: boolean,
149149
requiresConsent: boolean

src/persistence.interfaces.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import { Dictionary } from './utils';
1515
import { IMinifiedConsentJSONObject } from './consent';
1616
import { UserAttributes } from './identity-user-interfaces';
17+
import { CookieSyncDates } from './cookieSyncManager.interfaces';
1718

1819
export type UploadsTable = Dictionary<any>;
1920
export interface iForwardingStatsBatches {
@@ -79,10 +80,8 @@ export interface IPersistenceMinified extends Dictionary {
7980
// };
8081
}
8182

82-
export type CookieSyncDate = Dictionary<number>;
83-
8483
export interface IUserPersistenceMinified extends Dictionary {
85-
csd: CookieSyncDate; // Cookie Sync Dates // list of timestamps for last cookie sync
84+
csd: CookieSyncDates; // Cookie Sync Dates // list of timestamps for last cookie sync
8685
con: IMinifiedConsentJSONObject; // Consent State
8786
ui: UserIdentities; // User Identities
8887
ua: UserAttributes; // User Attributes
@@ -121,7 +120,7 @@ export interface IPersistence {
121120
getDomain(doc: string, locationHostname: string): string;
122121
getCartProducts(mpid: MPID): Product[];
123122
setCartProducts(allProducts: Product[]): void;
124-
saveUserCookieSyncDatesToPersistence(mpid: MPID, csd: CookieSyncDate): void;
123+
saveUserCookieSyncDatesToPersistence(mpid: MPID, csd: CookieSyncDates): void;
125124
savePersistence(persistance: IPersistenceMinified): void;
126125
getPersistence(): IPersistenceMinified;
127126
getFirstSeenTime(mpid: MPID): string | null;

src/store.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
IGlobalStoreV2MinifiedKeys,
3838
IPersistenceMinified,
3939
} from './persistence.interfaces';
40+
import { CookieSyncDates } from './cookieSyncManager.interfaces';
4041

4142
// This represents the runtime configuration of the SDK AFTER
4243
// initialization has been complete and all settings and
@@ -168,7 +169,7 @@ export interface IStore {
168169
identifyCalled: boolean;
169170
isLoggedIn: boolean;
170171
sideloadedKitsCount?: number;
171-
cookieSyncDates: Dictionary<number>;
172+
cookieSyncDates: CookieSyncDates;
172173
integrationAttributes: IntegrationAttributes;
173174
requireDelay: boolean;
174175
isLocalStorageAvailable: boolean | null;

test/jest/cookieSyncManager.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ describe.only('CookieSyncManager', () => {
440440
expect(loggerSpy).toHaveBeenCalledWith('Performing cookie sync');
441441
});
442442

443-
it.only('should return early if the user has not consented to the cookie sync', () => {
443+
it('should return early if the user has not consented to the cookie sync', () => {
444444
const mockImage = {
445445
onload: jest.fn(),
446446
src: '',
@@ -494,7 +494,7 @@ describe.only('CookieSyncManager', () => {
494494
expect(cookieSyncDates[42]).toBeUndefined();
495495
});
496496

497-
it.only('should return early if requiresConsent and mpidIsNotInCookies are both true', () => {
497+
it('should return early if requiresConsent and mpidIsNotInCookies are both true', () => {
498498
const mockImage = {
499499
onload: jest.fn(),
500500
src: '',

0 commit comments

Comments
 (0)