avo-inspector 2.0.0 → 2.2.0-alpha.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/CHANGELOG.md +9 -0
- package/README.md +8 -0
- package/dist/AvoAnonymousId.d.ts +26 -0
- package/dist/AvoInspector.d.ts +3 -2
- package/dist/AvoNetworkCallsHandler.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist-native/AvoInspector.d.ts +0 -1
- package/dist-native/AvoInspector.js +2 -2
- package/dist-native/AvoStorage.d.ts +2 -2
- package/dist-native/AvoStorage.js +31 -40
- package/dist-native/__mocks__/xhr.d.ts +6 -6
- package/dist-native/__mocks__/xhrError.d.ts +6 -6
- package/dist-native/__tests__/NetworkCallsHandler.js +2 -2
- package/dist-native/__tests__/Parsing.js +0 -59
- package/dist-native/__tests__/Sessions.js +1 -1
- package/dist-native/index.d.ts +1 -1
- package/jest.config.js +23 -0
- package/package.json +2 -22
- package/rescript/AvoInspector.res +5 -0
- package/rescript/AvoInspector.resi +2 -0
- package/dist-browser/AvoBatcher.d.ts +0 -24
- package/dist-browser/AvoDeduplicator.d.ts +0 -20
- package/dist-browser/AvoGuid.d.ts +0 -3
- package/dist-browser/AvoInspector.d.ts +0 -49
- package/dist-browser/AvoInspectorEnv.d.ts +0 -7
- package/dist-browser/AvoInstallationId.d.ts +0 -5
- package/dist-browser/AvoNetworkCallsHandler.d.ts +0 -48
- package/dist-browser/AvoSchemaParser.d.ts +0 -9
- package/dist-browser/AvoSessionTracker.d.ts +0 -15
- package/dist-browser/AvoStorage.d.ts +0 -22
- package/dist-browser/__mocks__/xhr.d.ts +0 -12
- package/dist-browser/__mocks__/xhrError.d.ts +0 -12
- package/dist-browser/__tests__/AvoInspector.d.ts +0 -1
- package/dist-browser/__tests__/Batcher.d.ts +0 -1
- package/dist-browser/__tests__/BatcherPublic.d.ts +0 -1
- package/dist-browser/__tests__/Deduplicator.d.ts +0 -1
- package/dist-browser/__tests__/InstallationId.d.ts +0 -1
- package/dist-browser/__tests__/NetworkCallsHandler.d.ts +0 -1
- package/dist-browser/__tests__/Parsing.d.ts +0 -1
- package/dist-browser/__tests__/Sessions.d.ts +0 -1
- package/dist-browser/__tests__/Storage.d.ts +0 -1
- package/dist-browser/__tests__/constants.d.ts +0 -36
- package/dist-browser/index.d.ts +0 -2
- package/dist-browser/utils.d.ts +0 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -110,6 +110,14 @@ inspector.setBatchSize(15);
|
|
|
110
110
|
inspector.setBatchFlushSeconds(10);
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
# Network timeout
|
|
114
|
+
|
|
115
|
+
You can control the network timeout for the SDK. Default is 2 seconds.
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
Inspector.AvoInspector.networkTimeout = 5000;
|
|
119
|
+
```
|
|
120
|
+
|
|
113
121
|
## Author
|
|
114
122
|
|
|
115
123
|
Avo (https://www.avo.app), friends@avo.app
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AvoAnonymousId manages a persistent anonymous user identifier.
|
|
3
|
+
*
|
|
4
|
+
* The anonymous ID is generated once and stored persistently across sessions.
|
|
5
|
+
* It remains the same until the storage is cleared or the user uninstalls the app.
|
|
6
|
+
*
|
|
7
|
+
* This class is designed to be standalone and reusable across different SDK platforms
|
|
8
|
+
* (Web, Node, React Native). Each platform should provide its own AvoStorage implementation.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AvoAnonymousId {
|
|
11
|
+
private static _anonymousId;
|
|
12
|
+
/**
|
|
13
|
+
* Get the anonymous ID. If it doesn't exist, generates and persists a new one.
|
|
14
|
+
* Returns "unknown" if storage is not initialized.
|
|
15
|
+
*/
|
|
16
|
+
static get anonymousId(): string;
|
|
17
|
+
/**
|
|
18
|
+
* The storage key used to persist the anonymous ID.
|
|
19
|
+
*/
|
|
20
|
+
static get storageKey(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Clear the cached anonymous ID. The next access will reload from storage.
|
|
23
|
+
* This is primarily useful for testing.
|
|
24
|
+
*/
|
|
25
|
+
static clearCache(): void;
|
|
26
|
+
}
|
package/dist/AvoInspector.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type AvoInspectorEnvValueType } from "./AvoInspectorEnv";
|
|
2
|
-
import { AvoSessionTracker } from "./AvoSessionTracker";
|
|
3
2
|
import { AvoBatcher } from "./AvoBatcher";
|
|
4
3
|
import { AvoStorage } from "./AvoStorage";
|
|
5
4
|
import { AvoDeduplicator } from "./AvoDeduplicator";
|
|
@@ -7,7 +6,6 @@ export declare class AvoInspector {
|
|
|
7
6
|
environment: AvoInspectorEnvValueType;
|
|
8
7
|
avoBatcher: AvoBatcher;
|
|
9
8
|
avoDeduplicator: AvoDeduplicator;
|
|
10
|
-
sessionTracker: AvoSessionTracker;
|
|
11
9
|
apiKey: string;
|
|
12
10
|
version: string;
|
|
13
11
|
static avoStorage: AvoStorage;
|
|
@@ -19,6 +17,9 @@ export declare class AvoInspector {
|
|
|
19
17
|
private static _shouldLog;
|
|
20
18
|
static get shouldLog(): boolean;
|
|
21
19
|
static set shouldLog(enable: boolean);
|
|
20
|
+
private static _networkTimeout;
|
|
21
|
+
static get networkTimeout(): number;
|
|
22
|
+
static set networkTimeout(timeout: number);
|
|
22
23
|
constructor(options: {
|
|
23
24
|
apiKey: string;
|
|
24
25
|
env: AvoInspectorEnvValueType;
|
|
@@ -9,6 +9,7 @@ export interface BaseBody {
|
|
|
9
9
|
trackingId: string;
|
|
10
10
|
createdAt: string;
|
|
11
11
|
sessionId: string;
|
|
12
|
+
anonymousId: string;
|
|
12
13
|
samplingRate: number;
|
|
13
14
|
}
|
|
14
15
|
export interface SessionStartedBody extends BaseBody {
|
|
@@ -36,8 +37,8 @@ export declare class AvoNetworkCallsHandler {
|
|
|
36
37
|
private sending;
|
|
37
38
|
private static readonly trackingEndpoint;
|
|
38
39
|
constructor(apiKey: string, envName: string, appName: string, appVersion: string, libVersion: string);
|
|
39
|
-
callInspectorWithBatchBody(inEvents: Array<SessionStartedBody | EventSchemaBody>, onCompleted: (error:
|
|
40
|
-
private
|
|
40
|
+
callInspectorWithBatchBody(inEvents: Array<SessionStartedBody | EventSchemaBody>, onCompleted: (error: Error | null) => any): void;
|
|
41
|
+
private fixAnonymousIds;
|
|
41
42
|
bodyForSessionStartedCall(): SessionStartedBody;
|
|
42
43
|
bodyForEventSchemaCall(eventName: string, eventProperties: Array<{
|
|
43
44
|
propertyName: string;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,(()=>(()=>{"use strict";var e={669:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoBatcher=void 0;var o=n(611),r=function(){function e(t){var n=this;this.events=[],this.networkCallsHandler=t,this.batchFlushAttemptTimestamp=Date.now(),o.AvoInspector.avoStorage.getItemAsync(e.cacheKey).then((function(e){if(null!==e){var t=e.filter((function(e){return null!==e}));n.events=n.events.concat(t),n.checkIfBatchNeedsToBeSent()}}))}return e.prototype.handleSessionStarted=function(){this.events.push(this.networkCallsHandler.bodyForSessionStartedCall()),this.saveEvents(),this.checkIfBatchNeedsToBeSent()},e.prototype.handleTrackSchema=function(e,t,n,r){this.events.push(this.networkCallsHandler.bodyForEventSchemaCall(e,t,n,r)),this.saveEvents(),o.AvoInspector.shouldLog&&console.log("Avo Inspector: saved event "+e+" with schema "+JSON.stringify(t)),this.checkIfBatchNeedsToBeSent()},e.prototype.checkIfBatchNeedsToBeSent=function(){var e=this.events.length,t=Date.now(),n=t-this.batchFlushAttemptTimestamp,r=e%o.AvoInspector.batchSize==0,s=n>=1e3*o.AvoInspector.batchFlushSeconds,i=this;if(r||s){this.batchFlushAttemptTimestamp=t;var a=i.events;i.events=[],this.networkCallsHandler.callInspectorWithBatchBody(a,(function(e){null!=e?(i.events=i.events.concat(a),o.AvoInspector.shouldLog&&console.log("Avo Inspector: batch sending failed: "+e+". We will attempt to send your schemas with next batch")):o.AvoInspector.shouldLog&&console.log("Avo Inspector: batch sent successfully."),i.saveEvents()}))}},e.prototype.saveEvents=function(){if(this.events.length>1e3){var t=this.events.length-1e3;this.events.splice(0,t)}o.AvoInspector.avoStorage.setItem(e.cacheKey,this.events)},Object.defineProperty(e,"cacheKey",{get:function(){return"AvoInspectorEvents"},enumerable:!1,configurable:!0}),e}();t.AvoBatcher=r},492:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoDeduplicator=void 0;var o=n(924),r=n(185),s=function(){function e(){this.avoFunctionsEvents={},this.manualEvents={},this.avoFunctionsEventsParams={},this.manualEventsParams={}}return e.prototype.shouldRegisterEvent=function(e,t,n){this.clearOldEvents(),n?(this.avoFunctionsEvents[Date.now()]=e,this.avoFunctionsEventsParams[e]=t):(this.manualEvents[Date.now()]=e,this.manualEventsParams[e]=t);var o=!n;return!this.hasSameEventAs(e,t,o)},e.prototype.hasSameEventAs=function(e,t,n){var o=!1;return n?this.lookForEventIn(e,t,this.avoFunctionsEventsParams)&&(o=!0):this.lookForEventIn(e,t,this.manualEventsParams)&&(o=!0),o&&(delete this.avoFunctionsEventsParams[e],delete this.manualEventsParams[e]),o},e.prototype.lookForEventIn=function(e,t,n){for(var o in n)if(n.hasOwnProperty(o)&&o===e){var s=n[e];if(s&&(0,r.deepEquals)(t,s))return!0}return!1},e.prototype.hasSeenEventParams=function(e,t){var n=!1;return t?this.lookForEventParamsIn(e,this.avoFunctionsEventsParams)&&(n=!0):this.lookForEventParamsIn(e,this.manualEventsParams)&&(n=!0),n},e.prototype.lookForEventParamsIn=function(e,t){for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];if(o&&(0,r.deepEquals)(e,o))return!0}return!1},e.prototype.shouldRegisterSchemaFromManually=function(e,t){return this.clearOldEvents(),!this.hasSameShapeInAvoFunctionsAs(e,t)},e.prototype.hasSameShapeInAvoFunctionsAs=function(e,t){var n=!1;return this.lookForEventSchemaIn(e,t,this.avoFunctionsEventsParams)&&(n=!0),n&&delete this.avoFunctionsEventsParams[e],n},e.prototype.lookForEventSchemaIn=function(e,t,n){for(var s in n)if(n.hasOwnProperty(s)&&s===e){var i=o.AvoSchemaParser.extractSchema(n[e]);if(i&&(0,r.deepEquals)(t,i))return!0}return!1},e.prototype.clearOldEvents=function(){var e=Date.now();for(var t in this.avoFunctionsEvents)if(this.avoFunctionsEvents.hasOwnProperty(t)&&e-(Number(t)||0)>300){var n=this.avoFunctionsEvents[t];delete this.avoFunctionsEvents[t],delete this.avoFunctionsEventsParams[n]}for(var t in this.manualEvents)this.manualEvents.hasOwnProperty(t)&&e-(Number(t)||0)>300&&(n=this.manualEvents[t],delete this.manualEvents[t],delete this.manualEventsParams[n])},e.prototype._clearEvents=function(){this.avoFunctionsEvents={},this.manualEvents={},this.avoFunctionsEventsParams={},this.manualEventsParams={}},e}();t.AvoDeduplicator=s},249:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e}();t.default=n},611:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoInspector=void 0;var o=n(844),r=n(924),s=n(948),i=n(669),a=n(243),c=n(491),l=n(492),u=n(185),p=n(330).rE,v=function(){function e(t){var n=this;if((0,u.isValueEmpty)(t.env)?(this.environment=o.AvoInspectorEnv.Dev,console.warn("[Avo Inspector] No environment provided. Defaulting to dev.")):Object.values(o.AvoInspectorEnv).includes(t.env)?this.environment=t.env:(this.environment=o.AvoInspectorEnv.Dev,console.warn("[Avo Inspector] Unsupported environment provided. Defaulting to dev. Supported environments - Dev, Staging, Prod.")),(0,u.isValueEmpty)(t.apiKey))throw new Error("[Avo Inspector] No API key provided. Inspector can't operate without API key.");if(this.apiKey=t.apiKey,(0,u.isValueEmpty)(t.version))throw new Error("[Avo Inspector] No version provided. Many features of Inspector rely on versioning. Please provide comparable string version, i.e. integer or semantic.");this.version=t.version,this.environment===o.AvoInspectorEnv.Dev?(e._batchSize=1,e._shouldLog=!0):(e._batchSize=30,e._batchFlushSeconds=30,e._shouldLog=!1),e.avoStorage=new c.AvoStorage(e._shouldLog,null!=t.suffix?t.suffix:"");var r=new a.AvoNetworkCallsHandler(this.apiKey,this.environment.toString(),t.appName||"",this.version,p);this.avoBatcher=new i.AvoBatcher(r),this.sessionTracker=new s.AvoSessionTracker(this.avoBatcher),this.avoDeduplicator=new l.AvoDeduplicator;try{"undefined"!=typeof window&&window.addEventListener("load",(function(){n.sessionTracker.startOrProlongSession(Date.now())}),!1)}catch(e){console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e)}}return Object.defineProperty(e,"batchSize",{get:function(){return this._batchSize},set:function(e){this._batchSize=e<1?1:e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"batchFlushSeconds",{get:function(){return this._batchFlushSeconds},enumerable:!1,configurable:!0}),Object.defineProperty(e,"shouldLog",{get:function(){return this._shouldLog},set:function(e){this._shouldLog=e},enumerable:!1,configurable:!0}),e.prototype.trackSchemaFromEvent=function(t,n){try{if(this.avoDeduplicator.shouldRegisterEvent(t,n,!1)){e.shouldLog&&console.log("Avo Inspector: supplied event "+t+" with params "+JSON.stringify(n));var o=this.extractSchema(n,!1);return this.trackSchemaInternal(t,o,null,null),o}return e.shouldLog&&console.log("Avo Inspector: Deduplicated event: "+t),[]}catch(e){return console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e),[]}},e.prototype._avoFunctionTrackSchemaFromEvent=function(t,n,o,r){try{if(this.avoDeduplicator.shouldRegisterEvent(t,n,!0)){e.shouldLog&&console.log("Avo Inspector: supplied event "+t+" with params "+JSON.stringify(n));var s=this.extractSchema(n,!1);return this.trackSchemaInternal(t,s,o,r),s}return e.shouldLog&&console.log("Avo Inspector: Deduplicated event: "+t),[]}catch(e){return console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e),[]}},e.prototype.trackSchema=function(t,n){try{this.avoDeduplicator.shouldRegisterSchemaFromManually(t,n)?(e.shouldLog&&console.log("Avo Inspector: supplied event "+t+" with schema "+JSON.stringify(n)),this.trackSchemaInternal(t,n,null,null)):e.shouldLog&&console.log("Avo Inspector: Deduplicated event: "+t)}catch(e){console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e)}},e.prototype.trackSchemaInternal=function(e,t,n,o){try{this.sessionTracker.startOrProlongSession(Date.now()),this.avoBatcher.handleTrackSchema(e,t,n,o)}catch(e){console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e)}},e.prototype.enableLogging=function(t){e._shouldLog=t},e.prototype.extractSchema=function(t,n){void 0===n&&(n=!0);try{return this.sessionTracker.startOrProlongSession(Date.now()),this.avoDeduplicator.hasSeenEventParams(t,!0)&&n&&e.shouldLog&&console.warn("Avo Inspector: WARNING! You are trying to extract schema shape that was just reported by your Avo Codegen. This is an indicator of duplicate inspector reporting. Please reach out to support@avo.app for advice if you are not sure how to handle this."),e.shouldLog&&console.log("Avo Inspector: extracting schema from "+JSON.stringify(t)),r.AvoSchemaParser.extractSchema(t)}catch(e){return console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e),[]}},e.prototype.setBatchSize=function(t){e._batchSize=t},e.prototype.setBatchFlushSeconds=function(t){e._batchFlushSeconds=t},e._batchSize=30,e._batchFlushSeconds=30,e._shouldLog=!1,e}();t.AvoInspector=v},844:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoInspectorEnv=void 0,t.AvoInspectorEnv={Prod:"prod",Dev:"dev",Staging:"staging"}},661:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoInstallationId=void 0;var o=n(249),r=n(611),s=function(){function e(){}return e.getInstallationId=function(){if(null!==e.installationId)return e.installationId;if(!r.AvoInspector.avoStorage.isInitialized())return"unknown";var t=r.AvoInspector.avoStorage.getItem(e.cacheKey);return null==t?(e.installationId=o.default.newGuid(),r.AvoInspector.avoStorage.setItem(e.cacheKey,e.installationId)):e.installationId=t,e.installationId},Object.defineProperty(e,"cacheKey",{get:function(){return"AvoInstallationId"},enumerable:!1,configurable:!0}),e.installationId=null,e}();t.AvoInstallationId=s},243:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoNetworkCallsHandler=void 0;var o=n(249),r=n(948),s=n(611),i=n(661),a=function(){function e(e,t,n,o,r){this.samplingRate=1,this.sending=!1,this.apiKey=e,this.envName=t,this.appName=n,this.appVersion=o,this.libVersion=r}return e.prototype.callInspectorWithBatchBody=function(t,n){var o=this;if(this.sending)n("Batch sending cancelled because another batch sending is in progress. Your events will be sent with next batch.");else{var r=t.filter((function(e){return null!=e}));if(this.fixSessionAndTrackingIds(r),0!==r.length)if(Math.random()>this.samplingRate)s.AvoInspector.shouldLog&&console.log("Avo Inspector: last event schema dropped due to sampling rate.");else{s.AvoInspector.shouldLog&&(console.log("Avo Inspector: events",r),r.forEach((function(e){if("sessionStarted"===e.type)console.log("Avo Inspector: sending session started event.");else if("event"===e.type){var t=e;console.log("Avo Inspector: sending event "+t.eventName+" with schema "+JSON.stringify(t.eventProperties))}}))),this.sending=!0;var i=new XMLHttpRequest;i.open("POST",e.trackingEndpoint,!0),i.setRequestHeader("Content-Type","text/plain"),i.send(JSON.stringify(r)),i.onload=function(){if(200!==i.status)n("Error ".concat(i.status,": ").concat(i.statusText));else{var e=JSON.parse(i.response).samplingRate;void 0!==e&&(o.samplingRate=e),n(null)}},i.onerror=function(){n("Request failed")},i.ontimeout=function(){n("Request timed out")},this.sending=!1}}},e.prototype.fixSessionAndTrackingIds=function(e){var t=null,n=null;e.forEach((function(e){null!==e.sessionId&&void 0!==e.sessionId&&"unknown"!==e.sessionId&&(t=e.sessionId),null!==e.trackingId&&void 0!==e.trackingId&&"unknown"!==e.trackingId&&(n=e.trackingId)})),e.forEach((function(e){"unknown"===e.sessionId&&(e.sessionId=null!=t?t:r.AvoSessionTracker.sessionId),"unknown"===e.trackingId&&(e.trackingId=null!=n?n:i.AvoInstallationId.getInstallationId())}))},e.prototype.bodyForSessionStartedCall=function(){var e=this.createBaseCallBody();return e.type="sessionStarted",e},e.prototype.bodyForEventSchemaCall=function(e,t,n,o){var r=this.createBaseCallBody();return r.type="event",r.eventName=e,r.eventProperties=t,null!=n?(r.avoFunction=!0,r.eventId=n,r.eventHash=o):(r.avoFunction=!1,r.eventId=null,r.eventHash=null),r},e.prototype.createBaseCallBody=function(){return{apiKey:this.apiKey,appName:this.appName,appVersion:this.appVersion,libVersion:this.libVersion,env:this.envName,libPlatform:"web",messageId:o.default.newGuid(),trackingId:i.AvoInstallationId.getInstallationId(),createdAt:(new Date).toISOString(),sessionId:r.AvoSessionTracker.sessionId,samplingRate:this.samplingRate}},e.trackingEndpoint="https://api.avo.app/inspector/v1/track",e}();t.AvoNetworkCallsHandler=a},924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoSchemaParser=void 0;var n=function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=function(){function e(){}return e.extractSchema=function(e){var t=this;if(null==e)return[];var o=function(e){if(n(e)){var r=e.map((function(e){return o(e)}));return t.removeDuplicates(r)}if("object"==typeof e){var s=[];for(var i in e)if(e.hasOwnProperty(i)){var a=e[i],c={propertyName:i,propertyType:t.getPropValueType(a)};"object"==typeof a&&null!=a&&(c.children=o(a)),s.push(c)}return s}return t.getPropValueType(e)};return o(e)},e.removeDuplicates=function(e){var t={boolean:{},number:{},string:{}},n=[];return e.filter((function(e){var o=typeof e;return o in t?!t[o].hasOwnProperty(e)&&(t[o][e]=!0):!n.includes(e)&&n.push(e)}))},e.getPropValueType=function(e){var t=typeof e;return null==e?"null":"string"===t?"string":"number"===t||"bigint"===t?(e+"").includes(".")?"float":"int":"boolean"===t?"boolean":"object"===t?n(e)?"list":"object":"unknown"},e}();t.AvoSchemaParser=o},948:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoSessionTracker=void 0;var o=n(249),r=n(611),s=function(){function e(e){this._lastSessionTimestamp=null,this._sessionLengthMillis=3e5,this.avoBatcher=e}return Object.defineProperty(e,"sessionId",{get:function(){if(null===e._sessionId){if(!r.AvoInspector.avoStorage.isInitialized())return"unknown";var t=null;try{t=r.AvoInspector.avoStorage.getItem(e.idCacheKey)}catch(e){console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e)}e._sessionId=null==t?this.updateSessionId():t}return e._sessionId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSessionTimestamp",{get:function(){if(null===this._lastSessionTimestamp||0===this._lastSessionTimestamp){var t=r.AvoInspector.avoStorage.getItem(e.lastSessionTimestampKey);null!=t?(this._lastSessionTimestamp=t,isNaN(this._lastSessionTimestamp)&&(this._lastSessionTimestamp=0)):this._lastSessionTimestamp=0}return this._lastSessionTimestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionLengthMillis",{get:function(){return this._sessionLengthMillis},enumerable:!1,configurable:!0}),e.prototype.startOrProlongSession=function(t){var n=this;r.AvoInspector.avoStorage.runAfterInit((function(){t-n.lastSessionTimestamp>n._sessionLengthMillis&&(e.updateSessionId(),n.avoBatcher.handleSessionStarted()),n._lastSessionTimestamp=t,r.AvoInspector.avoStorage.setItem(e.lastSessionTimestampKey,n._lastSessionTimestamp)}))},e.updateSessionId=function(){e._sessionId=o.default.newGuid();try{r.AvoInspector.avoStorage.setItem(e.idCacheKey,e.sessionId)}catch(e){console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e)}return e._sessionId},Object.defineProperty(e,"lastSessionTimestampKey",{get:function(){return"AvoInspectorSessionTimestamp"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"idCacheKey",{get:function(){return"AvoInspectorSessionId"},enumerable:!1,configurable:!0}),e._sessionId=null,e}();t.AvoSessionTracker=s},491:function(e,t){var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),r=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(r,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,o,r,s,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.AvoStorage=void 0;var i=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.useFallbackStorage=!1,t.fallbackStorage={},t.storageInitialized=!1,t.onStorageInitFuncs=[],t.shouldLog=!1,t.suffix="",t}return o(t,e),t.prototype.init=function(e,t){this.shouldLog=e,this.suffix=t,this.initializeStorageWeb(this.isLocalStorageAvailable())},t.prototype.initializeStorageWeb=function(e){this.storageInitialized=!0,e||(this.useFallbackStorage=!0),this.onStorageInitFuncs.forEach((function(e){e()}))},t.prototype.isLocalStorageAvailable=function(){var e=(new Date).toISOString();try{return window.localStorage.setItem(e,e),window.localStorage.getItem(e)===e&&(window.localStorage.removeItem(e),!0)}catch(e){return!1}},t.prototype.isInitialized=function(){return this.storageInitialized},t.prototype.getItemAsync=function(e){return r(this,void 0,void 0,(function(){var t=this;return s(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n,o){t.runAfterInit((function(){if(t.useFallbackStorage){var o=t.fallbackStorage[e+t.suffix];n(t.parseJson(o))}else if("undefined"!=typeof window){o=void 0;try{o=window.localStorage.getItem(e+t.suffix)}catch(e){t.shouldLog&&console.error("Avo Inspector Storage getItemAsync error:",e),n(null)}n(t.parseJson(o))}else n(null)}))}))];case 1:return[2,n.sent()]}}))}))},t.prototype.getItem=function(e){var t;if(this.storageInitialized){if(this.useFallbackStorage)t=this.fallbackStorage[e+this.suffix];else if("undefined"!=typeof window)try{t=window.localStorage.getItem(e+this.suffix)}catch(e){this.shouldLog&&console.error("Avo Inspector Storage getItem error:",e)}}else t=null;return this.parseJson(t)},t.prototype.setItem=function(e,t){var n=this;this.runAfterInit((function(){if(n.useFallbackStorage)n.fallbackStorage[e+n.suffix]=JSON.stringify(t);else if("undefined"!=typeof window)try{window.localStorage.setItem(e+n.suffix,JSON.stringify(t))}catch(e){n.shouldLog&&console.error("Avo Inspector Storage setItem error:",e)}}))},t.prototype.removeItem=function(e){var t=this;this.runAfterInit((function(){if(t.useFallbackStorage)t.fallbackStorage[e+t.suffix]=null;else if("undefined"!=typeof window)try{window.localStorage.removeItem(e+t.suffix)}catch(e){t.shouldLog&&console.error("Avo Inspector Storage removeItem error:",e)}}))},t.prototype.runAfterInit=function(e){this.storageInitialized?e():this.onStorageInitFuncs.push(e)},t}(function(){function e(){}return e.prototype.parseJson=function(e){return null!=e?JSON.parse(e):null},e}()),a=function(){function e(e,t){void 0===t&&(t=""),this.Platform=null,this.Platform="browser",this.storageImpl=new i,this.storageImpl.init(e,t)}return e.prototype.isInitialized=function(){return this.storageImpl.isInitialized()},e.prototype.getItemAsync=function(e){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.storageImpl.getItemAsync(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.getItem=function(e){return this.storageImpl.getItem(e)},e.prototype.setItem=function(e,t){this.storageImpl.setItem(e,t)},e.prototype.removeItem=function(e){this.storageImpl.removeItem(e)},e.prototype.runAfterInit=function(e){this.storageImpl.runAfterInit(e)},e}();t.AvoStorage=a},185:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deepEquals=t.isValueEmpty=void 0,t.isValueEmpty=function(e){return null==e||0==e.trim().length},t.deepEquals=function e(t,n){if(t===n)return!0;if(!(t instanceof Object&&n instanceof Object))return!1;if(t.constructor!==n.constructor)return!1;for(var o in t)if(t.hasOwnProperty(o)){if(!n.hasOwnProperty(o))return!1;if(t[o]!==n[o]){if("object"!=typeof t[o])return!1;if(!e(t[o],n[o]))return!1}}for(o in n)if(n.hasOwnProperty(o)&&!t.hasOwnProperty(o))return!1;return!0}},330:e=>{e.exports={rE:"2.0.0"}}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,n),s.exports}var o={};return(()=>{var e=o;Object.defineProperty(e,"__esModule",{value:!0}),e.AvoInspectorEnv=e.AvoInspector=void 0;var t=n(611);Object.defineProperty(e,"AvoInspector",{enumerable:!0,get:function(){return t.AvoInspector}});var r=n(844);Object.defineProperty(e,"AvoInspectorEnv",{enumerable:!0,get:function(){return r.AvoInspectorEnv}})})(),o})()));
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(self,(()=>(()=>{"use strict";var e={470:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoAnonymousId=void 0;var n=o(249),r=o(611),s=function(){function e(){}return Object.defineProperty(e,"anonymousId",{get:function(){if(null!==e._anonymousId)return e._anonymousId;if(!r.AvoInspector.avoStorage.isInitialized())return"unknown";var t=null;try{t=r.AvoInspector.avoStorage.getItem(e.storageKey)}catch(e){console.error("Avo Inspector: Error reading anonymous ID from storage. Please report to support@avo.app.",e)}if(null==t){e._anonymousId=n.default.newGuid();try{r.AvoInspector.avoStorage.setItem(e.storageKey,e._anonymousId)}catch(e){console.error("Avo Inspector: Error saving anonymous ID to storage. Please report to support@avo.app.",e)}}else e._anonymousId=t;return e._anonymousId},enumerable:!1,configurable:!0}),Object.defineProperty(e,"storageKey",{get:function(){return"AvoInspectorAnonymousId"},enumerable:!1,configurable:!0}),e.clearCache=function(){e._anonymousId=null},e._anonymousId=null,e}();t.AvoAnonymousId=s},669:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoBatcher=void 0;var n=o(611),r=function(){function e(t){var o=this;this.events=[],this.networkCallsHandler=t,this.batchFlushAttemptTimestamp=Date.now(),n.AvoInspector.avoStorage.getItemAsync(e.cacheKey).then((function(e){if(null!==e){var t=e.filter((function(e){return null!==e}));o.events=o.events.concat(t),o.checkIfBatchNeedsToBeSent()}})).catch((function(e){console.error("Avo Inspector: error getting events from cache",e)}))}return e.prototype.handleSessionStarted=function(){this.events.push(this.networkCallsHandler.bodyForSessionStartedCall()),this.saveEvents(),this.checkIfBatchNeedsToBeSent()},e.prototype.handleTrackSchema=function(e,t,o,r){this.events.push(this.networkCallsHandler.bodyForEventSchemaCall(e,t,o,r)),this.saveEvents(),n.AvoInspector.shouldLog&&console.log("Avo Inspector: saved event "+e+" with schema "+JSON.stringify(t)),this.checkIfBatchNeedsToBeSent()},e.prototype.checkIfBatchNeedsToBeSent=function(){var e=this.events.length,t=Date.now(),o=t-this.batchFlushAttemptTimestamp,r=e%n.AvoInspector.batchSize==0,s=o>=1e3*n.AvoInspector.batchFlushSeconds,a=this;if(r||s){this.batchFlushAttemptTimestamp=t;var i=a.events;a.events=[],this.networkCallsHandler.callInspectorWithBatchBody(i,(function(e){null!=e?(a.events=a.events.concat(i),n.AvoInspector.shouldLog&&console.log("Avo Inspector: batch sending failed: "+e.message+". We will attempt to send your schemas with next batch")):n.AvoInspector.shouldLog&&console.log("Avo Inspector: batch sent successfully."),a.saveEvents()}))}},e.prototype.saveEvents=function(){if(this.events.length>1e3){var t=this.events.length-1e3;this.events.splice(0,t)}n.AvoInspector.avoStorage.setItem(e.cacheKey,this.events)},Object.defineProperty(e,"cacheKey",{get:function(){return"AvoInspectorEvents"},enumerable:!1,configurable:!0}),e}();t.AvoBatcher=r},492:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoDeduplicator=void 0;var n=o(924),r=o(185),s=function(){function e(){this.avoFunctionsEvents={},this.manualEvents={},this.avoFunctionsEventsParams={},this.manualEventsParams={}}return e.prototype.shouldRegisterEvent=function(e,t,o){this.clearOldEvents(),o?(this.avoFunctionsEvents[Date.now()]=e,this.avoFunctionsEventsParams[e]=t):(this.manualEvents[Date.now()]=e,this.manualEventsParams[e]=t);var n=!o;return!this.hasSameEventAs(e,t,n)},e.prototype.hasSameEventAs=function(e,t,o){var n=!1;return o?this.lookForEventIn(e,t,this.avoFunctionsEventsParams)&&(n=!0):this.lookForEventIn(e,t,this.manualEventsParams)&&(n=!0),n&&(delete this.avoFunctionsEventsParams[e],delete this.manualEventsParams[e]),n},e.prototype.lookForEventIn=function(e,t,o){for(var n in o)if(o.hasOwnProperty(n)&&n===e){var s=o[e];if(s&&(0,r.deepEquals)(t,s))return!0}return!1},e.prototype.hasSeenEventParams=function(e,t){var o=!1;return t?this.lookForEventParamsIn(e,this.avoFunctionsEventsParams)&&(o=!0):this.lookForEventParamsIn(e,this.manualEventsParams)&&(o=!0),o},e.prototype.lookForEventParamsIn=function(e,t){for(var o in t)if(t.hasOwnProperty(o)){var n=t[o];if(n&&(0,r.deepEquals)(e,n))return!0}return!1},e.prototype.shouldRegisterSchemaFromManually=function(e,t){return this.clearOldEvents(),!this.hasSameShapeInAvoFunctionsAs(e,t)},e.prototype.hasSameShapeInAvoFunctionsAs=function(e,t){var o=!1;return this.lookForEventSchemaIn(e,t,this.avoFunctionsEventsParams)&&(o=!0),o&&delete this.avoFunctionsEventsParams[e],o},e.prototype.lookForEventSchemaIn=function(e,t,o){for(var s in o)if(o.hasOwnProperty(s)&&s===e){var a=n.AvoSchemaParser.extractSchema(o[e]);if(a&&(0,r.deepEquals)(t,a))return!0}return!1},e.prototype.clearOldEvents=function(){var e=Date.now();for(var t in this.avoFunctionsEvents)if(this.avoFunctionsEvents.hasOwnProperty(t)&&e-(Number(t)||0)>300){var o=this.avoFunctionsEvents[t];delete this.avoFunctionsEvents[t],delete this.avoFunctionsEventsParams[o]}for(var t in this.manualEvents)this.manualEvents.hasOwnProperty(t)&&e-(Number(t)||0)>300&&(o=this.manualEvents[t],delete this.manualEvents[t],delete this.manualEventsParams[o])},e.prototype._clearEvents=function(){this.avoFunctionsEvents={},this.manualEvents={},this.avoFunctionsEventsParams={},this.manualEventsParams={}},e}();t.AvoDeduplicator=s},249:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(){}return e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e}();t.default=o},611:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoInspector=void 0;var n=o(844),r=o(924),s=o(669),a=o(243),i=o(491),u=o(492),c=o(185),l=o(330).rE,p=function(){function e(t){if((0,c.isValueEmpty)(t.env)?(this.environment=n.AvoInspectorEnv.Dev,console.warn("[Avo Inspector] No environment provided. Defaulting to dev.")):Object.values(n.AvoInspectorEnv).includes(t.env)?this.environment=t.env:(this.environment=n.AvoInspectorEnv.Dev,console.warn("[Avo Inspector] Unsupported environment provided. Defaulting to dev. Supported environments - Dev, Staging, Prod.")),(0,c.isValueEmpty)(t.apiKey))throw new Error("[Avo Inspector] No API key provided. Inspector can't operate without API key.");if(this.apiKey=t.apiKey,(0,c.isValueEmpty)(t.version))throw new Error("[Avo Inspector] No version provided. Many features of Inspector rely on versioning. Please provide comparable string version, i.e. integer or semantic.");this.version=t.version,this.environment===n.AvoInspectorEnv.Dev?(e._batchSize=1,e._shouldLog=!0):(e._batchSize=30,e._batchFlushSeconds=30,e._shouldLog=!1),e.avoStorage=new i.AvoStorage(e._shouldLog,null!=t.suffix?t.suffix:"");var o=new a.AvoNetworkCallsHandler(this.apiKey,this.environment.toString(),t.appName||"",this.version,l);this.avoBatcher=new s.AvoBatcher(o),this.avoDeduplicator=new u.AvoDeduplicator}return Object.defineProperty(e,"batchSize",{get:function(){return this._batchSize},set:function(e){this._batchSize=e<1?1:e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"batchFlushSeconds",{get:function(){return this._batchFlushSeconds},enumerable:!1,configurable:!0}),Object.defineProperty(e,"shouldLog",{get:function(){return this._shouldLog},set:function(e){this._shouldLog=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"networkTimeout",{get:function(){return this._networkTimeout},set:function(e){this._networkTimeout=e},enumerable:!1,configurable:!0}),e.prototype.trackSchemaFromEvent=function(t,o){try{if(this.avoDeduplicator.shouldRegisterEvent(t,o,!1)){e.shouldLog&&console.log("Avo Inspector: supplied event "+t+" with params "+JSON.stringify(o));var n=this.extractSchema(o,!1);return this.trackSchemaInternal(t,n,null,null),n}return e.shouldLog&&console.log("Avo Inspector: Deduplicated event: "+t),[]}catch(e){return console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e),[]}},e.prototype._avoFunctionTrackSchemaFromEvent=function(t,o,n,r){try{if(this.avoDeduplicator.shouldRegisterEvent(t,o,!0)){e.shouldLog&&console.log("Avo Inspector: supplied event "+t+" with params "+JSON.stringify(o));var s=this.extractSchema(o,!1);return this.trackSchemaInternal(t,s,n,r),s}return e.shouldLog&&console.log("Avo Inspector: Deduplicated event: "+t),[]}catch(e){return console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e),[]}},e.prototype.trackSchema=function(t,o){try{this.avoDeduplicator.shouldRegisterSchemaFromManually(t,o)?(e.shouldLog&&console.log("Avo Inspector: supplied event "+t+" with schema "+JSON.stringify(o)),this.trackSchemaInternal(t,o,null,null)):e.shouldLog&&console.log("Avo Inspector: Deduplicated event: "+t)}catch(e){console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e)}},e.prototype.trackSchemaInternal=function(e,t,o,n){try{this.avoBatcher.handleTrackSchema(e,t,o,n)}catch(e){console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e)}},e.prototype.enableLogging=function(t){e._shouldLog=t},e.prototype.extractSchema=function(t,o){void 0===o&&(o=!0);try{return this.avoDeduplicator.hasSeenEventParams(t,!0)&&o&&e.shouldLog&&console.warn("Avo Inspector: WARNING! You are trying to extract schema shape that was just reported by your Avo Codegen. This is an indicator of duplicate inspector reporting. Please reach out to support@avo.app for advice if you are not sure how to handle this."),e.shouldLog&&console.log("Avo Inspector: extracting schema from "+JSON.stringify(t)),r.AvoSchemaParser.extractSchema(t)}catch(e){return console.error("Avo Inspector: something went wrong. Please report to support@avo.app.",e),[]}},e.prototype.setBatchSize=function(t){e._batchSize=t},e.prototype.setBatchFlushSeconds=function(t){e._batchFlushSeconds=t},e._batchSize=30,e._batchFlushSeconds=30,e._shouldLog=!1,e._networkTimeout=2e3,e}();t.AvoInspector=p},844:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoInspectorEnv=void 0,t.AvoInspectorEnv={Prod:"prod",Dev:"dev",Staging:"staging"}},243:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoNetworkCallsHandler=void 0;var n=o(249),r=o(611),s=o(470),a=function(){function e(e,t,o,n,r){this.samplingRate=1,this.sending=!1,this.apiKey=e,this.envName=t,this.appName=o,this.appVersion=n,this.libVersion=r}return e.prototype.callInspectorWithBatchBody=function(t,o){var n=this;if(this.sending)o(new Error("Batch sending cancelled because another batch sending is in progress. Your events will be sent with next batch."));else{var s=t.filter((function(e){return null!=e}));if(this.fixAnonymousIds(s),0!==s.length)if(Math.random()>this.samplingRate)r.AvoInspector.shouldLog&&console.log("Avo Inspector: last event schema dropped due to sampling rate.");else{r.AvoInspector.shouldLog&&(console.log("Avo Inspector: events",s),s.forEach((function(e){if("sessionStarted"===e.type)console.log("Avo Inspector: sending session started event.");else if("event"===e.type){var t=e;console.log("Avo Inspector: sending event "+t.eventName+" with schema "+JSON.stringify(t.eventProperties))}}))),this.sending=!0;var a=new XMLHttpRequest;a.open("POST",e.trackingEndpoint,!0),a.setRequestHeader("Content-Type","text/plain"),a.timeout=r.AvoInspector.networkTimeout,a.send(JSON.stringify(s)),a.onload=function(){if(200!==a.status)o(new Error("Error ".concat(a.status,": ").concat(a.statusText)));else{var e=JSON.parse(a.response).samplingRate;void 0!==e&&(n.samplingRate=e),o(null)}n.sending=!1},a.onerror=function(){o(new Error("Request failed")),n.sending=!1},a.ontimeout=function(){o(new Error("Request timed out")),n.sending=!1}}}},e.prototype.fixAnonymousIds=function(e){var t=null;e.forEach((function(e){null!==e.anonymousId&&void 0!==e.anonymousId&&"unknown"!==e.anonymousId&&(t=e.anonymousId)})),e.forEach((function(e){"unknown"===e.anonymousId&&(e.anonymousId=null!=t?t:s.AvoAnonymousId.anonymousId)}))},e.prototype.bodyForSessionStartedCall=function(){var e=this.createBaseCallBody();return e.type="sessionStarted",e},e.prototype.bodyForEventSchemaCall=function(e,t,o,n){var r=this.createBaseCallBody();return r.type="event",r.eventName=e,r.eventProperties=t,null!=o?(r.avoFunction=!0,r.eventId=o,r.eventHash=n):(r.avoFunction=!1,r.eventId=null,r.eventHash=null),r},e.prototype.createBaseCallBody=function(){return{apiKey:this.apiKey,appName:this.appName,appVersion:this.appVersion,libVersion:this.libVersion,env:this.envName,libPlatform:"web",messageId:n.default.newGuid(),trackingId:"",createdAt:(new Date).toISOString(),sessionId:"",anonymousId:s.AvoAnonymousId.anonymousId,samplingRate:this.samplingRate}},e.trackingEndpoint="https://api.avo.app/inspector/v1/track",e}();t.AvoNetworkCallsHandler=a},924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvoSchemaParser=void 0;var o=function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=function(){function e(){}return e.extractSchema=function(e){var t=this;if(null==e)return[];var n=function(e){if(o(e)){var r=e.map((function(e){return n(e)}));return t.removeDuplicates(r)}if("object"==typeof e){var s=[];for(var a in e)if(e.hasOwnProperty(a)){var i=e[a],u={propertyName:a,propertyType:t.getPropValueType(i)};"object"==typeof i&&null!=i&&(u.children=n(i)),s.push(u)}return s}return t.getPropValueType(e)};return n(e)},e.removeDuplicates=function(e){var t={boolean:{},number:{},string:{}},o=[];return e.filter((function(e){var n=typeof e;return n in t?!t[n].hasOwnProperty(e)&&(t[n][e]=!0):!o.includes(e)&&o.push(e)}))},e.getPropValueType=function(e){var t=typeof e;return null==e?"null":"string"===t?"string":"number"===t||"bigint"===t?(e+"").includes(".")?"float":"int":"boolean"===t?"boolean":"object"===t?o(e)?"list":"object":"unknown"},e}();t.AvoSchemaParser=n},491:function(e,t){var o,n=this&&this.__extends||(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},o(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),r=this&&this.__awaiter||function(e,t,o,n){return new(o||(o=Promise))((function(r,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function i(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,i)}u((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var o,n,r,s,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function i(i){return function(u){return function(i){if(o)throw new TypeError("Generator is already executing.");for(;s&&(s=0,i[0]&&(a=0)),a;)try{if(o=1,n&&(r=2&i[0]?n.return:i[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,i[1])).done)return r;switch(n=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{o=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.AvoStorage=void 0;var a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.useFallbackStorage=!1,t.fallbackStorage={},t.storageInitialized=!1,t.onStorageInitFuncs=[],t.shouldLog=!1,t.suffix="",t}return n(t,e),t.prototype.init=function(e,t){this.shouldLog=e,this.suffix=t,this.initializeStorageWeb(this.isLocalStorageAvailable())},t.prototype.initializeStorageWeb=function(e){this.storageInitialized=!0,e||(this.useFallbackStorage=!0),this.onStorageInitFuncs.forEach((function(e){e()}))},t.prototype.isLocalStorageAvailable=function(){var e=(new Date).toISOString();try{return window.localStorage.setItem(e,e),window.localStorage.getItem(e)===e&&(window.localStorage.removeItem(e),!0)}catch(e){return!1}},t.prototype.isInitialized=function(){return this.storageInitialized},t.prototype.getItemAsync=function(e){return r(this,void 0,void 0,(function(){var t=this;return s(this,(function(o){switch(o.label){case 0:return[4,new Promise((function(o,n){t.runAfterInit((function(){if(t.useFallbackStorage){var n=t.fallbackStorage[e+t.suffix];o(t.parseJson(n))}else if("undefined"!=typeof window){n=void 0;try{n=window.localStorage.getItem(e+t.suffix)}catch(e){t.shouldLog&&console.error("Avo Inspector Storage getItemAsync error:",e),o(null)}o(t.parseJson(n))}else o(null)}))}))];case 1:return[2,o.sent()]}}))}))},t.prototype.getItem=function(e){var t;if(this.storageInitialized){if(this.useFallbackStorage)t=this.fallbackStorage[e+this.suffix];else if("undefined"!=typeof window)try{t=window.localStorage.getItem(e+this.suffix)}catch(e){this.shouldLog&&console.error("Avo Inspector Storage getItem error:",e)}}else t=null;return this.parseJson(t)},t.prototype.setItem=function(e,t){var o=this;this.runAfterInit((function(){if(o.useFallbackStorage)o.fallbackStorage[e+o.suffix]=JSON.stringify(t);else if("undefined"!=typeof window)try{window.localStorage.setItem(e+o.suffix,JSON.stringify(t))}catch(e){o.shouldLog&&console.error("Avo Inspector Storage setItem error:",e)}}))},t.prototype.removeItem=function(e){var t=this;this.runAfterInit((function(){if(t.useFallbackStorage)t.fallbackStorage[e+t.suffix]=null;else if("undefined"!=typeof window)try{window.localStorage.removeItem(e+t.suffix)}catch(e){t.shouldLog&&console.error("Avo Inspector Storage removeItem error:",e)}}))},t.prototype.runAfterInit=function(e){this.storageInitialized?e():this.onStorageInitFuncs.push(e)},t}(function(){function e(){}return e.prototype.parseJson=function(e){return null!=e?JSON.parse(e):null},e}()),i=function(){function e(e,t){void 0===t&&(t=""),this.Platform=null,this.Platform="browser",this.storageImpl=new a,this.storageImpl.init(e,t)}return e.prototype.isInitialized=function(){return this.storageImpl.isInitialized()},e.prototype.getItemAsync=function(e){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.storageImpl.getItemAsync(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.getItem=function(e){return this.storageImpl.getItem(e)},e.prototype.setItem=function(e,t){this.storageImpl.setItem(e,t)},e.prototype.removeItem=function(e){this.storageImpl.removeItem(e)},e.prototype.runAfterInit=function(e){this.storageImpl.runAfterInit(e)},e}();t.AvoStorage=i},185:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deepEquals=t.isValueEmpty=void 0,t.isValueEmpty=function(e){return null==e||0==e.trim().length},t.deepEquals=function e(t,o){if(t===o)return!0;if(!(t instanceof Object&&o instanceof Object))return!1;if(t.constructor!==o.constructor)return!1;for(var n in t)if(t.hasOwnProperty(n)){if(!o.hasOwnProperty(n))return!1;if(t[n]!==o[n]){if("object"!=typeof t[n])return!1;if(!e(t[n],o[n]))return!1}}for(n in o)if(o.hasOwnProperty(n)&&!t.hasOwnProperty(n))return!1;return!0}},330:e=>{e.exports=JSON.parse('{"rE":"2.2.0-alpha.1"}')}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,o),s.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.AvoInspectorEnv=e.AvoInspector=void 0;var t=o(611);Object.defineProperty(e,"AvoInspector",{enumerable:!0,get:function(){return t.AvoInspector}});var r=o(844);Object.defineProperty(e,"AvoInspectorEnv",{enumerable:!0,get:function(){return r.AvoInspectorEnv}})})(),n})()));
|
|
@@ -47,7 +47,7 @@ var AvoInspector = /** @class */ (function () {
|
|
|
47
47
|
AvoInspector._batchFlushSeconds = 30;
|
|
48
48
|
AvoInspector._shouldLog = false;
|
|
49
49
|
}
|
|
50
|
-
AvoInspector.avoStorage = new AvoStorage_1.AvoStorage(AvoInspector._shouldLog
|
|
50
|
+
AvoInspector.avoStorage = new AvoStorage_1.AvoStorage(AvoInspector._shouldLog);
|
|
51
51
|
var avoNetworkCallsHandler = new AvoNetworkCallsHandler_1.AvoNetworkCallsHandler(this.apiKey, this.environment.toString(), options.appName || "", this.version, libVersion);
|
|
52
52
|
this.avoBatcher = new AvoBatcher_1.AvoBatcher(avoNetworkCallsHandler);
|
|
53
53
|
this.sessionTracker = new AvoSessionTracker_1.AvoSessionTracker(this.avoBatcher);
|
|
@@ -190,7 +190,7 @@ var AvoInspector = /** @class */ (function () {
|
|
|
190
190
|
this.sessionTracker.startOrProlongSession(Date.now());
|
|
191
191
|
if (this.avoDeduplicator.hasSeenEventParams(eventProperties, true)) {
|
|
192
192
|
if (shouldLogIfEnabled && AvoInspector.shouldLog) {
|
|
193
|
-
console.warn("Avo Inspector: WARNING! You are trying to extract schema shape that was just reported by your Avo
|
|
193
|
+
console.warn("Avo Inspector: WARNING! You are trying to extract schema shape that was just reported by your Avo functions. " +
|
|
194
194
|
"This is an indicator of duplicate inspector reporting. " +
|
|
195
195
|
"Please reach out to support@avo.app for advice if you are not sure how to handle this.");
|
|
196
196
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare abstract class PlatformAvoStorage {
|
|
2
|
-
abstract init(shouldLog: boolean
|
|
2
|
+
abstract init(shouldLog: boolean): void;
|
|
3
3
|
abstract getItemAsync<T>(key: string): Promise<T | null>;
|
|
4
4
|
abstract getItem<T>(key: string): T | null;
|
|
5
5
|
abstract setItem<T>(key: string, value: T): void;
|
|
@@ -11,7 +11,7 @@ declare abstract class PlatformAvoStorage {
|
|
|
11
11
|
export declare class AvoStorage {
|
|
12
12
|
Platform: string | null;
|
|
13
13
|
storageImpl: PlatformAvoStorage;
|
|
14
|
-
constructor(shouldLog: boolean
|
|
14
|
+
constructor(shouldLog: boolean);
|
|
15
15
|
isInitialized(): boolean;
|
|
16
16
|
getItemAsync<T>(key: string): Promise<T | null>;
|
|
17
17
|
getItem<T>(key: string): T | null;
|
|
@@ -34,21 +34,19 @@ var AndroidAvoStorage = /** @class */ (function (_super) {
|
|
|
34
34
|
function AndroidAvoStorage() {
|
|
35
35
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
36
36
|
_this.androidMemoryDataToAvoidAsyncQueries = {};
|
|
37
|
+
_this.storageLib = null;
|
|
37
38
|
_this.AsyncStorage = null;
|
|
38
39
|
_this.memoryStorageInitialized = false;
|
|
39
40
|
_this.onStorageInitFuncs = [];
|
|
40
|
-
_this.reactNative = null;
|
|
41
41
|
_this.shouldLog = false;
|
|
42
|
-
_this.suffix = "";
|
|
43
42
|
return _this;
|
|
44
43
|
}
|
|
45
|
-
AndroidAvoStorage.prototype.init = function (shouldLog
|
|
44
|
+
AndroidAvoStorage.prototype.init = function (shouldLog) {
|
|
46
45
|
var _this = this;
|
|
47
46
|
if (!process.env.BROWSER) {
|
|
48
|
-
this.
|
|
49
|
-
this.reactNative = require("react-native");
|
|
47
|
+
this.storageLib = require("@react-native-async-storage/async-storage");
|
|
50
48
|
this.shouldLog = shouldLog;
|
|
51
|
-
this.AsyncStorage = this.
|
|
49
|
+
this.AsyncStorage = this.storageLib.default;
|
|
52
50
|
this.loadAndroidDataToMemoryToAvoidAsyncQueries(function () {
|
|
53
51
|
_this.initializeStorageAndroid();
|
|
54
52
|
});
|
|
@@ -62,12 +60,10 @@ var AndroidAvoStorage = /** @class */ (function (_super) {
|
|
|
62
60
|
console.log("Avo Inspector: android loaded data from memory");
|
|
63
61
|
}
|
|
64
62
|
keyVals.forEach(function (keyVal) {
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
console.log(keyInStorage, keyVal[1]);
|
|
70
|
-
}
|
|
63
|
+
var key = keyVal[0];
|
|
64
|
+
_this.androidMemoryDataToAvoidAsyncQueries[key] = keyVal[1];
|
|
65
|
+
if (_this.shouldLog) {
|
|
66
|
+
console.log(key, keyVal[1]);
|
|
71
67
|
}
|
|
72
68
|
});
|
|
73
69
|
onLoaded();
|
|
@@ -81,25 +77,25 @@ var AndroidAvoStorage = /** @class */ (function (_super) {
|
|
|
81
77
|
});
|
|
82
78
|
};
|
|
83
79
|
AndroidAvoStorage.prototype.isInitialized = function () {
|
|
84
|
-
return this.
|
|
80
|
+
return this.storageLib && this.memoryStorageInitialized;
|
|
85
81
|
};
|
|
86
82
|
AndroidAvoStorage.prototype.getItemAsync = function (key) {
|
|
87
|
-
var maybeItem = this.AsyncStorage.getItem(key
|
|
83
|
+
var maybeItem = this.AsyncStorage.getItem(key);
|
|
88
84
|
return maybeItem.then(function (storedItem) {
|
|
89
85
|
return storedItem != null ? JSON.parse(storedItem) : null;
|
|
90
86
|
});
|
|
91
87
|
};
|
|
92
88
|
AndroidAvoStorage.prototype.getItem = function (key) {
|
|
93
|
-
var maybeItem = this.androidMemoryDataToAvoidAsyncQueries[key
|
|
89
|
+
var maybeItem = this.androidMemoryDataToAvoidAsyncQueries[key];
|
|
94
90
|
return this.parseJson(maybeItem);
|
|
95
91
|
};
|
|
96
92
|
AndroidAvoStorage.prototype.setItem = function (key, value) {
|
|
97
|
-
this.AsyncStorage.setItem(key
|
|
98
|
-
this.androidMemoryDataToAvoidAsyncQueries[key
|
|
93
|
+
this.AsyncStorage.setItem(key, JSON.stringify(value));
|
|
94
|
+
this.androidMemoryDataToAvoidAsyncQueries[key] = JSON.stringify(value);
|
|
99
95
|
};
|
|
100
96
|
AndroidAvoStorage.prototype.removeItem = function (key) {
|
|
101
|
-
this.AsyncStorage.removeItem(key
|
|
102
|
-
this.androidMemoryDataToAvoidAsyncQueries[key
|
|
97
|
+
this.AsyncStorage.removeItem(key);
|
|
98
|
+
this.androidMemoryDataToAvoidAsyncQueries[key] = null;
|
|
103
99
|
};
|
|
104
100
|
AndroidAvoStorage.prototype.runAfterInit = function (func) {
|
|
105
101
|
if (this.memoryStorageInitialized === true) {
|
|
@@ -116,12 +112,10 @@ var IosAvoStorage = /** @class */ (function (_super) {
|
|
|
116
112
|
function IosAvoStorage() {
|
|
117
113
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
118
114
|
_this.reactNative = null;
|
|
119
|
-
_this.suffix = "";
|
|
120
115
|
return _this;
|
|
121
116
|
}
|
|
122
|
-
IosAvoStorage.prototype.init = function (_shouldLog
|
|
117
|
+
IosAvoStorage.prototype.init = function (_shouldLog) {
|
|
123
118
|
if (!process.env.BROWSER) {
|
|
124
|
-
this.suffix = suffix;
|
|
125
119
|
this.reactNative = require("react-native");
|
|
126
120
|
}
|
|
127
121
|
};
|
|
@@ -130,23 +124,23 @@ var IosAvoStorage = /** @class */ (function (_super) {
|
|
|
130
124
|
};
|
|
131
125
|
IosAvoStorage.prototype.getItemAsync = function (key) {
|
|
132
126
|
var Settings = this.reactNative.Settings;
|
|
133
|
-
var maybeItem = Settings.get(key
|
|
127
|
+
var maybeItem = Settings.get(key);
|
|
134
128
|
return Promise.resolve(this.parseJson(maybeItem));
|
|
135
129
|
};
|
|
136
130
|
IosAvoStorage.prototype.getItem = function (key) {
|
|
137
131
|
var Settings = this.reactNative.Settings;
|
|
138
|
-
var maybeItem = Settings.get(key
|
|
132
|
+
var maybeItem = Settings.get(key);
|
|
139
133
|
return this.parseJson(maybeItem);
|
|
140
134
|
};
|
|
141
135
|
IosAvoStorage.prototype.setItem = function (key, value) {
|
|
142
136
|
var _a;
|
|
143
137
|
var Settings = this.reactNative.Settings;
|
|
144
|
-
Settings.set((_a = {}, _a[key
|
|
138
|
+
Settings.set((_a = {}, _a[key] = JSON.stringify(value), _a));
|
|
145
139
|
};
|
|
146
140
|
IosAvoStorage.prototype.removeItem = function (key) {
|
|
147
141
|
var _a;
|
|
148
142
|
var Settings = this.reactNative.Settings;
|
|
149
|
-
Settings.set((_a = {}, _a[key
|
|
143
|
+
Settings.set((_a = {}, _a[key] = null, _a));
|
|
150
144
|
};
|
|
151
145
|
IosAvoStorage.prototype.runAfterInit = function (func) {
|
|
152
146
|
func();
|
|
@@ -162,12 +156,10 @@ var BrowserAvoStorage = /** @class */ (function (_super) {
|
|
|
162
156
|
_this.storageInitialized = false;
|
|
163
157
|
_this.onStorageInitFuncs = [];
|
|
164
158
|
_this.shouldLog = false;
|
|
165
|
-
_this.suffix = "";
|
|
166
159
|
return _this;
|
|
167
160
|
}
|
|
168
|
-
BrowserAvoStorage.prototype.init = function (shouldLog
|
|
161
|
+
BrowserAvoStorage.prototype.init = function (shouldLog) {
|
|
169
162
|
this.shouldLog = shouldLog;
|
|
170
|
-
this.suffix = suffix;
|
|
171
163
|
this.initializeStorageWeb(this.isLocalStorageAvailable());
|
|
172
164
|
};
|
|
173
165
|
BrowserAvoStorage.prototype.initializeStorageWeb = function (isLocalStorageAvailable) {
|
|
@@ -203,14 +195,14 @@ var BrowserAvoStorage = /** @class */ (function (_super) {
|
|
|
203
195
|
return new Promise(function (resolve, _reject) {
|
|
204
196
|
thisStorage.runAfterInit(function () {
|
|
205
197
|
if (thisStorage.useFallbackStorage === true) {
|
|
206
|
-
var maybeItem = thisStorage.fallbackStorage[key
|
|
198
|
+
var maybeItem = thisStorage.fallbackStorage[key];
|
|
207
199
|
resolve(thisStorage.parseJson(maybeItem));
|
|
208
200
|
}
|
|
209
201
|
else {
|
|
210
202
|
if (typeof window !== "undefined") {
|
|
211
203
|
var maybeItem = void 0;
|
|
212
204
|
try {
|
|
213
|
-
maybeItem = window.localStorage.getItem(key
|
|
205
|
+
maybeItem = window.localStorage.getItem(key);
|
|
214
206
|
}
|
|
215
207
|
catch (error) {
|
|
216
208
|
if (thisStorage.shouldLog) {
|
|
@@ -233,12 +225,12 @@ var BrowserAvoStorage = /** @class */ (function (_super) {
|
|
|
233
225
|
maybeItem = null;
|
|
234
226
|
}
|
|
235
227
|
else if (this.useFallbackStorage === true) {
|
|
236
|
-
maybeItem = this.fallbackStorage[key
|
|
228
|
+
maybeItem = this.fallbackStorage[key];
|
|
237
229
|
}
|
|
238
230
|
else if (process.env.BROWSER) {
|
|
239
231
|
if (typeof window !== "undefined") {
|
|
240
232
|
try {
|
|
241
|
-
maybeItem = window.localStorage.getItem(key
|
|
233
|
+
maybeItem = window.localStorage.getItem(key);
|
|
242
234
|
}
|
|
243
235
|
catch (error) {
|
|
244
236
|
if (this.shouldLog) {
|
|
@@ -253,12 +245,12 @@ var BrowserAvoStorage = /** @class */ (function (_super) {
|
|
|
253
245
|
var _this = this;
|
|
254
246
|
this.runAfterInit(function () {
|
|
255
247
|
if (_this.useFallbackStorage === true) {
|
|
256
|
-
_this.fallbackStorage[key
|
|
248
|
+
_this.fallbackStorage[key] = JSON.stringify(value);
|
|
257
249
|
}
|
|
258
250
|
else {
|
|
259
251
|
if (typeof window !== "undefined") {
|
|
260
252
|
try {
|
|
261
|
-
window.localStorage.setItem(key
|
|
253
|
+
window.localStorage.setItem(key, JSON.stringify(value));
|
|
262
254
|
}
|
|
263
255
|
catch (error) {
|
|
264
256
|
if (_this.shouldLog) {
|
|
@@ -273,12 +265,12 @@ var BrowserAvoStorage = /** @class */ (function (_super) {
|
|
|
273
265
|
var _this = this;
|
|
274
266
|
this.runAfterInit(function () {
|
|
275
267
|
if (_this.useFallbackStorage === true) {
|
|
276
|
-
_this.fallbackStorage[key
|
|
268
|
+
_this.fallbackStorage[key] = null;
|
|
277
269
|
}
|
|
278
270
|
else {
|
|
279
271
|
if (typeof window !== "undefined") {
|
|
280
272
|
try {
|
|
281
|
-
window.localStorage.removeItem(key
|
|
273
|
+
window.localStorage.removeItem(key);
|
|
282
274
|
}
|
|
283
275
|
catch (error) {
|
|
284
276
|
if (_this.shouldLog) {
|
|
@@ -300,8 +292,7 @@ var BrowserAvoStorage = /** @class */ (function (_super) {
|
|
|
300
292
|
return BrowserAvoStorage;
|
|
301
293
|
}(PlatformAvoStorage));
|
|
302
294
|
var AvoStorage = /** @class */ (function () {
|
|
303
|
-
function AvoStorage(shouldLog
|
|
304
|
-
if (suffix === void 0) { suffix = ""; }
|
|
295
|
+
function AvoStorage(shouldLog) {
|
|
305
296
|
this.Platform = null;
|
|
306
297
|
if (!process.env.BROWSER) {
|
|
307
298
|
var reactNative = require("react-native");
|
|
@@ -320,7 +311,7 @@ var AvoStorage = /** @class */ (function () {
|
|
|
320
311
|
this.Platform = "browser";
|
|
321
312
|
this.storageImpl = new BrowserAvoStorage();
|
|
322
313
|
}
|
|
323
|
-
this.storageImpl.init(shouldLog
|
|
314
|
+
this.storageImpl.init(shouldLog);
|
|
324
315
|
}
|
|
325
316
|
AvoStorage.prototype.isInitialized = function () {
|
|
326
317
|
return this.storageImpl.isInitialized();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="jest" />
|
|
2
2
|
declare let xhrMock: {
|
|
3
|
-
open: jest.Mock<any, any>;
|
|
4
|
-
send: jest.Mock<any, any>;
|
|
5
|
-
setRequestHeader: jest.Mock<any, any>;
|
|
6
|
-
onload: jest.Mock<any, any>;
|
|
7
|
-
onerror: jest.Mock<any, any>;
|
|
8
|
-
ontimeout: jest.Mock<any, any>;
|
|
3
|
+
open: jest.Mock<any, any, any>;
|
|
4
|
+
send: jest.Mock<any, any, any>;
|
|
5
|
+
setRequestHeader: jest.Mock<any, any, any>;
|
|
6
|
+
onload: jest.Mock<any, any, any>;
|
|
7
|
+
onerror: jest.Mock<any, any, any>;
|
|
8
|
+
ontimeout: jest.Mock<any, any, any>;
|
|
9
9
|
status: number;
|
|
10
10
|
response: string;
|
|
11
11
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="jest" />
|
|
2
2
|
declare let xhrErrorMock: {
|
|
3
|
-
open: jest.Mock<any, any>;
|
|
4
|
-
send: jest.Mock<any, any>;
|
|
5
|
-
setRequestHeader: jest.Mock<any, any>;
|
|
6
|
-
onload: jest.Mock<any, any>;
|
|
7
|
-
onerror: jest.Mock<any, any>;
|
|
8
|
-
ontimeout: jest.Mock<any, any>;
|
|
3
|
+
open: jest.Mock<any, any, any>;
|
|
4
|
+
send: jest.Mock<any, any, any>;
|
|
5
|
+
setRequestHeader: jest.Mock<any, any, any>;
|
|
6
|
+
onload: jest.Mock<any, any, any>;
|
|
7
|
+
onerror: jest.Mock<any, any, any>;
|
|
8
|
+
ontimeout: jest.Mock<any, any, any>;
|
|
9
9
|
status: number;
|
|
10
10
|
statusText: string;
|
|
11
11
|
};
|
|
@@ -59,13 +59,13 @@ describe("NetworkCallsHandler", function () {
|
|
|
59
59
|
var body = networkHandler.bodyForSessionStartedCall();
|
|
60
60
|
expect(body).toEqual(__assign(__assign({}, baseBody), { type: "sessionStarted" }));
|
|
61
61
|
});
|
|
62
|
-
test("bodyForEventSchemaCall returns base body + event schema used for event sending from non
|
|
62
|
+
test("bodyForEventSchemaCall returns base body + event schema used for event sending from non avo functions", function () {
|
|
63
63
|
var eventName = "event name";
|
|
64
64
|
var eventProperties = [{ propertyName: "prop0", propertyType: "string" }];
|
|
65
65
|
var body = networkHandler.bodyForEventSchemaCall(eventName, eventProperties, null, null);
|
|
66
66
|
expect(body).toEqual(__assign(__assign({}, baseBody), { type: "event", eventName: eventName, eventProperties: eventProperties, avoFunction: false, eventId: null, eventHash: null }));
|
|
67
67
|
});
|
|
68
|
-
test("bodyForEventSchemaCall returns base body + event schema used for event sending from
|
|
68
|
+
test("bodyForEventSchemaCall returns base body + event schema used for event sending from avo functions", function () {
|
|
69
69
|
var eventName = "event name";
|
|
70
70
|
var eventId = "event id";
|
|
71
71
|
var eventHash = "event hash";
|
|
@@ -12,65 +12,6 @@ describe("Schema Parsing", function () {
|
|
|
12
12
|
var schema = inspector.extractSchema();
|
|
13
13
|
expect(schema).toEqual([]);
|
|
14
14
|
});
|
|
15
|
-
test("Record is parsed correctly", function () {
|
|
16
|
-
// Given
|
|
17
|
-
var eventProperrtiesaRecord = {
|
|
18
|
-
prop0: true,
|
|
19
|
-
prop1: 1,
|
|
20
|
-
prop2: "str",
|
|
21
|
-
prop3: 0.5,
|
|
22
|
-
prop4: undefined,
|
|
23
|
-
prop5: null,
|
|
24
|
-
prop6: { an: "object" },
|
|
25
|
-
prop7: [
|
|
26
|
-
"a",
|
|
27
|
-
"list",
|
|
28
|
-
{
|
|
29
|
-
"obj in list": true,
|
|
30
|
-
"int field": 1,
|
|
31
|
-
},
|
|
32
|
-
["another", "list"],
|
|
33
|
-
[1, 2],
|
|
34
|
-
],
|
|
35
|
-
};
|
|
36
|
-
// When
|
|
37
|
-
var res = inspector.extractSchema(eventProperrtiesaRecord);
|
|
38
|
-
// Then
|
|
39
|
-
res.forEach(function (_a, index) {
|
|
40
|
-
var propertyName = _a.propertyName;
|
|
41
|
-
expect(propertyName).toBe("prop".concat(index));
|
|
42
|
-
});
|
|
43
|
-
expect(res.length).toBe(8);
|
|
44
|
-
expect(res[0].propertyType).toBe(constants_1.type.BOOL);
|
|
45
|
-
expect(res[1].propertyType).toBe(constants_1.type.INT);
|
|
46
|
-
expect(res[2].propertyType).toBe(constants_1.type.STRING);
|
|
47
|
-
expect(res[3].propertyType).toBe(constants_1.type.FLOAT);
|
|
48
|
-
expect(res[4].propertyType).toBe(constants_1.type.NULL);
|
|
49
|
-
expect(res[5].propertyType).toBe(constants_1.type.NULL);
|
|
50
|
-
expect(res[6].propertyType).toBe(constants_1.type.OBJECT);
|
|
51
|
-
expect(res[6].children).toMatchObject([
|
|
52
|
-
{
|
|
53
|
-
propertyName: "an",
|
|
54
|
-
propertyType: constants_1.type.STRING,
|
|
55
|
-
},
|
|
56
|
-
]);
|
|
57
|
-
expect(res[7].propertyType).toBe(constants_1.type.LIST);
|
|
58
|
-
expect(res[7].children).toMatchObject([
|
|
59
|
-
constants_1.type.STRING,
|
|
60
|
-
[
|
|
61
|
-
{
|
|
62
|
-
propertyName: "obj in list",
|
|
63
|
-
propertyType: constants_1.type.BOOL,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
propertyName: "int field",
|
|
67
|
-
propertyType: constants_1.type.INT,
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
[constants_1.type.STRING],
|
|
71
|
-
[constants_1.type.INT],
|
|
72
|
-
]);
|
|
73
|
-
});
|
|
74
15
|
test("Property types and names are set", function () {
|
|
75
16
|
// Given
|
|
76
17
|
var eventProperties = {
|
|
@@ -172,7 +172,7 @@ describe("Sessions", function () {
|
|
|
172
172
|
// Then
|
|
173
173
|
expect(sessionTracker.lastSessionTimestamp).toBe(0);
|
|
174
174
|
// When
|
|
175
|
-
AvoInspector_1.AvoInspector.avoStorage.storageImpl.init(true
|
|
175
|
+
AvoInspector_1.AvoInspector.avoStorage.storageImpl.init(true);
|
|
176
176
|
// Then
|
|
177
177
|
expect(sessionTracker.lastSessionTimestamp).toBe(callMoment);
|
|
178
178
|
});
|
package/dist-native/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { AvoInspector } from "./AvoInspector";
|
|
2
|
-
export { AvoInspectorEnv
|
|
2
|
+
export { AvoInspectorEnv } from "./AvoInspectorEnv";
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
preset: "ts-jest",
|
|
3
|
+
testEnvironment: "jsdom",
|
|
4
|
+
setupFiles: ["<rootDir>/src/__tests__/jest.setup.js"],
|
|
5
|
+
moduleNameMapper: {
|
|
6
|
+
"^react-native$": "<rootDir>/src/__tests__/jest.setup.js",
|
|
7
|
+
},
|
|
8
|
+
testMatch: [
|
|
9
|
+
"**/src/__tests__/**/*.ts",
|
|
10
|
+
"!**/src/__tests__/setup.ts",
|
|
11
|
+
"!**/src/__tests__/constants.ts",
|
|
12
|
+
],
|
|
13
|
+
testPathIgnorePatterns: [
|
|
14
|
+
"/node_modules/",
|
|
15
|
+
"/dist/",
|
|
16
|
+
"/examples/",
|
|
17
|
+
"/constants/",
|
|
18
|
+
],
|
|
19
|
+
transform: {
|
|
20
|
+
"^.+\\.(ts|tsx)$": "ts-jest",
|
|
21
|
+
},
|
|
22
|
+
transformIgnorePatterns: ["/node_modules/", "\\.d\\.ts$"],
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "avo-inspector",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.2.0-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc --emitDeclarationOnly && webpack --config webpack.config.js",
|
|
10
10
|
"build-for-script-tag": "tsc --outDir dist-browser --emitDeclarationOnly && webpack --config webpack.browserConfig.js",
|
|
11
|
-
"lint": "eslint",
|
|
11
|
+
"lint": "eslint ./src --ext .js,.ts",
|
|
12
12
|
"test": "jest",
|
|
13
13
|
"test:browser": "BROWSER=1 jest",
|
|
14
14
|
"typecheck": "tsc --noEmit",
|
|
@@ -18,26 +18,6 @@
|
|
|
18
18
|
"type": "git",
|
|
19
19
|
"url": "git+https://github.com/avohq/web-avo-inspector.git"
|
|
20
20
|
},
|
|
21
|
-
"jest": {
|
|
22
|
-
"testEnvironment": "jsdom",
|
|
23
|
-
"transform": {
|
|
24
|
-
"^.+\\.[j]sx?$": "babel-jest",
|
|
25
|
-
"^.+\\.[t]sx?$": "ts-jest"
|
|
26
|
-
},
|
|
27
|
-
"testPathIgnorePatterns": [
|
|
28
|
-
"constants",
|
|
29
|
-
"examples",
|
|
30
|
-
"node_modules",
|
|
31
|
-
"dist",
|
|
32
|
-
"dist-native"
|
|
33
|
-
],
|
|
34
|
-
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
|
|
35
|
-
"moduleFileExtensions": [
|
|
36
|
-
"ts",
|
|
37
|
-
"tsx",
|
|
38
|
-
"js"
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
21
|
"keywords": [
|
|
42
22
|
"web",
|
|
43
23
|
"analytics",
|
|
@@ -17,3 +17,8 @@ external make: options => t = "AvoInspector"
|
|
|
17
17
|
|
|
18
18
|
@send
|
|
19
19
|
external trackSchemaFromEvent: (t, string, Js.Json.t) => unit = "trackSchemaFromEvent"
|
|
20
|
+
|
|
21
|
+
let setNetworkTimeout = (timeout) => {
|
|
22
|
+
%raw(`require("avo-inspector").AvoInspector.networkTimeout = timeout`)
|
|
23
|
+
()
|
|
24
|
+
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type AvoNetworkCallsHandler } from "./AvoNetworkCallsHandler";
|
|
2
|
-
export interface AvoBatcherType {
|
|
3
|
-
handleSessionStarted: () => void;
|
|
4
|
-
handleTrackSchema: (eventName: string, schema: Array<{
|
|
5
|
-
propertyName: string;
|
|
6
|
-
propertyType: string;
|
|
7
|
-
children?: any;
|
|
8
|
-
}>, eventId: string | null, eventHash: string | null) => void;
|
|
9
|
-
}
|
|
10
|
-
export declare class AvoBatcher implements AvoBatcherType {
|
|
11
|
-
private events;
|
|
12
|
-
private batchFlushAttemptTimestamp;
|
|
13
|
-
private readonly networkCallsHandler;
|
|
14
|
-
constructor(networkCallsHandler: AvoNetworkCallsHandler);
|
|
15
|
-
handleSessionStarted(): void;
|
|
16
|
-
handleTrackSchema(eventName: string, schema: Array<{
|
|
17
|
-
propertyName: string;
|
|
18
|
-
propertyType: string;
|
|
19
|
-
children?: any;
|
|
20
|
-
}>, eventId: string | null, eventHash: string | null): void;
|
|
21
|
-
private checkIfBatchNeedsToBeSent;
|
|
22
|
-
private saveEvents;
|
|
23
|
-
static get cacheKey(): string;
|
|
24
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare class AvoDeduplicator {
|
|
2
|
-
avoFunctionsEvents: Record<number, string>;
|
|
3
|
-
manualEvents: Record<number, string>;
|
|
4
|
-
avoFunctionsEventsParams: Record<string, Record<string, any>>;
|
|
5
|
-
manualEventsParams: Record<string, Record<string, any>>;
|
|
6
|
-
shouldRegisterEvent(eventName: string, params: Record<string, any>, fromAvoFunction: boolean): boolean;
|
|
7
|
-
private hasSameEventAs;
|
|
8
|
-
private lookForEventIn;
|
|
9
|
-
hasSeenEventParams(params: Record<string, any>, checkInAvoFunctions: boolean): boolean;
|
|
10
|
-
private lookForEventParamsIn;
|
|
11
|
-
shouldRegisterSchemaFromManually(eventName: string, eventSchema: Array<{
|
|
12
|
-
propertyName: string;
|
|
13
|
-
propertyType: string;
|
|
14
|
-
children?: any;
|
|
15
|
-
}>): boolean;
|
|
16
|
-
private hasSameShapeInAvoFunctionsAs;
|
|
17
|
-
private lookForEventSchemaIn;
|
|
18
|
-
private clearOldEvents;
|
|
19
|
-
private _clearEvents;
|
|
20
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type AvoInspectorEnvValueType } from "./AvoInspectorEnv";
|
|
2
|
-
import { AvoSessionTracker } from "./AvoSessionTracker";
|
|
3
|
-
import { AvoBatcher } from "./AvoBatcher";
|
|
4
|
-
import { AvoStorage } from "./AvoStorage";
|
|
5
|
-
import { AvoDeduplicator } from "./AvoDeduplicator";
|
|
6
|
-
export declare class AvoInspector {
|
|
7
|
-
environment: AvoInspectorEnvValueType;
|
|
8
|
-
avoBatcher: AvoBatcher;
|
|
9
|
-
avoDeduplicator: AvoDeduplicator;
|
|
10
|
-
sessionTracker: AvoSessionTracker;
|
|
11
|
-
apiKey: string;
|
|
12
|
-
version: string;
|
|
13
|
-
static avoStorage: AvoStorage;
|
|
14
|
-
private static _batchSize;
|
|
15
|
-
static get batchSize(): number;
|
|
16
|
-
static set batchSize(newSize: number);
|
|
17
|
-
private static _batchFlushSeconds;
|
|
18
|
-
static get batchFlushSeconds(): number;
|
|
19
|
-
private static _shouldLog;
|
|
20
|
-
static get shouldLog(): boolean;
|
|
21
|
-
static set shouldLog(enable: boolean);
|
|
22
|
-
constructor(options: {
|
|
23
|
-
apiKey: string;
|
|
24
|
-
env: AvoInspectorEnvValueType;
|
|
25
|
-
version: string;
|
|
26
|
-
appName?: string;
|
|
27
|
-
suffix?: string;
|
|
28
|
-
});
|
|
29
|
-
trackSchemaFromEvent(eventName: string, eventProperties: Record<string, any>): Array<{
|
|
30
|
-
propertyName: string;
|
|
31
|
-
propertyType: string;
|
|
32
|
-
children?: any;
|
|
33
|
-
}>;
|
|
34
|
-
private _avoFunctionTrackSchemaFromEvent;
|
|
35
|
-
trackSchema(eventName: string, eventSchema: Array<{
|
|
36
|
-
propertyName: string;
|
|
37
|
-
propertyType: string;
|
|
38
|
-
children?: any;
|
|
39
|
-
}>): void;
|
|
40
|
-
private trackSchemaInternal;
|
|
41
|
-
enableLogging(enable: boolean): void;
|
|
42
|
-
extractSchema(eventProperties: Record<string, any>, shouldLogIfEnabled?: boolean): Array<{
|
|
43
|
-
propertyName: string;
|
|
44
|
-
propertyType: string;
|
|
45
|
-
children?: any;
|
|
46
|
-
}>;
|
|
47
|
-
setBatchSize(newBatchSize: number): void;
|
|
48
|
-
setBatchFlushSeconds(newBatchFlushSeconds: number): void;
|
|
49
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const AvoInspectorEnv: {
|
|
2
|
-
readonly Prod: "prod";
|
|
3
|
-
readonly Dev: "dev";
|
|
4
|
-
readonly Staging: "staging";
|
|
5
|
-
};
|
|
6
|
-
export type AvoInspectorEnvType = typeof AvoInspectorEnv;
|
|
7
|
-
export type AvoInspectorEnvValueType = AvoInspectorEnvType[keyof AvoInspectorEnvType];
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export interface BaseBody {
|
|
2
|
-
apiKey: string;
|
|
3
|
-
appName: string;
|
|
4
|
-
appVersion: string;
|
|
5
|
-
libVersion: string;
|
|
6
|
-
env: string;
|
|
7
|
-
libPlatform: "web";
|
|
8
|
-
messageId: string;
|
|
9
|
-
trackingId: string;
|
|
10
|
-
createdAt: string;
|
|
11
|
-
sessionId: string;
|
|
12
|
-
samplingRate: number;
|
|
13
|
-
}
|
|
14
|
-
export interface SessionStartedBody extends BaseBody {
|
|
15
|
-
type: "sessionStarted";
|
|
16
|
-
}
|
|
17
|
-
export interface EventSchemaBody extends BaseBody {
|
|
18
|
-
type: "event";
|
|
19
|
-
eventName: string;
|
|
20
|
-
eventProperties: Array<{
|
|
21
|
-
propertyName: string;
|
|
22
|
-
propertyType: string;
|
|
23
|
-
children?: any;
|
|
24
|
-
}>;
|
|
25
|
-
avoFunction: boolean;
|
|
26
|
-
eventId: string | null;
|
|
27
|
-
eventHash: string | null;
|
|
28
|
-
}
|
|
29
|
-
export declare class AvoNetworkCallsHandler {
|
|
30
|
-
private readonly apiKey;
|
|
31
|
-
private readonly envName;
|
|
32
|
-
private readonly appName;
|
|
33
|
-
private readonly appVersion;
|
|
34
|
-
private readonly libVersion;
|
|
35
|
-
private samplingRate;
|
|
36
|
-
private sending;
|
|
37
|
-
private static readonly trackingEndpoint;
|
|
38
|
-
constructor(apiKey: string, envName: string, appName: string, appVersion: string, libVersion: string);
|
|
39
|
-
callInspectorWithBatchBody(inEvents: Array<SessionStartedBody | EventSchemaBody>, onCompleted: (error: string | null) => any): void;
|
|
40
|
-
private fixSessionAndTrackingIds;
|
|
41
|
-
bodyForSessionStartedCall(): SessionStartedBody;
|
|
42
|
-
bodyForEventSchemaCall(eventName: string, eventProperties: Array<{
|
|
43
|
-
propertyName: string;
|
|
44
|
-
propertyType: string;
|
|
45
|
-
children?: any;
|
|
46
|
-
}>, eventId: string | null, eventHash: string | null): EventSchemaBody;
|
|
47
|
-
private createBaseCallBody;
|
|
48
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type AvoBatcherType } from "./AvoBatcher";
|
|
2
|
-
export declare class AvoSessionTracker {
|
|
3
|
-
private static _sessionId;
|
|
4
|
-
static get sessionId(): string;
|
|
5
|
-
private _lastSessionTimestamp;
|
|
6
|
-
get lastSessionTimestamp(): number;
|
|
7
|
-
private readonly _sessionLengthMillis;
|
|
8
|
-
get sessionLengthMillis(): number;
|
|
9
|
-
private readonly avoBatcher;
|
|
10
|
-
constructor(avoBatcher: AvoBatcherType);
|
|
11
|
-
startOrProlongSession(atTime: number): void;
|
|
12
|
-
private static updateSessionId;
|
|
13
|
-
static get lastSessionTimestampKey(): string;
|
|
14
|
-
static get idCacheKey(): string;
|
|
15
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
declare abstract class PlatformAvoStorage {
|
|
2
|
-
abstract init(shouldLog: boolean, suffix: string): void;
|
|
3
|
-
abstract getItemAsync<T>(key: string): Promise<T | null>;
|
|
4
|
-
abstract getItem<T>(key: string): T | null;
|
|
5
|
-
abstract setItem<T>(key: string, value: T): void;
|
|
6
|
-
abstract removeItem(key: string): void;
|
|
7
|
-
abstract runAfterInit(func: () => void): void;
|
|
8
|
-
abstract isInitialized(): boolean;
|
|
9
|
-
parseJson<T>(maybeItem: string | null | undefined): T | null;
|
|
10
|
-
}
|
|
11
|
-
export declare class AvoStorage {
|
|
12
|
-
Platform: string | null;
|
|
13
|
-
storageImpl: PlatformAvoStorage;
|
|
14
|
-
constructor(shouldLog: boolean, suffix?: string);
|
|
15
|
-
isInitialized(): boolean;
|
|
16
|
-
getItemAsync<T>(key: string): Promise<T | null>;
|
|
17
|
-
getItem<T>(key: string): T | null;
|
|
18
|
-
setItem<T>(key: string, value: T): void;
|
|
19
|
-
removeItem(key: string): void;
|
|
20
|
-
runAfterInit(func: () => void): void;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
|
-
declare const xhrMock: {
|
|
3
|
-
open: jest.Mock<any, any, any>;
|
|
4
|
-
send: jest.Mock<any, any, any>;
|
|
5
|
-
setRequestHeader: jest.Mock<any, any, any>;
|
|
6
|
-
onload: jest.Mock<any, any, any>;
|
|
7
|
-
onerror: jest.Mock<any, any, any>;
|
|
8
|
-
ontimeout: jest.Mock<any, any, any>;
|
|
9
|
-
status: number;
|
|
10
|
-
response: string;
|
|
11
|
-
};
|
|
12
|
-
export default xhrMock;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
|
-
declare const xhrErrorMock: {
|
|
3
|
-
open: jest.Mock<any, any, any>;
|
|
4
|
-
send: jest.Mock<any, any, any>;
|
|
5
|
-
setRequestHeader: jest.Mock<any, any, any>;
|
|
6
|
-
onload: jest.Mock<any, any, any>;
|
|
7
|
-
onerror: jest.Mock<any, any, any>;
|
|
8
|
-
ontimeout: jest.Mock<any, any, any>;
|
|
9
|
-
status: number;
|
|
10
|
-
statusText: string;
|
|
11
|
-
};
|
|
12
|
-
export default xhrErrorMock;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
declare const defaultOptions: {
|
|
2
|
-
apiKey: string;
|
|
3
|
-
env: "prod";
|
|
4
|
-
version: string;
|
|
5
|
-
shouldLog: boolean;
|
|
6
|
-
};
|
|
7
|
-
declare const error: {
|
|
8
|
-
API_KEY: string;
|
|
9
|
-
VERSION: string;
|
|
10
|
-
};
|
|
11
|
-
declare const mockedReturns: {
|
|
12
|
-
INSTALLATION_ID: string;
|
|
13
|
-
GUID: string;
|
|
14
|
-
SESSION_ID: string;
|
|
15
|
-
};
|
|
16
|
-
declare const networkCallType: {
|
|
17
|
-
EVENT: string;
|
|
18
|
-
SESSION_STARTED: string;
|
|
19
|
-
};
|
|
20
|
-
declare const requestMsg: {
|
|
21
|
-
ERROR: string;
|
|
22
|
-
TIMEOUT: string;
|
|
23
|
-
};
|
|
24
|
-
declare const trackingEndpoint = "https://api.avo.app/inspector/v1/track";
|
|
25
|
-
declare const sessionTimeMs: number;
|
|
26
|
-
declare const type: {
|
|
27
|
-
STRING: string;
|
|
28
|
-
INT: string;
|
|
29
|
-
OBJECT: string;
|
|
30
|
-
FLOAT: string;
|
|
31
|
-
LIST: string;
|
|
32
|
-
BOOL: string;
|
|
33
|
-
NULL: string;
|
|
34
|
-
UNKNOWN: string;
|
|
35
|
-
};
|
|
36
|
-
export { defaultOptions, error, mockedReturns, networkCallType, requestMsg, sessionTimeMs, type, trackingEndpoint };
|
package/dist-browser/index.d.ts
DELETED
package/dist-browser/utils.d.ts
DELETED