@magicpixel/rn-mp-client-sdk 0.12.0 → 1.12.1
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/commonjs/common/app-types.js.map +1 -1
- package/lib/commonjs/common/constants.js +5 -26
- package/lib/commonjs/common/constants.js.map +1 -1
- package/lib/commonjs/common/data-store.js +36 -117
- package/lib/commonjs/common/data-store.js.map +1 -1
- package/lib/commonjs/common/event-bus.js +3 -10
- package/lib/commonjs/common/event-bus.js.map +1 -1
- package/lib/commonjs/common/logger.js +9 -18
- package/lib/commonjs/common/logger.js.map +1 -1
- package/lib/commonjs/common/network-service.js +6 -21
- package/lib/commonjs/common/network-service.js.map +1 -1
- package/lib/commonjs/common/reporter.js +8 -31
- package/lib/commonjs/common/reporter.js.map +1 -1
- package/lib/commonjs/common/utils.js +64 -65
- package/lib/commonjs/common/utils.js.map +1 -1
- package/lib/commonjs/coverage/lcov-report/block-navigation.js +6 -19
- package/lib/commonjs/coverage/lcov-report/block-navigation.js.map +1 -1
- package/lib/commonjs/coverage/lcov-report/prettify.js +2 -182
- package/lib/commonjs/coverage/lcov-report/prettify.js.map +1 -1
- package/lib/commonjs/coverage/lcov-report/sorter.js +64 -94
- package/lib/commonjs/coverage/lcov-report/sorter.js.map +1 -1
- package/lib/commonjs/eedl/eedl.js +207 -84
- package/lib/commonjs/eedl/eedl.js.map +1 -1
- package/lib/commonjs/index.js +104 -95
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/geo-api-response.js +2 -0
- package/lib/commonjs/models/geo-api-response.js.map +1 -0
- package/lib/commonjs/models/mp-client-sdk.js +3 -11
- package/lib/commonjs/models/mp-client-sdk.js.map +1 -1
- package/lib/commonjs/processors/data-element.processor.js +85 -80
- package/lib/commonjs/processors/data-element.processor.js.map +1 -1
- package/lib/commonjs/processors/geo-location.processor.js +70 -0
- package/lib/commonjs/processors/geo-location.processor.js.map +1 -0
- package/lib/commonjs/processors/qc.processor.js +2 -25
- package/lib/commonjs/processors/qc.processor.js.map +1 -1
- package/lib/commonjs/processors/tag.processor.js +17 -86
- package/lib/commonjs/processors/tag.processor.js.map +1 -1
- package/lib/commonjs/processors/trans-function.processor.js +5 -23
- package/lib/commonjs/processors/trans-function.processor.js.map +1 -1
- package/lib/commonjs/processors/visit-id.processor.js +4 -50
- package/lib/commonjs/processors/visit-id.processor.js.map +1 -1
- package/lib/module/common/app-types.js.map +1 -1
- package/lib/module/common/constants.js +4 -22
- package/lib/module/common/constants.js.map +1 -1
- package/lib/module/common/data-store.js +35 -108
- package/lib/module/common/data-store.js.map +1 -1
- package/lib/module/common/event-bus.js +3 -6
- package/lib/module/common/event-bus.js.map +1 -1
- package/lib/module/common/logger.js +9 -16
- package/lib/module/common/logger.js.map +1 -1
- package/lib/module/common/network-service.js +6 -11
- package/lib/module/common/network-service.js.map +1 -1
- package/lib/module/common/reporter.js +8 -19
- package/lib/module/common/reporter.js.map +1 -1
- package/lib/module/common/utils.js +63 -56
- package/lib/module/common/utils.js.map +1 -1
- package/lib/module/coverage/lcov-report/block-navigation.js +6 -19
- package/lib/module/coverage/lcov-report/block-navigation.js.map +1 -1
- package/lib/module/coverage/lcov-report/prettify.js +2 -182
- package/lib/module/coverage/lcov-report/prettify.js.map +1 -1
- package/lib/module/coverage/lcov-report/sorter.js +64 -94
- package/lib/module/coverage/lcov-report/sorter.js.map +1 -1
- package/lib/module/eedl/eedl.js +206 -76
- package/lib/module/eedl/eedl.js.map +1 -1
- package/lib/module/index.js +102 -57
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/geo-api-response.js +2 -0
- package/lib/module/models/geo-api-response.js.map +1 -0
- package/lib/module/models/mp-client-sdk.js +0 -5
- package/lib/module/models/mp-client-sdk.js.map +1 -1
- package/lib/module/processors/data-element.processor.js +82 -71
- package/lib/module/processors/data-element.processor.js.map +1 -1
- package/lib/module/processors/geo-location.processor.js +63 -0
- package/lib/module/processors/geo-location.processor.js.map +1 -0
- package/lib/module/processors/qc.processor.js +2 -11
- package/lib/module/processors/qc.processor.js.map +1 -1
- package/lib/module/processors/tag.processor.js +17 -57
- package/lib/module/processors/tag.processor.js.map +1 -1
- package/lib/module/processors/trans-function.processor.js +5 -12
- package/lib/module/processors/trans-function.processor.js.map +1 -1
- package/lib/module/processors/visit-id.processor.js +4 -27
- package/lib/module/processors/visit-id.processor.js.map +1 -1
- package/lib/typescript/common/app-types.d.ts +3 -0
- package/lib/typescript/common/constants.d.ts +1 -0
- package/lib/typescript/common/data-store.d.ts +8 -0
- package/lib/typescript/common/utils.d.ts +19 -0
- package/lib/typescript/eedl/eedl.d.ts +16 -5
- package/lib/typescript/index.d.ts +53 -0
- package/lib/typescript/models/geo-api-response.d.ts +12 -0
- package/lib/typescript/processors/data-element.processor.d.ts +10 -1
- package/lib/typescript/processors/geo-location.processor.d.ts +10 -0
- package/package.json +25 -10
- package/src/common/app-types.ts +3 -0
- package/src/common/constants.ts +2 -0
- package/src/common/data-store.ts +38 -0
- package/src/common/network-service.ts +2 -0
- package/src/common/utils.ts +58 -0
- package/src/eedl/eedl.ts +241 -18
- package/src/index.tsx +98 -3
- package/src/models/geo-api-response.ts +13 -0
- package/src/processors/data-element.processor.ts +140 -70
- package/src/processors/geo-location.processor.ts +91 -0
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TagProcessor = void 0;
|
|
7
|
-
|
|
8
7
|
var _logger = require("../common/logger");
|
|
9
|
-
|
|
10
8
|
var _dataStore = require("../common/data-store");
|
|
11
|
-
|
|
12
9
|
var _reporter = require("../common/reporter");
|
|
13
|
-
|
|
14
10
|
var _constants = require("../common/constants");
|
|
15
|
-
|
|
16
11
|
var _utils = require("../common/utils");
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* Finds all the applicable tags based on the true qualification criteria. Method does not return anything
|
|
20
14
|
* because it uses pass by memory reference. The last 2 paramters (allTagInfo and applicableTagInfo) are
|
|
@@ -25,24 +19,20 @@ var _utils = require("../common/utils");
|
|
|
25
19
|
* @param allTagInfo
|
|
26
20
|
* @param applicableTagInfo
|
|
27
21
|
*/
|
|
22
|
+
|
|
28
23
|
class TagProcessor {
|
|
29
24
|
static findApplicableTags(sdkTags, sdkProviders, validQcList, allTagInfo, applicableTagInfo) {
|
|
30
25
|
const applicableTags = [];
|
|
31
26
|
const tagKeys = Object.keys(sdkTags);
|
|
32
27
|
const currentEpochSeconds = Math.round(new Date().getTime() / 1000);
|
|
33
|
-
|
|
34
28
|
_logger.Logger.logDbg('Total Tag Length: ', tagKeys.length);
|
|
35
|
-
|
|
36
29
|
for (const tagId of tagKeys) {
|
|
37
30
|
const tag = sdkTags[tagId];
|
|
38
|
-
|
|
39
31
|
if (tag) {
|
|
40
32
|
let isQualified = true;
|
|
41
|
-
|
|
42
33
|
for (const qc of tag.qc) {
|
|
43
34
|
if (validQcList.indexOf(qc) === -1) {
|
|
44
35
|
var _sdkProviders$tag$p;
|
|
45
|
-
|
|
46
36
|
isQualified = false;
|
|
47
37
|
allTagInfo.push({
|
|
48
38
|
id: tagId,
|
|
@@ -55,11 +45,9 @@ class TagProcessor {
|
|
|
55
45
|
break;
|
|
56
46
|
}
|
|
57
47
|
}
|
|
58
|
-
|
|
59
48
|
if (isQualified && applicableTags.indexOf(tagId) === -1) {
|
|
60
49
|
if (this.checkTagDateValidity(currentEpochSeconds, tag.st, tag.ex)) {
|
|
61
50
|
var _sdkProviders$tag$p2, _sdkProviders$tag$p3;
|
|
62
|
-
|
|
63
51
|
applicableTags.push(tagId);
|
|
64
52
|
allTagInfo.push({
|
|
65
53
|
id: tagId,
|
|
@@ -79,7 +67,6 @@ class TagProcessor {
|
|
|
79
67
|
});
|
|
80
68
|
} else {
|
|
81
69
|
var _sdkProviders$tag$p4;
|
|
82
|
-
|
|
83
70
|
allTagInfo.push({
|
|
84
71
|
id: tagId,
|
|
85
72
|
nm: tag.nm,
|
|
@@ -93,61 +80,46 @@ class TagProcessor {
|
|
|
93
80
|
}
|
|
94
81
|
}
|
|
95
82
|
}
|
|
83
|
+
|
|
96
84
|
/**
|
|
97
85
|
* Core function which actually puts the tag on page based on the tag type (JS or Image)
|
|
98
86
|
* @param eventName
|
|
99
87
|
* @param evtId
|
|
100
88
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
103
89
|
static async processTags(eventName, evtId) {
|
|
104
90
|
try {
|
|
105
91
|
_logger.Logger.logDbg('Processing tags for event: ', eventName, ' with id: ', evtId);
|
|
106
|
-
|
|
107
92
|
const allTagInfo = [];
|
|
108
93
|
const applicableTagInfo = [];
|
|
109
|
-
|
|
110
94
|
const prStatus = _dataStore.DataStore.getPrivacyCompliance();
|
|
111
|
-
|
|
112
95
|
const dataElements = _dataStore.DataStore.getDataElements();
|
|
113
|
-
|
|
114
96
|
const transFunctions = _dataStore.DataStore.getTransFunctions();
|
|
115
|
-
|
|
116
97
|
const sdkTags = _dataStore.DataStore.getSdkTags();
|
|
117
|
-
|
|
118
98
|
const sdkProviders = _dataStore.DataStore.getSdkProviders();
|
|
99
|
+
const validQcList = _dataStore.DataStore.getValidQcList();
|
|
119
100
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this.findApplicableTags(sdkTags, sdkProviders, validQcList, allTagInfo, applicableTagInfo); // set expected tag count, so that the reporter knows when all tags are finished and can report asynchronously
|
|
101
|
+
// Find applicable tags
|
|
102
|
+
this.findApplicableTags(sdkTags, sdkProviders, validQcList, allTagInfo, applicableTagInfo);
|
|
124
103
|
|
|
104
|
+
// set expected tag count, so that the reporter knows when all tags are finished and can report asynchronously
|
|
125
105
|
_reporter.Reporter.setExpectedTagCount(applicableTagInfo.length, evtId);
|
|
106
|
+
_logger.Logger.logDbg('Applicable Tags: ', applicableTagInfo);
|
|
126
107
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
108
|
+
// process tags one by one
|
|
130
109
|
for (const tagInfo of applicableTagInfo) {
|
|
131
110
|
try {
|
|
132
111
|
_logger.Logger.logDbg(`Processing Tag: ${tagInfo.nm} [${tagInfo.id}]`);
|
|
133
|
-
|
|
134
112
|
const tag = sdkTags[tagInfo.id];
|
|
135
|
-
|
|
136
113
|
if (!tag) {
|
|
137
114
|
continue;
|
|
138
115
|
}
|
|
139
|
-
|
|
140
116
|
const provider = sdkProviders[tag.p];
|
|
141
|
-
|
|
142
117
|
if (!provider) {
|
|
143
118
|
continue;
|
|
144
119
|
}
|
|
145
|
-
|
|
146
120
|
const result = this.hydrateTag(tagInfo, tag, provider, prStatus, dataElements, transFunctions);
|
|
147
|
-
|
|
148
121
|
if (result.isInError) {
|
|
149
122
|
_logger.Logger.logDbg(`Tag ${tagInfo.nm} not processed because of error code: ${result.errCd}`);
|
|
150
|
-
|
|
151
123
|
if (result.errCd === 'NP') {
|
|
152
124
|
_reporter.Reporter.reportItem({
|
|
153
125
|
st: _constants.Constants.ST_PR_EXC,
|
|
@@ -173,22 +145,16 @@ class TagProcessor {
|
|
|
173
145
|
req: result.errMsg
|
|
174
146
|
}, evtId);
|
|
175
147
|
}
|
|
176
|
-
|
|
177
148
|
continue;
|
|
178
149
|
}
|
|
179
|
-
|
|
180
150
|
const finalUrl = result.content;
|
|
181
|
-
|
|
182
151
|
_logger.Logger.logDbg('Final Url :: ', finalUrl);
|
|
183
|
-
|
|
184
152
|
if (provider.typ === _constants.Constants.PR_TYP_APP) {
|
|
185
153
|
if (provider.sTyp === _constants.Constants.PR_S_TYP_R) {
|
|
186
154
|
// process and fire app event
|
|
187
155
|
try {
|
|
188
156
|
const parsedData = JSON.parse(result.content);
|
|
189
|
-
|
|
190
157
|
_utils.Utils.triggerEvent(parsedData.event_bus_name, parsedData.event_bus_payload);
|
|
191
|
-
|
|
192
158
|
_reporter.Reporter.reportItem({
|
|
193
159
|
st: _constants.Constants.ST_OK,
|
|
194
160
|
t: tagInfo.id,
|
|
@@ -198,7 +164,6 @@ class TagProcessor {
|
|
|
198
164
|
}, evtId);
|
|
199
165
|
} catch (err) {
|
|
200
166
|
_logger.Logger.logError(err);
|
|
201
|
-
|
|
202
167
|
_reporter.Reporter.reportItem({
|
|
203
168
|
st: _constants.Constants.ST_ERR,
|
|
204
169
|
t: tagInfo.id,
|
|
@@ -213,7 +178,6 @@ class TagProcessor {
|
|
|
213
178
|
}
|
|
214
179
|
} catch (err) {
|
|
215
180
|
_logger.Logger.logError('Failed loading tag: ', tagInfo.id, ': Name: ', tagInfo.nm, 'with error ', err);
|
|
216
|
-
|
|
217
181
|
_reporter.Reporter.reportItem({
|
|
218
182
|
st: _constants.Constants.ST_ERR,
|
|
219
183
|
t: tagInfo.id,
|
|
@@ -224,10 +188,11 @@ class TagProcessor {
|
|
|
224
188
|
}
|
|
225
189
|
}
|
|
226
190
|
} catch (err) {
|
|
227
|
-
_logger.Logger.logError('Error processing tags: ', err);
|
|
228
|
-
|
|
191
|
+
_logger.Logger.logError('Error processing tags: ', err);
|
|
192
|
+
// TODO: Report as metric to client
|
|
229
193
|
}
|
|
230
194
|
}
|
|
195
|
+
|
|
231
196
|
/**
|
|
232
197
|
* Takes all the placeholders in a tag and replaces them with actual values from data elements or
|
|
233
198
|
* actual static values. Method returns an object with errCd and replaced content and a boolean identifier
|
|
@@ -239,15 +204,11 @@ class TagProcessor {
|
|
|
239
204
|
* @param dataElements
|
|
240
205
|
* @param transFunctions
|
|
241
206
|
*/
|
|
242
|
-
|
|
243
|
-
|
|
244
207
|
static hydrateTag(tagInfo, tag, provider, prStatus, dataElements, transFunctions) {
|
|
245
208
|
_logger.Logger.logDbg(`Hydrating Tag: ${tagInfo.nm} [${tagInfo.id}]`);
|
|
246
|
-
|
|
247
209
|
if (!provider) {
|
|
248
210
|
// serious issue. tag is in build sdk but not the appropriate provider
|
|
249
211
|
_logger.Logger.logError(`Not hydrating tag: ${tagInfo.nm} [${tagInfo.id}] because appropriate provider was not found`);
|
|
250
|
-
|
|
251
212
|
return {
|
|
252
213
|
isInError: true,
|
|
253
214
|
content: null,
|
|
@@ -255,56 +216,47 @@ class TagProcessor {
|
|
|
255
216
|
errMsg: `Not hydrating tag: ${tagInfo.nm} [${tagInfo.id}] because appropriate provider was not found`
|
|
256
217
|
}; // No Provider
|
|
257
218
|
}
|
|
258
|
-
|
|
259
219
|
if (provider.pr === 'B' && !prStatus) {
|
|
260
220
|
_logger.Logger.logDbg(`Not hydrating provider: ${provider.nm} [${tag.p}] because it is blacklisted`);
|
|
261
|
-
|
|
262
221
|
return {
|
|
263
222
|
isInError: true,
|
|
264
223
|
content: null,
|
|
265
224
|
errCd: 'PRB',
|
|
266
225
|
errMsg: `Not hydrating provider: ${provider.nm} [${tag.p}] because it is blacklisted`
|
|
267
226
|
}; // Privacy Blocked
|
|
268
|
-
}
|
|
269
|
-
|
|
227
|
+
}
|
|
270
228
|
|
|
229
|
+
// merge both provider and client tag params into one - tag param overwrites provider params
|
|
271
230
|
const params = _utils.Utils.mergeMaps(undefined, provider.rParams, tag.rParams);
|
|
272
|
-
|
|
273
231
|
if (provider.typ === 'app' && provider.sTyp === 'r') {
|
|
274
232
|
// this is o app type provider. no need to find place-holders, just convert params to an object and prepare the json object
|
|
275
233
|
return this.resourceParamsToActualValues(Object.values(params), dataElements, transFunctions);
|
|
276
234
|
} else {
|
|
277
235
|
// make tag url
|
|
278
236
|
const preReplaceUrl = provider.url + (tag.url ? tag.url : '');
|
|
279
|
-
const finalUrl = provider.url + (tag.url ? tag.url : '');
|
|
280
|
-
|
|
281
|
-
const placeHolders = this.findPlaceHolders(preReplaceUrl); // process tag attributes
|
|
237
|
+
const finalUrl = provider.url + (tag.url ? tag.url : '');
|
|
282
238
|
|
|
239
|
+
// find placeholder values
|
|
240
|
+
const placeHolders = this.findPlaceHolders(preReplaceUrl);
|
|
241
|
+
// process tag attributes
|
|
283
242
|
return this.replacePlaceHolders(finalUrl, placeHolders, dataElements, transFunctions, params, provider.chld || tag.chld, 'rph');
|
|
284
243
|
}
|
|
285
244
|
}
|
|
286
|
-
|
|
287
245
|
static findPlaceHolders(content) {
|
|
288
246
|
const placeHolders = [];
|
|
289
|
-
|
|
290
247
|
let match = _constants.Constants.PLACEHOLDER_REGEX.exec(content);
|
|
291
|
-
|
|
292
248
|
while (match !== null) {
|
|
293
249
|
placeHolders.push(match[2]);
|
|
294
250
|
match = _constants.Constants.PLACEHOLDER_REGEX.exec(content);
|
|
295
251
|
}
|
|
296
|
-
|
|
297
252
|
return placeHolders;
|
|
298
253
|
}
|
|
299
|
-
|
|
300
254
|
static resourceParamsToActualValues(params, deItems, transFunctions) {
|
|
301
255
|
// resolve all param values and convert them into a temporary structure
|
|
302
256
|
const paramValueArray = {};
|
|
303
|
-
|
|
304
257
|
for (const param of params) {
|
|
305
258
|
if (param.val_src !== 'CHILDREN') {
|
|
306
259
|
const deVal = this.parseParamValue(param, deItems, transFunctions);
|
|
307
|
-
|
|
308
260
|
if (param.rqd && typeof deVal === 'undefined') {
|
|
309
261
|
return {
|
|
310
262
|
isInError: true,
|
|
@@ -313,13 +265,10 @@ class TagProcessor {
|
|
|
313
265
|
errMsg: `Tag validation failed. Parameter ${param.nm} is marked as mandatory, but no value was found in source.`
|
|
314
266
|
};
|
|
315
267
|
}
|
|
316
|
-
|
|
317
268
|
paramValueArray[param.fKey] = deVal;
|
|
318
269
|
}
|
|
319
270
|
}
|
|
320
|
-
|
|
321
271
|
const op = _utils.Utils.unFlattenObject(paramValueArray);
|
|
322
|
-
|
|
323
272
|
return {
|
|
324
273
|
isInError: false,
|
|
325
274
|
content: JSON.stringify(op),
|
|
@@ -327,10 +276,8 @@ class TagProcessor {
|
|
|
327
276
|
errMsg: null
|
|
328
277
|
};
|
|
329
278
|
}
|
|
330
|
-
|
|
331
279
|
static parseParamValue(paramItem, deItems, transFunctions) {
|
|
332
280
|
let paramValue = undefined;
|
|
333
|
-
|
|
334
281
|
if (paramItem.sv || paramItem.de || paramItem.tfId) {
|
|
335
282
|
if (paramItem.sv) {
|
|
336
283
|
paramValue = paramItem.sv;
|
|
@@ -339,18 +286,15 @@ class TagProcessor {
|
|
|
339
286
|
} else if (paramItem.tfId) {
|
|
340
287
|
paramValue = transFunctions[paramItem.tfId];
|
|
341
288
|
}
|
|
342
|
-
|
|
343
289
|
paramValue = _utils.Utils.applyTransformationResourceParam(paramValue, paramItem.tf);
|
|
344
290
|
return paramValue;
|
|
345
291
|
} else {
|
|
346
292
|
return undefined;
|
|
347
293
|
}
|
|
348
294
|
}
|
|
349
|
-
|
|
350
295
|
static replacePlaceHolders(content, placeHolders, deItems, transFunctions, params, hasChildren, replaceMode) {
|
|
351
296
|
let isInError = false;
|
|
352
297
|
let errMsg;
|
|
353
|
-
|
|
354
298
|
if (!params) {
|
|
355
299
|
return {
|
|
356
300
|
isInError: false,
|
|
@@ -359,30 +303,24 @@ class TagProcessor {
|
|
|
359
303
|
errMsg: 'No parameters where found to process in this tag'
|
|
360
304
|
};
|
|
361
305
|
}
|
|
362
|
-
|
|
363
306
|
if (hasChildren) {
|
|
364
307
|
// convert the flattened parameters to parent - child format. this is inside a condition
|
|
365
308
|
// because we may not have a lot of JSON type parameters and we can save some processing time by limiting
|
|
366
309
|
// when this is done
|
|
367
310
|
params = _utils.Utils.unFlattenResourceParams(Object.values(params));
|
|
368
311
|
}
|
|
369
|
-
|
|
370
312
|
for (const ph of placeHolders) {
|
|
371
313
|
try {
|
|
372
314
|
const tagParam = params[ph];
|
|
373
|
-
|
|
374
315
|
if (tagParam) {
|
|
375
316
|
if (tagParam.children && tagParam.children.length > 0) {
|
|
376
317
|
const paramValue = {};
|
|
377
|
-
|
|
378
318
|
for (const childParam of tagParam.children) {
|
|
379
319
|
paramValue[childParam.nm] = this.parseParamValue(childParam, deItems, transFunctions);
|
|
380
320
|
}
|
|
381
|
-
|
|
382
321
|
content = this.replaceValues(ph, content, JSON.stringify(paramValue), replaceMode);
|
|
383
322
|
} else {
|
|
384
323
|
const paramValue = this.parseParamValue(tagParam, deItems, transFunctions);
|
|
385
|
-
|
|
386
324
|
if (typeof paramValue === 'object') {
|
|
387
325
|
content = this.replaceValues(ph, content, JSON.stringify(paramValue), replaceMode);
|
|
388
326
|
} else {
|
|
@@ -400,7 +338,6 @@ class TagProcessor {
|
|
|
400
338
|
break;
|
|
401
339
|
}
|
|
402
340
|
}
|
|
403
|
-
|
|
404
341
|
return {
|
|
405
342
|
isInError,
|
|
406
343
|
content,
|
|
@@ -408,25 +345,19 @@ class TagProcessor {
|
|
|
408
345
|
errMsg: errMsg
|
|
409
346
|
};
|
|
410
347
|
}
|
|
411
|
-
|
|
412
348
|
static checkTagDateValidity(currentEpochSeconds, tagStart, tagEnd) {
|
|
413
349
|
return currentEpochSeconds >= tagStart && currentEpochSeconds <= tagEnd;
|
|
414
350
|
}
|
|
415
|
-
|
|
416
351
|
static replaceValues(placeHolder, content, val, replaceMode) {
|
|
417
352
|
let replaceVal;
|
|
418
|
-
|
|
419
353
|
if (replaceMode === 'kph') {
|
|
420
354
|
replaceVal = val && val !== '' ? val : `{{${placeHolder}}`;
|
|
421
355
|
} else if (replaceMode === 'rph') {
|
|
422
356
|
replaceVal = val && val !== '' ? val : '';
|
|
423
357
|
}
|
|
424
|
-
|
|
425
358
|
content = content.split(`{{${placeHolder}}}`).join(replaceVal);
|
|
426
359
|
return content;
|
|
427
360
|
}
|
|
428
|
-
|
|
429
361
|
}
|
|
430
|
-
|
|
431
362
|
exports.TagProcessor = TagProcessor;
|
|
432
363
|
//# sourceMappingURL=tag.processor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TagProcessor","findApplicableTags","sdkTags","sdkProviders","validQcList","allTagInfo","applicableTagInfo","applicableTags","tagKeys","Object","keys","currentEpochSeconds","Math","round","Date","getTime","Logger","logDbg","length","tagId","tag","isQualified","qc","indexOf","push","id","nm","status","pr","p","prNm","checkTagDateValidity","st","ex","processTags","eventName","evtId","prStatus","DataStore","getPrivacyCompliance","dataElements","getDataElements","transFunctions","getTransFunctions","getSdkTags","getSdkProviders","getValidQcList","Reporter","setExpectedTagCount","tagInfo","provider","result","hydrateTag","isInError","errCd","reportItem","Constants","ST_PR_EXC","t","tNm","req","errMsg","ST_PR_BL","ST_VAL_FAIL","finalUrl","content","typ","PR_TYP_APP","sTyp","PR_S_TYP_R","parsedData","JSON","parse","Utils","triggerEvent","event_bus_name","event_bus_payload","ST_OK","err","logError","ST_ERR","stack","params","mergeMaps","undefined","rParams","resourceParamsToActualValues","values","preReplaceUrl","url","placeHolders","findPlaceHolders","replacePlaceHolders","chld","match","PLACEHOLDER_REGEX","exec","deItems","paramValueArray","param","val_src","deVal","parseParamValue","rqd","fKey","op","unFlattenObject","stringify","paramItem","paramValue","sv","de","tfId","applyTransformationResourceParam","tf","hasChildren","replaceMode","unFlattenResourceParams","ph","tagParam","children","childParam","replaceValues","tagStart","tagEnd","placeHolder","val","replaceVal","split","join"],"sources":["tag.processor.ts"],"sourcesContent":["/**\n * Finds all the applicable tags based on the true qualification criteria. Method does not return anything\n * because it uses pass by memory reference. The last 2 paramters (allTagInfo and applicableTagInfo) are\n * return variables\n * @param sdkTags\n * @param sdkProviders\n * @param validQcList\n * @param allTagInfo\n * @param applicableTagInfo\n */\nimport type {\n HydrateTagInfo,\n MapLike,\n ReplaceMode,\n TagInfoItem,\n} from '../common/app-types';\nimport type {\n ClientSdkParamItem,\n ClientSdkPrItem,\n ClientSdkTagItem,\n} from '../models/mp-client-sdk';\nimport { Logger } from '../common/logger';\nimport { DataStore } from '../common/data-store';\nimport { Reporter } from '../common/reporter';\nimport { Constants } from '../common/constants';\nimport { Utils } from '../common/utils';\n\nexport class TagProcessor {\n private static findApplicableTags(\n sdkTags: MapLike<ClientSdkTagItem>,\n sdkProviders: MapLike<ClientSdkPrItem>,\n validQcList: string[],\n allTagInfo: TagInfoItem[],\n applicableTagInfo: TagInfoItem[]\n ): void {\n const applicableTags: string[] = [];\n const tagKeys = Object.keys(sdkTags);\n const currentEpochSeconds = Math.round(new Date().getTime() / 1000);\n Logger.logDbg('Total Tag Length: ', tagKeys.length);\n for (const tagId of tagKeys) {\n const tag: ClientSdkTagItem | undefined = sdkTags[tagId];\n if (tag) {\n let isQualified = true;\n for (const qc of tag.qc) {\n if (validQcList.indexOf(qc) === -1) {\n isQualified = false;\n allTagInfo.push({\n id: tagId,\n nm: tag.nm,\n status: false,\n qc,\n pr: tag.p,\n prNm: sdkProviders[tag.p]?.nm || '',\n });\n break;\n }\n }\n if (isQualified && applicableTags.indexOf(tagId) === -1) {\n if (this.checkTagDateValidity(currentEpochSeconds, tag.st, tag.ex)) {\n applicableTags.push(tagId);\n allTagInfo.push({\n id: tagId,\n nm: tag.nm,\n status: true,\n qc: tag.qc,\n pr: tag.p,\n prNm: sdkProviders[tag.p]?.nm || '',\n });\n applicableTagInfo.push({\n id: tagId,\n nm: tag.nm,\n status: true,\n qc: tag.qc,\n pr: tag.p,\n prNm: sdkProviders[tag.p]?.nm || '',\n });\n } else {\n allTagInfo.push({\n id: tagId,\n nm: tag.nm,\n status: false,\n qc: tag.qc,\n pr: tag.p,\n prNm: sdkProviders[tag.p]?.nm || '',\n });\n }\n }\n }\n }\n }\n\n /**\n * Core function which actually puts the tag on page based on the tag type (JS or Image)\n * @param eventName\n * @param evtId\n */\n static async processTags(eventName: string, evtId: string): Promise<void> {\n try {\n Logger.logDbg(\n 'Processing tags for event: ',\n eventName,\n ' with id: ',\n evtId\n );\n const allTagInfo: Array<TagInfoItem> = [];\n const applicableTagInfo: Array<TagInfoItem> = [];\n const prStatus = DataStore.getPrivacyCompliance();\n const dataElements = DataStore.getDataElements();\n const transFunctions = DataStore.getTransFunctions();\n const sdkTags = DataStore.getSdkTags();\n const sdkProviders = DataStore.getSdkProviders();\n const validQcList = DataStore.getValidQcList();\n\n // Find applicable tags\n this.findApplicableTags(\n sdkTags,\n sdkProviders,\n validQcList,\n allTagInfo,\n applicableTagInfo\n );\n\n // set expected tag count, so that the reporter knows when all tags are finished and can report asynchronously\n Reporter.setExpectedTagCount(applicableTagInfo.length, evtId);\n\n Logger.logDbg('Applicable Tags: ', applicableTagInfo);\n\n // process tags one by one\n for (const tagInfo of applicableTagInfo) {\n try {\n Logger.logDbg(`Processing Tag: ${tagInfo.nm} [${tagInfo.id}]`);\n\n const tag: ClientSdkTagItem | undefined = sdkTags[tagInfo.id];\n\n if (!tag) {\n continue;\n }\n\n const provider: ClientSdkPrItem | undefined = sdkProviders[tag.p];\n\n if (!provider) {\n continue;\n }\n\n const result = this.hydrateTag(\n tagInfo,\n tag,\n provider,\n prStatus,\n dataElements,\n transFunctions\n );\n\n if (result.isInError) {\n Logger.logDbg(\n `Tag ${tagInfo.nm} not processed because of error code: ${result.errCd}`\n );\n if (result.errCd === 'NP') {\n Reporter.reportItem(\n {\n st: Constants.ST_PR_EXC,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: result.errMsg,\n },\n evtId\n );\n } else if (result.errCd === 'PRB') {\n Reporter.reportItem(\n {\n st: Constants.ST_PR_BL,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: result.errMsg,\n },\n evtId\n );\n } else if (result.errCd === 'REF') {\n Reporter.reportItem(\n {\n st: Constants.ST_VAL_FAIL,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: result.errMsg,\n },\n evtId\n );\n }\n continue;\n }\n\n const finalUrl = result.content;\n Logger.logDbg('Final Url :: ', finalUrl);\n\n if (provider.typ === Constants.PR_TYP_APP) {\n if (provider.sTyp === Constants.PR_S_TYP_R) {\n // process and fire app event\n try {\n const parsedData = JSON.parse(result.content as string);\n Utils.triggerEvent(\n parsedData.event_bus_name,\n parsedData.event_bus_payload\n );\n Reporter.reportItem(\n {\n st: Constants.ST_OK,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: parsedData,\n },\n evtId\n );\n } catch (err) {\n Logger.logError(err);\n Reporter.reportItem(\n {\n st: Constants.ST_ERR,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: result.content,\n },\n evtId\n );\n }\n } else {\n Logger.logError('Unsupported provider type: ' + provider.sTyp);\n }\n }\n } catch (err) {\n Logger.logError(\n 'Failed loading tag: ',\n tagInfo.id,\n ': Name: ',\n tagInfo.nm,\n 'with error ',\n err\n );\n Reporter.reportItem(\n {\n st: Constants.ST_ERR,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: (err as any)?.stack,\n },\n evtId\n );\n }\n }\n } catch (err) {\n Logger.logError('Error processing tags: ', err);\n // TODO: Report as metric to client\n }\n }\n\n /**\n * Takes all the placeholders in a tag and replaces them with actual values from data elements or\n * actual static values. Method returns an object with errCd and replaced content and a boolean identifier\n * to denote if this process failed or not\n * @param tagInfo\n * @param tag\n * @param provider\n * @param prStatus\n * @param dataElements\n * @param transFunctions\n */\n private static hydrateTag(\n tagInfo: TagInfoItem,\n tag: ClientSdkTagItem,\n provider: ClientSdkPrItem,\n prStatus: boolean,\n dataElements: MapLike<any>,\n transFunctions: MapLike<any>\n ): HydrateTagInfo {\n Logger.logDbg(`Hydrating Tag: ${tagInfo.nm} [${tagInfo.id}]`);\n if (!provider) {\n // serious issue. tag is in build sdk but not the appropriate provider\n Logger.logError(\n `Not hydrating tag: ${tagInfo.nm} [${tagInfo.id}] because appropriate provider was not found`\n );\n return {\n isInError: true,\n content: null,\n errCd: 'NP',\n errMsg: `Not hydrating tag: ${tagInfo.nm} [${tagInfo.id}] because appropriate provider was not found`,\n }; // No Provider\n }\n\n if (provider.pr === 'B' && !prStatus) {\n Logger.logDbg(\n `Not hydrating provider: ${provider.nm} [${tag.p}] because it is blacklisted`\n );\n return {\n isInError: true,\n content: null,\n errCd: 'PRB',\n errMsg: `Not hydrating provider: ${provider.nm} [${tag.p}] because it is blacklisted`,\n }; // Privacy Blocked\n }\n\n // merge both provider and client tag params into one - tag param overwrites provider params\n const params: MapLike<ClientSdkParamItem | undefined> =\n Utils.mergeMaps<ClientSdkParamItem>(\n undefined,\n provider.rParams,\n tag.rParams\n );\n\n if (provider.typ === 'app' && provider.sTyp === 'r') {\n // this is o app type provider. no need to find place-holders, just convert params to an object and prepare the json object\n return this.resourceParamsToActualValues(\n Object.values(params),\n dataElements,\n transFunctions\n );\n } else {\n // make tag url\n const preReplaceUrl: string = provider.url + (tag.url ? tag.url : '');\n const finalUrl: string = provider.url + (tag.url ? tag.url : '');\n\n // find placeholder values\n const placeHolders: string[] = this.findPlaceHolders(preReplaceUrl);\n // process tag attributes\n return this.replacePlaceHolders(\n finalUrl,\n placeHolders,\n dataElements,\n transFunctions,\n params,\n provider.chld || tag.chld,\n 'rph'\n );\n }\n }\n\n private static findPlaceHolders(content: string): string[] {\n const placeHolders: string[] = [];\n let match = Constants.PLACEHOLDER_REGEX.exec(content);\n while (match !== null) {\n placeHolders.push(match[2]);\n match = Constants.PLACEHOLDER_REGEX.exec(content);\n }\n return placeHolders;\n }\n\n private static resourceParamsToActualValues(\n params: ClientSdkParamItem[],\n deItems: MapLike,\n transFunctions: MapLike\n ): HydrateTagInfo {\n // resolve all param values and convert them into a temporary structure\n const paramValueArray: MapLike = {};\n\n for (const param of params) {\n if (param.val_src !== 'CHILDREN') {\n const deVal = this.parseParamValue(param, deItems, transFunctions);\n\n if (param.rqd && typeof deVal === 'undefined') {\n return {\n isInError: true,\n content: '',\n errCd: 'REF',\n errMsg: `Tag validation failed. Parameter ${param.nm} is marked as mandatory, but no value was found in source.`,\n };\n }\n\n paramValueArray[param.fKey] = deVal;\n }\n }\n\n const op = Utils.unFlattenObject(paramValueArray);\n\n return {\n isInError: false,\n content: JSON.stringify(op),\n errCd: null,\n errMsg: null,\n };\n }\n\n private static parseParamValue(\n paramItem: ClientSdkParamItem,\n deItems: MapLike<any>,\n transFunctions: MapLike<any>\n ): any {\n let paramValue = undefined;\n if (paramItem.sv || paramItem.de || paramItem.tfId) {\n if (paramItem.sv) {\n paramValue = paramItem.sv;\n } else if (paramItem.de) {\n paramValue = deItems[paramItem.de];\n } else if (paramItem.tfId) {\n paramValue = transFunctions[paramItem.tfId];\n }\n\n paramValue = Utils.applyTransformationResourceParam(\n paramValue,\n paramItem.tf\n );\n return paramValue;\n } else {\n return undefined;\n }\n }\n\n private static replacePlaceHolders(\n content: string,\n placeHolders: string[],\n deItems: MapLike<any>,\n transFunctions: MapLike<any>,\n params: MapLike<ClientSdkParamItem>,\n hasChildren: boolean,\n replaceMode: ReplaceMode\n ): HydrateTagInfo {\n let isInError = false;\n let errMsg;\n\n if (!params) {\n return {\n isInError: false,\n content,\n errCd: null,\n errMsg: 'No parameters where found to process in this tag',\n };\n }\n\n if (hasChildren) {\n // convert the flattened parameters to parent - child format. this is inside a condition\n // because we may not have a lot of JSON type parameters and we can save some processing time by limiting\n // when this is done\n params = Utils.unFlattenResourceParams(Object.values(params));\n }\n\n for (const ph of placeHolders) {\n try {\n const tagParam: ClientSdkParamItem = params[ph];\n if (tagParam) {\n if (tagParam.children && tagParam.children.length > 0) {\n const paramValue: MapLike<any> = {};\n for (const childParam of tagParam.children) {\n paramValue[childParam.nm] = this.parseParamValue(\n childParam,\n deItems,\n transFunctions\n );\n }\n content = this.replaceValues(\n ph,\n content,\n JSON.stringify(paramValue),\n replaceMode\n );\n } else {\n const paramValue = this.parseParamValue(\n tagParam,\n deItems,\n transFunctions\n );\n if (typeof paramValue === 'object') {\n content = this.replaceValues(\n ph,\n content,\n JSON.stringify(paramValue),\n replaceMode\n );\n } else {\n content = this.replaceValues(\n ph,\n content,\n paramValue,\n replaceMode\n );\n }\n }\n } else {\n // TODO: Report\n // place holder was found but the corresponding item was not found in tag resource params\n Logger.logDbg(\n 'place holder:',\n ph,\n ', was found but the corresponding item was not found in tag resource params'\n );\n }\n } catch (err) {\n isInError = true;\n errMsg = (err as any)?.stack;\n break;\n }\n }\n\n return {\n isInError,\n content,\n errCd: isInError ? 'REF' : null,\n errMsg: errMsg,\n };\n }\n\n private static checkTagDateValidity(\n currentEpochSeconds: number,\n tagStart: number,\n tagEnd: number\n ): boolean {\n return currentEpochSeconds >= tagStart && currentEpochSeconds <= tagEnd;\n }\n\n private static replaceValues(\n placeHolder: string,\n content: string,\n val: any,\n replaceMode: ReplaceMode\n ): string {\n let replaceVal: string;\n if (replaceMode === 'kph') {\n replaceVal = val && val !== '' ? val : `{{${placeHolder}}`;\n } else if (replaceMode === 'rph') {\n replaceVal = val && val !== '' ? val : '';\n }\n content = content.split(`{{${placeHolder}}}`).join(replaceVal);\n return content;\n }\n}\n"],"mappings":";;;;;;;AAqBA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBO,MAAMA,YAAN,CAAmB;EACS,OAAlBC,kBAAkB,CAC/BC,OAD+B,EAE/BC,YAF+B,EAG/BC,WAH+B,EAI/BC,UAJ+B,EAK/BC,iBAL+B,EAMzB;IACN,MAAMC,cAAwB,GAAG,EAAjC;IACA,MAAMC,OAAO,GAAGC,MAAM,CAACC,IAAP,CAAYR,OAAZ,CAAhB;IACA,MAAMS,mBAAmB,GAAGC,IAAI,CAACC,KAAL,CAAW,IAAIC,IAAJ,GAAWC,OAAX,KAAuB,IAAlC,CAA5B;;IACAC,cAAA,CAAOC,MAAP,CAAc,oBAAd,EAAoCT,OAAO,CAACU,MAA5C;;IACA,KAAK,MAAMC,KAAX,IAAoBX,OAApB,EAA6B;MAC3B,MAAMY,GAAiC,GAAGlB,OAAO,CAACiB,KAAD,CAAjD;;MACA,IAAIC,GAAJ,EAAS;QACP,IAAIC,WAAW,GAAG,IAAlB;;QACA,KAAK,MAAMC,EAAX,IAAiBF,GAAG,CAACE,EAArB,EAAyB;UACvB,IAAIlB,WAAW,CAACmB,OAAZ,CAAoBD,EAApB,MAA4B,CAAC,CAAjC,EAAoC;YAAA;;YAClCD,WAAW,GAAG,KAAd;YACAhB,UAAU,CAACmB,IAAX,CAAgB;cACdC,EAAE,EAAEN,KADU;cAEdO,EAAE,EAAEN,GAAG,CAACM,EAFM;cAGdC,MAAM,EAAE,KAHM;c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MAGLX,KAAK,EAAED,SAAS,GAAG,KAAH,GAAW,IAHtB;MAILQ,MAAM,EAAEA;IAJH,CAAP;EAMD;;EAEkC,OAApB9B,oBAAoB,CACjCpB,mBADiC,EAEjCgH,QAFiC,EAGjCC,MAHiC,EAIxB;IACT,OAAOjH,mBAAmB,IAAIgH,QAAvB,IAAmChH,mBAAmB,IAAIiH,MAAjE;EACD;;EAE2B,OAAbF,aAAa,CAC1BG,WAD0B,EAE1B5D,OAF0B,EAG1B6D,GAH0B,EAI1BV,WAJ0B,EAKlB;IACR,IAAIW,UAAJ;;IACA,IAAIX,WAAW,KAAK,KAApB,EAA2B;MACzBW,UAAU,GAAGD,GAAG,IAAIA,GAAG,KAAK,EAAf,GAAoBA,GAApB,GAA2B,KAAID,WAAY,GAAxD;IACD,CAFD,MAEO,IAAIT,WAAW,KAAK,KAApB,EAA2B;MAChCW,UAAU,GAAGD,GAAG,IAAIA,GAAG,KAAK,EAAf,GAAoBA,GAApB,GAA0B,EAAvC;IACD;;IACD7D,OAAO,GAAGA,OAAO,CAAC+D,KAAR,CAAe,KAAIH,WAAY,IAA/B,EAAoCI,IAApC,CAAyCF,UAAzC,CAAV;IACA,OAAO9D,OAAP;EACD;;AAlfuB"}
|
|
1
|
+
{"version":3,"names":["_logger","require","_dataStore","_reporter","_constants","_utils","TagProcessor","findApplicableTags","sdkTags","sdkProviders","validQcList","allTagInfo","applicableTagInfo","applicableTags","tagKeys","Object","keys","currentEpochSeconds","Math","round","Date","getTime","Logger","logDbg","length","tagId","tag","isQualified","qc","indexOf","_sdkProviders$tag$p","push","id","nm","status","pr","p","prNm","checkTagDateValidity","st","ex","_sdkProviders$tag$p2","_sdkProviders$tag$p3","_sdkProviders$tag$p4","processTags","eventName","evtId","prStatus","DataStore","getPrivacyCompliance","dataElements","getDataElements","transFunctions","getTransFunctions","getSdkTags","getSdkProviders","getValidQcList","Reporter","setExpectedTagCount","tagInfo","provider","result","hydrateTag","isInError","errCd","reportItem","Constants","ST_PR_EXC","t","tNm","req","errMsg","ST_PR_BL","ST_VAL_FAIL","finalUrl","content","typ","PR_TYP_APP","sTyp","PR_S_TYP_R","parsedData","JSON","parse","Utils","triggerEvent","event_bus_name","event_bus_payload","ST_OK","err","logError","ST_ERR","stack","params","mergeMaps","undefined","rParams","resourceParamsToActualValues","values","preReplaceUrl","url","placeHolders","findPlaceHolders","replacePlaceHolders","chld","match","PLACEHOLDER_REGEX","exec","deItems","paramValueArray","param","val_src","deVal","parseParamValue","rqd","fKey","op","unFlattenObject","stringify","paramItem","paramValue","sv","de","tfId","applyTransformationResourceParam","tf","hasChildren","replaceMode","unFlattenResourceParams","ph","tagParam","children","childParam","replaceValues","tagStart","tagEnd","placeHolder","val","replaceVal","split","join","exports"],"sources":["tag.processor.ts"],"sourcesContent":["/**\n * Finds all the applicable tags based on the true qualification criteria. Method does not return anything\n * because it uses pass by memory reference. The last 2 paramters (allTagInfo and applicableTagInfo) are\n * return variables\n * @param sdkTags\n * @param sdkProviders\n * @param validQcList\n * @param allTagInfo\n * @param applicableTagInfo\n */\nimport type {\n HydrateTagInfo,\n MapLike,\n ReplaceMode,\n TagInfoItem,\n} from '../common/app-types';\nimport type {\n ClientSdkParamItem,\n ClientSdkPrItem,\n ClientSdkTagItem,\n} from '../models/mp-client-sdk';\nimport { Logger } from '../common/logger';\nimport { DataStore } from '../common/data-store';\nimport { Reporter } from '../common/reporter';\nimport { Constants } from '../common/constants';\nimport { Utils } from '../common/utils';\n\nexport class TagProcessor {\n private static findApplicableTags(\n sdkTags: MapLike<ClientSdkTagItem>,\n sdkProviders: MapLike<ClientSdkPrItem>,\n validQcList: string[],\n allTagInfo: TagInfoItem[],\n applicableTagInfo: TagInfoItem[]\n ): void {\n const applicableTags: string[] = [];\n const tagKeys = Object.keys(sdkTags);\n const currentEpochSeconds = Math.round(new Date().getTime() / 1000);\n Logger.logDbg('Total Tag Length: ', tagKeys.length);\n for (const tagId of tagKeys) {\n const tag: ClientSdkTagItem | undefined = sdkTags[tagId];\n if (tag) {\n let isQualified = true;\n for (const qc of tag.qc) {\n if (validQcList.indexOf(qc) === -1) {\n isQualified = false;\n allTagInfo.push({\n id: tagId,\n nm: tag.nm,\n status: false,\n qc,\n pr: tag.p,\n prNm: sdkProviders[tag.p]?.nm || '',\n });\n break;\n }\n }\n if (isQualified && applicableTags.indexOf(tagId) === -1) {\n if (this.checkTagDateValidity(currentEpochSeconds, tag.st, tag.ex)) {\n applicableTags.push(tagId);\n allTagInfo.push({\n id: tagId,\n nm: tag.nm,\n status: true,\n qc: tag.qc,\n pr: tag.p,\n prNm: sdkProviders[tag.p]?.nm || '',\n });\n applicableTagInfo.push({\n id: tagId,\n nm: tag.nm,\n status: true,\n qc: tag.qc,\n pr: tag.p,\n prNm: sdkProviders[tag.p]?.nm || '',\n });\n } else {\n allTagInfo.push({\n id: tagId,\n nm: tag.nm,\n status: false,\n qc: tag.qc,\n pr: tag.p,\n prNm: sdkProviders[tag.p]?.nm || '',\n });\n }\n }\n }\n }\n }\n\n /**\n * Core function which actually puts the tag on page based on the tag type (JS or Image)\n * @param eventName\n * @param evtId\n */\n static async processTags(eventName: string, evtId: string): Promise<void> {\n try {\n Logger.logDbg(\n 'Processing tags for event: ',\n eventName,\n ' with id: ',\n evtId\n );\n const allTagInfo: Array<TagInfoItem> = [];\n const applicableTagInfo: Array<TagInfoItem> = [];\n const prStatus = DataStore.getPrivacyCompliance();\n const dataElements = DataStore.getDataElements();\n const transFunctions = DataStore.getTransFunctions();\n const sdkTags = DataStore.getSdkTags();\n const sdkProviders = DataStore.getSdkProviders();\n const validQcList = DataStore.getValidQcList();\n\n // Find applicable tags\n this.findApplicableTags(\n sdkTags,\n sdkProviders,\n validQcList,\n allTagInfo,\n applicableTagInfo\n );\n\n // set expected tag count, so that the reporter knows when all tags are finished and can report asynchronously\n Reporter.setExpectedTagCount(applicableTagInfo.length, evtId);\n\n Logger.logDbg('Applicable Tags: ', applicableTagInfo);\n\n // process tags one by one\n for (const tagInfo of applicableTagInfo) {\n try {\n Logger.logDbg(`Processing Tag: ${tagInfo.nm} [${tagInfo.id}]`);\n\n const tag: ClientSdkTagItem | undefined = sdkTags[tagInfo.id];\n\n if (!tag) {\n continue;\n }\n\n const provider: ClientSdkPrItem | undefined = sdkProviders[tag.p];\n\n if (!provider) {\n continue;\n }\n\n const result = this.hydrateTag(\n tagInfo,\n tag,\n provider,\n prStatus,\n dataElements,\n transFunctions\n );\n\n if (result.isInError) {\n Logger.logDbg(\n `Tag ${tagInfo.nm} not processed because of error code: ${result.errCd}`\n );\n if (result.errCd === 'NP') {\n Reporter.reportItem(\n {\n st: Constants.ST_PR_EXC,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: result.errMsg,\n },\n evtId\n );\n } else if (result.errCd === 'PRB') {\n Reporter.reportItem(\n {\n st: Constants.ST_PR_BL,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: result.errMsg,\n },\n evtId\n );\n } else if (result.errCd === 'REF') {\n Reporter.reportItem(\n {\n st: Constants.ST_VAL_FAIL,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: result.errMsg,\n },\n evtId\n );\n }\n continue;\n }\n\n const finalUrl = result.content;\n Logger.logDbg('Final Url :: ', finalUrl);\n\n if (provider.typ === Constants.PR_TYP_APP) {\n if (provider.sTyp === Constants.PR_S_TYP_R) {\n // process and fire app event\n try {\n const parsedData = JSON.parse(result.content as string);\n Utils.triggerEvent(\n parsedData.event_bus_name,\n parsedData.event_bus_payload\n );\n Reporter.reportItem(\n {\n st: Constants.ST_OK,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: parsedData,\n },\n evtId\n );\n } catch (err) {\n Logger.logError(err);\n Reporter.reportItem(\n {\n st: Constants.ST_ERR,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: result.content,\n },\n evtId\n );\n }\n } else {\n Logger.logError('Unsupported provider type: ' + provider.sTyp);\n }\n }\n } catch (err) {\n Logger.logError(\n 'Failed loading tag: ',\n tagInfo.id,\n ': Name: ',\n tagInfo.nm,\n 'with error ',\n err\n );\n Reporter.reportItem(\n {\n st: Constants.ST_ERR,\n t: tagInfo.id,\n p: tagInfo.pr,\n tNm: tagInfo.nm,\n req: (err as any)?.stack,\n },\n evtId\n );\n }\n }\n } catch (err) {\n Logger.logError('Error processing tags: ', err);\n // TODO: Report as metric to client\n }\n }\n\n /**\n * Takes all the placeholders in a tag and replaces them with actual values from data elements or\n * actual static values. Method returns an object with errCd and replaced content and a boolean identifier\n * to denote if this process failed or not\n * @param tagInfo\n * @param tag\n * @param provider\n * @param prStatus\n * @param dataElements\n * @param transFunctions\n */\n private static hydrateTag(\n tagInfo: TagInfoItem,\n tag: ClientSdkTagItem,\n provider: ClientSdkPrItem,\n prStatus: boolean,\n dataElements: MapLike<any>,\n transFunctions: MapLike<any>\n ): HydrateTagInfo {\n Logger.logDbg(`Hydrating Tag: ${tagInfo.nm} [${tagInfo.id}]`);\n if (!provider) {\n // serious issue. tag is in build sdk but not the appropriate provider\n Logger.logError(\n `Not hydrating tag: ${tagInfo.nm} [${tagInfo.id}] because appropriate provider was not found`\n );\n return {\n isInError: true,\n content: null,\n errCd: 'NP',\n errMsg: `Not hydrating tag: ${tagInfo.nm} [${tagInfo.id}] because appropriate provider was not found`,\n }; // No Provider\n }\n\n if (provider.pr === 'B' && !prStatus) {\n Logger.logDbg(\n `Not hydrating provider: ${provider.nm} [${tag.p}] because it is blacklisted`\n );\n return {\n isInError: true,\n content: null,\n errCd: 'PRB',\n errMsg: `Not hydrating provider: ${provider.nm} [${tag.p}] because it is blacklisted`,\n }; // Privacy Blocked\n }\n\n // merge both provider and client tag params into one - tag param overwrites provider params\n const params: MapLike<ClientSdkParamItem | undefined> =\n Utils.mergeMaps<ClientSdkParamItem>(\n undefined,\n provider.rParams,\n tag.rParams\n );\n\n if (provider.typ === 'app' && provider.sTyp === 'r') {\n // this is o app type provider. no need to find place-holders, just convert params to an object and prepare the json object\n return this.resourceParamsToActualValues(\n Object.values(params),\n dataElements,\n transFunctions\n );\n } else {\n // make tag url\n const preReplaceUrl: string = provider.url + (tag.url ? tag.url : '');\n const finalUrl: string = provider.url + (tag.url ? tag.url : '');\n\n // find placeholder values\n const placeHolders: string[] = this.findPlaceHolders(preReplaceUrl);\n // process tag attributes\n return this.replacePlaceHolders(\n finalUrl,\n placeHolders,\n dataElements,\n transFunctions,\n params,\n provider.chld || tag.chld,\n 'rph'\n );\n }\n }\n\n private static findPlaceHolders(content: string): string[] {\n const placeHolders: string[] = [];\n let match = Constants.PLACEHOLDER_REGEX.exec(content);\n while (match !== null) {\n placeHolders.push(match[2]);\n match = Constants.PLACEHOLDER_REGEX.exec(content);\n }\n return placeHolders;\n }\n\n private static resourceParamsToActualValues(\n params: ClientSdkParamItem[],\n deItems: MapLike,\n transFunctions: MapLike\n ): HydrateTagInfo {\n // resolve all param values and convert them into a temporary structure\n const paramValueArray: MapLike = {};\n\n for (const param of params) {\n if (param.val_src !== 'CHILDREN') {\n const deVal = this.parseParamValue(param, deItems, transFunctions);\n\n if (param.rqd && typeof deVal === 'undefined') {\n return {\n isInError: true,\n content: '',\n errCd: 'REF',\n errMsg: `Tag validation failed. Parameter ${param.nm} is marked as mandatory, but no value was found in source.`,\n };\n }\n\n paramValueArray[param.fKey] = deVal;\n }\n }\n\n const op = Utils.unFlattenObject(paramValueArray);\n\n return {\n isInError: false,\n content: JSON.stringify(op),\n errCd: null,\n errMsg: null,\n };\n }\n\n private static parseParamValue(\n paramItem: ClientSdkParamItem,\n deItems: MapLike<any>,\n transFunctions: MapLike<any>\n ): any {\n let paramValue = undefined;\n if (paramItem.sv || paramItem.de || paramItem.tfId) {\n if (paramItem.sv) {\n paramValue = paramItem.sv;\n } else if (paramItem.de) {\n paramValue = deItems[paramItem.de];\n } else if (paramItem.tfId) {\n paramValue = transFunctions[paramItem.tfId];\n }\n\n paramValue = Utils.applyTransformationResourceParam(\n paramValue,\n paramItem.tf\n );\n return paramValue;\n } else {\n return undefined;\n }\n }\n\n private static replacePlaceHolders(\n content: string,\n placeHolders: string[],\n deItems: MapLike<any>,\n transFunctions: MapLike<any>,\n params: MapLike<ClientSdkParamItem>,\n hasChildren: boolean,\n replaceMode: ReplaceMode\n ): HydrateTagInfo {\n let isInError = false;\n let errMsg;\n\n if (!params) {\n return {\n isInError: false,\n content,\n errCd: null,\n errMsg: 'No parameters where found to process in this tag',\n };\n }\n\n if (hasChildren) {\n // convert the flattened parameters to parent - child format. this is inside a condition\n // because we may not have a lot of JSON type parameters and we can save some processing time by limiting\n // when this is done\n params = Utils.unFlattenResourceParams(Object.values(params));\n }\n\n for (const ph of placeHolders) {\n try {\n const tagParam: ClientSdkParamItem = params[ph];\n if (tagParam) {\n if (tagParam.children && tagParam.children.length > 0) {\n const paramValue: MapLike<any> = {};\n for (const childParam of tagParam.children) {\n paramValue[childParam.nm] = this.parseParamValue(\n childParam,\n deItems,\n transFunctions\n );\n }\n content = this.replaceValues(\n ph,\n content,\n JSON.stringify(paramValue),\n replaceMode\n );\n } else {\n const paramValue = this.parseParamValue(\n tagParam,\n deItems,\n transFunctions\n );\n if (typeof paramValue === 'object') {\n content = this.replaceValues(\n ph,\n content,\n JSON.stringify(paramValue),\n replaceMode\n );\n } else {\n content = this.replaceValues(\n ph,\n content,\n paramValue,\n replaceMode\n );\n }\n }\n } else {\n // TODO: Report\n // place holder was found but the corresponding item was not found in tag resource params\n Logger.logDbg(\n 'place holder:',\n ph,\n ', was found but the corresponding item was not found in tag resource params'\n );\n }\n } catch (err) {\n isInError = true;\n errMsg = (err as any)?.stack;\n break;\n }\n }\n\n return {\n isInError,\n content,\n errCd: isInError ? 'REF' : null,\n errMsg: errMsg,\n };\n }\n\n private static checkTagDateValidity(\n currentEpochSeconds: number,\n tagStart: number,\n tagEnd: number\n ): boolean {\n return currentEpochSeconds >= tagStart && currentEpochSeconds <= tagEnd;\n }\n\n private static replaceValues(\n placeHolder: string,\n content: string,\n val: any,\n replaceMode: ReplaceMode\n ): string {\n let replaceVal: string;\n if (replaceMode === 'kph') {\n replaceVal = val && val !== '' ? val : `{{${placeHolder}}`;\n } else if (replaceMode === 'rph') {\n replaceVal = val && val !== '' ? val : '';\n }\n content = content.split(`{{${placeHolder}}}`).join(replaceVal);\n return content;\n }\n}\n"],"mappings":";;;;;;AAqBA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBO,MAAMK,YAAY,CAAC;EACxB,OAAeC,kBAAkBA,CAC/BC,OAAkC,EAClCC,YAAsC,EACtCC,WAAqB,EACrBC,UAAyB,EACzBC,iBAAgC,EAC1B;IACN,MAAMC,cAAwB,GAAG,EAAE;IACnC,MAAMC,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACR,OAAO,CAAC;IACpC,MAAMS,mBAAmB,GAAGC,IAAI,CAACC,KAAK,CAAC,IAAIC,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IACnEC,cAAM,CAACC,MAAM,CAAC,oBAAoB,EAAET,OAAO,CAACU,MAAM,CAAC;IACnD,KAAK,MAAMC,KAAK,IAAIX,OAAO,EAAE;MAC3B,MAAMY,GAAiC,GAAGlB,OAAO,CAACiB,KAAK,CAAC;MACxD,IAAIC,GAAG,EAAE;QACP,IAAIC,WAAW,GAAG,IAAI;QACtB,KAAK,MAAMC,EAAE,IAAIF,GAAG,CAACE,EAAE,EAAE;UACvB,IAAIlB,WAAW,CAACmB,OAAO,CAACD,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE;YAAA,IAAAE,mBAAA;YAClCH,WAAW,GAAG,KAAK;YACnBhB,UAAU,CAACoB,IAAI,C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AAe,EACfyG,EAAE,EACF,6EACF,CAAC;QACH;MACF,CAAC,CAAC,OAAOxC,GAAG,EAAE;QACZzB,SAAS,GAAG,IAAI;QAChBQ,MAAM,GAAIiB,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAUG,KAAK;QAC5B;MACF;IACF;IAEA,OAAO;MACL5B,SAAS;MACTY,OAAO;MACPX,KAAK,EAAED,SAAS,GAAG,KAAK,GAAG,IAAI;MAC/BQ,MAAM,EAAEA;IACV,CAAC;EACH;EAEA,OAAejC,oBAAoBA,CACjCrB,mBAA2B,EAC3BoH,QAAgB,EAChBC,MAAc,EACL;IACT,OAAOrH,mBAAmB,IAAIoH,QAAQ,IAAIpH,mBAAmB,IAAIqH,MAAM;EACzE;EAEA,OAAeF,aAAaA,CAC1BG,WAAmB,EACnB5D,OAAe,EACf6D,GAAQ,EACRV,WAAwB,EAChB;IACR,IAAIW,UAAkB;IACtB,IAAIX,WAAW,KAAK,KAAK,EAAE;MACzBW,UAAU,GAAGD,GAAG,IAAIA,GAAG,KAAK,EAAE,GAAGA,GAAG,GAAG,KAAKD,WAAW,GAAG;IAC5D,CAAC,MAAM,IAAIT,WAAW,KAAK,KAAK,EAAE;MAChCW,UAAU,GAAGD,GAAG,IAAIA,GAAG,KAAK,EAAE,GAAGA,GAAG,GAAG,EAAE;IAC3C;IACA7D,OAAO,GAAGA,OAAO,CAAC+D,KAAK,CAAC,KAAKH,WAAW,IAAI,CAAC,CAACI,IAAI,CAACF,UAAU,CAAC;IAC9D,OAAO9D,OAAO;EAChB;AACF;AAACiE,OAAA,CAAAtI,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TransFunctionProcessor = void 0;
|
|
7
|
-
|
|
8
7
|
var _dataStore = require("../common/data-store");
|
|
9
|
-
|
|
10
8
|
var _logger = require("../common/logger");
|
|
11
|
-
|
|
12
9
|
var _utils = require("../common/utils");
|
|
13
|
-
|
|
14
10
|
var _reporter = require("../common/reporter");
|
|
15
|
-
|
|
16
11
|
/**
|
|
17
12
|
* Process all the data elements at once, or if a set of keys are specified, processes only
|
|
18
13
|
* those keys and updates the dataElements object in global-fns file
|
|
@@ -20,12 +15,11 @@ var _reporter = require("../common/reporter");
|
|
|
20
15
|
* @param sdkTransFunctions
|
|
21
16
|
* @param optTfnKeys
|
|
22
17
|
*/
|
|
18
|
+
|
|
23
19
|
class TransFunctionProcessor {
|
|
24
20
|
static processTransformationFunctions(dataElements, sdkTransFunctions, optTfnKeys) {
|
|
25
21
|
const tfn = _dataStore.DataStore.getTransFunctions();
|
|
26
|
-
|
|
27
22
|
const tfnKeys = optTfnKeys && optTfnKeys.length > 0 ? optTfnKeys : Object.keys(sdkTransFunctions);
|
|
28
|
-
|
|
29
23
|
try {
|
|
30
24
|
for (const key of tfnKeys) {
|
|
31
25
|
try {
|
|
@@ -40,52 +34,40 @@ class TransFunctionProcessor {
|
|
|
40
34
|
if (tfnItem) {
|
|
41
35
|
if (tfnItem.rParams) {
|
|
42
36
|
const tfnFnInput = {};
|
|
43
|
-
|
|
44
37
|
for (const paramKey of Object.keys(tfnItem.rParams)) {
|
|
45
38
|
// tfn can have only data elements as of now.
|
|
46
39
|
const rParam = tfnItem.rParams[paramKey];
|
|
47
40
|
const deId = rParam === null || rParam === void 0 ? void 0 : rParam.de;
|
|
48
|
-
|
|
49
41
|
if (deId) {
|
|
50
42
|
let paramValue = dataElements[deId] || '';
|
|
51
|
-
|
|
52
43
|
if (rParam.rqd && !paramValue) {
|
|
53
44
|
_logger.Logger.logDbg(`Value required for: ${paramKey}, in transformation function. But not found`);
|
|
54
|
-
|
|
55
45
|
break;
|
|
56
46
|
}
|
|
57
|
-
|
|
58
47
|
if (rParam.tf) {
|
|
59
48
|
paramValue = _utils.Utils.applyTransformationResourceParam(paramValue, rParam.tf);
|
|
60
49
|
}
|
|
61
|
-
|
|
62
50
|
tfnFnInput[paramKey] = paramValue;
|
|
63
51
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
}
|
|
53
|
+
// invoke the function and get the value
|
|
67
54
|
tfn[key] = tfnItem.fn(tfnFnInput);
|
|
68
55
|
}
|
|
69
56
|
} else {
|
|
70
57
|
tfn[key] = '';
|
|
71
58
|
}
|
|
72
59
|
} catch (err) {
|
|
73
|
-
_logger.Logger.logError('Error processing transformation function: ', key, ' with error: ', err);
|
|
74
|
-
|
|
60
|
+
_logger.Logger.logError('Error processing transformation function: ', key, ' with error: ', err);
|
|
61
|
+
// TODO: Report as metric to client
|
|
75
62
|
}
|
|
76
63
|
}
|
|
77
64
|
} catch (err) {
|
|
78
65
|
_logger.Logger.logError('Error processing transformation functions: ', err);
|
|
79
|
-
|
|
80
66
|
_reporter.Reporter.reportError('m::processTransformationFunctions', err);
|
|
81
67
|
}
|
|
82
|
-
|
|
83
68
|
_dataStore.DataStore.setTransFunctions(tfn);
|
|
84
|
-
|
|
85
69
|
return tfn;
|
|
86
70
|
}
|
|
87
|
-
|
|
88
71
|
}
|
|
89
|
-
|
|
90
72
|
exports.TransFunctionProcessor = TransFunctionProcessor;
|
|
91
73
|
//# sourceMappingURL=trans-function.processor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TransFunctionProcessor","processTransformationFunctions","dataElements","sdkTransFunctions","optTfnKeys","tfn","DataStore","getTransFunctions","tfnKeys","length","Object","keys","key","tfnItem","rParams","tfnFnInput","paramKey","rParam","deId","de","paramValue","rqd","Logger","logDbg","tf","Utils","applyTransformationResourceParam","fn","err","logError","Reporter","reportError","setTransFunctions"],"sources":["trans-function.processor.ts"],"sourcesContent":["/**\n * Process all the data elements at once, or if a set of keys are specified, processes only\n * those keys and updates the dataElements object in global-fns file\n * @param dataElements\n * @param sdkTransFunctions\n * @param optTfnKeys\n */\nimport type { MapLike } from '../common/app-types';\nimport type { ClientSdkTfnItem } from '../models/mp-client-sdk';\nimport { DataStore } from '../common/data-store';\nimport { Logger } from '../common/logger';\nimport { Utils } from '../common/utils';\nimport { Reporter } from '../common/reporter';\n\nexport class TransFunctionProcessor {\n static processTransformationFunctions(\n dataElements: MapLike<any>,\n sdkTransFunctions: MapLike<ClientSdkTfnItem>,\n optTfnKeys?: string[]\n ): MapLike<any> {\n const tfn = DataStore.getTransFunctions();\n const tfnKeys =\n optTfnKeys && optTfnKeys.length > 0\n ? optTfnKeys\n : Object.keys(sdkTransFunctions);\n try {\n for (const key of tfnKeys) {\n try {\n const tfnItem = sdkTransFunctions[key];\n /**\n * How to process transformation functions\n * 1) Find all the data elements in the resource params of trans function\n * 2) make them into an object (key value) where key is the resourceKey and value is the value of data elements\n * 3) Invoke the tfn and get the value and store it against the tfn key\n */\n\n if (tfnItem) {\n if (tfnItem.rParams) {\n const tfnFnInput: any = {};\n for (const paramKey of Object.keys(tfnItem.rParams)) {\n // tfn can have only data elements as of now.\n const rParam = tfnItem.rParams[paramKey];\n const deId = rParam?.de;\n if (deId) {\n let paramValue = dataElements[deId] || '';\n if (rParam.rqd && !paramValue) {\n Logger.logDbg(\n `Value required for: ${paramKey}, in transformation function. But not found`\n );\n break;\n }\n if (rParam.tf) {\n paramValue = Utils.applyTransformationResourceParam(\n paramValue,\n rParam.tf\n );\n }\n tfnFnInput[paramKey] = paramValue;\n }\n }\n // invoke the function and get the value\n tfn[key] = tfnItem.fn(tfnFnInput);\n }\n } else {\n tfn[key] = '';\n }\n } catch (err) {\n Logger.logError(\n 'Error processing transformation function: ',\n key,\n ' with error: ',\n err\n );\n // TODO: Report as metric to client\n }\n }\n } catch (err) {\n Logger.logError('Error processing transformation functions: ', err);\n Reporter.reportError('m::processTransformationFunctions', err);\n }\n\n DataStore.setTransFunctions(tfn);\n return tfn;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_dataStore","require","_logger","_utils","_reporter","TransFunctionProcessor","processTransformationFunctions","dataElements","sdkTransFunctions","optTfnKeys","tfn","DataStore","getTransFunctions","tfnKeys","length","Object","keys","key","tfnItem","rParams","tfnFnInput","paramKey","rParam","deId","de","paramValue","rqd","Logger","logDbg","tf","Utils","applyTransformationResourceParam","fn","err","logError","Reporter","reportError","setTransFunctions","exports"],"sources":["trans-function.processor.ts"],"sourcesContent":["/**\n * Process all the data elements at once, or if a set of keys are specified, processes only\n * those keys and updates the dataElements object in global-fns file\n * @param dataElements\n * @param sdkTransFunctions\n * @param optTfnKeys\n */\nimport type { MapLike } from '../common/app-types';\nimport type { ClientSdkTfnItem } from '../models/mp-client-sdk';\nimport { DataStore } from '../common/data-store';\nimport { Logger } from '../common/logger';\nimport { Utils } from '../common/utils';\nimport { Reporter } from '../common/reporter';\n\nexport class TransFunctionProcessor {\n static processTransformationFunctions(\n dataElements: MapLike<any>,\n sdkTransFunctions: MapLike<ClientSdkTfnItem>,\n optTfnKeys?: string[]\n ): MapLike<any> {\n const tfn = DataStore.getTransFunctions();\n const tfnKeys =\n optTfnKeys && optTfnKeys.length > 0\n ? optTfnKeys\n : Object.keys(sdkTransFunctions);\n try {\n for (const key of tfnKeys) {\n try {\n const tfnItem = sdkTransFunctions[key];\n /**\n * How to process transformation functions\n * 1) Find all the data elements in the resource params of trans function\n * 2) make them into an object (key value) where key is the resourceKey and value is the value of data elements\n * 3) Invoke the tfn and get the value and store it against the tfn key\n */\n\n if (tfnItem) {\n if (tfnItem.rParams) {\n const tfnFnInput: any = {};\n for (const paramKey of Object.keys(tfnItem.rParams)) {\n // tfn can have only data elements as of now.\n const rParam = tfnItem.rParams[paramKey];\n const deId = rParam?.de;\n if (deId) {\n let paramValue = dataElements[deId] || '';\n if (rParam.rqd && !paramValue) {\n Logger.logDbg(\n `Value required for: ${paramKey}, in transformation function. But not found`\n );\n break;\n }\n if (rParam.tf) {\n paramValue = Utils.applyTransformationResourceParam(\n paramValue,\n rParam.tf\n );\n }\n tfnFnInput[paramKey] = paramValue;\n }\n }\n // invoke the function and get the value\n tfn[key] = tfnItem.fn(tfnFnInput);\n }\n } else {\n tfn[key] = '';\n }\n } catch (err) {\n Logger.logError(\n 'Error processing transformation function: ',\n key,\n ' with error: ',\n err\n );\n // TODO: Report as metric to client\n }\n }\n } catch (err) {\n Logger.logError('Error processing transformation functions: ', err);\n Reporter.reportError('m::processTransformationFunctions', err);\n }\n\n DataStore.setTransFunctions(tfn);\n return tfn;\n }\n}\n"],"mappings":";;;;;;AASA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQO,MAAMI,sBAAsB,CAAC;EAClC,OAAOC,8BAA8BA,CACnCC,YAA0B,EAC1BC,iBAA4C,EAC5CC,UAAqB,EACP;IACd,MAAMC,GAAG,GAAGC,oBAAS,CAACC,iBAAiB,CAAC,CAAC;IACzC,MAAMC,OAAO,GACXJ,UAAU,IAAIA,UAAU,CAACK,MAAM,GAAG,CAAC,GAC/BL,UAAU,GACVM,MAAM,CAACC,IAAI,CAACR,iBAAiB,CAAC;IACpC,IAAI;MACF,KAAK,MAAMS,GAAG,IAAIJ,OAAO,EAAE;QACzB,IAAI;UACF,MAAMK,OAAO,GAAGV,iBAAiB,CAACS,GAAG,CAAC;UACtC;AACV;AACA;AACA;AACA;AACA;;UAEU,IAAIC,OAAO,EAAE;YACX,IAAIA,OAAO,CAACC,OAAO,EAAE;cACnB,MAAMC,UAAe,GAAG,CAAC,CAAC;cAC1B,KAAK,MAAMC,QAAQ,IAAIN,MAAM,CAACC,IAAI,CAACE,OAAO,CAACC,OAAO,CAAC,EAAE;gBACnD;gBACA,MAAMG,MAAM,GAAGJ,OAAO,CAACC,OAAO,CAACE,QAAQ,CAAC;gBACxC,MAAME,IAAI,GAAGD,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEE,EAAE;gBACvB,IAAID,IAAI,EAAE;kBACR,IAAIE,U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