mapp-intelligence-reactnative-plugin 1.0.1 → 1.0.3

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 (45) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/gradle.properties +4 -5
  3. package/android/src/main/java/com/mappinteligenceplugin/mapper/Util.kt +12 -4
  4. package/ios/MappinteligencePlugin.mm +3 -2
  5. package/lib/commonjs/Converters.js +1 -1
  6. package/lib/commonjs/Converters.js.map +1 -1
  7. package/lib/commonjs/DataTypes.js +10 -2
  8. package/lib/commonjs/DataTypes.js.map +1 -1
  9. package/lib/commonjs/GlobalErrorHandler.js +2 -6
  10. package/lib/commonjs/GlobalErrorHandler.js.map +1 -1
  11. package/lib/commonjs/MappIntelligencePlugin.js +296 -0
  12. package/lib/commonjs/MappIntelligencePlugin.js.map +1 -0
  13. package/lib/commonjs/UseWebTracking.js +6 -24
  14. package/lib/commonjs/UseWebTracking.js.map +1 -1
  15. package/lib/commonjs/index.js +14 -390
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/promiseRejectionHandler.js.map +1 -1
  18. package/lib/module/Converters.js +1 -1
  19. package/lib/module/Converters.js.map +1 -1
  20. package/lib/module/DataTypes.js +10 -2
  21. package/lib/module/DataTypes.js.map +1 -1
  22. package/lib/module/GlobalErrorHandler.js +2 -6
  23. package/lib/module/GlobalErrorHandler.js.map +1 -1
  24. package/lib/module/MappIntelligencePlugin.js +290 -0
  25. package/lib/module/MappIntelligencePlugin.js.map +1 -0
  26. package/lib/module/UseWebTracking.js +6 -23
  27. package/lib/module/UseWebTracking.js.map +1 -1
  28. package/lib/module/index.js +2 -320
  29. package/lib/module/index.js.map +1 -1
  30. package/lib/module/promiseRejectionHandler.js.map +1 -1
  31. package/lib/typescript/src/DataTypes.d.ts +6 -6
  32. package/lib/typescript/src/DataTypes.d.ts.map +1 -1
  33. package/lib/typescript/src/GlobalErrorHandler.d.ts.map +1 -1
  34. package/lib/typescript/src/MappIntelligencePlugin.d.ts +201 -0
  35. package/lib/typescript/src/MappIntelligencePlugin.d.ts.map +1 -0
  36. package/lib/typescript/src/UseWebTracking.d.ts.map +1 -1
  37. package/lib/typescript/src/index.d.ts +2 -200
  38. package/lib/typescript/src/index.d.ts.map +1 -1
  39. package/mapp-intelligence-reactnative-plugin.podspec +1 -1
  40. package/package.json +27 -22
  41. package/src/Converters.tsx +1 -1
  42. package/src/GlobalErrorHandler.tsx +3 -6
  43. package/src/MappIntelligencePlugin.tsx +392 -0
  44. package/src/UseWebTracking.tsx +13 -27
  45. package/src/index.tsx +2 -410
@@ -0,0 +1,290 @@
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', pageParameters);
162
+ return mappPlugin.trackPageWithCustomData(pageParameters, pageTitle);
163
+ },
164
+ /**
165
+ * Track user action
166
+ * @param name - action name
167
+ * @param eventParameters - predefined event parameters
168
+ * @param sessionParamters - predefined session parameters
169
+ * @param userCategories - predefined user categories
170
+ * @param ecommerceParameters - predefined ecommerce parameters
171
+ * @param campaignParameters - predefined campaign parameters
172
+ * @returns result if method executed succesfully or not
173
+ */
174
+ trackAction: (name, eventParameters, sessionParamters, userCategories, ecommerceParameters, campaignParameters) => {
175
+ console.log('trackAction');
176
+ return mappPlugin.trackAction(name, convertEventParameters(eventParameters), convertSessionParamters(sessionParamters), convertUserCategories(userCategories), convertEcommerceParameters(ecommerceParameters), convertCampaignParameters(campaignParameters));
177
+ },
178
+ /**
179
+ * Track URL's with included deeplinks, media parameters
180
+ * @param url single url that can contain some query parameters for tracking
181
+ * @param mediaCode media code to track
182
+ * @returns result if method executed succesfully or not
183
+ */
184
+ trackUrl: (url, mediaCode) => {
185
+ return mappPlugin.trackUrl(url, mediaCode);
186
+ },
187
+ /**
188
+ * Track video or audio events - starting, playing, pausing/stoping, ending of playing
189
+ * @param mediaEvent predefined events to track
190
+ * @returns result if method executed succesfully or not
191
+ */
192
+ trackMedia: mediaEvent => {
193
+ console.log('Execute MediaEvent');
194
+ return mappPlugin.trackMedia(convertMediaEvent(mediaEvent));
195
+ },
196
+ /**
197
+ * Record data about handled exceptions
198
+ * @param e caught exception
199
+ * @param stackTrace stack trace of the caught exception
200
+ * @returns result if method executed succesfully or not
201
+ */
202
+ trackException: (e, stackTrace) => {
203
+ return mappPlugin.trackException(e.name, e.message?.slice(0, 1000), stackTrace?.slice(0, 1000));
204
+ },
205
+ /**
206
+ * Record data about handled exception
207
+ * @param name name or type of the exception if can be obtained
208
+ * @param message message of the current caught exception
209
+ * @param stackTrace stack trace of the caught exception
210
+ * @returns result if method executed succesfully or not
211
+ */
212
+ trackExceptionWithName: (name, message, stackTrace) => {
213
+ return mappPlugin.trackException(name, message.slice(0, 1000), stackTrace?.slice(0, 1000));
214
+ },
215
+ /**
216
+ * Set unique everId as identifier for a single device/user
217
+ * @param everId unique identifier in the tracking system
218
+ * @returns result if method executed succesfully or not
219
+ */
220
+ setEverId: everId => {
221
+ console.log('setEverId');
222
+ return mappPlugin.setEverId(everId);
223
+ },
224
+ /**
225
+ * Returns current everId of a device
226
+ * @returns everId
227
+ */
228
+ getEverId: () => {
229
+ return mappPlugin.getEverId();
230
+ },
231
+ /**
232
+ * Check if plugin is initialized and ready to use
233
+ * @returns true if plugin is ready to use; false otherwise.
234
+ */
235
+ isInitialized: () => {
236
+ return mappPlugin.isInitialized();
237
+ },
238
+ /**
239
+ * Temporary sessionId is used when anonymous tracking is enabled to provide
240
+ * anonymous tracking of a single session
241
+ * @param sessionId unique session identifier
242
+ * @returns result if method executed succesfully or not
243
+ */
244
+ setTemporarySessionId: sessionId => {
245
+ console.log('setTemporarySessionId');
246
+ return mappPlugin.setTemporarySessionId(sessionId);
247
+ },
248
+ /**
249
+ * In some cases, it is necessary to exclude users completely from tracking.
250
+ * For this purpose, the SDK provides an opt-out option.
251
+ * 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.
252
+ * @param sendData true to send recorded data before opt-out
253
+ * @returns result if method executed succesfully or not
254
+ */
255
+ optOut: sendData => {
256
+ return mappPlugin.optOut(sendData);
257
+ },
258
+ /**
259
+ * Disables opt-out, and resets tracking to enabled.
260
+ * @param sendData true to send recorded data before opt-in
261
+ * @returns result if method executed succesfully or not
262
+ */
263
+ optIn: sendData => {
264
+ return mappPlugin.optIn(sendData);
265
+ },
266
+ /**
267
+ * Reset all webtrekk configuration. After this, new init with settings must be called before using plugin.
268
+ * @returns result if method executed succesfully or not
269
+ */
270
+ reset: () => {
271
+ return mappPlugin.reset();
272
+ },
273
+ /**
274
+ * When called, data will be immediately sent.
275
+ * The request will then be deleted from the database, cleaning it.
276
+ * Please note that the application must be started and visible to use this method.
277
+ * @returns result if method executed succesfully or not
278
+ */
279
+ sendRequestsAndClean: () => {
280
+ return mappPlugin.sendRequestsAndClean();
281
+ },
282
+ /**
283
+ * Get active configuration of the native SDK and returns it as a string
284
+ * @returns string representation of the active configuration
285
+ */
286
+ printCurrentConfig: () => {
287
+ return mappPlugin.getCurrentConfig();
288
+ }
289
+ };
290
+ //# 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","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,CAACC,KA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ED;AACF;AACA;AACA;AACA;AACA;EACEC,oBAAoB,EAAEA,CAAA,KAAuB;IAC3C,OAAOjE,UAAU,CAACiE,oBAAoB,CAAC,CAAC;EAC1C,CAAC;EAED;AACF;AACA;AACA;EACEC,kBAAkB,EAAEA,CAAA,KAAuB;IACzC,OAAOlE,UAAU,CAACmE,gBAAgB,CAAC,CAAC;EACtC;AACF,CAAC","ignoreList":[]}
@@ -1,27 +1,10 @@
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 'mapp-intelligence-reactnative-plugin';
5
-
6
3
  const runOnce = `
7
4
  var meta = document.createElement('meta');
8
5
  meta.setAttribute('name', 'viewport');
9
6
  meta.setAttribute('content', 'width=device-width, height=device-height, initial-scale=0.85, maximum-scale=1.0, user-scalable=no');
10
7
  document.getElementsByTagName('head')[0].appendChild(meta);
11
-
12
- window.WebtrekkAndroidWebViewCallback = {};
13
-
14
- window.WebtrekkAndroidWebViewCallback.trackCustomPage = function(pageName,param){
15
- window.ReactNativeWebView.postMessage(JSON.stringify({ 'method': 'trackCustomPage', 'name':pageName, 'params':param }));
16
- }
17
-
18
- window.WebtrekkAndroidWebViewCallback.trackCustomEvent = function(eventName, param){
19
- window.ReactNativeWebView.postMessage(JSON.stringify({ 'method': 'trackCustomEvent', 'name':eventName, 'params':param }));
20
- }
21
-
22
- window.WebtrekkAndroidWebViewCallback.getEverId = function(){
23
- window.ReactNativeWebView.postMessage(JSON.stringify({ 'method': 'getEverId', 'name':'webtrekkApplicationEverId', 'params': window.webtrekkApplicationEverId }));
24
- }
25
8
  `;
26
9
  const injectEverIdScript = `window.webtrekkApplicationEverId = '%everId%' ; true; `;
27
10
  export const useWebTracking = (onMessage, onLoad) => {
@@ -45,9 +28,9 @@ export const useWebTracking = (onMessage, onLoad) => {
45
28
  }, [onMessage]);
46
29
  const trackCustomPage = (name, params) => {
47
30
  try {
48
- const parameters = getJson(params) ?? new Map();
31
+ const parameters = getJson(params);
49
32
  console.log('Page Name: ', name, '; Params: ', parameters);
50
- trackPageWithCustomData(name, parameters);
33
+ MappIntelligencePlugin.trackPageWithCustomData(name, parameters);
51
34
  } catch (error) {
52
35
  console.error(error);
53
36
  }
@@ -56,7 +39,7 @@ export const useWebTracking = (onMessage, onLoad) => {
56
39
  try {
57
40
  const parameters = getJson(params);
58
41
  console.log('Event Name: ', name, '; Params: ', parameters);
59
- trackAction(name, parameters, null, null, null, null);
42
+ MappIntelligencePlugin.trackAction(name, parameters, null, null, null, null);
60
43
  } catch (error) {
61
44
  console.error(error);
62
45
  }
@@ -73,7 +56,7 @@ export const useWebTracking = (onMessage, onLoad) => {
73
56
  }
74
57
  };
75
58
  const handleLoad = useCallback(() => {
76
- getEverId().then(everId => {
59
+ MappIntelligencePlugin.getEverId().then(everId => {
77
60
  if (webViewRef.current) {
78
61
  const scripts = injectEverIdScript.replace('%everId%', everId);
79
62
  webViewRef.current.injectJavaScript(scripts);
@@ -84,7 +67,7 @@ export const useWebTracking = (onMessage, onLoad) => {
84
67
  }
85
68
  }).catch(error => {
86
69
  console.error(error);
87
- trackException(error);
70
+ MappIntelligencePlugin.trackException(error);
88
71
  });
89
72
  if (onLoad) {
90
73
  onLoad();
@@ -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,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AM;UACf3B,UAAU,CAACuB,OAAO,EAAEG,gBAAgB,CACjC,mDACH,CAAC;QACH,CAAC,EAAE,IAAI,CAAC;MACV;IACF,CAAC,CAAC,CACDE,KAAK,CAAEb,KAAY,IAAK;MACvBJ,OAAO,CAACI,KAAK,CAACA,KAAK,CAAC;MACpBtB,cAAc,CAACsB,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","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","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,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,I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