react-marketing-tools 0.4.3 → 0.4.4
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/analytics/analyticsEventService.d.cts +13 -0
- package/dist/analytics/analyticsEventService.d.ts +13 -0
- package/dist/analytics/ga4GoogleAnalyticsEventTracking.d.cts +3 -0
- package/dist/analytics/ga4GoogleAnalyticsEventTracking.d.ts +3 -0
- package/dist/analytics/handleDataLayerPush.d.cts +3 -0
- package/dist/analytics/handleDataLayerPush.d.ts +3 -0
- package/dist/analytics/helpers.d.cts +41 -0
- package/dist/analytics/helpers.d.ts +41 -0
- package/dist/buildConfig/index.d.cts +8 -0
- package/dist/buildConfig/index.d.ts +8 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.ts +6 -6
- package/dist/ipInfo/index.d.cts +3 -0
- package/dist/ipInfo/index.d.ts +3 -0
- package/dist/react-marketing-tools.es.js +32772 -47978
- package/dist/react-marketing-tools.umd.cjs +1 -0
- package/dist/react-marketing-tools.umd.js +1 -27
- package/dist/types/index.d.cts +130 -0
- package/dist/utilities/assertValueCheckers.d.cts +1 -0
- package/dist/utilities/assertValueCheckers.d.ts +1 -0
- package/dist/utilities/commonFunctions.d.cts +5 -0
- package/dist/utilities/commonFunctions.d.ts +5 -0
- package/dist/utilities/cookies.d.cts +1 -0
- package/dist/utilities/cookies.d.ts +1 -0
- package/package.json +46 -45
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export interface AnalyticsEventActionPrefix extends Record<string, string> {
|
|
2
|
+
}
|
|
3
|
+
export interface AnalyticsGlobalEventAction extends Record<string, string> {
|
|
4
|
+
}
|
|
5
|
+
export type Event = {
|
|
6
|
+
name: string;
|
|
7
|
+
params: Record<AllowedTypes, AllowedTypes>;
|
|
8
|
+
};
|
|
9
|
+
export type GooglePayload = {
|
|
10
|
+
non_personalized_ads: boolean;
|
|
11
|
+
client_id: string;
|
|
12
|
+
user_id: string;
|
|
13
|
+
user_properties: {
|
|
14
|
+
user_id: string;
|
|
15
|
+
user_type: string;
|
|
16
|
+
client_id: string;
|
|
17
|
+
};
|
|
18
|
+
events: Event[];
|
|
19
|
+
};
|
|
20
|
+
export type EventNameInfo = {
|
|
21
|
+
eventName?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
actionPrefix: string;
|
|
24
|
+
globalAppEvent: string;
|
|
25
|
+
previousGlobalAppEvent?: string;
|
|
26
|
+
};
|
|
27
|
+
export type AllowedTypes = string | number;
|
|
28
|
+
export type TrackAnalyticsEventOptions = {
|
|
29
|
+
data: Record<AllowedTypes, AllowedTypes>;
|
|
30
|
+
eventNameInfo: EventNameInfo;
|
|
31
|
+
analyticsType: string;
|
|
32
|
+
userDataKeysToHashArray?: Array<string> | null;
|
|
33
|
+
dataLayerCheck?: boolean;
|
|
34
|
+
consoleLogData?: object;
|
|
35
|
+
};
|
|
36
|
+
export type GlobalVars = {
|
|
37
|
+
app: string;
|
|
38
|
+
device_category?: string | undefined;
|
|
39
|
+
device_os?: string | undefined;
|
|
40
|
+
device_browser?: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
export type DataLayer = {
|
|
43
|
+
event: string;
|
|
44
|
+
globalVars: GlobalVars;
|
|
45
|
+
journeyProps: Record<any, any>;
|
|
46
|
+
userProps: Record<any, any>;
|
|
47
|
+
};
|
|
48
|
+
export type ConsoleLogData = {
|
|
49
|
+
showGlobalVars?: boolean;
|
|
50
|
+
showJourneyPropsPayload?: boolean;
|
|
51
|
+
showUserProps?: boolean;
|
|
52
|
+
};
|
|
53
|
+
export interface AnalyticsTrackerDataOptions {
|
|
54
|
+
consoleLogData: ConsoleLogData | null;
|
|
55
|
+
data: Record<any, any>;
|
|
56
|
+
eventName: string;
|
|
57
|
+
globalAppEvent: string;
|
|
58
|
+
userDetails: Record<any, any>;
|
|
59
|
+
}
|
|
60
|
+
export interface HandleDataLayerPushOptions extends AnalyticsTrackerDataOptions {
|
|
61
|
+
dataLayerCheck: boolean;
|
|
62
|
+
}
|
|
63
|
+
export type ServerLocationData = {
|
|
64
|
+
SERVER_CITY: string;
|
|
65
|
+
SERVER_COUNTRY: string;
|
|
66
|
+
SERVER_HOSTNAME: string;
|
|
67
|
+
SERVER_IP: string;
|
|
68
|
+
SERVER_LOCATION: string;
|
|
69
|
+
SERVER_POSTAL: string;
|
|
70
|
+
SERVER_REGION: string;
|
|
71
|
+
SERVER_TIMEZONE: string;
|
|
72
|
+
};
|
|
73
|
+
export type IpInfo = {
|
|
74
|
+
city: string;
|
|
75
|
+
country: string;
|
|
76
|
+
SERVER_HOSTNAME: string;
|
|
77
|
+
hostname: string;
|
|
78
|
+
ip: string;
|
|
79
|
+
loc: string;
|
|
80
|
+
postal: string;
|
|
81
|
+
region: string;
|
|
82
|
+
timezone: string;
|
|
83
|
+
};
|
|
84
|
+
export type Ga4GoogleAnalyticsEventTracking = AnalyticsTrackerDataOptions;
|
|
85
|
+
export type Platform = 'GOOGLE' | 'FACEBOOK' | 'DATALAYER_PUSH';
|
|
86
|
+
export type AnalyticsPlatform = {
|
|
87
|
+
[key in Platform]: Platform;
|
|
88
|
+
};
|
|
89
|
+
export type Tokens = {
|
|
90
|
+
IP_INFO_TOKEN?: string;
|
|
91
|
+
GA4_PUBLIC_API_SECRET?: string;
|
|
92
|
+
GA4_PUBLIC_MEASUREMENT_ID?: string;
|
|
93
|
+
};
|
|
94
|
+
export type Config = {
|
|
95
|
+
TOKENS?: Tokens;
|
|
96
|
+
appName: string;
|
|
97
|
+
appSessionCookieName: string;
|
|
98
|
+
withDeviceInfo?: boolean;
|
|
99
|
+
includeUserKeys: Array<string>;
|
|
100
|
+
showMissingUserAttributesInConsole: boolean | undefined;
|
|
101
|
+
withServerLocationInfo: boolean | undefined;
|
|
102
|
+
eventActionPrefixList: AnalyticsEventActionPrefix;
|
|
103
|
+
analyticsGlobalEventActionList: AnalyticsGlobalEventAction;
|
|
104
|
+
};
|
|
105
|
+
export type BuildConfigOptions = {
|
|
106
|
+
appName: string;
|
|
107
|
+
appSessionCookieName: string;
|
|
108
|
+
eventActionPrefix?: AnalyticsEventActionPrefix;
|
|
109
|
+
globalEventActionList?: AnalyticsGlobalEventAction;
|
|
110
|
+
includeUserKeys?: Array<string> | undefined;
|
|
111
|
+
showMissingUserAttributesInConsole?: boolean;
|
|
112
|
+
showMeBuildInEventActionPrefixList?: boolean;
|
|
113
|
+
TOKENS?: Tokens;
|
|
114
|
+
withDeviceInfo?: boolean;
|
|
115
|
+
withServerLocationInfo?: boolean;
|
|
116
|
+
};
|
|
117
|
+
export declare let config: Config;
|
|
118
|
+
export type ProviderStateProps = {
|
|
119
|
+
appName: string;
|
|
120
|
+
appSessionCookieName: string;
|
|
121
|
+
analyticsPlatform: AnalyticsPlatform;
|
|
122
|
+
eventActionPrefixList: AnalyticsEventActionPrefix;
|
|
123
|
+
analyticsGlobalEventActionList: AnalyticsGlobalEventAction;
|
|
124
|
+
};
|
|
125
|
+
export type ProviderApiProps = {
|
|
126
|
+
trackAnalyticsEvent: (options: TrackAnalyticsEventOptions) => Promise<void>;
|
|
127
|
+
showMeBuildInAnalyticsPlatform: () => void;
|
|
128
|
+
showMeBuildInEventActionPrefixList: () => void;
|
|
129
|
+
showMeBuildInGlobalEventActionList: () => void;
|
|
130
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const assertIsTrue: (condition: boolean, errorMessage?: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const assertIsTrue: (condition: boolean, errorMessage?: string) => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const isClientSide: () => boolean;
|
|
2
|
+
export declare const objectHasAttributes: (obj: object, key?: string) => boolean;
|
|
3
|
+
export declare const replaceWhiteSpace: (stringValue: string, replaceValue: string) => string;
|
|
4
|
+
export declare const checkAllArrayValuesReturnTrue: (valueArray: boolean[]) => boolean;
|
|
5
|
+
export declare const hashString: (value: string) => Promise<string>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const isClientSide: () => boolean;
|
|
2
|
+
export declare const objectHasAttributes: (obj: object, key?: string) => boolean;
|
|
3
|
+
export declare const replaceWhiteSpace: (stringValue: string, replaceValue: string) => string;
|
|
4
|
+
export declare const checkAllArrayValuesReturnTrue: (valueArray: boolean[]) => boolean;
|
|
5
|
+
export declare const hashString: (value: string) => Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCookieValueByName: (name: string) => string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCookieValueByName: (name: string) => string | undefined;
|
package/package.json
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-marketing-tools",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.4",
|
|
5
5
|
"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.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "bronz3beard <exempli.gratia.webdesign@gmail.com> (https://www.heyrory.com/)",
|
|
8
8
|
"homepage": "https://www.heyrory.com/",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/bronz3beard/react-marketing-tools"
|
|
11
|
+
"url": "git+https://github.com/bronz3beard/react-marketing-tools.git"
|
|
12
12
|
},
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/bronz3beard/react-marketing-tools/issues"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"
|
|
18
|
-
"./dist/types/index.d.ts",
|
|
19
|
-
"./dist/manifest.json",
|
|
20
|
-
"./dist/react-marketing-tools.es.js",
|
|
21
|
-
"./dist/react-marketing-tools.umd.js",
|
|
22
|
-
"./README.md"
|
|
17
|
+
"dist"
|
|
23
18
|
],
|
|
24
19
|
"keywords": [
|
|
25
20
|
"javascript",
|
|
@@ -34,23 +29,35 @@
|
|
|
34
29
|
"pixel",
|
|
35
30
|
"dataLayer"
|
|
36
31
|
],
|
|
37
|
-
"main": "./dist/react-marketing-tools.umd.
|
|
32
|
+
"main": "./dist/react-marketing-tools.umd.cjs",
|
|
38
33
|
"module": "./dist/react-marketing-tools.es.js",
|
|
39
34
|
"types": "./dist/index.d.ts",
|
|
40
35
|
"exports": {
|
|
41
36
|
".": {
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"default": "./dist/react-marketing-tools.es.js"
|
|
40
|
+
},
|
|
41
|
+
"require": {
|
|
42
|
+
"types": "./dist/index.d.cts",
|
|
43
|
+
"default": "./dist/react-marketing-tools.umd.cjs"
|
|
44
|
+
}
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
+
"sideEffects": false,
|
|
47
48
|
"scripts": {
|
|
48
|
-
"
|
|
49
|
-
"build": "
|
|
50
|
-
"
|
|
51
|
-
"
|
|
49
|
+
"build": "vite build && tsc -p tsconfig.build.json && node scripts/emit-cts-types.mjs && node scripts/copy-legacy-umd.mjs",
|
|
50
|
+
"build:watch": "vite build --watch",
|
|
51
|
+
"check:package": "publint --strict && attw --pack .",
|
|
52
|
+
"check:size": "node scripts/check-size.mjs",
|
|
53
|
+
"format": "prettier --write .",
|
|
54
|
+
"format:check": "prettier --check .",
|
|
55
|
+
"lint": "eslint .",
|
|
52
56
|
"mock:publish": "npm pack --dry-run",
|
|
53
|
-
"
|
|
57
|
+
"prepublishOnly": "npm run build && npm run check:size",
|
|
58
|
+
"test": "vitest run",
|
|
59
|
+
"test:watch": "vitest",
|
|
60
|
+
"typecheck": "tsc --noEmit"
|
|
54
61
|
},
|
|
55
62
|
"browserslist": {
|
|
56
63
|
"production": [
|
|
@@ -64,36 +71,30 @@
|
|
|
64
71
|
"last 1 safari version"
|
|
65
72
|
]
|
|
66
73
|
},
|
|
67
|
-
"eslintConfig": {
|
|
68
|
-
"env": {
|
|
69
|
-
"browser": true,
|
|
70
|
-
"node": true,
|
|
71
|
-
"es2020": true
|
|
72
|
-
},
|
|
73
|
-
"extends": [
|
|
74
|
-
"eslint:recommended",
|
|
75
|
-
"plugin:react/recommended"
|
|
76
|
-
],
|
|
77
|
-
"parserOptions": {
|
|
78
|
-
"sourceType": "module"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
74
|
"dependencies": {
|
|
82
|
-
"device-detector-js": "^3.0.3"
|
|
83
|
-
|
|
75
|
+
"device-detector-js": "^3.0.3"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"react": ">=17.0.0"
|
|
84
79
|
},
|
|
85
80
|
"devDependencies": {
|
|
86
|
-
"@
|
|
87
|
-
"@types/
|
|
88
|
-
"@types/react
|
|
89
|
-
"@
|
|
90
|
-
"
|
|
91
|
-
"eslint
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"react-
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
81
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
82
|
+
"@types/node": "^22.20.4",
|
|
83
|
+
"@types/react": "^19.3.0",
|
|
84
|
+
"@types/react-dom": "^19.3.0",
|
|
85
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
86
|
+
"@eslint/js": "^10.0.1",
|
|
87
|
+
"eslint": "^10.11.0",
|
|
88
|
+
"eslint-config-prettier": "^10.1.8",
|
|
89
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
90
|
+
"jsdom": "^30.1.0",
|
|
91
|
+
"prettier": "^3.9.8",
|
|
92
|
+
"publint": "^0.3.24",
|
|
93
|
+
"react": "^19.3.0",
|
|
94
|
+
"react-dom": "^19.3.0",
|
|
95
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
96
|
+
"typescript-eslint": "^8.70.0",
|
|
97
|
+
"vite": "^8.3.0",
|
|
98
|
+
"vitest": "^5.0.1"
|
|
98
99
|
}
|
|
99
100
|
}
|