diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..8abaea2 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +nodejs 16.14.0 diff --git a/package.json b/package.json index e3688e6..1bdf0d5 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@sentry/integrations": "^6.19.7", "@sentry/react": "^6.19.7", "@sentry/tracing": "^6.19.7", - "clarity-js": "^0.7.24", + "clarity-js": "^0.7.32", "jest-environment-jsdom": "^29.7.0", "mixpanel-browser": "^2.49.0", "react": "^18.2.0" diff --git a/src/initializers/index.ts b/src/initializers/index.ts index 3ff7ea6..ba71d95 100644 --- a/src/initializers/index.ts +++ b/src/initializers/index.ts @@ -33,6 +33,7 @@ const clarityInitializer = ( track: true, content: true, }); + clarity.consent(); } }; diff --git a/src/providers/setups/clarity/clarity.spec.ts b/src/providers/setups/clarity/clarity.spec.ts index 36714c9..242334b 100644 --- a/src/providers/setups/clarity/clarity.spec.ts +++ b/src/providers/setups/clarity/clarity.spec.ts @@ -5,32 +5,15 @@ jest.mock('clarity-js', () => ({ clarity: { identify: jest.fn(), set: jest.fn(), + consent: jest.fn(), }, })); describe('ClarityProvider', () => { it('dispatchUserIdentification should call clarity.identify with correct arguments', () => { const userId = 'user123'; - ClarityProvider.userIdentification(userId, ''); expect(clarity.identify).toHaveBeenCalledWith(userId); }); - - it('dispatchCustomEvent should call clarity.set with correct arguments', () => { - const eventName = 'clickEvent'; - const properties = { key: 'value' }; - - ClarityProvider.customEvent(eventName, properties); - - expect(clarity.set).toHaveBeenCalledWith(eventName, 'customEvent'); - }); - - it('dispatchScreenEvent should call clarity.set with correct arguments', () => { - const screenName = 'HomeScreen'; - - ClarityProvider.screenEvent(screenName); - - expect(clarity.set).toHaveBeenCalledWith(screenName, 'screen'); - }); }); diff --git a/src/providers/setups/clarity/clarity.ts b/src/providers/setups/clarity/clarity.ts index 7c97e03..4e44b9b 100644 --- a/src/providers/setups/clarity/clarity.ts +++ b/src/providers/setups/clarity/clarity.ts @@ -12,6 +12,7 @@ const dispatchUserIdentification = ( id: string, userProperties: IUserProperties, ): void => { + clarity.consent(); clarity.identify(id); }; @@ -19,11 +20,9 @@ const dispatchCustomEvent = ( event: string, properties: PropertiesType, ): void => { - clarity.set(event, 'customEvent'); }; const dispatchScreenEvent = (screen: string): void => { - clarity.set(screen, 'screen'); }; const ClarityProvider: ProviderType = {