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.
@@ -0,0 +1,13 @@
1
+ import { TrackAnalyticsEventOptions } from '../types/index.cjs';
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} userDataKeysToHashArray 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 };
@@ -0,0 +1,13 @@
1
+ import { TrackAnalyticsEventOptions } from '../types/index.js';
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} userDataKeysToHashArray 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 };
@@ -0,0 +1,3 @@
1
+ import { Ga4GoogleAnalyticsEventTracking } from '../types';
2
+ declare const ga4GoogleAnalyticsEventTracking: (options: Ga4GoogleAnalyticsEventTracking) => Promise<void>;
3
+ export default ga4GoogleAnalyticsEventTracking;
@@ -0,0 +1,3 @@
1
+ import { Ga4GoogleAnalyticsEventTracking } from '../types';
2
+ declare const ga4GoogleAnalyticsEventTracking: (options: Ga4GoogleAnalyticsEventTracking) => Promise<void>;
3
+ export default ga4GoogleAnalyticsEventTracking;
@@ -0,0 +1,3 @@
1
+ import { HandleDataLayerPushOptions } from '../types';
2
+ declare const handleDataLayerPush: (options: HandleDataLayerPushOptions) => Promise<void>;
3
+ export default handleDataLayerPush;
@@ -0,0 +1,3 @@
1
+ import { HandleDataLayerPushOptions } from '../types';
2
+ declare const handleDataLayerPush: (options: HandleDataLayerPushOptions) => Promise<void>;
3
+ export default handleDataLayerPush;
@@ -0,0 +1,41 @@
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;
@@ -0,0 +1,41 @@
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;
@@ -0,0 +1,8 @@
1
+ import { BuildConfigOptions, Config, AnalyticsPlatform } from '../types/index.cjs';
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, };
@@ -0,0 +1,8 @@
1
+ import { BuildConfigOptions, Config, AnalyticsPlatform } from '../types/index.js';
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, };
@@ -0,0 +1,26 @@
1
+ import { ReactElement, ReactNode, Context } from 'react';
2
+ import type { ProviderStateProps, ProviderApiProps } from './types/index.cjs';
3
+ export type { Event, GooglePayload, EventNameInfo, AllowedTypes, TrackAnalyticsEventOptions, GlobalVars, DataLayer, ConsoleLogData, AnalyticsTrackerDataOptions, HandleDataLayerPushOptions, ServerLocationData, IpInfo, Ga4GoogleAnalyticsEventTracking, Platform, AnalyticsPlatform, Tokens, Config, BuildConfigOptions, ProviderStateProps, ProviderApiProps, AnalyticsEventActionPrefix, AnalyticsGlobalEventAction, } from './types/index.cjs';
4
+ export { config, analyticsPlatform, buildConfig, showMeBuildInAnalyticsPlatform, showMeBuildInGlobalEventActionList, showMeBuildInEventActionPrefixList, } from './buildConfig/index.cjs';
5
+ export { trackAnalyticsEvent } from './analytics/analyticsEventService.cjs';
6
+ export declare const ContextState: Context<ProviderStateProps>;
7
+ export declare const ContextApi: Context<ProviderApiProps>;
8
+ type ReactMarketingProviderProps = {
9
+ children: ReactNode;
10
+ };
11
+ export declare const ReactMarketingProvider: ({ children, }: ReactMarketingProviderProps) => ReactElement;
12
+ /**
13
+ * @property {string} appName
14
+ * @property {string} appSessionCookieName
15
+ * @property {AnalyticsPlatform} analyticsPlatform
16
+ * @property {AnalyticsEventActionPrefix} eventActionPrefixList
17
+ * @property {AnalyticsGlobalEventAction} analyticsGlobalEventActionList
18
+ */
19
+ export declare const useMarketingState: () => ProviderStateProps;
20
+ /**
21
+ * @property {function} trackAnalyticsEvent(options)
22
+ * @property {function} showMeBuildInAnalyticsPlatform
23
+ * @property {function} showMeBuildInEventActionPrefixList
24
+ * @property {function} showMeBuildInGlobalEventActionList
25
+ */
26
+ export declare const useMarketingApi: () => ProviderApiProps;
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { ReactNode, Context } from 'react';
2
- import type { ProviderStateProps, ProviderApiProps } from './types';
3
- export type { Event, GooglePayload, EventNameInfo, AllowedTypes, TrackAnalyticsEventOptions, GlobalVars, DataLayer, ConsoleLogData, AnalyticsTrackerDataOptions, HandleDataLayerPushOptions, ServerLocationData, IpInfo, Ga4GoogleAnalyticsEventTracking, Platform, AnalyticsPlatform, Tokens, Config, BuildConfigOptions, ProviderStateProps, ProviderApiProps, AnalyticsEventActionPrefix, AnalyticsGlobalEventAction, } from './types';
4
- export { config, analyticsPlatform, buildConfig, showMeBuildInAnalyticsPlatform, showMeBuildInGlobalEventActionList, showMeBuildInEventActionPrefixList, } from './buildConfig';
5
- export { trackAnalyticsEvent } from './analytics/analyticsEventService';
1
+ import { ReactElement, ReactNode, Context } from 'react';
2
+ import type { ProviderStateProps, ProviderApiProps } from './types/index.js';
3
+ export type { Event, GooglePayload, EventNameInfo, AllowedTypes, TrackAnalyticsEventOptions, GlobalVars, DataLayer, ConsoleLogData, AnalyticsTrackerDataOptions, HandleDataLayerPushOptions, ServerLocationData, IpInfo, Ga4GoogleAnalyticsEventTracking, Platform, AnalyticsPlatform, Tokens, Config, BuildConfigOptions, ProviderStateProps, ProviderApiProps, AnalyticsEventActionPrefix, AnalyticsGlobalEventAction, } from './types/index.js';
4
+ export { config, analyticsPlatform, buildConfig, showMeBuildInAnalyticsPlatform, showMeBuildInGlobalEventActionList, showMeBuildInEventActionPrefixList, } from './buildConfig/index.js';
5
+ export { trackAnalyticsEvent } from './analytics/analyticsEventService.js';
6
6
  export declare const ContextState: Context<ProviderStateProps>;
7
7
  export declare const ContextApi: Context<ProviderApiProps>;
8
8
  type ReactMarketingProviderProps = {
9
9
  children: ReactNode;
10
10
  };
11
- export declare const ReactMarketingProvider: ({ children, }: ReactMarketingProviderProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const ReactMarketingProvider: ({ children, }: ReactMarketingProviderProps) => ReactElement;
12
12
  /**
13
13
  * @property {string} appName
14
14
  * @property {string} appSessionCookieName
@@ -0,0 +1,3 @@
1
+ import { IpInfo, ServerLocationData } from '../types';
2
+ export declare const buildServerLocationData: (withServerLocationInfo: boolean | undefined, IP_INFO_TOKEN: string | undefined) => Promise<ServerLocationData | undefined>;
3
+ export declare const getIpInfo: (IP_INFO_TOKEN: string) => Promise<IpInfo>;
@@ -0,0 +1,3 @@
1
+ import { IpInfo, ServerLocationData } from '../types';
2
+ export declare const buildServerLocationData: (withServerLocationInfo: boolean | undefined, IP_INFO_TOKEN: string | undefined) => Promise<ServerLocationData | undefined>;
3
+ export declare const getIpInfo: (IP_INFO_TOKEN: string) => Promise<IpInfo>;