mapp-intelligence-reactnative-plugin 1.0.0 → 1.0.2

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.
Files changed (43) hide show
  1. package/README.md +31 -7
  2. package/android/gradle.properties +3 -3
  3. package/android/src/main/java/com/mappinteligenceplugin/mapper/Util.kt +12 -4
  4. package/lib/commonjs/Converters.js +1 -1
  5. package/lib/commonjs/Converters.js.map +1 -1
  6. package/lib/commonjs/GlobalErrorHandler.js +2 -6
  7. package/lib/commonjs/GlobalErrorHandler.js.map +1 -1
  8. package/lib/commonjs/MappIntelligencePlugin.js +298 -0
  9. package/lib/commonjs/MappIntelligencePlugin.js.map +1 -0
  10. package/lib/commonjs/UseWebTracking.js +7 -11
  11. package/lib/commonjs/UseWebTracking.js.map +1 -1
  12. package/lib/commonjs/index.js +49 -378
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/commonjs/promiseRejectionHandler.js.map +1 -1
  15. package/lib/module/Converters.js +1 -1
  16. package/lib/module/Converters.js.map +1 -1
  17. package/lib/module/GlobalErrorHandler.js +2 -6
  18. package/lib/module/GlobalErrorHandler.js.map +1 -1
  19. package/lib/module/MappIntelligencePlugin.js +292 -0
  20. package/lib/module/MappIntelligencePlugin.js.map +1 -0
  21. package/lib/module/UseWebTracking.js +6 -10
  22. package/lib/module/UseWebTracking.js.map +1 -1
  23. package/lib/module/index.js +5 -319
  24. package/lib/module/index.js.map +1 -1
  25. package/lib/module/promiseRejectionHandler.js.map +1 -1
  26. package/lib/typescript/src/Converters.d.ts +1 -1
  27. package/lib/typescript/src/Converters.d.ts.map +1 -1
  28. package/lib/typescript/src/DataTypes.d.ts +6 -6
  29. package/lib/typescript/src/DataTypes.d.ts.map +1 -1
  30. package/lib/typescript/src/GlobalErrorHandler.d.ts.map +1 -1
  31. package/lib/typescript/src/MappIntelligencePlugin.d.ts +201 -0
  32. package/lib/typescript/src/MappIntelligencePlugin.d.ts.map +1 -0
  33. package/lib/typescript/src/UseWebTracking.d.ts +2 -2
  34. package/lib/typescript/src/UseWebTracking.d.ts.map +1 -1
  35. package/lib/typescript/src/index.d.ts +5 -199
  36. package/lib/typescript/src/index.d.ts.map +1 -1
  37. package/mapp-intelligence-reactnative-plugin.podspec +1 -1
  38. package/package.json +28 -24
  39. package/src/Converters.tsx +6 -6
  40. package/src/GlobalErrorHandler.tsx +3 -6
  41. package/src/MappIntelligencePlugin.tsx +394 -0
  42. package/src/UseWebTracking.tsx +13 -15
  43. package/src/index.tsx +5 -409
@@ -0,0 +1,292 @@
1
+ import { Platform, NativeModules } from 'react-native';
2
+ import { convertPageParameters, convertSessionParamters, convertUserCategories, convertEcommerceParameters, convertCampaignParameters, convertEventParameters, convertMediaEvent } from './Converters';
3
+ const LINKING_ERROR = `The package 'mapp-intelligence-reactnative-plugin' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
4
+ ios: "- You have run 'pod install'\n",
5
+ default: ''
6
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
7
+ const mappPlugin = NativeModules.MappinteligencePlugin ? NativeModules.MappinteligencePlugin : new Proxy({}, {
8
+ get() {
9
+ throw new Error(LINKING_ERROR);
10
+ }
11
+ });
12
+ export const MappIntelligencePlugin = {
13
+ /**
14
+ * Builds plugin with a provided configuration. After this method finishes, plugin is ready for use.
15
+ * @returns result if method executed succesfully or not
16
+ */
17
+ build: () => {
18
+ console.log('build');
19
+ return mappPlugin.build();
20
+ },
21
+ /**
22
+ * Initialize plugin with a provided trackIds and domain
23
+ * @param trackIDs array of trackIds
24
+ * @param domain tracking domain url
25
+ * @returns result if method executed succesfully or not
26
+ */
27
+ initWithConfiguration: (trackIDs, domain) => {
28
+ console.log('initWithConfiguration');
29
+ return mappPlugin.initWithConfiguration(trackIDs, domain);
30
+ },
31
+ /**
32
+ * Set log level to define what will be logged to the console
33
+ * @param level log level
34
+ * @returns result if method executed succesfully or not
35
+ */
36
+ setLogLevel: level => {
37
+ console.log('setLogLevel - ' + level.valueOf());
38
+ return mappPlugin.setLogLevel(level.valueOf());
39
+ },
40
+ /**
41
+ * Set exception log level
42
+ * @param level one of the predefined exception types
43
+ * @returns result if method executed succesfully or not
44
+ */
45
+ setExceptionLogLevel: level => {
46
+ return mappPlugin.setExceptionLogLevel(level);
47
+ },
48
+ /**
49
+ * Sets interval in minutes, for periodic job to execute and send tracked requests to a server
50
+ * @param interval number in minutes. The minimum is 15, limited by Android specification for a worker.
51
+ * @returns result if method executed succesfully or not
52
+ */
53
+ setRequestInterval: interval => {
54
+ console.log('setRequestInterval');
55
+ return mappPlugin.setRequestInterval(interval);
56
+ },
57
+ /**
58
+ * If sets to true, request will be send in a batch (multiple records in single network call);
59
+ * Otherwise records are sent one record by one network call.
60
+ * @param enabled speciffy if batch is enabled or disabled
61
+ * @returns result if method executed succesfully or not
62
+ */
63
+ setBatchSupportEnabled: enabled => {
64
+ console.log('setBatchSupportEnabled');
65
+ return mappPlugin.setBatchSupportEnabled(enabled);
66
+ },
67
+ /**
68
+ * iOS Only - Enable sending data while application is in a background state
69
+ * @param enabled
70
+ * @returns result if method executed succesfully or not
71
+ */
72
+ setEnableBackgroundSendout: enabled => {
73
+ console.log('setEnableBackgroundSendout');
74
+ return mappPlugin.setEnableBackgroundSendout(enabled);
75
+ },
76
+ /**
77
+ * Set number of track records to send in a sigle batch request
78
+ * @param size number of track records
79
+ * @returns result if method executed succesfully or not
80
+ */
81
+ setBatchSupportSize: size => {
82
+ console.log('setBatchSupportSize');
83
+ return mappPlugin.setBatchSupportSize(size);
84
+ },
85
+ /**
86
+ * Requests are buffered in a queue before sending. This option set size of the queue.
87
+ * @param numberOfRequsts size of a queue for buffering requests
88
+ * @returns result if method executed succesfully or not
89
+ */
90
+ setRequestPerQueue: numberOfRequsts => {
91
+ console.log('setRequestPerQueue');
92
+ return mappPlugin.setRequestPerQueue(numberOfRequsts);
93
+ },
94
+ /**
95
+ * Control if migration should be applied from a previos SDK version.
96
+ * @param migrate true to apply migration on the initialization process; otherwise false
97
+ * @returns result if method executed succesfully or not
98
+ */
99
+ setShouldMigrate: migrate => {
100
+ console.log('setShouldMigrate');
101
+ return mappPlugin.setShouldMigrate(migrate);
102
+ },
103
+ /**
104
+ * Based on the result of the user's conset to allow personalized tracking or not,
105
+ * enable anonymous tracking when no consent. If enabled, everId will be deleted (and not generated until anonymous tracking is enabled)
106
+ * @param anonymous true to enable anonymous tracking; false to disable it.
107
+ * @returns result if method executed succesfully or not
108
+ */
109
+ setAnonymousTracking: anonymous => {
110
+ console.log('setAnonymousTracking');
111
+ return mappPlugin.setAnonymousTracking(anonymous);
112
+ },
113
+ /**
114
+ * Send application version as parameter in every request
115
+ * @param flag - true to set sending application version in every request; otherwise false.
116
+ * @returns result if method executed succesfully or not
117
+ */
118
+ setSendAppVersionInEveryRequest: flag => {
119
+ console.log('setSendAppVersionInEveryRequest');
120
+ return mappPlugin.setSendAppVersionInEveryRequest(flag);
121
+ },
122
+ /**
123
+ * To enable user matching between Engage and Intelligence system
124
+ * @param enabled true to enable user matching; false to disable it.
125
+ * @returns result if method executed succesfully or not
126
+ */
127
+ setEnableUserMatching: enabled => {
128
+ console.log('setEnableUserMatching');
129
+ return mappPlugin.setEnableUserMatching(enabled);
130
+ },
131
+ /**
132
+ * Track single page by page name
133
+ * @param pageTitle page name for tracking
134
+ * @returns result if method executed succesfully or not
135
+ */
136
+ trackPage: pageTitle => {
137
+ console.log('trackPage');
138
+ return mappPlugin.trackPage(pageTitle);
139
+ },
140
+ /**
141
+ * Detailed page tracking with additional parameters that can be set to track
142
+ * @param pageTitle - name of the page
143
+ * @param pageParameters - parameters for the page
144
+ * @param sessionParamters - parameters for the current session
145
+ * @param userCategories - predefined user categories
146
+ * @param ecommerceParameters - predefined eCommerce parameters
147
+ * @param campaignParameters - predefined campaign parameters
148
+ * @returns result if method executed succesfully or not
149
+ */
150
+ trackCustomPage: (pageTitle, pageParameters, sessionParamters, userCategories, ecommerceParameters, campaignParameters) => {
151
+ console.log('trackCustomPage');
152
+ return mappPlugin.trackCustomPage(pageTitle, convertPageParameters(pageParameters), convertSessionParamters(sessionParamters), convertUserCategories(userCategories), convertEcommerceParameters(ecommerceParameters), convertCampaignParameters(campaignParameters));
153
+ },
154
+ /**
155
+ * Custom page tracking with option to track some custom parameters
156
+ * @param pageTitle - name of the page
157
+ * @param pageParameters - custom parameters that can be tracked
158
+ * @returns result if method executed succesfully or not
159
+ */
160
+ trackPageWithCustomData: (pageTitle, pageParameters) => {
161
+ console.log('trackPageWithCustomData');
162
+ const params = pageParameters?.entries();
163
+ const data = params != null ? Object.fromEntries(params) : {};
164
+ return mappPlugin.trackPageWithCustomData(data, pageTitle);
165
+ },
166
+ /**
167
+ * Track user action
168
+ * @param name - action name
169
+ * @param eventParameters - predefined event parameters
170
+ * @param sessionParamters - predefined session parameters
171
+ * @param userCategories - predefined user categories
172
+ * @param ecommerceParameters - predefined ecommerce parameters
173
+ * @param campaignParameters - predefined campaign parameters
174
+ * @returns result if method executed succesfully or not
175
+ */
176
+ trackAction: (name, eventParameters, sessionParamters, userCategories, ecommerceParameters, campaignParameters) => {
177
+ console.log('trackAction');
178
+ return mappPlugin.trackAction(name, convertEventParameters(eventParameters), convertSessionParamters(sessionParamters), convertUserCategories(userCategories), convertEcommerceParameters(ecommerceParameters), convertCampaignParameters(campaignParameters));
179
+ },
180
+ /**
181
+ * Track URL's with included deeplinks, media parameters
182
+ * @param url single url that can contain some query parameters for tracking
183
+ * @param mediaCode media code to track
184
+ * @returns result if method executed succesfully or not
185
+ */
186
+ trackUrl: (url, mediaCode) => {
187
+ return mappPlugin.trackUrl(url, mediaCode);
188
+ },
189
+ /**
190
+ * Track video or audio events - starting, playing, pausing/stoping, ending of playing
191
+ * @param mediaEvent predefined events to track
192
+ * @returns result if method executed succesfully or not
193
+ */
194
+ trackMedia: mediaEvent => {
195
+ console.log('Execute MediaEvent');
196
+ return mappPlugin.trackMedia(convertMediaEvent(mediaEvent));
197
+ },
198
+ /**
199
+ * Record data about handled exceptions
200
+ * @param e caught exception
201
+ * @param stackTrace stack trace of the caught exception
202
+ * @returns result if method executed succesfully or not
203
+ */
204
+ trackException: (e, stackTrace) => {
205
+ return mappPlugin.trackException(e.name, e.message?.slice(0, 1000), stackTrace?.slice(0, 1000));
206
+ },
207
+ /**
208
+ * Record data about handled exception
209
+ * @param name name or type of the exception if can be obtained
210
+ * @param message message of the current caught exception
211
+ * @param stackTrace stack trace of the caught exception
212
+ * @returns result if method executed succesfully or not
213
+ */
214
+ trackExceptionWithName: (name, message, stackTrace) => {
215
+ return mappPlugin.trackException(name, message.slice(0, 1000), stackTrace?.slice(0, 1000));
216
+ },
217
+ /**
218
+ * Set unique everId as identifier for a single device/user
219
+ * @param everId unique identifier in the tracking system
220
+ * @returns result if method executed succesfully or not
221
+ */
222
+ setEverId: everId => {
223
+ console.log('setEverId');
224
+ return mappPlugin.setEverId(everId);
225
+ },
226
+ /**
227
+ * Returns current everId of a device
228
+ * @returns everId
229
+ */
230
+ getEverId: () => {
231
+ return mappPlugin.getEverId();
232
+ },
233
+ /**
234
+ * Check if plugin is initialized and ready to use
235
+ * @returns true if plugin is ready to use; false otherwise.
236
+ */
237
+ isInitialized: () => {
238
+ return mappPlugin.isInitialized();
239
+ },
240
+ /**
241
+ * Temporary sessionId is used when anonymous tracking is enabled to provide
242
+ * anonymous tracking of a single session
243
+ * @param sessionId unique session identifier
244
+ * @returns result if method executed succesfully or not
245
+ */
246
+ setTemporarySessionId: sessionId => {
247
+ console.log('setTemporarySessionId');
248
+ return mappPlugin.setTemporarySessionId(sessionId);
249
+ },
250
+ /**
251
+ * In some cases, it is necessary to exclude users completely from tracking.
252
+ * For this purpose, the SDK provides an opt-out option.
253
+ * Internally, calling this method will delete all current tracking data cached in the database (if sendCurrentData is set to false), cancel the sending of requests, terminate the WorkManager, and disable all incoming tracking requests.
254
+ * @param sendData true to send recorded data before opt-out
255
+ * @returns result if method executed succesfully or not
256
+ */
257
+ optOut: sendData => {
258
+ return mappPlugin.optOut(sendData);
259
+ },
260
+ /**
261
+ * Disables opt-out, and resets tracking to enabled.
262
+ * @param sendData true to send recorded data before opt-in
263
+ * @returns result if method executed succesfully or not
264
+ */
265
+ optIn: sendData => {
266
+ return mappPlugin.optIn(sendData);
267
+ },
268
+ /**
269
+ * Reset all webtrekk configuration. After this, new init with settings must be called before using plugin.
270
+ * @returns result if method executed succesfully or not
271
+ */
272
+ reset: () => {
273
+ return mappPlugin.reset();
274
+ },
275
+ /**
276
+ * When called, data will be immediately sent.
277
+ * The request will then be deleted from the database, cleaning it.
278
+ * Please note that the application must be started and visible to use this method.
279
+ * @returns result if method executed succesfully or not
280
+ */
281
+ sendRequestsAndClean: () => {
282
+ return mappPlugin.sendRequestsAndClean();
283
+ },
284
+ /**
285
+ * Get active configuration of the native SDK and returns it as a string
286
+ * @returns string representation of the active configuration
287
+ */
288
+ printCurrentConfig: () => {
289
+ return mappPlugin.getCurrentConfig();
290
+ }
291
+ };
292
+ //# sourceMappingURL=MappIntelligencePlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","NativeModules","convertPageParameters","convertSessionParamters","convertUserCategories","convertEcommerceParameters","convertCampaignParameters","convertEventParameters","convertMediaEvent","LINKING_ERROR","select","ios","default","mappPlugin","MappinteligencePlugin","Proxy","get","Error","MappIntelligencePlugin","build","console","log","initWithConfiguration","trackIDs","domain","setLogLevel","level","valueOf","setExceptionLogLevel","setRequestInterval","interval","setBatchSupportEnabled","enabled","setEnableBackgroundSendout","setBatchSupportSize","size","setRequestPerQueue","numberOfRequsts","setShouldMigrate","migrate","setAnonymousTracking","anonymous","setSendAppVersionInEveryRequest","flag","setEnableUserMatching","trackPage","pageTitle","trackCustomPage","pageParameters","sessionParamters","userCategories","ecommerceParameters","campaignParameters","trackPageWithCustomData","params","entries","data","Object","fromEntries","trackAction","name","eventParameters","trackUrl","url","mediaCode","trackMedia","mediaEvent","trackException","e","stackTrace","message","slice","trackExceptionWithName","setEverId","everId","getEverId","isInitialized","setTemporarySessionId","sessionId","optOut","sendData","optIn","reset","sendRequestsAndClean","printCurrentConfig","getCurrentConfig"],"sourceRoot":"../../src","sources":["MappIntelligencePlugin.tsx"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,aAAa,QAAQ,cAAc;AACtD,SACEC,qBAAqB,EACrBC,uBAAuB,EACvBC,qBAAqB,EACrBC,0BAA0B,EAC1BC,yBAAyB,EACzBC,sBAAsB,EACtBC,iBAAiB,QACZ,cAAc;AAarB,MAAMC,aAAa,GACjB,+FAA+F,GAC/FT,QAAQ,CAACU,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,UAAU,GAAGZ,aAAa,CAACa,qBAAqB,GAClDb,aAAa,CAACa,qBAAqB,GACnC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,MAAMS,sBAAsB,GAAG;EACpC;AACF;AACA;AACA;EACEC,KAAK,EAAEA,CAAA,KAAuB;IAC5BC,OAAO,CAACC,GAAG,CAAC,OAAO,CAAC;IACpB,OAAOR,UAAU,CAACM,KAAK,CAAC,CAAC;EAC3B,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEG,qBAAqB,EAAEA,CACrBC,QAAkB,EAClBC,MAAc,KACM;IACpBJ,OAAO,CAACC,GAAG,CAAC,uBAAuB,CAAC;IACpC,OAAOR,UAAU,CAACS,qBAAqB,CAACC,QAAQ,EAAEC,MAAM,CAAC;EAC3D,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,WAAW,EAAGC,KAAe,IAAsB;IACjDN,OAAO,CAACC,GAAG,CAAC,gBAAgB,GAAGK,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC;IAC/C,OAAOd,UAAU,CAACY,WAAW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AAU,CAACoE,KAAK,CAACD,QAAQ,CAAC;EACnC,CAAC;EAED;AACF;AACA;AACA;EACEE,KAAK,EAAEA,CAAA,KAAuB;IAC5B,OAAOrE,UAAU,CAACqE,KAAK,CAAC,CAAC;EAC3B,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEC,oBAAoB,EAAEA,CAAA,KAAuB;IAC3C,OAAOtE,UAAU,CAACsE,oBAAoB,CAAC,CAAC;EAC1C,CAAC;EAED;AACF;AACA;AACA;EACEC,kBAAkB,EAAEA,CAAA,KAAuB;IACzC,OAAOvE,UAAU,CAACwE,gBAAgB,CAAC,CAAC;EACtC;AACF,CAAC","ignoreList":[]}
@@ -1,8 +1,5 @@
1
- // useWebTracking.tsx
1
+ import { MappIntelligencePlugin } from './MappIntelligencePlugin';
2
2
  import { useRef, useCallback } from 'react';
3
- import { trackPageWithCustomData, trackAction, trackException, getEverId } from './index';
4
- //import * as MappIntelligencePlugin from 'react-native-mappinteligence-plugin';
5
-
6
3
  const runOnce = `
7
4
  var meta = document.createElement('meta');
8
5
  meta.setAttribute('name', 'viewport');
@@ -24,7 +21,7 @@ const runOnce = `
24
21
  }
25
22
  `;
26
23
  const injectEverIdScript = `window.webtrekkApplicationEverId = '%everId%' ; true; `;
27
- const useWebTracking = (onMessage, onLoad) => {
24
+ export const useWebTracking = (onMessage, onLoad) => {
28
25
  const webViewRef = useRef(null);
29
26
  const handleMessage = useCallback(event => {
30
27
  try {
@@ -47,7 +44,7 @@ const useWebTracking = (onMessage, onLoad) => {
47
44
  try {
48
45
  const parameters = getJson(params) ?? new Map();
49
46
  console.log('Page Name: ', name, '; Params: ', parameters);
50
- trackPageWithCustomData(name, parameters);
47
+ MappIntelligencePlugin.trackPageWithCustomData(name, parameters);
51
48
  } catch (error) {
52
49
  console.error(error);
53
50
  }
@@ -56,7 +53,7 @@ const useWebTracking = (onMessage, onLoad) => {
56
53
  try {
57
54
  const parameters = getJson(params);
58
55
  console.log('Event Name: ', name, '; Params: ', parameters);
59
- trackAction(name, parameters, null, null, null, null);
56
+ MappIntelligencePlugin.trackAction(name, parameters, null, null, null, null);
60
57
  } catch (error) {
61
58
  console.error(error);
62
59
  }
@@ -73,7 +70,7 @@ const useWebTracking = (onMessage, onLoad) => {
73
70
  }
74
71
  };
75
72
  const handleLoad = useCallback(() => {
76
- getEverId().then(everId => {
73
+ MappIntelligencePlugin.getEverId().then(everId => {
77
74
  if (webViewRef.current) {
78
75
  const scripts = injectEverIdScript.replace('%everId%', everId);
79
76
  webViewRef.current.injectJavaScript(scripts);
@@ -84,7 +81,7 @@ const useWebTracking = (onMessage, onLoad) => {
84
81
  }
85
82
  }).catch(error => {
86
83
  console.error(error);
87
- trackException(error);
84
+ MappIntelligencePlugin.trackException(error);
88
85
  });
89
86
  if (onLoad) {
90
87
  onLoad();
@@ -103,5 +100,4 @@ const useWebTracking = (onMessage, onLoad) => {
103
100
  getInjectedJavaScript
104
101
  };
105
102
  };
106
- export default useWebTracking;
107
103
  //# sourceMappingURL=UseWebTracking.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useRef","useCallback","trackPageWithCustomData","trackAction","trackException","getEverId","runOnce","injectEverIdScript","useWebTracking","onMessage","onLoad","webViewRef","handleMessage","event","message","JSON","parse","nativeEvent","data","method","name","params","console","log","trackCustomPage","trackCustomEvent","error","parameters","getJson","Map","json","handleLoad","then","everId","current","scripts","replace","injectJavaScript","setTimeout","catch","getInjectedJavaScript","script"],"sourceRoot":"../../src","sources":["UseWebTracking.tsx"],"mappings":"AAAA;AACA,SAASA,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAC3C,SACEC,uBAAuB,EACvBC,WAAW,EACXC,cAAc,EACdC,SAAS,QACJ,SAAS;AAChB;;AAIA,MAAMC,OAAO,GAAI;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,MAAMC,kBAAkB,GAAI,wDAAuD;AAMnF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B,KAAK,CAAC;IACvB,CAAC,CAAC;IAEJ,IAAIhB,MAAM,EAAE;MACVA,MAAM,CAAC,CAAC;IACV;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,MAAM8B,qBAAqB,GAAIC,MAAkC,IAAK;IACpE,IAAIA,MAAM,EAAE;MACV,OAAOnC,OAAO,GAAG,UAAU,GAAGmC,MAAM;IACtC;IACA,OAAOnC,OAAO;EAChB,CAAC;EAED,OAAO;IAAEK,UAAU;IAAEC,aAAa;IAAEmB,UAAU;IAAES;EAAsB,CAAC;AACzE,CAAC;AAED,eAAehC,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["MappIntelligencePlugin","useRef","useCallback","runOnce","injectEverIdScript","useWebTracking","onMessage","onLoad","webViewRef","handleMessage","event","message","JSON","parse","nativeEvent","data","method","name","params","console","log","trackCustomPage","trackCustomEvent","error","parameters","getJson","Map","trackPageWithCustomData","trackAction","json","handleLoad","getEverId","then","everId","current","scripts","replace","injectJavaScript","setTimeout","catch","trackException","getInjectedJavaScript","script"],"sourceRoot":"../../src","sources":["UseWebTracking.tsx"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAI3C,MAAMC,OAAO,GAAG;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,MAAMC,kBAAkB,GAAG,wDAAwD;AAMnF,OAAO,MAAMC,cAAc,GAAGA,CAC5BC,SAA4B,EAC5BC,MAAsB,KACnB;EACH,MAAMC,UAAU,GAAGP,MAAM,CAAU,IAAI,CAAC;EAExC,MAAMQ,aAAa,GAAGP,WAAW,CAC9BQ,KAA0B,IAAK;IAC9B,IAAI;MACF,MAAMC,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,KAAK,CAACI,WAAW,CAACC,IAAI,CAAC;MAClD,MAAMC,MAAM,GAAGL,OAA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