Skip to content

Commit 88ce76b

Browse files
authored
fix(analytics): package.json fields (#2660)
1 parent 8c49f31 commit 88ce76b

File tree

7 files changed

+23
-10
lines changed

7 files changed

+23
-10
lines changed

.changeset/fruity-bottles-lie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@scaleway/use-analytics": patch
3+
---
4+
5+
remove fields from package.json

packages/use-analytics/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55
"engines": {
66
"node": ">=20.x"
77
},
8-
"main": "./dist/index.cjs",
98
"sideEffects": false,
109
"type": "module",
11-
"module": "./dist/index.js",
12-
"types": "./dist/index.d.ts",
1310
"exports": {
1411
".": {
1512
"types": "./dist/analytics/index.d.ts",

packages/use-analytics/src/analytics/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ConsentOptions, LoadOptions } from '@rudderstack/analytics-js'
22

3-
export const consentOptions: ConsentOptions = {
3+
export const defaultConsentOptions: ConsentOptions = {
44
trackConsent: true,
55
discardPreConsentEvents: true,
66
storage: {

packages/use-analytics/src/analytics/useAnalytics.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { ReactNode } from 'react'
55
import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect'
66
import { destSDKBaseURL, pluginsSDKBaseURL } from '../constants'
77
import type { CategoryKind } from '../types'
8-
import { consentOptions, defaultLoadOptions } from './constants'
8+
import { defaultConsentOptions, defaultLoadOptions } from './constants'
99
import { trackLink } from './segments/trackLink'
1010
import type { TrackLink } from './segments/trackLink'
1111
import { userMigrationsTraits } from './segments/userMigrationsTraits'
@@ -111,7 +111,7 @@ export function AnalyticsProvider<T extends Events>({
111111
userMigrationsTraits(rudderAnalytics)
112112

113113
rudderAnalytics.consent({
114-
...consentOptions,
114+
...defaultConsentOptions,
115115
consentManagement: {
116116
enabled: true,
117117
allowedConsentIds: allowedConsents,

packages/use-analytics/src/cookies-consent/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ export {
22
CookieConsentProvider,
33
useCookieConsent,
44
} from './CookieConsentProvider'
5-
// export { SegmentConsentMiddleware } from './SegmentConsentMiddleware'
5+
export { CATEGORIES } from '../constants'
6+
export type { AnalyticsIntegration, CategoryKind, Consents } from '../types'
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1+
export { AnalyticsProvider, useAnalytics, useDestinations } from './analytics'
2+
export {
3+
defaultLoadOptions,
4+
defaultConsentOptions,
5+
} from './analytics/constants'
6+
17
export type {
28
Analytics,
39
OnEventError,
410
AnalyticsProviderProps,
511
} from './analytics/useAnalytics'
6-
7-
export { AnalyticsProvider, useAnalytics, useDestinations } from './analytics'
12+
export type {
13+
AnalyticsIntegration,
14+
CategoryKind,
15+
Consents,
16+
Consent,
17+
} from './types'

packages/use-analytics/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const isCategoryKind = (key: string): key is CategoryKind =>
99
type Provider = 'custom'
1010
type ResolutionStrategy = 'and' | 'or'
1111

12-
type Consents = { consent: CategoryKind }[]
12+
export type Consents = { consent: CategoryKind }[]
1313

1414
type Destination = {
1515
id: string

0 commit comments

Comments
 (0)