posthog-js 1.76.0 → 1.77.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/dist/array.full.js +2 -2
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +2 -2
- package/dist/array.js.map +1 -1
- package/dist/es.js +2 -2
- package/dist/es.js.map +1 -1
- package/dist/module.d.ts +38 -6
- package/dist/module.js +2 -2
- package/dist/module.js.map +1 -1
- package/lib/package.json +8 -6
- package/lib/src/autocapture-utils.d.ts +15 -0
- package/lib/src/autocapture-utils.js +303 -0
- package/lib/src/autocapture-utils.js.map +1 -0
- package/lib/src/autocapture.d.ts +27 -0
- package/lib/src/autocapture.js +290 -0
- package/lib/src/autocapture.js.map +1 -0
- package/lib/src/base-request-queue.d.ts +12 -0
- package/lib/src/base-request-queue.js +33 -0
- package/lib/src/base-request-queue.js.map +1 -0
- package/lib/src/compression.d.ts +3 -0
- package/lib/src/compression.js +35 -0
- package/lib/src/compression.js.map +1 -0
- package/lib/src/config.d.ts +5 -0
- package/lib/src/config.js +9 -0
- package/lib/src/config.js.map +1 -0
- package/lib/src/constants.d.ts +19 -0
- package/lib/src/constants.js +41 -0
- package/lib/src/constants.js.map +1 -0
- package/lib/src/decide.d.ts +8 -0
- package/lib/src/decide.js +118 -0
- package/lib/src/decide.js.map +1 -0
- package/lib/src/extensions/cloud.d.ts +1 -0
- package/lib/src/extensions/cloud.js +2 -0
- package/lib/src/extensions/cloud.js.map +1 -0
- package/lib/src/extensions/exceptions/error-conversion.d.ts +26 -0
- package/lib/src/extensions/exceptions/error-conversion.js +204 -0
- package/lib/src/extensions/exceptions/error-conversion.js.map +1 -0
- package/lib/src/extensions/exceptions/exception-autocapture.d.ts +24 -0
- package/lib/src/extensions/exceptions/exception-autocapture.js +164 -0
- package/lib/src/extensions/exceptions/exception-autocapture.js.map +1 -0
- package/lib/src/extensions/exceptions/stack-trace.d.ts +31 -0
- package/lib/src/extensions/exceptions/stack-trace.js +259 -0
- package/lib/src/extensions/exceptions/stack-trace.js.map +1 -0
- package/lib/src/extensions/exceptions/type-checking.d.ts +10 -0
- package/lib/src/extensions/exceptions/type-checking.js +43 -0
- package/lib/src/extensions/exceptions/type-checking.js.map +1 -0
- package/lib/src/extensions/rageclick.d.ts +10 -0
- package/lib/src/extensions/rageclick.js +33 -0
- package/lib/src/extensions/rageclick.js.map +1 -0
- package/lib/src/extensions/segment-integration.d.ts +44 -0
- package/lib/src/extensions/segment-integration.js +34 -0
- package/lib/src/extensions/segment-integration.js.map +1 -0
- package/lib/src/extensions/sentry-integration.d.ts +30 -0
- package/lib/src/extensions/sentry-integration.js +63 -0
- package/lib/src/extensions/sentry-integration.js.map +1 -0
- package/lib/src/extensions/sessionrecording-utils.d.ts +67 -0
- package/lib/src/extensions/sessionrecording-utils.js +192 -0
- package/lib/src/extensions/sessionrecording-utils.js.map +1 -0
- package/lib/src/extensions/sessionrecording.d.ts +45 -0
- package/lib/src/extensions/sessionrecording.js +430 -0
- package/lib/src/extensions/sessionrecording.js.map +1 -0
- package/lib/src/extensions/toolbar.d.ts +18 -0
- package/lib/src/extensions/toolbar.js +151 -0
- package/lib/src/extensions/toolbar.js.map +1 -0
- package/lib/src/extensions/web-performance.d.ts +20 -0
- package/lib/src/extensions/web-performance.js +245 -0
- package/lib/src/extensions/web-performance.js.map +1 -0
- package/lib/src/gdpr-utils.d.ts +80 -0
- package/lib/src/gdpr-utils.js +236 -0
- package/lib/src/gdpr-utils.js.map +1 -0
- package/lib/src/loader-globals-full.d.ts +1 -0
- package/lib/src/loader-globals-full.js +5 -0
- package/lib/src/loader-globals-full.js.map +1 -0
- package/lib/src/loader-globals.d.ts +1 -0
- package/lib/src/loader-globals.js +3 -0
- package/lib/src/loader-globals.js.map +1 -0
- package/lib/src/loader-module.d.ts +4 -0
- package/lib/src/loader-module.js +6 -0
- package/lib/src/loader-module.js.map +1 -0
- package/lib/src/loader-recorder-v2.d.ts +2 -0
- package/lib/src/loader-recorder-v2.js +15 -0
- package/lib/src/loader-recorder-v2.js.map +1 -0
- package/lib/src/loader-recorder.d.ts +2 -0
- package/lib/src/loader-recorder.js +15 -0
- package/lib/src/loader-recorder.js.map +1 -0
- package/lib/src/page-view.d.ts +38 -0
- package/lib/src/page-view.js +127 -0
- package/lib/src/page-view.js.map +1 -0
- package/lib/src/posthog-core.d.ts +701 -0
- package/lib/src/posthog-core.js +1916 -0
- package/lib/src/posthog-core.js.map +1 -0
- package/lib/src/posthog-featureflags.d.ts +70 -0
- package/lib/src/posthog-featureflags.js +438 -0
- package/lib/src/posthog-featureflags.js.map +1 -0
- package/lib/src/posthog-persistence.d.ts +57 -0
- package/lib/src/posthog-persistence.js +256 -0
- package/lib/src/posthog-persistence.js.map +1 -0
- package/lib/src/posthog-surveys.d.ts +57 -0
- package/lib/src/posthog-surveys.js +76 -0
- package/lib/src/posthog-surveys.js.map +1 -0
- package/lib/src/rate-limiter.d.ts +5 -0
- package/lib/src/rate-limiter.js +66 -0
- package/lib/src/rate-limiter.js.map +1 -0
- package/lib/src/request-queue.d.ts +10 -0
- package/lib/src/request-queue.js +146 -0
- package/lib/src/request-queue.js.map +1 -0
- package/lib/src/retry-queue.d.ts +28 -0
- package/lib/src/retry-queue.js +198 -0
- package/lib/src/retry-queue.js.map +1 -0
- package/lib/src/send-request.d.ts +6 -0
- package/lib/src/send-request.js +125 -0
- package/lib/src/send-request.js.map +1 -0
- package/lib/src/sessionid.d.ts +28 -0
- package/lib/src/sessionid.js +205 -0
- package/lib/src/sessionid.js.map +1 -0
- package/lib/src/storage.d.ts +7 -0
- package/lib/src/storage.js +291 -0
- package/lib/src/storage.js.map +1 -0
- package/lib/src/types.d.ts +294 -0
- package/lib/src/types.js +6 -0
- package/lib/src/types.js.map +1 -0
- package/lib/src/utils.d.ts +89 -0
- package/lib/src/utils.js +868 -0
- package/lib/src/utils.js.map +1 -0
- package/lib/src/uuidv7.d.ts +42 -0
- package/lib/src/uuidv7.js +228 -0
- package/lib/src/uuidv7.js.map +1 -0
- package/package.json +8 -6
- package/CHANGELOG.md +0 -1145
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/* eslint camelcase: "off" */
|
|
2
|
+
import { _each, _extend, _include, _info, _isObject, _isUndefined, _strip_empty_properties, logger } from './utils';
|
|
3
|
+
import { cookieStore, localStore, localPlusCookieStore, memoryStore, sessionStore } from './storage';
|
|
4
|
+
import { PERSISTENCE_RESERVED_PROPERTIES, EVENT_TIMERS_KEY, ENABLED_FEATURE_FLAGS, POSTHOG_QUOTA_LIMITED, USER_STATE, } from './constants';
|
|
5
|
+
var CASE_INSENSITIVE_PERSISTENCE_TYPES = [
|
|
6
|
+
'cookie',
|
|
7
|
+
'localstorage',
|
|
8
|
+
'localstorage+cookie',
|
|
9
|
+
'sessionstorage',
|
|
10
|
+
'memory',
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* PostHog Persistence Object
|
|
14
|
+
* @constructor
|
|
15
|
+
*/
|
|
16
|
+
var PostHogPersistence = /** @class */ (function () {
|
|
17
|
+
function PostHogPersistence(config) {
|
|
18
|
+
// clean chars that aren't accepted by the http spec for cookie values
|
|
19
|
+
// https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
|
|
20
|
+
var token = '';
|
|
21
|
+
if (config['token']) {
|
|
22
|
+
token = config['token'].replace(/\+/g, 'PL').replace(/\//g, 'SL').replace(/=/g, 'EQ');
|
|
23
|
+
}
|
|
24
|
+
this.props = {};
|
|
25
|
+
this.campaign_params_saved = false;
|
|
26
|
+
this.custom_campaign_params = config['custom_campaign_params'] || [];
|
|
27
|
+
if (config['persistence_name']) {
|
|
28
|
+
this.name = 'ph_' + config['persistence_name'];
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.name = 'ph_' + token + '_posthog';
|
|
32
|
+
}
|
|
33
|
+
if (CASE_INSENSITIVE_PERSISTENCE_TYPES.indexOf(config['persistence'].toLowerCase()) === -1) {
|
|
34
|
+
logger.critical('Unknown persistence type ' + config['persistence'] + '; falling back to cookie');
|
|
35
|
+
config['persistence'] = 'cookie';
|
|
36
|
+
}
|
|
37
|
+
// We handle storage type in a case-insensitive way for backwards compatibility
|
|
38
|
+
var storage_type = config['persistence'].toLowerCase();
|
|
39
|
+
if (storage_type === 'localstorage' && localStore.is_supported()) {
|
|
40
|
+
this.storage = localStore;
|
|
41
|
+
}
|
|
42
|
+
else if (storage_type === 'localstorage+cookie' && localPlusCookieStore.is_supported()) {
|
|
43
|
+
this.storage = localPlusCookieStore;
|
|
44
|
+
}
|
|
45
|
+
else if (storage_type === 'sessionstorage' && sessionStore.is_supported()) {
|
|
46
|
+
this.storage = sessionStore;
|
|
47
|
+
}
|
|
48
|
+
else if (storage_type === 'memory') {
|
|
49
|
+
this.storage = memoryStore;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.storage = cookieStore;
|
|
53
|
+
}
|
|
54
|
+
this.user_state = 'anonymous';
|
|
55
|
+
this.load();
|
|
56
|
+
this.update_config(config);
|
|
57
|
+
this.save();
|
|
58
|
+
}
|
|
59
|
+
PostHogPersistence.prototype.properties = function () {
|
|
60
|
+
var p = {};
|
|
61
|
+
// Filter out reserved properties
|
|
62
|
+
_each(this.props, function (v, k) {
|
|
63
|
+
if (k === ENABLED_FEATURE_FLAGS && typeof v === 'object') {
|
|
64
|
+
var keys = Object.keys(v);
|
|
65
|
+
for (var i = 0; i < keys.length; i++) {
|
|
66
|
+
p["$feature/".concat(keys[i])] = v[keys[i]];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (!_include(PERSISTENCE_RESERVED_PROPERTIES, k)) {
|
|
70
|
+
p[k] = v;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return p;
|
|
74
|
+
};
|
|
75
|
+
PostHogPersistence.prototype.load = function () {
|
|
76
|
+
if (this.disabled) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
var entry = this.storage.parse(this.name);
|
|
80
|
+
if (entry) {
|
|
81
|
+
this.props = _extend({}, entry);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* NOTE: Saving frequently causes issues with Recordings and Consent Management Platform (CMP) tools which
|
|
86
|
+
* observe cookie changes, and modify their UI, often causing infinite loops.
|
|
87
|
+
* As such callers of this should ideally check that the data has changed beforehand
|
|
88
|
+
*/
|
|
89
|
+
PostHogPersistence.prototype.save = function () {
|
|
90
|
+
if (this.disabled) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
this.storage.set(this.name, this.props, this.expire_days, this.cross_subdomain, this.secure);
|
|
94
|
+
};
|
|
95
|
+
PostHogPersistence.prototype.remove = function () {
|
|
96
|
+
// remove both domain and subdomain cookies
|
|
97
|
+
this.storage.remove(this.name, false);
|
|
98
|
+
this.storage.remove(this.name, true);
|
|
99
|
+
};
|
|
100
|
+
// removes the storage entry and deletes all loaded data
|
|
101
|
+
// forced name for tests
|
|
102
|
+
PostHogPersistence.prototype.clear = function () {
|
|
103
|
+
this.remove();
|
|
104
|
+
this.props = {};
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* @param {Object} props
|
|
108
|
+
* @param {*=} default_value
|
|
109
|
+
* @param {number=} days
|
|
110
|
+
*/
|
|
111
|
+
PostHogPersistence.prototype.register_once = function (props, default_value, days) {
|
|
112
|
+
var _this = this;
|
|
113
|
+
if (_isObject(props)) {
|
|
114
|
+
if (typeof default_value === 'undefined') {
|
|
115
|
+
default_value = 'None';
|
|
116
|
+
}
|
|
117
|
+
this.expire_days = typeof days === 'undefined' ? this.default_expiry : days;
|
|
118
|
+
var hasChanges_1 = false;
|
|
119
|
+
_each(props, function (val, prop) {
|
|
120
|
+
if (!_this.props.hasOwnProperty(prop) || _this.props[prop] === default_value) {
|
|
121
|
+
_this.props[prop] = val;
|
|
122
|
+
hasChanges_1 = true;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
if (hasChanges_1) {
|
|
126
|
+
this.save();
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return false;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* @param {Object} props
|
|
134
|
+
* @param {number=} days
|
|
135
|
+
*/
|
|
136
|
+
PostHogPersistence.prototype.register = function (props, days) {
|
|
137
|
+
var _this = this;
|
|
138
|
+
if (_isObject(props)) {
|
|
139
|
+
this.expire_days = typeof days === 'undefined' ? this.default_expiry : days;
|
|
140
|
+
var hasChanges_2 = false;
|
|
141
|
+
_each(props, function (val, prop) {
|
|
142
|
+
if (props.hasOwnProperty(prop) && _this.props[prop] !== val) {
|
|
143
|
+
_this.props[prop] = val;
|
|
144
|
+
hasChanges_2 = true;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
if (hasChanges_2) {
|
|
148
|
+
this.save();
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return false;
|
|
153
|
+
};
|
|
154
|
+
PostHogPersistence.prototype.unregister = function (prop) {
|
|
155
|
+
if (prop in this.props) {
|
|
156
|
+
delete this.props[prop];
|
|
157
|
+
this.save();
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
PostHogPersistence.prototype.update_campaign_params = function () {
|
|
161
|
+
if (!this.campaign_params_saved) {
|
|
162
|
+
this.register(_info.campaignParams(this.custom_campaign_params));
|
|
163
|
+
this.campaign_params_saved = true;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
PostHogPersistence.prototype.update_search_keyword = function () {
|
|
167
|
+
this.register(_info.searchInfo());
|
|
168
|
+
};
|
|
169
|
+
PostHogPersistence.prototype.update_referrer_info = function () {
|
|
170
|
+
this.register({
|
|
171
|
+
$referrer: this.props['$referrer'] || _info.referrer(),
|
|
172
|
+
$referring_domain: this.props['$referring_domain'] || _info.referringDomain(),
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
PostHogPersistence.prototype.get_referrer_info = function () {
|
|
176
|
+
return _strip_empty_properties({
|
|
177
|
+
$referrer: this['props']['$referrer'],
|
|
178
|
+
$referring_domain: this['props']['$referring_domain'],
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
// safely fills the passed in object with stored properties,
|
|
182
|
+
// does not override any properties defined in both
|
|
183
|
+
// returns the passed in object
|
|
184
|
+
PostHogPersistence.prototype.safe_merge = function (props) {
|
|
185
|
+
_each(this.props, function (val, prop) {
|
|
186
|
+
if (!(prop in props)) {
|
|
187
|
+
props[prop] = val;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
return props;
|
|
191
|
+
};
|
|
192
|
+
PostHogPersistence.prototype.update_config = function (config) {
|
|
193
|
+
this.default_expiry = this.expire_days = config['cookie_expiration'];
|
|
194
|
+
this.set_disabled(config['disable_persistence']);
|
|
195
|
+
this.set_cross_subdomain(config['cross_subdomain_cookie']);
|
|
196
|
+
this.set_secure(config['secure_cookie']);
|
|
197
|
+
};
|
|
198
|
+
PostHogPersistence.prototype.set_disabled = function (disabled) {
|
|
199
|
+
this.disabled = disabled;
|
|
200
|
+
if (this.disabled) {
|
|
201
|
+
this.remove();
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
this.save();
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
PostHogPersistence.prototype.set_cross_subdomain = function (cross_subdomain) {
|
|
208
|
+
if (cross_subdomain !== this.cross_subdomain) {
|
|
209
|
+
this.cross_subdomain = cross_subdomain;
|
|
210
|
+
this.remove();
|
|
211
|
+
this.save();
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
PostHogPersistence.prototype.get_cross_subdomain = function () {
|
|
215
|
+
return !!this.cross_subdomain;
|
|
216
|
+
};
|
|
217
|
+
PostHogPersistence.prototype.set_secure = function (secure) {
|
|
218
|
+
if (secure !== this.secure) {
|
|
219
|
+
this.secure = secure;
|
|
220
|
+
this.remove();
|
|
221
|
+
this.save();
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
PostHogPersistence.prototype.set_event_timer = function (event_name, timestamp) {
|
|
225
|
+
var timers = this.props[EVENT_TIMERS_KEY] || {};
|
|
226
|
+
timers[event_name] = timestamp;
|
|
227
|
+
this.props[EVENT_TIMERS_KEY] = timers;
|
|
228
|
+
this.save();
|
|
229
|
+
};
|
|
230
|
+
PostHogPersistence.prototype.remove_event_timer = function (event_name) {
|
|
231
|
+
var timers = this.props[EVENT_TIMERS_KEY] || {};
|
|
232
|
+
var timestamp = timers[event_name];
|
|
233
|
+
if (!_isUndefined(timestamp)) {
|
|
234
|
+
delete this.props[EVENT_TIMERS_KEY][event_name];
|
|
235
|
+
this.save();
|
|
236
|
+
}
|
|
237
|
+
return timestamp;
|
|
238
|
+
};
|
|
239
|
+
PostHogPersistence.prototype.get_user_state = function () {
|
|
240
|
+
return this.props[USER_STATE] || 'anonymous';
|
|
241
|
+
};
|
|
242
|
+
PostHogPersistence.prototype.set_user_state = function (state) {
|
|
243
|
+
this.props[USER_STATE] = state;
|
|
244
|
+
this.save();
|
|
245
|
+
};
|
|
246
|
+
PostHogPersistence.prototype.get_quota_limits = function () {
|
|
247
|
+
return this.props[POSTHOG_QUOTA_LIMITED] || {};
|
|
248
|
+
};
|
|
249
|
+
PostHogPersistence.prototype.set_quota_limits = function (state) {
|
|
250
|
+
this.props[POSTHOG_QUOTA_LIMITED] = state;
|
|
251
|
+
this.save();
|
|
252
|
+
};
|
|
253
|
+
return PostHogPersistence;
|
|
254
|
+
}());
|
|
255
|
+
export { PostHogPersistence };
|
|
256
|
+
//# sourceMappingURL=posthog-persistence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posthog-persistence.js","sourceRoot":"","sources":["../../src/posthog-persistence.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAE7B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,SAAS,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, _include, _info, _isObject, _isUndefined, _strip_empty_properties, logger } from './utils'\nimport { cookieStore, localStore, localPlusCookieStore, memoryStore, sessionStore } from './storage'\nimport { PersistentStore, PostHogConfig, Properties } from './types'\nimport {\n PERSISTENCE_RESERVED_PROPERTIES,\n EVENT_TIMERS_KEY,\n ENABLED_FEATURE_FLAGS,\n POSTHOG_QUOTA_LIMITED,\n USER_STATE,\n} from './constants'\n\nconst CASE_INSENSITIVE_PERSISTENCE_TYPES: readonly Lowercase<PostHogConfig['persistence']>[] = [\n 'cookie',\n 'localstorage',\n 'localstorage+cookie',\n 'sessionstorage',\n 'memory',\n]\n\n/**\n * PostHog Persistence Object\n * @constructor\n */\nexport class PostHogPersistence {\n props: Properties\n storage: PersistentStore\n campaign_params_saved: boolean\n custom_campaign_params: string[]\n name: string\n disabled: boolean | undefined\n secure: boolean | undefined\n expire_days: number | undefined\n default_expiry: number | undefined\n cross_subdomain: boolean | undefined\n user_state: 'anonymous' | 'identified'\n\n constructor(config: PostHogConfig) {\n // clean chars that aren't accepted by the http spec for cookie values\n // https://datatracker.ietf.org/doc/html/rfc2616#section-2.2\n let token = ''\n\n if (config['token']) {\n token = config['token'].replace(/\\+/g, 'PL').replace(/\\//g, 'SL').replace(/=/g, 'EQ')\n }\n\n this.props = {}\n this.campaign_params_saved = false\n this.custom_campaign_params = config['custom_campaign_params'] || []\n\n if (config['persistence_name']) {\n this.name = 'ph_' + config['persistence_name']\n } else {\n this.name = 'ph_' + token + '_posthog'\n }\n\n if (\n CASE_INSENSITIVE_PERSISTENCE_TYPES.indexOf(\n config['persistence'].toLowerCase() as Lowercase<PostHogConfig['persistence']>\n ) === -1\n ) {\n logger.critical('Unknown persistence type ' + config['persistence'] + '; falling back to cookie')\n config['persistence'] = 'cookie'\n }\n // We handle storage type in a case-insensitive way for backwards compatibility\n const storage_type = config['persistence'].toLowerCase() as Lowercase<PostHogConfig['persistence']>\n if (storage_type === 'localstorage' && localStore.is_supported()) {\n this.storage = localStore\n } else if (storage_type === 'localstorage+cookie' && localPlusCookieStore.is_supported()) {\n this.storage = localPlusCookieStore\n } else if (storage_type === 'sessionstorage' && sessionStore.is_supported()) {\n this.storage = sessionStore\n } else if (storage_type === 'memory') {\n this.storage = memoryStore\n } else {\n this.storage = cookieStore\n }\n\n this.user_state = 'anonymous'\n\n this.load()\n this.update_config(config)\n this.save()\n }\n\n properties(): Properties {\n const p: Properties = {}\n // Filter out reserved properties\n _each(this.props, function (v, k) {\n if (k === ENABLED_FEATURE_FLAGS && typeof v === 'object') {\n const keys = Object.keys(v)\n for (let i = 0; i < keys.length; i++) {\n p[`$feature/${keys[i]}`] = v[keys[i]]\n }\n } else if (!_include(PERSISTENCE_RESERVED_PROPERTIES, k)) {\n p[k] = v\n }\n })\n return p\n }\n\n load(): void {\n if (this.disabled) {\n return\n }\n\n const entry = this.storage.parse(this.name)\n\n if (entry) {\n this.props = _extend({}, entry)\n }\n }\n\n /**\n * NOTE: Saving frequently causes issues with Recordings and Consent Management Platform (CMP) tools which\n * observe cookie changes, and modify their UI, often causing infinite loops.\n * As such callers of this should ideally check that the data has changed beforehand\n */\n save(): void {\n if (this.disabled) {\n return\n }\n this.storage.set(this.name, this.props, this.expire_days, this.cross_subdomain, this.secure)\n }\n\n remove(): void {\n // remove both domain and subdomain cookies\n this.storage.remove(this.name, false)\n this.storage.remove(this.name, true)\n }\n\n // removes the storage entry and deletes all loaded data\n // forced name for tests\n\n clear(): void {\n this.remove()\n this.props = {}\n }\n\n /**\n * @param {Object} props\n * @param {*=} default_value\n * @param {number=} days\n */\n\n register_once(props: Properties, default_value: any, days?: number): boolean {\n if (_isObject(props)) {\n if (typeof default_value === 'undefined') {\n default_value = 'None'\n }\n this.expire_days = typeof days === 'undefined' ? this.default_expiry : days\n\n let hasChanges = false\n\n _each(props, (val, prop) => {\n if (!this.props.hasOwnProperty(prop) || this.props[prop] === default_value) {\n this.props[prop] = val\n hasChanges = true\n }\n })\n\n if (hasChanges) {\n this.save()\n return true\n }\n }\n return false\n }\n\n /**\n * @param {Object} props\n * @param {number=} days\n */\n\n register(props: Properties, days?: number): boolean {\n if (_isObject(props)) {\n this.expire_days = typeof days === 'undefined' ? this.default_expiry : days\n\n let hasChanges = false\n\n _each(props, (val, prop) => {\n if (props.hasOwnProperty(prop) && this.props[prop] !== val) {\n this.props[prop] = val\n hasChanges = true\n }\n })\n\n if (hasChanges) {\n this.save()\n return true\n }\n }\n return false\n }\n\n unregister(prop: string): void {\n if (prop in this.props) {\n delete this.props[prop]\n this.save()\n }\n }\n\n update_campaign_params(): void {\n if (!this.campaign_params_saved) {\n this.register(_info.campaignParams(this.custom_campaign_params))\n this.campaign_params_saved = true\n }\n }\n\n update_search_keyword(): void {\n this.register(_info.searchInfo())\n }\n\n update_referrer_info(): void {\n this.register({\n $referrer: this.props['$referrer'] || _info.referrer(),\n $referring_domain: this.props['$referring_domain'] || _info.referringDomain(),\n })\n }\n\n get_referrer_info(): Properties {\n return _strip_empty_properties({\n $referrer: this['props']['$referrer'],\n $referring_domain: this['props']['$referring_domain'],\n })\n }\n\n // safely fills the passed in object with stored properties,\n // does not override any properties defined in both\n // returns the passed in object\n\n safe_merge(props: Properties): Properties {\n _each(this.props, function (val, prop) {\n if (!(prop in props)) {\n props[prop] = val\n }\n })\n\n return props\n }\n\n update_config(config: PostHogConfig): void {\n this.default_expiry = this.expire_days = config['cookie_expiration']\n this.set_disabled(config['disable_persistence'])\n this.set_cross_subdomain(config['cross_subdomain_cookie'])\n this.set_secure(config['secure_cookie'])\n }\n\n set_disabled(disabled: boolean): void {\n this.disabled = disabled\n if (this.disabled) {\n this.remove()\n } else {\n this.save()\n }\n }\n\n set_cross_subdomain(cross_subdomain: boolean): void {\n if (cross_subdomain !== this.cross_subdomain) {\n this.cross_subdomain = cross_subdomain\n this.remove()\n this.save()\n }\n }\n\n get_cross_subdomain(): boolean {\n return !!this.cross_subdomain\n }\n\n set_secure(secure: boolean): void {\n if (secure !== this.secure) {\n this.secure = secure\n this.remove()\n this.save()\n }\n }\n\n set_event_timer(event_name: string, timestamp: number): void {\n const timers = this.props[EVENT_TIMERS_KEY] || {}\n timers[event_name] = timestamp\n this.props[EVENT_TIMERS_KEY] = timers\n this.save()\n }\n\n remove_event_timer(event_name: string): number {\n const timers = this.props[EVENT_TIMERS_KEY] || {}\n const timestamp = timers[event_name]\n if (!_isUndefined(timestamp)) {\n delete this.props[EVENT_TIMERS_KEY][event_name]\n this.save()\n }\n return timestamp\n }\n\n get_user_state(): 'anonymous' | 'identified' {\n return this.props[USER_STATE] || 'anonymous'\n }\n\n set_user_state(state: 'anonymous' | 'identified'): void {\n this.props[USER_STATE] = state\n this.save()\n }\n\n get_quota_limits(): Record<string, number> {\n return this.props[POSTHOG_QUOTA_LIMITED] || {}\n }\n\n set_quota_limits(state: Record<string, number>): void {\n this.props[POSTHOG_QUOTA_LIMITED] = state\n this.save()\n }\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { PostHog } from './posthog-core';
|
|
2
|
+
/**
|
|
3
|
+
* Having Survey types in types.ts was confusing tsc
|
|
4
|
+
* and generating an invalid module.d.ts
|
|
5
|
+
* See https://github.com/PostHog/posthog-js/issues/698
|
|
6
|
+
*/
|
|
7
|
+
export interface SurveyAppearance {
|
|
8
|
+
background_color?: string;
|
|
9
|
+
button_color?: string;
|
|
10
|
+
text_color?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare enum SurveyType {
|
|
13
|
+
Popover = "Popover",
|
|
14
|
+
Button = "Button",
|
|
15
|
+
Email = "Email",
|
|
16
|
+
FullScreen = "Fullscreen"
|
|
17
|
+
}
|
|
18
|
+
export interface SurveyQuestion {
|
|
19
|
+
type: SurveyQuestionType;
|
|
20
|
+
question: string;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
link?: boolean;
|
|
23
|
+
choices?: string[];
|
|
24
|
+
}
|
|
25
|
+
export declare enum SurveyQuestionType {
|
|
26
|
+
Open = "open",
|
|
27
|
+
MultipleChoiceSingle = "multiple_single",
|
|
28
|
+
MultipleChoiceMulti = "multiple_multi",
|
|
29
|
+
NPS = "nps",
|
|
30
|
+
Rating = "rating",
|
|
31
|
+
Link = "link"
|
|
32
|
+
}
|
|
33
|
+
export interface SurveyResponse {
|
|
34
|
+
surveys: Survey[];
|
|
35
|
+
}
|
|
36
|
+
export declare type SurveyCallback = (surveys: Survey[]) => void;
|
|
37
|
+
export interface Survey {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
type: SurveyType;
|
|
41
|
+
linked_flag_key?: string | null;
|
|
42
|
+
targeting_flag_key?: string | null;
|
|
43
|
+
questions: SurveyQuestion[];
|
|
44
|
+
appearance?: SurveyAppearance | null;
|
|
45
|
+
conditions?: {
|
|
46
|
+
url?: string;
|
|
47
|
+
selector?: string;
|
|
48
|
+
} | null;
|
|
49
|
+
start_date?: string | null;
|
|
50
|
+
end_date?: string | null;
|
|
51
|
+
}
|
|
52
|
+
export declare class PostHogSurveys {
|
|
53
|
+
instance: PostHog;
|
|
54
|
+
constructor(instance: PostHog);
|
|
55
|
+
getSurveys(callback: SurveyCallback, forceReload?: boolean): void;
|
|
56
|
+
getActiveMatchingSurveys(callback: SurveyCallback, forceReload?: boolean): void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { SURVEYS } from './constants';
|
|
2
|
+
export var SurveyType;
|
|
3
|
+
(function (SurveyType) {
|
|
4
|
+
SurveyType["Popover"] = "Popover";
|
|
5
|
+
SurveyType["Button"] = "Button";
|
|
6
|
+
SurveyType["Email"] = "Email";
|
|
7
|
+
SurveyType["FullScreen"] = "Fullscreen";
|
|
8
|
+
})(SurveyType || (SurveyType = {}));
|
|
9
|
+
export var SurveyQuestionType;
|
|
10
|
+
(function (SurveyQuestionType) {
|
|
11
|
+
SurveyQuestionType["Open"] = "open";
|
|
12
|
+
SurveyQuestionType["MultipleChoiceSingle"] = "multiple_single";
|
|
13
|
+
SurveyQuestionType["MultipleChoiceMulti"] = "multiple_multi";
|
|
14
|
+
SurveyQuestionType["NPS"] = "nps";
|
|
15
|
+
SurveyQuestionType["Rating"] = "rating";
|
|
16
|
+
SurveyQuestionType["Link"] = "link";
|
|
17
|
+
})(SurveyQuestionType || (SurveyQuestionType = {}));
|
|
18
|
+
var PostHogSurveys = /** @class */ (function () {
|
|
19
|
+
function PostHogSurveys(instance) {
|
|
20
|
+
this.instance = instance;
|
|
21
|
+
}
|
|
22
|
+
PostHogSurveys.prototype.getSurveys = function (callback, forceReload) {
|
|
23
|
+
var _this = this;
|
|
24
|
+
if (forceReload === void 0) { forceReload = false; }
|
|
25
|
+
var existingSurveys = this.instance.get_property(SURVEYS);
|
|
26
|
+
if (!existingSurveys || forceReload) {
|
|
27
|
+
this.instance._send_request("".concat(this.instance.get_config('api_host'), "/api/surveys/?token=").concat(this.instance.get_config('token')), {}, { method: 'GET' }, function (response) {
|
|
28
|
+
var _a;
|
|
29
|
+
var surveys = response.surveys;
|
|
30
|
+
_this.instance.persistence.register((_a = {}, _a[SURVEYS] = surveys, _a));
|
|
31
|
+
return callback(surveys);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return callback(existingSurveys);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
PostHogSurveys.prototype.getActiveMatchingSurveys = function (callback, forceReload) {
|
|
39
|
+
var _this = this;
|
|
40
|
+
if (forceReload === void 0) { forceReload = false; }
|
|
41
|
+
this.getSurveys(function (surveys) {
|
|
42
|
+
var activeSurveys = surveys.filter(function (survey) {
|
|
43
|
+
return !!(survey.start_date && !survey.end_date);
|
|
44
|
+
});
|
|
45
|
+
var conditionMatchedSurveys = activeSurveys.filter(function (survey) {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
if (!survey.conditions) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
var urlCheck = ((_a = survey.conditions) === null || _a === void 0 ? void 0 : _a.url)
|
|
51
|
+
? window.location.href.indexOf(survey.conditions.url) > -1
|
|
52
|
+
: true;
|
|
53
|
+
var selectorCheck = ((_b = survey.conditions) === null || _b === void 0 ? void 0 : _b.selector)
|
|
54
|
+
? document.querySelector(survey.conditions.selector)
|
|
55
|
+
: true;
|
|
56
|
+
return urlCheck && selectorCheck;
|
|
57
|
+
});
|
|
58
|
+
var targetingMatchedSurveys = conditionMatchedSurveys.filter(function (survey) {
|
|
59
|
+
if (!survey.linked_flag_key && !survey.targeting_flag_key) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
var linkedFlagCheck = survey.linked_flag_key
|
|
63
|
+
? _this.instance.featureFlags.isFeatureEnabled(survey.linked_flag_key)
|
|
64
|
+
: true;
|
|
65
|
+
var targetingFlagCheck = survey.targeting_flag_key
|
|
66
|
+
? _this.instance.featureFlags.isFeatureEnabled(survey.targeting_flag_key)
|
|
67
|
+
: true;
|
|
68
|
+
return linkedFlagCheck && targetingFlagCheck;
|
|
69
|
+
});
|
|
70
|
+
return callback(targetingMatchedSurveys);
|
|
71
|
+
}, forceReload);
|
|
72
|
+
};
|
|
73
|
+
return PostHogSurveys;
|
|
74
|
+
}());
|
|
75
|
+
export { PostHogSurveys };
|
|
76
|
+
//# sourceMappingURL=posthog-surveys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posthog-surveys.js","sourceRoot":"","sources":["../../src/posthog-surveys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAarC,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,iCAAmB,CAAA;IACnB,+BAAiB,CAAA;IACjB,6BAAe,CAAA;IACf,uCAAyB,CAAA;AAC7B,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB;AAUD,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC1B,mCAAa,CAAA;IACb,8DAAwC,CAAA;IACxC,4DAAsC,CAAA;IACtC,iCAAW,CAAA;IACX,u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AAC,CAAA;IACnB,CAAC;IACL,qBAAC;AAAD,CAAC,AA1DD,IA0DC","sourcesContent":["import { PostHog } from './posthog-core'\nimport { SURVEYS } from './constants'\n\n/**\n * Having Survey types in types.ts was confusing tsc\n * and generating an invalid module.d.ts\n * See https://github.com/PostHog/posthog-js/issues/698\n */\nexport interface SurveyAppearance {\n background_color?: string\n button_color?: string\n text_color?: string\n}\n\nexport enum SurveyType {\n Popover = 'Popover',\n Button = 'Button',\n Email = 'Email',\n FullScreen = 'Fullscreen',\n}\n\nexport interface SurveyQuestion {\n type: SurveyQuestionType\n question: string\n required?: boolean\n link?: boolean\n choices?: string[]\n}\n\nexport enum SurveyQuestionType {\n Open = 'open',\n MultipleChoiceSingle = 'multiple_single',\n MultipleChoiceMulti = 'multiple_multi',\n NPS = 'nps',\n Rating = 'rating',\n Link = 'link',\n}\n\nexport interface SurveyResponse {\n surveys: Survey[]\n}\n\nexport type SurveyCallback = (surveys: Survey[]) => void\n\nexport interface Survey {\n // Sync this with the backend's SurveySerializer!\n name: string\n description: string\n type: SurveyType\n linked_flag_key?: string | null\n targeting_flag_key?: string | null\n questions: SurveyQuestion[]\n appearance?: SurveyAppearance | null\n conditions?: { url?: string; selector?: string } | null\n start_date?: string | null\n end_date?: string | null\n}\n\nexport class PostHogSurveys {\n instance: PostHog\n\n constructor(instance: PostHog) {\n this.instance = instance\n }\n\n getSurveys(callback: SurveyCallback, forceReload = false) {\n const existingSurveys = this.instance.get_property(SURVEYS)\n if (!existingSurveys || forceReload) {\n this.instance._send_request(\n `${this.instance.get_config('api_host')}/api/surveys/?token=${this.instance.get_config('token')}`,\n {},\n { method: 'GET' },\n (response) => {\n const surveys = response.surveys\n this.instance.persistence.register({ [SURVEYS]: surveys })\n return callback(surveys)\n }\n )\n } else {\n return callback(existingSurveys)\n }\n }\n\n getActiveMatchingSurveys(callback: SurveyCallback, forceReload = false) {\n this.getSurveys((surveys) => {\n const activeSurveys = surveys.filter((survey) => {\n return !!(survey.start_date && !survey.end_date)\n })\n const conditionMatchedSurveys = activeSurveys.filter((survey) => {\n if (!survey.conditions) {\n return true\n }\n const urlCheck = survey.conditions?.url\n ? window.location.href.indexOf(survey.conditions.url) > -1\n : true\n const selectorCheck = survey.conditions?.selector\n ? document.querySelector(survey.conditions.selector)\n : true\n return urlCheck && selectorCheck\n })\n const targetingMatchedSurveys = conditionMatchedSurveys.filter((survey) => {\n if (!survey.linked_flag_key && !survey.targeting_flag_key) {\n return true\n }\n const linkedFlagCheck = survey.linked_flag_key\n ? this.instance.featureFlags.isFeatureEnabled(survey.linked_flag_key)\n : true\n const targetingFlagCheck = survey.targeting_flag_key\n ? this.instance.featureFlags.isFeatureEnabled(survey.targeting_flag_key)\n : true\n return linkedFlagCheck && targetingFlagCheck\n })\n\n return callback(targetingMatchedSurveys)\n }, forceReload)\n }\n}\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
+
}
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
16
|
+
};
|
|
17
|
+
import { SESSION_RECORDING_BATCH_KEY } from './extensions/sessionrecording';
|
|
18
|
+
/**
|
|
19
|
+
* Really a 429 response should have a `Retry-After` header which is either a date string,
|
|
20
|
+
* or the number of seconds to wait before retrying
|
|
21
|
+
*
|
|
22
|
+
* But we can rate limit endpoints differently, so send custom header per endpoint
|
|
23
|
+
* The endpoints are configurable, so we tie the headers/retries to specific batch keys
|
|
24
|
+
*
|
|
25
|
+
* And only support a number of seconds to wait before retrying
|
|
26
|
+
*/
|
|
27
|
+
var supportedRetryHeaders = {
|
|
28
|
+
'X-PostHog-Retry-After-Recordings': SESSION_RECORDING_BATCH_KEY,
|
|
29
|
+
'X-PostHog-Retry-After-Events': 'events',
|
|
30
|
+
};
|
|
31
|
+
var RateLimiter = /** @class */ (function () {
|
|
32
|
+
function RateLimiter() {
|
|
33
|
+
this.limits = {};
|
|
34
|
+
}
|
|
35
|
+
RateLimiter.prototype.isRateLimited = function (batchKey) {
|
|
36
|
+
var retryAfter = this.limits[batchKey || 'events'] || false;
|
|
37
|
+
if (retryAfter === false) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return new Date().getTime() < retryAfter;
|
|
41
|
+
};
|
|
42
|
+
RateLimiter.prototype.on429Response = function (response) {
|
|
43
|
+
var _this = this;
|
|
44
|
+
if (response.status !== 429) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
Object.entries(supportedRetryHeaders).forEach(function (_a) {
|
|
48
|
+
var _b = __read(_a, 2), header = _b[0], batchKey = _b[1];
|
|
49
|
+
var responseHeader = response.getResponseHeader(header);
|
|
50
|
+
if (!responseHeader) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
var retryAfterSeconds = parseInt(responseHeader, 10);
|
|
54
|
+
if (isNaN(retryAfterSeconds)) {
|
|
55
|
+
retryAfterSeconds = 60;
|
|
56
|
+
}
|
|
57
|
+
if (retryAfterSeconds) {
|
|
58
|
+
var retryAfterMillis = retryAfterSeconds * 1000;
|
|
59
|
+
_this.limits[batchKey] = new Date().getTime() + retryAfterMillis;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
return RateLimiter;
|
|
64
|
+
}());
|
|
65
|
+
export { RateLimiter };
|
|
66
|
+
//# sourceMappingURL=rate-limiter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-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,EAAE,CAAC,OAAO,EAAE,GAAG,gBAAgB,CAAA;aAClE;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IACL,kBAAC;AAAD,CAAC,AAlCD,IAkCC","sourcesContent":["import { SESSION_RECORDING_BATCH_KEY } from './extensions/sessionrecording'\n\n/**\n * Really a 429 response should have a `Retry-After` header which is either a date string,\n * or the number of seconds to wait before retrying\n *\n * But we can rate limit endpoints differently, so send custom header per endpoint\n * The endpoints are configurable, so we tie the headers/retries to specific batch keys\n *\n * And only support a number of seconds to wait before retrying\n */\nconst supportedRetryHeaders = {\n 'X-PostHog-Retry-After-Recordings': SESSION_RECORDING_BATCH_KEY,\n 'X-PostHog-Retry-After-Events': 'events',\n}\n\nexport class RateLimiter {\n limits: Record<string, number> = {}\n\n isRateLimited(batchKey: string | undefined): boolean {\n const retryAfter = this.limits[batchKey || 'events'] || false\n\n if (retryAfter === false) {\n return false\n }\n return new Date().getTime() < retryAfter\n }\n\n on429Response(response: XMLHttpRequest): void {\n if (response.status !== 429) {\n return\n }\n\n Object.entries(supportedRetryHeaders).forEach(([header, batchKey]) => {\n const responseHeader = response.getResponseHeader(header)\n if (!responseHeader) {\n return\n }\n\n let retryAfterSeconds = parseInt(responseHeader, 10)\n if (isNaN(retryAfterSeconds)) {\n retryAfterSeconds = 60\n }\n\n if (retryAfterSeconds) {\n const retryAfterMillis = retryAfterSeconds * 1000\n this.limits[batchKey] = new Date().getTime() + retryAfterMillis\n }\n })\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RequestQueueScaffold } from './base-request-queue';
|
|
2
|
+
import { Properties, QueuedRequestData, XHROptions } from './types';
|
|
3
|
+
export declare class RequestQueue extends RequestQueueScaffold {
|
|
4
|
+
handlePollRequest: (url: string, data: Properties, options?: XHROptions) => void;
|
|
5
|
+
constructor(handlePollRequest: (url: string, data: Properties, options?: XHROptions) => void, pollInterval?: number);
|
|
6
|
+
enqueue(url: string, data: Properties, options: XHROptions): void;
|
|
7
|
+
poll(): void;
|
|
8
|
+
unload(): void;
|
|
9
|
+
formatQueue(): Record<string, QueuedRequestData>;
|
|
10
|
+
}
|