react-marketing-tools 0.3.5 → 0.3.7
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 +1 -0
- package/package.json +5 -4
- package/dist/.vite/manifest.json +0 -7
- package/dist/analytics/analyticsEventService.d.ts +0 -13
- package/dist/analytics/ga4GoogleAnalyticsEventTracking.d.ts +0 -3
- package/dist/analytics/handleDataLayerPush.d.ts +0 -3
- package/dist/analytics/helpers.d.ts +0 -41
- package/dist/buildConfig/index.d.ts +0 -8
- package/dist/ipInfo/index.d.ts +0 -3
- package/dist/types/index.d.ts +0 -125
- package/dist/utilities/assertValueCheckers.d.ts +0 -1
- package/dist/utilities/commonFunctions.d.ts +0 -5
- package/dist/utilities/cookies.d.ts +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode, Context } from 'react';
|
|
2
2
|
import type { ProviderStateProps, ProviderApiProps } from './types';
|
|
3
|
+
export * from './types';
|
|
3
4
|
export { config, analyticsPlatform, buildConfig, showMeBuildInAnalyticsPlatform, showMeBuildInGlobalEventActionList, showMeBuildInEventActionPrefixList, } from './buildConfig';
|
|
4
5
|
export { trackAnalyticsEvent } from './analytics/analyticsEventService';
|
|
5
6
|
export declare const ContextState: Context<ProviderStateProps>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-marketing-tools",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.7",
|
|
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/)",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"url": "https://github.com/bronz3beard/react-marketing-tools/issues"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"./dist",
|
|
17
|
+
"./dist/index.d.ts",
|
|
18
18
|
"./dist/manifest.json",
|
|
19
|
-
"./dist/react-
|
|
20
|
-
"./dist/react-
|
|
19
|
+
"./dist/react-marketing-tools.es.js",
|
|
20
|
+
"./dist/react-marketing-tools.umd.js",
|
|
21
21
|
"./README.md"
|
|
22
22
|
],
|
|
23
23
|
"keywords": [
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"types": "./dist/index.d.ts",
|
|
39
39
|
"exports": {
|
|
40
40
|
".": {
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
41
42
|
"import": "./dist/react-marketing-tools.es.js",
|
|
42
43
|
"require": "./dist/react-marketing-tools.umd.js"
|
|
43
44
|
}
|
package/dist/.vite/manifest.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { TrackAnalyticsEventOptions } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @paramType {object} options
|
|
5
|
-
* @property {object} data this is an object of any data you want to collect in analytics
|
|
6
|
-
* @property {object} eventNameInfo
|
|
7
|
-
* @property {string} analyticsType
|
|
8
|
-
* @property {array | undefined} userDataToHashKeyArray default for this value is null, when used it should include an array of strings you wish to hash.
|
|
9
|
-
* @property {boolean} dataLayerCheck
|
|
10
|
-
* @property {object} consoleLogData (optional) is an object with the following attributes, "showGlobalVars", "showJourneyPropsPayload", "showUserProps" if any of the values are true you will be able to see the respective payload in your console.
|
|
11
|
-
*/
|
|
12
|
-
declare const trackAnalyticsEvent: (options: TrackAnalyticsEventOptions) => Promise<void>;
|
|
13
|
-
export { trackAnalyticsEvent };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import DeviceDetector from 'device-detector-js';
|
|
2
|
-
import { AllowedTypes, EventNameInfo } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param {object} user the structure of this data is dictated by you, aka your API or DB.
|
|
6
|
-
* @param {[string]} includeUserKeys is an array of strings that represent keys from your user data that you want to whitelist, the value for each key in the whitelist will be hashed.
|
|
7
|
-
* @returns a new user object with all values hashed including only the whitelisted key value pairs
|
|
8
|
-
*/
|
|
9
|
-
export declare const hashUserData: (user: Record<AllowedTypes, AllowedTypes>, includeUserKeys: Array<string>) => Promise<Record<AllowedTypes, AllowedTypes>>;
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @param {object} user the structure of this data is dictated by you, aka your API or DB.
|
|
13
|
-
* @param {[string]} includeUserKeys is an array of strings that represent keys from your user data that you want to map over, if no keys are supplied the original passed in user data is returned.
|
|
14
|
-
* @param {boolean} showMissingUserAttributesInConsole a boolean condition to show or hide "user" attributes that are not included in the "includeUserKeys" array, by console logging in dev tools.
|
|
15
|
-
* @returns If no "includeUserKeys" are supplied the original ser object is returned, otherwise, a new user object with only the key value pairs that you included in your includeUserKeys array is returned.
|
|
16
|
-
*/
|
|
17
|
-
export declare const buildNewUserData: (user: Record<AllowedTypes, AllowedTypes>, includeUserKeys: Array<string>, showMissingUserAttributesInConsole: boolean | undefined) => Record<string, string>;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @paramType {Object} eventNameInfo
|
|
21
|
-
* @property {analyticsPrefixActionList} actionPrefix either a built in value of JOURNEY | INTERACTION or a custom value added to the analyticsPrefixActionList object.
|
|
22
|
-
* @property {string} description an OPTIONAL value passed in that is formatted like the following from 'Very descriptive description' to VERY_DESCRIPTIVE_DESCRIPTION.
|
|
23
|
-
* @property {string} globalAppEvent the current event name for this track event selected from the analyticsGlobalEventActionList
|
|
24
|
-
* @property {string} previousGlobalAppEvent an OPTIONAL value, the previous event name for this track event selected from the analyticsGlobalEventActionList.
|
|
25
|
-
* @returns string eventName for this specific tracked event
|
|
26
|
-
*/
|
|
27
|
-
export declare const buildAnalyticsEventName: (eventNameInfo: EventNameInfo) => string;
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param {object} data
|
|
31
|
-
* @param {string} globalAppEvent
|
|
32
|
-
* @returns dataObject
|
|
33
|
-
*/
|
|
34
|
-
export declare const buildEventDataObject: (data: Record<AllowedTypes, AllowedTypes>, globalAppEvent: string) => Promise<Record<AllowedTypes, AllowedTypes>>;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* @param {string} eventName
|
|
38
|
-
* @returns a Boolean value, true if the event name is already in the dataLayer.
|
|
39
|
-
*/
|
|
40
|
-
export declare const defaultDataLayerEventCheck: (eventName: string) => boolean;
|
|
41
|
-
export declare const deviceDetectorInfo: (userAgent: string) => DeviceDetector.DeviceDetectorResult;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BuildConfigOptions, Config, AnalyticsPlatform } from '../types';
|
|
2
|
-
declare const analyticsPlatform: AnalyticsPlatform;
|
|
3
|
-
declare const showMeBuildInAnalyticsPlatform: () => void;
|
|
4
|
-
declare const showMeBuildInEventActionPrefixList: () => void;
|
|
5
|
-
declare const showMeBuildInGlobalEventActionList: () => void;
|
|
6
|
-
declare let config: Config;
|
|
7
|
-
declare const buildConfig: (options: BuildConfigOptions) => void;
|
|
8
|
-
export { config, analyticsPlatform, buildConfig, showMeBuildInAnalyticsPlatform, showMeBuildInGlobalEventActionList, showMeBuildInEventActionPrefixList, };
|
package/dist/ipInfo/index.d.ts
DELETED
package/dist/types/index.d.ts
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
export type Event = {
|
|
2
|
-
name: string;
|
|
3
|
-
params: Record<AllowedTypes, AllowedTypes>;
|
|
4
|
-
};
|
|
5
|
-
export type GooglePayload = {
|
|
6
|
-
non_personalized_ads: boolean;
|
|
7
|
-
client_id: string;
|
|
8
|
-
user_id: string;
|
|
9
|
-
user_properties: {
|
|
10
|
-
user_id: string;
|
|
11
|
-
user_type: string;
|
|
12
|
-
client_id: string;
|
|
13
|
-
};
|
|
14
|
-
events: Event[];
|
|
15
|
-
};
|
|
16
|
-
export type EventNameInfo = {
|
|
17
|
-
eventName: string;
|
|
18
|
-
description?: string;
|
|
19
|
-
actionPrefix: string;
|
|
20
|
-
globalAppEvent: string;
|
|
21
|
-
previousGlobalAppEvent?: string;
|
|
22
|
-
};
|
|
23
|
-
export type AllowedTypes = string | number;
|
|
24
|
-
export type TrackAnalyticsEventOptions = {
|
|
25
|
-
data: Record<AllowedTypes, AllowedTypes>;
|
|
26
|
-
eventNameInfo: EventNameInfo;
|
|
27
|
-
analyticsType: string;
|
|
28
|
-
userDataToHashKeyArray: Array<string> | null;
|
|
29
|
-
dataLayerCheck: boolean;
|
|
30
|
-
consoleLogData?: object;
|
|
31
|
-
};
|
|
32
|
-
export type GlobalVars = {
|
|
33
|
-
app: string;
|
|
34
|
-
device_category?: string | undefined;
|
|
35
|
-
device_os?: string | undefined;
|
|
36
|
-
device_browser?: string | undefined;
|
|
37
|
-
};
|
|
38
|
-
export type DataLayer = {
|
|
39
|
-
event: string;
|
|
40
|
-
globalVars: GlobalVars;
|
|
41
|
-
journeyProps: Record<any, any>;
|
|
42
|
-
userProps: Record<any, any>;
|
|
43
|
-
};
|
|
44
|
-
export type ConsoleLogData = {
|
|
45
|
-
showGlobalVars?: boolean;
|
|
46
|
-
showJourneyPropsPayload?: boolean;
|
|
47
|
-
showUserProps?: boolean;
|
|
48
|
-
};
|
|
49
|
-
export interface AnalyticsTrackerDataOptions {
|
|
50
|
-
consoleLogData: ConsoleLogData | null;
|
|
51
|
-
data: Record<any, any>;
|
|
52
|
-
eventName: string;
|
|
53
|
-
globalAppEvent: string;
|
|
54
|
-
userDetails: Record<any, any>;
|
|
55
|
-
}
|
|
56
|
-
export interface HandleDataLayerPushOptions extends AnalyticsTrackerDataOptions {
|
|
57
|
-
dataLayerCheck: boolean;
|
|
58
|
-
}
|
|
59
|
-
export type ServerLocationData = {
|
|
60
|
-
SERVER_CITY: string;
|
|
61
|
-
SERVER_COUNTRY: string;
|
|
62
|
-
SERVER_HOSTNAME: string;
|
|
63
|
-
SERVER_IP: string;
|
|
64
|
-
SERVER_LOCATION: string;
|
|
65
|
-
SERVER_POSTAL: string;
|
|
66
|
-
SERVER_REGION: string;
|
|
67
|
-
SERVER_TIMEZONE: string;
|
|
68
|
-
};
|
|
69
|
-
export type IpInfo = {
|
|
70
|
-
city: string;
|
|
71
|
-
country: string;
|
|
72
|
-
SERVER_HOSTNAME: string;
|
|
73
|
-
hostname: string;
|
|
74
|
-
ip: string;
|
|
75
|
-
loc: string;
|
|
76
|
-
postal: string;
|
|
77
|
-
region: string;
|
|
78
|
-
timezone: string;
|
|
79
|
-
};
|
|
80
|
-
export type Ga4GoogleAnalyticsEventTracking = AnalyticsTrackerDataOptions;
|
|
81
|
-
export type Platform = 'GOOGLE' | 'FACEBOOK' | 'DATALAYER_PUSH';
|
|
82
|
-
export type AnalyticsPlatform = {
|
|
83
|
-
[key in Platform]: Platform;
|
|
84
|
-
};
|
|
85
|
-
export type Tokens = {
|
|
86
|
-
IP_INFO_TOKEN?: string;
|
|
87
|
-
GA4_PUBLIC_API_SECRET?: string;
|
|
88
|
-
GA4_PUBLIC_MEASUREMENT_ID?: string;
|
|
89
|
-
};
|
|
90
|
-
export type Config = {
|
|
91
|
-
TOKENS?: Tokens;
|
|
92
|
-
appName: string;
|
|
93
|
-
appSessionCookieName: string;
|
|
94
|
-
withDeviceInfo?: boolean;
|
|
95
|
-
includeUserKeys: Array<string>;
|
|
96
|
-
showMissingUserAttributesInConsole: boolean | undefined;
|
|
97
|
-
withServerLocationInfo: boolean | undefined;
|
|
98
|
-
eventActionPrefixList: Record<string, string>;
|
|
99
|
-
analyticsGlobalEventActionList: Record<string, string>;
|
|
100
|
-
};
|
|
101
|
-
export type BuildConfigOptions = {
|
|
102
|
-
appName: string;
|
|
103
|
-
appSessionCookieName: string;
|
|
104
|
-
eventActionPrefix?: Record<string, string>;
|
|
105
|
-
globalEventActionList?: Record<string, string>;
|
|
106
|
-
includeUserKeys?: Array<string> | undefined;
|
|
107
|
-
showMissingUserAttributesInConsole?: boolean;
|
|
108
|
-
TOKENS?: Tokens;
|
|
109
|
-
withDeviceInfo?: boolean;
|
|
110
|
-
withServerLocationInfo?: boolean;
|
|
111
|
-
};
|
|
112
|
-
export declare let config: Config;
|
|
113
|
-
export type ProviderStateProps = {
|
|
114
|
-
appName: string;
|
|
115
|
-
appSessionCookieName: string;
|
|
116
|
-
analyticsPlatform: AnalyticsPlatform;
|
|
117
|
-
eventActionPrefixList: Record<string, string>;
|
|
118
|
-
analyticsGlobalEventActionList: Record<string, string>;
|
|
119
|
-
};
|
|
120
|
-
export type ProviderApiProps = {
|
|
121
|
-
trackAnalyticsEvent: (options: TrackAnalyticsEventOptions) => Promise<void>;
|
|
122
|
-
showMeBuildInAnalyticsPlatform: () => void;
|
|
123
|
-
showMeBuildInEventActionPrefixList: () => void;
|
|
124
|
-
showMeBuildInGlobalEventActionList: () => void;
|
|
125
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const assertIsTrue: (condition: boolean, errorMessage?: string) => void;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const isClientSide: () => boolean;
|
|
2
|
-
export declare const objectHasAttributes: (obj: Record<any, any>, 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>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getCookieValueByName: (name: string) => string | undefined;
|