@rh-support/utils 2.1.44 → 2.1.46
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/lib/esm/eventUtils.d.ts +10 -1
- package/lib/esm/eventUtils.d.ts.map +1 -1
- package/lib/esm/eventUtils.js +45 -36
- package/lib/esm/validatorUtils.js +1 -1
- package/package.json +2 -2
package/lib/esm/eventUtils.d.ts
CHANGED
|
@@ -5,8 +5,17 @@ export interface IPendoTrackEventProperty {
|
|
|
5
5
|
declare function haltEvent(event: React.SyntheticEvent<{}>): void;
|
|
6
6
|
declare function pendoTrackEvent(name: any, properties?: IPendoTrackEventProperty): void;
|
|
7
7
|
declare function dtmTrackEvent(eventName: string, stepName: string, caseNumber?: string, product?: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Gets the page name used in track events based off the current pathname.
|
|
10
|
+
* @param pathname the current pathname
|
|
11
|
+
* @returns the track event page name
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPageName(pathname: string): string;
|
|
8
14
|
declare function dtmTrackEventCaseCreationStepEncountered(caseSection: boolean, stepName: string, caseNumber?: string, caseType?: string, caseTitle?: string, product?: string, version?: string): void;
|
|
9
|
-
declare function
|
|
15
|
+
export declare function dtmTrackEventCaseStepEncountered(stepName: 'close' | 'comment' | 'follow' | 'review', caseNumber?: string, product?: string, version?: string): void;
|
|
16
|
+
export declare function dtmTrackEventPageLoadStarted(pageName: string): void;
|
|
17
|
+
declare function dtmTrackEventRecommendationListingItemClicked(url: string, activityName: string, contentListingRegion: string, contentID: string, contentPosition: number, contentTitle: string, contentUrl: string, displayFeature: string, displayFeatureTitle: string): void;
|
|
10
18
|
declare function dtmTrackEventRecommendationListingDisplayed(contentListingRegion: any, activityName: any, listing: any, resultsCount: any): void;
|
|
19
|
+
export declare function dtmTrackEventUploadFileToAnalyze(caseSection: boolean, stepName: string, caseType?: string, caseTitle?: string, product?: string, version?: string): void;
|
|
11
20
|
export { haltEvent, pendoTrackEvent, dtmTrackEvent, dtmTrackEventCaseCreationStepEncountered, dtmTrackEventRecommendationListingItemClicked, dtmTrackEventRecommendationListingDisplayed, };
|
|
12
21
|
//# sourceMappingURL=eventUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventUtils.d.ts","sourceRoot":"","sources":["../../src/eventUtils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,wBAAwB;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,iBAAS,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,QAKjD;AAKD,iBAAS,eAAe,CAAC,IAAI,KAAA,EAAE,UAAU,GAAE,wBAA6B,QAMvE;AAED,iBAAS,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,QAUhG;AAGD,iBAAS,wCAAwC,CAC7C,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"eventUtils.d.ts","sourceRoot":"","sources":["../../src/eventUtils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,wBAAwB;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,iBAAS,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,QAKjD;AAKD,iBAAS,eAAe,CAAC,IAAI,KAAA,EAAE,UAAU,GAAE,wBAA6B,QAMvE;AAED,iBAAS,aA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ED,OAAO,EACH,SAAS,EACT,eAAe,EACf,aAAa,EACb,wCAAwC,EACxC,6CAA6C,EAC7C,2CAA2C,GAC9C,CAAC"}
|
package/lib/esm/eventUtils.js
CHANGED
|
@@ -27,46 +27,46 @@ function dtmTrackEvent(eventName, stepName, caseNumber, product) {
|
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets the page name used in track events based off the current pathname.
|
|
32
|
+
* @param pathname the current pathname
|
|
33
|
+
* @returns the track event page name
|
|
34
|
+
*/
|
|
35
|
+
export function getPageName(pathname) {
|
|
36
|
+
return `cp|support|cases|${pathname.replace('#', '').split('/').filter(Boolean).join('|')}`;
|
|
37
|
+
}
|
|
30
38
|
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#case-creation-step-encountered
|
|
31
39
|
function dtmTrackEventCaseCreationStepEncountered(caseSection, stepName, caseNumber, caseType, caseTitle, product, version) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
const event = 'Case Creation Step Encountered';
|
|
41
|
+
const caseObject = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ type: 'cp-support', caseSection: caseSection ? 'case' : 'troubleshoot', stepName }, (caseNumber && { caseNumber })), (version && { caseProductVersion: version })), (caseType && { caseType })), (caseTitle && { caseTitle })), (product && { caseProduct: product }));
|
|
42
|
+
(window.appEventData || []).push({
|
|
43
|
+
event,
|
|
44
|
+
case: caseObject,
|
|
35
45
|
});
|
|
46
|
+
}
|
|
47
|
+
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#Page-Load-Started
|
|
48
|
+
export function dtmTrackEventCaseStepEncountered(stepName, caseNumber, product, version) {
|
|
49
|
+
const event = 'Case Step Encountered';
|
|
50
|
+
const caseObject = Object.assign(Object.assign({ type: 'cp-support', stepName }, (caseNumber && { caseNumber })), (product && { caseProduct: `${product}|${version}` }));
|
|
36
51
|
(window.appEventData || []).push({
|
|
37
|
-
event
|
|
38
|
-
case:
|
|
52
|
+
event,
|
|
53
|
+
case: caseObject,
|
|
39
54
|
});
|
|
40
55
|
}
|
|
41
|
-
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
listingItemClicked: {
|
|
53
|
-
activityName,
|
|
54
|
-
contentListingRegion,
|
|
55
|
-
listing: [
|
|
56
|
-
{
|
|
57
|
-
content: {
|
|
58
|
-
contentID,
|
|
59
|
-
contentPosition,
|
|
60
|
-
contentTitle,
|
|
61
|
-
contentUrl,
|
|
62
|
-
displayFeature: 'recommended',
|
|
63
|
-
displayFeatureTitle: 'listingItemClicked',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
listingType: 'listingItemClicked',
|
|
68
|
-
},
|
|
56
|
+
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#Page-Load-Started
|
|
57
|
+
export function dtmTrackEventPageLoadStarted(pageName) {
|
|
58
|
+
const event = 'Page Load Started';
|
|
59
|
+
const caseObject = {
|
|
60
|
+
type: 'cp-support',
|
|
61
|
+
pageName,
|
|
62
|
+
};
|
|
63
|
+
(window.appEventData || []).push({
|
|
64
|
+
event,
|
|
65
|
+
case: caseObject,
|
|
69
66
|
});
|
|
67
|
+
}
|
|
68
|
+
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#recommendation-listing-item-clicked
|
|
69
|
+
function dtmTrackEventRecommendationListingItemClicked(url, activityName, contentListingRegion, contentID, contentPosition, contentTitle, contentUrl, displayFeature, displayFeatureTitle) {
|
|
70
70
|
(window.appEventData || []).push({
|
|
71
71
|
event: 'Recommendation Listing Item Clicked',
|
|
72
72
|
linkInfo: {
|
|
@@ -86,12 +86,12 @@ function dtmTrackEventRecommendationListingItemClicked(url, activityName, conten
|
|
|
86
86
|
contentPosition,
|
|
87
87
|
contentTitle,
|
|
88
88
|
contentUrl,
|
|
89
|
-
displayFeature
|
|
90
|
-
displayFeatureTitle
|
|
89
|
+
displayFeature,
|
|
90
|
+
displayFeatureTitle,
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
93
|
],
|
|
94
|
-
listingType: '
|
|
94
|
+
listingType: 'Support Cases',
|
|
95
95
|
},
|
|
96
96
|
});
|
|
97
97
|
}
|
|
@@ -108,4 +108,13 @@ function dtmTrackEventRecommendationListingDisplayed(contentListingRegion, activ
|
|
|
108
108
|
},
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
+
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#Page-Load-Started
|
|
112
|
+
export function dtmTrackEventUploadFileToAnalyze(caseSection, stepName, caseType, caseTitle, product, version) {
|
|
113
|
+
const eventName = 'Upload File to Analyze';
|
|
114
|
+
const caseObject = Object.assign(Object.assign(Object.assign(Object.assign({ type: 'cp-support', caseSection: caseSection ? 'case' : 'troubleshoot', stepName }, (product && { caseProduct: product })), (version && { caseProductVersion: version })), (caseType && { caseType })), (caseTitle && { caseTitle }));
|
|
115
|
+
(window.appEventData || []).push({
|
|
116
|
+
event: eventName,
|
|
117
|
+
case: caseObject,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
111
120
|
export { haltEvent, pendoTrackEvent, dtmTrackEvent, dtmTrackEventCaseCreationStepEncountered, dtmTrackEventRecommendationListingItemClicked, dtmTrackEventRecommendationListingDisplayed, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const emojiPattern = /[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/gu;
|
|
2
2
|
const mailformat = new RegExp(
|
|
3
3
|
// eslint-disable-next-line no-control-regex
|
|
4
|
-
"([!#-'*+/-9=?A-Z^-~-]+(
|
|
4
|
+
"^([!#-'*+/-9=?A-Z^-~-]+(\\.[!#-'*+/-9=?A-Z^-~-]+)*|\"([]!#-[^-~ \\t]|(\\[\\t -~]))+\")@([!#-'*+/-9=?A-Z^-~-]+(\\.[!#-'*+/-9=?A-Z^-~-]+)*|\\[[\\t -Z^-~]*])$");
|
|
5
5
|
const imageRegex = /^image\/(gif|png|jpeg)$/;
|
|
6
6
|
// To check if email is valid
|
|
7
7
|
function isEmailValid(object) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.46",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Vikas Rathee <vrathee@redhat.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"defaults and supports es6-module",
|
|
75
75
|
"maintained node versions"
|
|
76
76
|
],
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "8402b82ce0dac6a288aa9361ebb61f4a209f90e0"
|
|
78
78
|
}
|