react-marketing-tools 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,144 @@
1
- export * from './lib/analytics/types'
2
- export * from './lib/buildConfig/types'
3
- export * from './lib/ipInfo/types'
4
- export * from './lib/types'
5
- export * from './lib/index'
1
+ // react-marketing-tools.d.ts
2
+
3
+ declare module 'react-marketing-tools' {
4
+ // Event types
5
+ export type Event = {
6
+ name: string
7
+ params: Record<AllowedTypes, AllowedTypes>
8
+ }
9
+
10
+ // GooglePayload type - Represents the payload structure for Google Analytics
11
+ export type GooglePayload = {
12
+ non_personalized_ads: boolean
13
+ client_id: string
14
+ user_id: string
15
+ user_properties: {
16
+ user_id: string
17
+ user_type: string
18
+ client_id: string
19
+ }
20
+ events: Event[]
21
+ }
22
+
23
+ // EventNameInfo type - Information about a specific analytics event
24
+ export type EventNameInfo = {
25
+ eventName: string
26
+ description?: string
27
+ actionPrefix: string
28
+ globalAppEvent: string
29
+ previousGlobalAppEvent?: string
30
+ }
31
+
32
+ // AllowedTypes type - Union type for allowed parameter types in events
33
+ export type AllowedTypes = string | number
34
+
35
+ // TrackAnalyticsEventOptions type - Options for tracking an analytics event
36
+ export type TrackAnalyticsEventOptions = {
37
+ data: Record<AllowedTypes, AllowedTypes>
38
+ eventNameInfo: EventNameInfo
39
+ analyticsType: string
40
+ userDataToHashKeyArray: Array<string> | null
41
+ dataLayerCheck: boolean
42
+ consoleLogData?: object
43
+ }
44
+
45
+ // GlobalVars type - Represents global variables in analytics tracking
46
+ export type GlobalVars = {
47
+ app: string
48
+ device_category?: string | undefined
49
+ device_os?: string | undefined
50
+ device_browser?: string | undefined
51
+ }
52
+
53
+ // DataLayer type - Represents the data layer for analytics events
54
+ export type DataLayer = {
55
+ event: string
56
+ globalVars: GlobalVars
57
+ journeyProps: Record<any, any>
58
+ userProps: Record<any, any>
59
+ }
60
+
61
+ // ConsoleLogData type - Options for console logging analytics data
62
+ export type ConsoleLogData = {
63
+ showGlobalVars?: boolean
64
+ showJourneyPropsPayload?: boolean
65
+ showUserProps?: boolean
66
+ }
67
+
68
+ // AnalyticsTrackerDataOptions interface - Options for analytics tracking
69
+ export interface AnalyticsTrackerDataOptions {
70
+ consoleLogData: ConsoleLogData | null
71
+ data: Record<any, any>
72
+ eventName: string
73
+ globalAppEvent: string
74
+ userDetails: Record<any, any>
75
+ }
76
+
77
+ // HandleDataLayerPushOptions type - Options for handling data layer push
78
+ export interface HandleDataLayerPushOptions
79
+ extends AnalyticsTrackerDataOptions {
80
+ dataLayerCheck: boolean
81
+ }
82
+
83
+ // Ga4GoogleAnalyticsEventTracking type - Options for GA4 Google Analytics event tracking
84
+ export type Ga4GoogleAnalyticsEventTracking = AnalyticsTrackerDataOptions
85
+
86
+ // Platform type - Union type for supported analytics platforms
87
+ export type Platform = 'GOOGLE' | 'FACEBOOK' | 'DATALAYER_PUSH'
88
+
89
+ // Tokens type - Represents tokens used in the analytics configuration
90
+ export type Tokens = {
91
+ IP_INFO_TOKEN?: string
92
+ GA4_PUBLIC_API_SECRET?: string
93
+ GA4_PUBLIC_MEASUREMENT_ID?: string
94
+ }
95
+
96
+ // Config type - Represents the configuration for analytics tracking
97
+ export type Config = {
98
+ TOKENS?: Tokens
99
+ appName: string
100
+ appSessionCookieName: string
101
+ withDeviceInfo?: boolean
102
+ includeUserKeys: Array<string>
103
+ showMissingUserAttributesInConsole: boolean | undefined
104
+ withServerLocationInfo: boolean | undefined
105
+ eventActionPrefixList: Record<string, string>
106
+ analyticsGlobalEventActionList: Record<string, string>
107
+ }
108
+
109
+ // BuildConfigOptions type - Options for building the analytics configuration
110
+ export type BuildConfigOptions = {
111
+ appName: string
112
+ appSessionCookieName: string
113
+ eventActionPrefix?: Record<string, string>
114
+ globalEventActionList?: Record<string, string>
115
+ includeUserKeys?: boolean
116
+ showMissingUserAttributesInConsole?: boolean
117
+ TOKENS?: Tokens
118
+ withDeviceInfo?: boolean
119
+ withServerLocationInfo?: boolean
120
+ }
121
+
122
+ // Function declarations
123
+ export const analyticsPlatform: {
124
+ [key in Platform]: Platform
125
+ }
126
+
127
+ // Function to log supported analytics platforms
128
+ export const showMeBuildInAnalyticsPlatform: () => void
129
+
130
+ export const analyticsEventActionPrefixList: Record<string, string>
131
+
132
+ // Function to log built-in event action prefix list
133
+ export const showMeBuildInEventActionPrefixList: () => void
134
+
135
+ export const analyticsGlobalEventActionList: Record<string, string>
136
+
137
+ // Function to log built-in global event action list
138
+ export const showMeBuildInGlobalEventActionList: () => void
139
+
140
+ export let config: Config
141
+
142
+ // Function to build the analytics configuration
143
+ export const buildConfig: (options: BuildConfigOptions) => void
144
+ }
@@ -1,4 +1,5 @@
1
- import { Platform, TrackAnalyticsEventOptions } from '..';
1
+ import { TrackAnalyticsEventOptions } from './analytics/types';
2
+ import { Platform } from './buildConfig/types';
2
3
  export declare type ProviderStateProps = {
3
4
  appName: string;
4
5
  appSessionCookieName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-marketing-tools",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "React Marketing Tools are a set of tools to make it easier for you to implement analytics and track user journeys, interactions throughout your App. using dataLayer/Google Tag Manager, GA4 fetch directly or coming soon facebook pixel.",
5
5
  "license": "MIT",
6
6
  "author": "bronz3beard <exempli.gratia.webdesign@gmail.com> (https://www.heyrory.com/)",
@@ -43,7 +43,8 @@
43
43
  "build": "tsc && vite build",
44
44
  "build:watch": "tsc && vite build --watch",
45
45
  "preview": "vite preview",
46
- "mock:publish": "npm pack --dry-run"
46
+ "mock:publish": "npm pack --dry-run",
47
+ "check-types": "tsc --noEmit --pretty"
47
48
  },
48
49
  "browserslist": {
49
50
  "production": [