@appwrite.io/console 18.2.0 → 18.3.0-rc.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/README.md +2 -2
- package/dist/cjs/sdk.js +1092 -44
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1091 -45
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +1092 -44
- package/package.json +1 -1
- package/types/enums/analytics-dimension.d.ts +24 -0
- package/types/enums/analytics-interval.d.ts +6 -0
- package/types/enums/project-key-scopes.d.ts +3 -1
- package/types/enums/proxy-rule-deployment-resource-type.d.ts +2 -1
- package/types/enums/query-suggestion-resource.d.ts +1 -0
- package/types/enums/usage-event-metric.d.ts +3 -0
- package/types/enums/usage-gauge-metric.d.ts +1 -0
- package/types/index.d.ts +5 -0
- package/types/models.d.ts +141 -13
- package/types/services/analytics-tracking.d.ts +211 -0
- package/types/services/analytics.d.ts +254 -0
- package/types/services/push.d.ts +2 -2
- package/types/service.d.ts +0 -11
package/dist/iife/sdk.js
CHANGED
|
@@ -4467,7 +4467,7 @@
|
|
|
4467
4467
|
'x-sdk-name': 'Console',
|
|
4468
4468
|
'x-sdk-platform': 'console',
|
|
4469
4469
|
'x-sdk-language': 'web',
|
|
4470
|
-
'x-sdk-version': '18.
|
|
4470
|
+
'x-sdk-version': '18.3.0-rc.1',
|
|
4471
4471
|
'X-Appwrite-Response-Format': '2.3.0',
|
|
4472
4472
|
};
|
|
4473
4473
|
this.realtime = {
|
|
@@ -5320,29 +5320,6 @@
|
|
|
5320
5320
|
}
|
|
5321
5321
|
Client.CHUNK_SIZE = 1024 * 1024 * 5;
|
|
5322
5322
|
|
|
5323
|
-
class Service {
|
|
5324
|
-
constructor(client) {
|
|
5325
|
-
this.client = client;
|
|
5326
|
-
}
|
|
5327
|
-
static flatten(data, prefix = '') {
|
|
5328
|
-
let output = {};
|
|
5329
|
-
for (const [key, value] of Object.entries(data)) {
|
|
5330
|
-
const finalKey = prefix ? prefix + '[' + key + ']' : key;
|
|
5331
|
-
if (Array.isArray(value)) {
|
|
5332
|
-
output = Object.assign(Object.assign({}, output), Service.flatten(value, finalKey));
|
|
5333
|
-
}
|
|
5334
|
-
else {
|
|
5335
|
-
output[finalKey] = value;
|
|
5336
|
-
}
|
|
5337
|
-
}
|
|
5338
|
-
return output;
|
|
5339
|
-
}
|
|
5340
|
-
}
|
|
5341
|
-
/**
|
|
5342
|
-
* The size for chunked uploads in bytes.
|
|
5343
|
-
*/
|
|
5344
|
-
Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
|
|
5345
|
-
|
|
5346
5323
|
class Account {
|
|
5347
5324
|
constructor(client) {
|
|
5348
5325
|
this.client = client;
|
|
@@ -7404,7 +7381,7 @@
|
|
|
7404
7381
|
}
|
|
7405
7382
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
7406
7383
|
apiPayload['project'] = this.client.config.project;
|
|
7407
|
-
for (const [key, value] of Object.entries(
|
|
7384
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
7408
7385
|
uri.searchParams.append(key, value);
|
|
7409
7386
|
}
|
|
7410
7387
|
if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
|
|
@@ -7813,7 +7790,7 @@
|
|
|
7813
7790
|
}
|
|
7814
7791
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
7815
7792
|
apiPayload['project'] = this.client.config.project;
|
|
7816
|
-
for (const [key, value] of Object.entries(
|
|
7793
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
7817
7794
|
uri.searchParams.append(key, value);
|
|
7818
7795
|
}
|
|
7819
7796
|
if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
|
|
@@ -8381,6 +8358,369 @@
|
|
|
8381
8358
|
}
|
|
8382
8359
|
}
|
|
8383
8360
|
|
|
8361
|
+
class Analytics {
|
|
8362
|
+
constructor(client) {
|
|
8363
|
+
this.client = client;
|
|
8364
|
+
}
|
|
8365
|
+
listProperties(paramsOrFirst, ...rest) {
|
|
8366
|
+
let params;
|
|
8367
|
+
if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
|
|
8368
|
+
(paramsOrFirst &&
|
|
8369
|
+
typeof paramsOrFirst === 'object' &&
|
|
8370
|
+
!Array.isArray(paramsOrFirst))) {
|
|
8371
|
+
params = (paramsOrFirst || {});
|
|
8372
|
+
}
|
|
8373
|
+
else {
|
|
8374
|
+
params = {
|
|
8375
|
+
queries: paramsOrFirst,
|
|
8376
|
+
search: rest[0],
|
|
8377
|
+
total: rest[1],
|
|
8378
|
+
};
|
|
8379
|
+
}
|
|
8380
|
+
const queries = params.queries;
|
|
8381
|
+
const search = params.search;
|
|
8382
|
+
const total = params.total;
|
|
8383
|
+
const apiPath = '/analytics/properties';
|
|
8384
|
+
const apiPayload = {};
|
|
8385
|
+
if (typeof queries !== 'undefined') {
|
|
8386
|
+
apiPayload['queries'] = queries;
|
|
8387
|
+
}
|
|
8388
|
+
if (typeof search !== 'undefined') {
|
|
8389
|
+
apiPayload['search'] = search;
|
|
8390
|
+
}
|
|
8391
|
+
if (typeof total !== 'undefined') {
|
|
8392
|
+
apiPayload['total'] = total;
|
|
8393
|
+
}
|
|
8394
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
8395
|
+
const apiHeaders = {
|
|
8396
|
+
'X-Appwrite-Project': this.client.config.project,
|
|
8397
|
+
accept: 'application/json',
|
|
8398
|
+
};
|
|
8399
|
+
return this.client.call('get', uri, apiHeaders, apiPayload);
|
|
8400
|
+
}
|
|
8401
|
+
createProperty(paramsOrFirst, ...rest) {
|
|
8402
|
+
let params;
|
|
8403
|
+
if (paramsOrFirst &&
|
|
8404
|
+
typeof paramsOrFirst === 'object' &&
|
|
8405
|
+
!Array.isArray(paramsOrFirst)) {
|
|
8406
|
+
params = (paramsOrFirst || {});
|
|
8407
|
+
}
|
|
8408
|
+
else {
|
|
8409
|
+
params = {
|
|
8410
|
+
propertyId: paramsOrFirst,
|
|
8411
|
+
name: rest[0],
|
|
8412
|
+
domain: rest[1],
|
|
8413
|
+
timezone: rest[2],
|
|
8414
|
+
enabled: rest[3],
|
|
8415
|
+
xpublic: rest[4],
|
|
8416
|
+
allowedOrigins: rest[5],
|
|
8417
|
+
};
|
|
8418
|
+
}
|
|
8419
|
+
const propertyId = params.propertyId;
|
|
8420
|
+
const name = params.name;
|
|
8421
|
+
const domain = params.domain;
|
|
8422
|
+
const timezone = params.timezone;
|
|
8423
|
+
const enabled = params.enabled;
|
|
8424
|
+
const xpublic = params.xpublic;
|
|
8425
|
+
const allowedOrigins = params.allowedOrigins;
|
|
8426
|
+
if (typeof propertyId === 'undefined') {
|
|
8427
|
+
throw new AppwriteException('Missing required parameter: "propertyId"');
|
|
8428
|
+
}
|
|
8429
|
+
if (typeof name === 'undefined') {
|
|
8430
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
8431
|
+
}
|
|
8432
|
+
const apiPath = '/analytics/properties';
|
|
8433
|
+
const apiPayload = {};
|
|
8434
|
+
if (typeof propertyId !== 'undefined') {
|
|
8435
|
+
apiPayload['propertyId'] = propertyId;
|
|
8436
|
+
}
|
|
8437
|
+
if (typeof name !== 'undefined') {
|
|
8438
|
+
apiPayload['name'] = name;
|
|
8439
|
+
}
|
|
8440
|
+
if (typeof domain !== 'undefined') {
|
|
8441
|
+
apiPayload['domain'] = domain;
|
|
8442
|
+
}
|
|
8443
|
+
if (typeof timezone !== 'undefined') {
|
|
8444
|
+
apiPayload['timezone'] = timezone;
|
|
8445
|
+
}
|
|
8446
|
+
if (typeof enabled !== 'undefined') {
|
|
8447
|
+
apiPayload['enabled'] = enabled;
|
|
8448
|
+
}
|
|
8449
|
+
if (typeof xpublic !== 'undefined') {
|
|
8450
|
+
apiPayload['public'] = xpublic;
|
|
8451
|
+
}
|
|
8452
|
+
if (typeof allowedOrigins !== 'undefined') {
|
|
8453
|
+
apiPayload['allowedOrigins'] = allowedOrigins;
|
|
8454
|
+
}
|
|
8455
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
8456
|
+
const apiHeaders = {
|
|
8457
|
+
'X-Appwrite-Project': this.client.config.project,
|
|
8458
|
+
'content-type': 'application/json',
|
|
8459
|
+
accept: 'application/json',
|
|
8460
|
+
};
|
|
8461
|
+
return this.client.call('post', uri, apiHeaders, apiPayload);
|
|
8462
|
+
}
|
|
8463
|
+
getProperty(paramsOrFirst) {
|
|
8464
|
+
let params;
|
|
8465
|
+
if (paramsOrFirst &&
|
|
8466
|
+
typeof paramsOrFirst === 'object' &&
|
|
8467
|
+
!Array.isArray(paramsOrFirst)) {
|
|
8468
|
+
params = (paramsOrFirst || {});
|
|
8469
|
+
}
|
|
8470
|
+
else {
|
|
8471
|
+
params = {
|
|
8472
|
+
propertyId: paramsOrFirst,
|
|
8473
|
+
};
|
|
8474
|
+
}
|
|
8475
|
+
const propertyId = params.propertyId;
|
|
8476
|
+
if (typeof propertyId === 'undefined' || propertyId === '') {
|
|
8477
|
+
throw new AppwriteException('Missing required parameter: "propertyId"');
|
|
8478
|
+
}
|
|
8479
|
+
const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
|
|
8480
|
+
const apiPayload = {};
|
|
8481
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
8482
|
+
const apiHeaders = {
|
|
8483
|
+
'X-Appwrite-Project': this.client.config.project,
|
|
8484
|
+
accept: 'application/json',
|
|
8485
|
+
};
|
|
8486
|
+
return this.client.call('get', uri, apiHeaders, apiPayload);
|
|
8487
|
+
}
|
|
8488
|
+
updateProperty(paramsOrFirst, ...rest) {
|
|
8489
|
+
let params;
|
|
8490
|
+
if (paramsOrFirst &&
|
|
8491
|
+
typeof paramsOrFirst === 'object' &&
|
|
8492
|
+
!Array.isArray(paramsOrFirst)) {
|
|
8493
|
+
params = (paramsOrFirst || {});
|
|
8494
|
+
}
|
|
8495
|
+
else {
|
|
8496
|
+
params = {
|
|
8497
|
+
propertyId: paramsOrFirst,
|
|
8498
|
+
name: rest[0],
|
|
8499
|
+
domain: rest[1],
|
|
8500
|
+
timezone: rest[2],
|
|
8501
|
+
enabled: rest[3],
|
|
8502
|
+
xpublic: rest[4],
|
|
8503
|
+
allowedOrigins: rest[5],
|
|
8504
|
+
};
|
|
8505
|
+
}
|
|
8506
|
+
const propertyId = params.propertyId;
|
|
8507
|
+
const name = params.name;
|
|
8508
|
+
const domain = params.domain;
|
|
8509
|
+
const timezone = params.timezone;
|
|
8510
|
+
const enabled = params.enabled;
|
|
8511
|
+
const xpublic = params.xpublic;
|
|
8512
|
+
const allowedOrigins = params.allowedOrigins;
|
|
8513
|
+
if (typeof propertyId === 'undefined' || propertyId === '') {
|
|
8514
|
+
throw new AppwriteException('Missing required parameter: "propertyId"');
|
|
8515
|
+
}
|
|
8516
|
+
const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
|
|
8517
|
+
const apiPayload = {};
|
|
8518
|
+
if (typeof name !== 'undefined') {
|
|
8519
|
+
apiPayload['name'] = name;
|
|
8520
|
+
}
|
|
8521
|
+
if (typeof domain !== 'undefined') {
|
|
8522
|
+
apiPayload['domain'] = domain;
|
|
8523
|
+
}
|
|
8524
|
+
if (typeof timezone !== 'undefined') {
|
|
8525
|
+
apiPayload['timezone'] = timezone;
|
|
8526
|
+
}
|
|
8527
|
+
if (typeof enabled !== 'undefined') {
|
|
8528
|
+
apiPayload['enabled'] = enabled;
|
|
8529
|
+
}
|
|
8530
|
+
if (typeof xpublic !== 'undefined') {
|
|
8531
|
+
apiPayload['public'] = xpublic;
|
|
8532
|
+
}
|
|
8533
|
+
if (typeof allowedOrigins !== 'undefined') {
|
|
8534
|
+
apiPayload['allowedOrigins'] = allowedOrigins;
|
|
8535
|
+
}
|
|
8536
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
8537
|
+
const apiHeaders = {
|
|
8538
|
+
'X-Appwrite-Project': this.client.config.project,
|
|
8539
|
+
'content-type': 'application/json',
|
|
8540
|
+
accept: 'application/json',
|
|
8541
|
+
};
|
|
8542
|
+
return this.client.call('patch', uri, apiHeaders, apiPayload);
|
|
8543
|
+
}
|
|
8544
|
+
deleteProperty(paramsOrFirst) {
|
|
8545
|
+
let params;
|
|
8546
|
+
if (paramsOrFirst &&
|
|
8547
|
+
typeof paramsOrFirst === 'object' &&
|
|
8548
|
+
!Array.isArray(paramsOrFirst)) {
|
|
8549
|
+
params = (paramsOrFirst || {});
|
|
8550
|
+
}
|
|
8551
|
+
else {
|
|
8552
|
+
params = {
|
|
8553
|
+
propertyId: paramsOrFirst,
|
|
8554
|
+
};
|
|
8555
|
+
}
|
|
8556
|
+
const propertyId = params.propertyId;
|
|
8557
|
+
if (typeof propertyId === 'undefined' || propertyId === '') {
|
|
8558
|
+
throw new AppwriteException('Missing required parameter: "propertyId"');
|
|
8559
|
+
}
|
|
8560
|
+
const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
|
|
8561
|
+
const apiPayload = {};
|
|
8562
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
8563
|
+
const apiHeaders = {
|
|
8564
|
+
'X-Appwrite-Project': this.client.config.project,
|
|
8565
|
+
'content-type': 'application/json',
|
|
8566
|
+
accept: 'application/json',
|
|
8567
|
+
};
|
|
8568
|
+
return this.client.call('delete', uri, apiHeaders, apiPayload);
|
|
8569
|
+
}
|
|
8570
|
+
createEvent(paramsOrFirst, ...rest) {
|
|
8571
|
+
let params;
|
|
8572
|
+
if (paramsOrFirst &&
|
|
8573
|
+
typeof paramsOrFirst === 'object' &&
|
|
8574
|
+
!Array.isArray(paramsOrFirst)) {
|
|
8575
|
+
params = (paramsOrFirst || {});
|
|
8576
|
+
}
|
|
8577
|
+
else {
|
|
8578
|
+
params = {
|
|
8579
|
+
propertyId: paramsOrFirst,
|
|
8580
|
+
name: rest[0],
|
|
8581
|
+
url: rest[1],
|
|
8582
|
+
domain: rest[2],
|
|
8583
|
+
referrer: rest[3],
|
|
8584
|
+
screenWidth: rest[4],
|
|
8585
|
+
sessionHash: rest[5],
|
|
8586
|
+
scrollDepth: rest[6],
|
|
8587
|
+
engagementTime: rest[7],
|
|
8588
|
+
props: rest[8],
|
|
8589
|
+
userId: rest[9],
|
|
8590
|
+
ip: rest[10],
|
|
8591
|
+
userAgent: rest[11],
|
|
8592
|
+
};
|
|
8593
|
+
}
|
|
8594
|
+
const propertyId = params.propertyId;
|
|
8595
|
+
const name = params.name;
|
|
8596
|
+
const url = params.url;
|
|
8597
|
+
const domain = params.domain;
|
|
8598
|
+
const referrer = params.referrer;
|
|
8599
|
+
const screenWidth = params.screenWidth;
|
|
8600
|
+
const sessionHash = params.sessionHash;
|
|
8601
|
+
const scrollDepth = params.scrollDepth;
|
|
8602
|
+
const engagementTime = params.engagementTime;
|
|
8603
|
+
const props = params.props;
|
|
8604
|
+
const userId = params.userId;
|
|
8605
|
+
const ip = params.ip;
|
|
8606
|
+
const userAgent = params.userAgent;
|
|
8607
|
+
if (typeof propertyId === 'undefined' || propertyId === '') {
|
|
8608
|
+
throw new AppwriteException('Missing required parameter: "propertyId"');
|
|
8609
|
+
}
|
|
8610
|
+
if (typeof name === 'undefined') {
|
|
8611
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
8612
|
+
}
|
|
8613
|
+
if (typeof url === 'undefined') {
|
|
8614
|
+
throw new AppwriteException('Missing required parameter: "url"');
|
|
8615
|
+
}
|
|
8616
|
+
const apiPath = '/analytics/properties/{propertyId}/events'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
|
|
8617
|
+
const apiPayload = {};
|
|
8618
|
+
if (typeof name !== 'undefined') {
|
|
8619
|
+
apiPayload['name'] = name;
|
|
8620
|
+
}
|
|
8621
|
+
if (typeof url !== 'undefined') {
|
|
8622
|
+
apiPayload['url'] = url;
|
|
8623
|
+
}
|
|
8624
|
+
if (typeof domain !== 'undefined') {
|
|
8625
|
+
apiPayload['domain'] = domain;
|
|
8626
|
+
}
|
|
8627
|
+
if (typeof referrer !== 'undefined') {
|
|
8628
|
+
apiPayload['referrer'] = referrer;
|
|
8629
|
+
}
|
|
8630
|
+
if (typeof screenWidth !== 'undefined') {
|
|
8631
|
+
apiPayload['screenWidth'] = screenWidth;
|
|
8632
|
+
}
|
|
8633
|
+
if (typeof sessionHash !== 'undefined') {
|
|
8634
|
+
apiPayload['sessionHash'] = sessionHash;
|
|
8635
|
+
}
|
|
8636
|
+
if (typeof scrollDepth !== 'undefined') {
|
|
8637
|
+
apiPayload['scrollDepth'] = scrollDepth;
|
|
8638
|
+
}
|
|
8639
|
+
if (typeof engagementTime !== 'undefined') {
|
|
8640
|
+
apiPayload['engagementTime'] = engagementTime;
|
|
8641
|
+
}
|
|
8642
|
+
if (typeof props !== 'undefined') {
|
|
8643
|
+
apiPayload['props'] = props;
|
|
8644
|
+
}
|
|
8645
|
+
if (typeof userId !== 'undefined') {
|
|
8646
|
+
apiPayload['userId'] = userId;
|
|
8647
|
+
}
|
|
8648
|
+
if (typeof ip !== 'undefined') {
|
|
8649
|
+
apiPayload['ip'] = ip;
|
|
8650
|
+
}
|
|
8651
|
+
if (typeof userAgent !== 'undefined') {
|
|
8652
|
+
apiPayload['userAgent'] = userAgent;
|
|
8653
|
+
}
|
|
8654
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
8655
|
+
const apiHeaders = {
|
|
8656
|
+
'X-Appwrite-Project': this.client.config.project,
|
|
8657
|
+
'content-type': 'application/json',
|
|
8658
|
+
accept: 'application/json',
|
|
8659
|
+
};
|
|
8660
|
+
return this.client.call('post', uri, apiHeaders, apiPayload);
|
|
8661
|
+
}
|
|
8662
|
+
listMetrics(paramsOrFirst, ...rest) {
|
|
8663
|
+
let params;
|
|
8664
|
+
if (paramsOrFirst &&
|
|
8665
|
+
typeof paramsOrFirst === 'object' &&
|
|
8666
|
+
!Array.isArray(paramsOrFirst)) {
|
|
8667
|
+
params = (paramsOrFirst || {});
|
|
8668
|
+
}
|
|
8669
|
+
else {
|
|
8670
|
+
params = {
|
|
8671
|
+
propertyId: paramsOrFirst,
|
|
8672
|
+
queries: rest[0],
|
|
8673
|
+
interval: rest[1],
|
|
8674
|
+
dimensions: rest[2],
|
|
8675
|
+
dateRange: rest[3],
|
|
8676
|
+
startAt: rest[4],
|
|
8677
|
+
endAt: rest[5],
|
|
8678
|
+
limit: rest[6],
|
|
8679
|
+
};
|
|
8680
|
+
}
|
|
8681
|
+
const propertyId = params.propertyId;
|
|
8682
|
+
const queries = params.queries;
|
|
8683
|
+
const interval = params.interval;
|
|
8684
|
+
const dimensions = params.dimensions;
|
|
8685
|
+
const dateRange = params.dateRange;
|
|
8686
|
+
const startAt = params.startAt;
|
|
8687
|
+
const endAt = params.endAt;
|
|
8688
|
+
const limit = params.limit;
|
|
8689
|
+
if (typeof propertyId === 'undefined' || propertyId === '') {
|
|
8690
|
+
throw new AppwriteException('Missing required parameter: "propertyId"');
|
|
8691
|
+
}
|
|
8692
|
+
const apiPath = '/analytics/properties/{propertyId}/metrics'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
|
|
8693
|
+
const apiPayload = {};
|
|
8694
|
+
if (typeof queries !== 'undefined') {
|
|
8695
|
+
apiPayload['queries'] = queries;
|
|
8696
|
+
}
|
|
8697
|
+
if (typeof interval !== 'undefined') {
|
|
8698
|
+
apiPayload['interval'] = interval;
|
|
8699
|
+
}
|
|
8700
|
+
if (typeof dimensions !== 'undefined') {
|
|
8701
|
+
apiPayload['dimensions'] = dimensions;
|
|
8702
|
+
}
|
|
8703
|
+
if (typeof dateRange !== 'undefined') {
|
|
8704
|
+
apiPayload['dateRange'] = dateRange;
|
|
8705
|
+
}
|
|
8706
|
+
if (typeof startAt !== 'undefined') {
|
|
8707
|
+
apiPayload['startAt'] = startAt;
|
|
8708
|
+
}
|
|
8709
|
+
if (typeof endAt !== 'undefined') {
|
|
8710
|
+
apiPayload['endAt'] = endAt;
|
|
8711
|
+
}
|
|
8712
|
+
if (typeof limit !== 'undefined') {
|
|
8713
|
+
apiPayload['limit'] = limit;
|
|
8714
|
+
}
|
|
8715
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
8716
|
+
const apiHeaders = {
|
|
8717
|
+
'X-Appwrite-Project': this.client.config.project,
|
|
8718
|
+
accept: 'application/json',
|
|
8719
|
+
};
|
|
8720
|
+
return this.client.call('get', uri, apiHeaders, apiPayload);
|
|
8721
|
+
}
|
|
8722
|
+
}
|
|
8723
|
+
|
|
8384
8724
|
class Apps {
|
|
8385
8725
|
constructor(client) {
|
|
8386
8726
|
this.client = client;
|
|
@@ -9273,7 +9613,7 @@
|
|
|
9273
9613
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9274
9614
|
apiPayload['project'] = this.client.config.project;
|
|
9275
9615
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9276
|
-
for (const [key, value] of Object.entries(
|
|
9616
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
9277
9617
|
uri.searchParams.append(key, value);
|
|
9278
9618
|
}
|
|
9279
9619
|
return uri.toString();
|
|
@@ -9318,7 +9658,7 @@
|
|
|
9318
9658
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9319
9659
|
apiPayload['project'] = this.client.config.project;
|
|
9320
9660
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9321
|
-
for (const [key, value] of Object.entries(
|
|
9661
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
9322
9662
|
uri.searchParams.append(key, value);
|
|
9323
9663
|
}
|
|
9324
9664
|
return uri.toString();
|
|
@@ -9347,7 +9687,7 @@
|
|
|
9347
9687
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9348
9688
|
apiPayload['project'] = this.client.config.project;
|
|
9349
9689
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9350
|
-
for (const [key, value] of Object.entries(
|
|
9690
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
9351
9691
|
uri.searchParams.append(key, value);
|
|
9352
9692
|
}
|
|
9353
9693
|
return uri.toString();
|
|
@@ -9392,7 +9732,7 @@
|
|
|
9392
9732
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9393
9733
|
apiPayload['project'] = this.client.config.project;
|
|
9394
9734
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9395
|
-
for (const [key, value] of Object.entries(
|
|
9735
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
9396
9736
|
uri.searchParams.append(key, value);
|
|
9397
9737
|
}
|
|
9398
9738
|
return uri.toString();
|
|
@@ -9431,7 +9771,7 @@
|
|
|
9431
9771
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9432
9772
|
apiPayload['project'] = this.client.config.project;
|
|
9433
9773
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9434
|
-
for (const [key, value] of Object.entries(
|
|
9774
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
9435
9775
|
uri.searchParams.append(key, value);
|
|
9436
9776
|
}
|
|
9437
9777
|
return uri.toString();
|
|
@@ -9473,7 +9813,7 @@
|
|
|
9473
9813
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9474
9814
|
apiPayload['project'] = this.client.config.project;
|
|
9475
9815
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9476
|
-
for (const [key, value] of Object.entries(
|
|
9816
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
9477
9817
|
uri.searchParams.append(key, value);
|
|
9478
9818
|
}
|
|
9479
9819
|
return uri.toString();
|
|
@@ -9535,7 +9875,7 @@
|
|
|
9535
9875
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9536
9876
|
apiPayload['project'] = this.client.config.project;
|
|
9537
9877
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9538
|
-
for (const [key, value] of Object.entries(
|
|
9878
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
9539
9879
|
uri.searchParams.append(key, value);
|
|
9540
9880
|
}
|
|
9541
9881
|
return uri.toString();
|
|
@@ -9629,7 +9969,7 @@
|
|
|
9629
9969
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9630
9970
|
apiPayload['project'] = this.client.config.project;
|
|
9631
9971
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9632
|
-
for (const [key, value] of Object.entries(
|
|
9972
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
9633
9973
|
uri.searchParams.append(key, value);
|
|
9634
9974
|
}
|
|
9635
9975
|
return uri.toString();
|
|
@@ -9753,7 +10093,7 @@
|
|
|
9753
10093
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9754
10094
|
apiPayload['project'] = this.client.config.project;
|
|
9755
10095
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9756
|
-
for (const [key, value] of Object.entries(
|
|
10096
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
9757
10097
|
uri.searchParams.append(key, value);
|
|
9758
10098
|
}
|
|
9759
10099
|
return uri.toString();
|
|
@@ -19329,7 +19669,7 @@
|
|
|
19329
19669
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
19330
19670
|
apiPayload['project'] = this.client.config.project;
|
|
19331
19671
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
19332
|
-
for (const [key, value] of Object.entries(
|
|
19672
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
19333
19673
|
uri.searchParams.append(key, value);
|
|
19334
19674
|
}
|
|
19335
19675
|
return uri.toString();
|
|
@@ -29968,7 +30308,7 @@
|
|
|
29968
30308
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
29969
30309
|
apiPayload['project'] = this.client.config.project;
|
|
29970
30310
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
29971
|
-
for (const [key, value] of Object.entries(
|
|
30311
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
29972
30312
|
uri.searchParams.append(key, value);
|
|
29973
30313
|
}
|
|
29974
30314
|
return uri.toString();
|
|
@@ -30075,7 +30415,7 @@
|
|
|
30075
30415
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
30076
30416
|
apiPayload['project'] = this.client.config.project;
|
|
30077
30417
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
30078
|
-
for (const [key, value] of Object.entries(
|
|
30418
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
30079
30419
|
uri.searchParams.append(key, value);
|
|
30080
30420
|
}
|
|
30081
30421
|
return uri.toString();
|
|
@@ -38259,7 +38599,7 @@
|
|
|
38259
38599
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
38260
38600
|
apiPayload['project'] = this.client.config.project;
|
|
38261
38601
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
38262
|
-
for (const [key, value] of Object.entries(
|
|
38602
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
38263
38603
|
uri.searchParams.append(key, value);
|
|
38264
38604
|
}
|
|
38265
38605
|
return uri.toString();
|
|
@@ -39090,7 +39430,7 @@
|
|
|
39090
39430
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
39091
39431
|
apiPayload['project'] = this.client.config.project;
|
|
39092
39432
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
39093
|
-
for (const [key, value] of Object.entries(
|
|
39433
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
39094
39434
|
uri.searchParams.append(key, value);
|
|
39095
39435
|
}
|
|
39096
39436
|
return uri.toString();
|
|
@@ -39183,7 +39523,7 @@
|
|
|
39183
39523
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
39184
39524
|
apiPayload['project'] = this.client.config.project;
|
|
39185
39525
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
39186
|
-
for (const [key, value] of Object.entries(
|
|
39526
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
39187
39527
|
uri.searchParams.append(key, value);
|
|
39188
39528
|
}
|
|
39189
39529
|
return uri.toString();
|
|
@@ -39221,7 +39561,7 @@
|
|
|
39221
39561
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
39222
39562
|
apiPayload['project'] = this.client.config.project;
|
|
39223
39563
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
39224
|
-
for (const [key, value] of Object.entries(
|
|
39564
|
+
for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
|
|
39225
39565
|
uri.searchParams.append(key, value);
|
|
39226
39566
|
}
|
|
39227
39567
|
return uri.toString();
|
|
@@ -49800,9 +50140,8 @@
|
|
|
49800
50140
|
* );
|
|
49801
50141
|
* // sub.update({ background: true }); sub.unsubscribe();
|
|
49802
50142
|
*/
|
|
49803
|
-
class Push
|
|
50143
|
+
class Push {
|
|
49804
50144
|
constructor(client) {
|
|
49805
|
-
super(client);
|
|
49806
50145
|
this.mqtt = null;
|
|
49807
50146
|
this.connecting = null;
|
|
49808
50147
|
this.Buffer = null;
|
|
@@ -49832,6 +50171,7 @@
|
|
|
49832
50171
|
this.connectedKey = '';
|
|
49833
50172
|
this.connectionEpoch = 0;
|
|
49834
50173
|
this.subscriptions = new Map();
|
|
50174
|
+
this.client = client;
|
|
49835
50175
|
}
|
|
49836
50176
|
// The broker subscription for a filter uses the highest QoS any local subscription on
|
|
49837
50177
|
// it wants, so a QoS-0 subscription never downgrades a QoS-1 one sharing the filter.
|
|
@@ -50571,6 +50911,670 @@
|
|
|
50571
50911
|
return filterParts.length === topicParts.length;
|
|
50572
50912
|
}
|
|
50573
50913
|
|
|
50914
|
+
/**
|
|
50915
|
+
* Analytics auto-tracking helpers.
|
|
50916
|
+
*
|
|
50917
|
+
* These are hand-written companions to the generated `Analytics` service.
|
|
50918
|
+
* The generated service exposes `createEvent(params)` for arbitrary events;
|
|
50919
|
+
* this module wires up common auto-tracking behaviours (pageviews, outbound
|
|
50920
|
+
* links, downloads, scroll depth, active engagement) on top of it.
|
|
50921
|
+
*
|
|
50922
|
+
* The tracking helpers accept a plain event-emitter function so they do not
|
|
50923
|
+
* hard-couple to the generated `Analytics` class. The emitter adapts this
|
|
50924
|
+
* module's option shape to `createEvent`: `url` is required there, and `props`
|
|
50925
|
+
* is a flat alternating key/value list rather than an object.
|
|
50926
|
+
*
|
|
50927
|
+
* ```ts
|
|
50928
|
+
* const analytics = new Analytics(client);
|
|
50929
|
+
* const tracking = new AnalyticsTracking(
|
|
50930
|
+
* (name, options) => analytics.createEvent({
|
|
50931
|
+
* propertyId: options?.propertyId ?? '<PROPERTY_ID>',
|
|
50932
|
+
* name,
|
|
50933
|
+
* url: options?.url ?? window.location.href,
|
|
50934
|
+
* referrer: options?.referrer,
|
|
50935
|
+
* scrollDepth: options?.scrollDepth,
|
|
50936
|
+
* engagementTime: options?.engagementTime,
|
|
50937
|
+
* props: Object.entries(options?.props ?? {}).flatMap(
|
|
50938
|
+
* ([key, value]) => [key, String(value)],
|
|
50939
|
+
* ),
|
|
50940
|
+
* }),
|
|
50941
|
+
* { propertyId: '<PROPERTY_ID>' }
|
|
50942
|
+
* );
|
|
50943
|
+
* tracking.enableAllAutoTracking();
|
|
50944
|
+
* ```
|
|
50945
|
+
*
|
|
50946
|
+
* `propertyId` is optional: when set it is merged into the options of every
|
|
50947
|
+
* emitted event, so an emitter that forwards `options.propertyId` (as above)
|
|
50948
|
+
* picks it up instead of every caller hand-rolling it into the closure.
|
|
50949
|
+
* Per-event `propertyId` always wins over the configured default.
|
|
50950
|
+
*
|
|
50951
|
+
* All helpers respect `navigator.doNotTrack === '1'` by default; opt out with
|
|
50952
|
+
* `respectDoNotTrack: false` in the constructor options.
|
|
50953
|
+
*
|
|
50954
|
+
* Engagement time follows Plausible's model: rather than one total at unload,
|
|
50955
|
+
* a delta is emitted at every natural checkpoint of the visit (tab hidden, SPA
|
|
50956
|
+
* route change, unload). See `enableAutoEngagementTime` for details.
|
|
50957
|
+
*
|
|
50958
|
+
* Auto-emitted event names follow `snake_case` + lowercase (`pageview`,
|
|
50959
|
+
* `outbound_link`, `file_download`, `screen_view`, etc.). Any prop keys use
|
|
50960
|
+
* camelCase to match the endpoint's parameter naming. Callers can pass any
|
|
50961
|
+
* custom event name; the auto-track methods only own the events they emit
|
|
50962
|
+
* themselves.
|
|
50963
|
+
*/
|
|
50964
|
+
const DEFAULT_DOWNLOAD_EXTENSIONS = [
|
|
50965
|
+
'pdf',
|
|
50966
|
+
'zip',
|
|
50967
|
+
'rar',
|
|
50968
|
+
'7z',
|
|
50969
|
+
'tar',
|
|
50970
|
+
'gz',
|
|
50971
|
+
'csv',
|
|
50972
|
+
'tsv',
|
|
50973
|
+
'xls',
|
|
50974
|
+
'xlsx',
|
|
50975
|
+
'doc',
|
|
50976
|
+
'docx',
|
|
50977
|
+
'ppt',
|
|
50978
|
+
'pptx',
|
|
50979
|
+
'dmg',
|
|
50980
|
+
'exe',
|
|
50981
|
+
'msi',
|
|
50982
|
+
'pkg',
|
|
50983
|
+
'deb',
|
|
50984
|
+
'rpm',
|
|
50985
|
+
'apk',
|
|
50986
|
+
'mp3',
|
|
50987
|
+
'wav',
|
|
50988
|
+
'flac',
|
|
50989
|
+
'mp4',
|
|
50990
|
+
'mov',
|
|
50991
|
+
'avi',
|
|
50992
|
+
'mkv',
|
|
50993
|
+
'webm',
|
|
50994
|
+
];
|
|
50995
|
+
/**
|
|
50996
|
+
* Two-part public suffixes common enough to matter for outbound-link detection.
|
|
50997
|
+
* See `rootDomain()` for why this is a short list rather than the Public Suffix
|
|
50998
|
+
* List.
|
|
50999
|
+
*/
|
|
51000
|
+
const MULTI_PART_SUFFIXES = new Set([
|
|
51001
|
+
'co.uk',
|
|
51002
|
+
'org.uk',
|
|
51003
|
+
'ac.uk',
|
|
51004
|
+
'gov.uk',
|
|
51005
|
+
'me.uk',
|
|
51006
|
+
'net.uk',
|
|
51007
|
+
'sch.uk',
|
|
51008
|
+
'co.jp',
|
|
51009
|
+
'ne.jp',
|
|
51010
|
+
'or.jp',
|
|
51011
|
+
'ac.jp',
|
|
51012
|
+
'go.jp',
|
|
51013
|
+
'com.au',
|
|
51014
|
+
'net.au',
|
|
51015
|
+
'org.au',
|
|
51016
|
+
'edu.au',
|
|
51017
|
+
'gov.au',
|
|
51018
|
+
'com.br',
|
|
51019
|
+
'net.br',
|
|
51020
|
+
'org.br',
|
|
51021
|
+
'com.cn',
|
|
51022
|
+
'net.cn',
|
|
51023
|
+
'org.cn',
|
|
51024
|
+
'gov.cn',
|
|
51025
|
+
'co.in',
|
|
51026
|
+
'net.in',
|
|
51027
|
+
'org.in',
|
|
51028
|
+
'co.nz',
|
|
51029
|
+
'net.nz',
|
|
51030
|
+
'org.nz',
|
|
51031
|
+
'co.za',
|
|
51032
|
+
'org.za',
|
|
51033
|
+
'com.mx',
|
|
51034
|
+
'com.ar',
|
|
51035
|
+
'com.co',
|
|
51036
|
+
'com.pe',
|
|
51037
|
+
'com.tr',
|
|
51038
|
+
'com.tw',
|
|
51039
|
+
'com.sg',
|
|
51040
|
+
'com.hk',
|
|
51041
|
+
'com.my',
|
|
51042
|
+
'com.ph',
|
|
51043
|
+
'com.vn',
|
|
51044
|
+
'co.kr',
|
|
51045
|
+
'co.il',
|
|
51046
|
+
'co.id',
|
|
51047
|
+
'co.th',
|
|
51048
|
+
'com.ua',
|
|
51049
|
+
'com.pl',
|
|
51050
|
+
'com.es',
|
|
51051
|
+
]);
|
|
51052
|
+
const SCROLL_DEPTH_THROTTLE_MS = 200;
|
|
51053
|
+
class AnalyticsTracking {
|
|
51054
|
+
constructor(emit, options = {}) {
|
|
51055
|
+
this.pageviewCleanups = [];
|
|
51056
|
+
this.scrollCleanups = [];
|
|
51057
|
+
this.engagementCleanups = [];
|
|
51058
|
+
this.maxScrollDepth = 0;
|
|
51059
|
+
this.scrollTicking = false;
|
|
51060
|
+
this.lastScrollReport = 0;
|
|
51061
|
+
this.engagementStart = 0;
|
|
51062
|
+
this.engagementAccumulatedMs = 0;
|
|
51063
|
+
this.engagementActive = false;
|
|
51064
|
+
this.emit = emit;
|
|
51065
|
+
this.respectDoNotTrack = options.respectDoNotTrack !== false;
|
|
51066
|
+
this.propertyId = options.propertyId;
|
|
51067
|
+
}
|
|
51068
|
+
/**
|
|
51069
|
+
* Enable the opinionated default auto-tracking set: pageviews, outbound
|
|
51070
|
+
* links, scroll depth and active engagement time. Downloads must be opted
|
|
51071
|
+
* into separately via `enableAutoDownloadTracking()` because the extension
|
|
51072
|
+
* list is application-specific.
|
|
51073
|
+
*/
|
|
51074
|
+
enableAllAutoTracking() {
|
|
51075
|
+
this.enableAutoPageviews();
|
|
51076
|
+
this.enableAutoOutboundTracking();
|
|
51077
|
+
this.enableAutoScrollDepth();
|
|
51078
|
+
this.enableAutoEngagementTime();
|
|
51079
|
+
}
|
|
51080
|
+
/**
|
|
51081
|
+
* Track an event manually. Respects the DNT setting and swallows emitter
|
|
51082
|
+
* exceptions so tracking failures never surface to the host page.
|
|
51083
|
+
*/
|
|
51084
|
+
track(name, options) {
|
|
51085
|
+
if (!this.canTrack()) {
|
|
51086
|
+
return;
|
|
51087
|
+
}
|
|
51088
|
+
try {
|
|
51089
|
+
this.emit(name, this.withPropertyId(options));
|
|
51090
|
+
}
|
|
51091
|
+
catch (error) {
|
|
51092
|
+
console.warn('AnalyticsTracking: emitter threw', error);
|
|
51093
|
+
}
|
|
51094
|
+
}
|
|
51095
|
+
/**
|
|
51096
|
+
* Convenience wrapper for pageview-shaped events.
|
|
51097
|
+
*/
|
|
51098
|
+
pageview(url, referrer) {
|
|
51099
|
+
this.track('pageview', {
|
|
51100
|
+
url: url !== null && url !== void 0 ? url : this.currentPageUrl(),
|
|
51101
|
+
referrer: referrer !== null && referrer !== void 0 ? referrer : (typeof document !== 'undefined'
|
|
51102
|
+
? document.referrer
|
|
51103
|
+
: undefined),
|
|
51104
|
+
});
|
|
51105
|
+
}
|
|
51106
|
+
/**
|
|
51107
|
+
* Enable SPA-aware pageview tracking. Fires an initial pageview on
|
|
51108
|
+
* enable, then again on every `pushState`, `replaceState`, `popstate`
|
|
51109
|
+
* or hashchange. Idempotent — repeat calls no-op.
|
|
51110
|
+
*/
|
|
51111
|
+
enableAutoPageviews() {
|
|
51112
|
+
if (this.pageviewCleanups.length > 0) {
|
|
51113
|
+
return;
|
|
51114
|
+
}
|
|
51115
|
+
if (typeof window === 'undefined' || typeof history === 'undefined') {
|
|
51116
|
+
return;
|
|
51117
|
+
}
|
|
51118
|
+
this.currentPath = this.currentPageUrl();
|
|
51119
|
+
this.pageview();
|
|
51120
|
+
const handleNavigation = () => {
|
|
51121
|
+
const nextPath = this.currentPageUrl();
|
|
51122
|
+
if (nextPath === this.currentPath) {
|
|
51123
|
+
return;
|
|
51124
|
+
}
|
|
51125
|
+
const previous = this.currentPath;
|
|
51126
|
+
this.currentPath = nextPath;
|
|
51127
|
+
this.flushScrollDepth(previous);
|
|
51128
|
+
this.flushEngagement(previous);
|
|
51129
|
+
this.pageview(nextPath);
|
|
51130
|
+
// flushEngagement no longer auto-restarts the timer (see its
|
|
51131
|
+
// implementation note re: bfcache). SPA navigation stays on the
|
|
51132
|
+
// same document, so restart engagement tracking for the new
|
|
51133
|
+
// route as long as the tab is visible.
|
|
51134
|
+
if (this.engagementCleanups.length > 0 &&
|
|
51135
|
+
(typeof document === 'undefined' ||
|
|
51136
|
+
document.visibilityState !== 'hidden')) {
|
|
51137
|
+
this.startEngagement();
|
|
51138
|
+
}
|
|
51139
|
+
};
|
|
51140
|
+
const originalPushState = history.pushState.bind(history);
|
|
51141
|
+
const originalReplaceState = history.replaceState.bind(history);
|
|
51142
|
+
// Our wrappers stay reachable after cleanup whenever another library
|
|
51143
|
+
// patched on top of ours, so they have to be switchable off rather than
|
|
51144
|
+
// merely unreferenced.
|
|
51145
|
+
let patchActive = true;
|
|
51146
|
+
const patchedPushState = (data, unused, url) => {
|
|
51147
|
+
originalPushState(data, unused, url);
|
|
51148
|
+
if (patchActive) {
|
|
51149
|
+
handleNavigation();
|
|
51150
|
+
}
|
|
51151
|
+
};
|
|
51152
|
+
const patchedReplaceState = (data, unused, url) => {
|
|
51153
|
+
originalReplaceState(data, unused, url);
|
|
51154
|
+
if (patchActive) {
|
|
51155
|
+
handleNavigation();
|
|
51156
|
+
}
|
|
51157
|
+
};
|
|
51158
|
+
history.pushState = patchedPushState;
|
|
51159
|
+
history.replaceState = patchedReplaceState;
|
|
51160
|
+
const popstateHandler = () => handleNavigation();
|
|
51161
|
+
const hashchangeHandler = () => handleNavigation();
|
|
51162
|
+
window.addEventListener('popstate', popstateHandler);
|
|
51163
|
+
window.addEventListener('hashchange', hashchangeHandler);
|
|
51164
|
+
this.pageviewCleanups.push(() => {
|
|
51165
|
+
// Only unwind our own patch. A router (Next.js App Router, React
|
|
51166
|
+
// Router, …) that patched these after us owns the current value,
|
|
51167
|
+
// and assigning our saved reference back would silently throw its
|
|
51168
|
+
// wrapper away. In that case ours stays in the chain, which is why
|
|
51169
|
+
// `patchActive` exists: the wrapper keeps delegating to the original
|
|
51170
|
+
// but stops reporting.
|
|
51171
|
+
patchActive = false;
|
|
51172
|
+
if (history.pushState === patchedPushState) {
|
|
51173
|
+
history.pushState = originalPushState;
|
|
51174
|
+
}
|
|
51175
|
+
if (history.replaceState === patchedReplaceState) {
|
|
51176
|
+
history.replaceState = originalReplaceState;
|
|
51177
|
+
}
|
|
51178
|
+
window.removeEventListener('popstate', popstateHandler);
|
|
51179
|
+
window.removeEventListener('hashchange', hashchangeHandler);
|
|
51180
|
+
});
|
|
51181
|
+
}
|
|
51182
|
+
/**
|
|
51183
|
+
* Disable auto-pageview tracking installed by `enableAutoPageviews`.
|
|
51184
|
+
* Safe to call when auto-pageviews were never enabled.
|
|
51185
|
+
*/
|
|
51186
|
+
disableAutoPageviews() {
|
|
51187
|
+
for (const cleanup of this.pageviewCleanups) {
|
|
51188
|
+
cleanup();
|
|
51189
|
+
}
|
|
51190
|
+
this.pageviewCleanups = [];
|
|
51191
|
+
}
|
|
51192
|
+
/**
|
|
51193
|
+
* Enable click-based outbound link tracking. Detects anchor clicks that
|
|
51194
|
+
* navigate to a different origin and fires an `outbound_link` event
|
|
51195
|
+
* (with `hostname` and `href` props) before the browser navigates.
|
|
51196
|
+
*/
|
|
51197
|
+
enableAutoOutboundTracking(options = {}) {
|
|
51198
|
+
if (this.outboundCleanup) {
|
|
51199
|
+
return;
|
|
51200
|
+
}
|
|
51201
|
+
if (typeof document === 'undefined') {
|
|
51202
|
+
return;
|
|
51203
|
+
}
|
|
51204
|
+
const includeSubdomains = options.includeSubdomains === true;
|
|
51205
|
+
const clickHandler = (event) => {
|
|
51206
|
+
const anchor = this.findAnchor(event.target);
|
|
51207
|
+
if (!anchor || !anchor.href) {
|
|
51208
|
+
return;
|
|
51209
|
+
}
|
|
51210
|
+
const target = this.parseUrl(anchor.href);
|
|
51211
|
+
if (!target || !this.isExternal(target, includeSubdomains)) {
|
|
51212
|
+
return;
|
|
51213
|
+
}
|
|
51214
|
+
this.track('outbound_link', {
|
|
51215
|
+
url: target.href,
|
|
51216
|
+
props: { hostname: target.hostname, href: target.href },
|
|
51217
|
+
});
|
|
51218
|
+
};
|
|
51219
|
+
document.addEventListener('click', clickHandler, { capture: true });
|
|
51220
|
+
this.outboundCleanup = () => document.removeEventListener('click', clickHandler, {
|
|
51221
|
+
capture: true,
|
|
51222
|
+
});
|
|
51223
|
+
}
|
|
51224
|
+
/**
|
|
51225
|
+
* Disable outbound-link tracking installed by `enableAutoOutboundTracking`.
|
|
51226
|
+
* Safe to call when auto-outbound was never enabled.
|
|
51227
|
+
*/
|
|
51228
|
+
disableAutoOutboundTracking() {
|
|
51229
|
+
if (this.outboundCleanup) {
|
|
51230
|
+
this.outboundCleanup();
|
|
51231
|
+
this.outboundCleanup = undefined;
|
|
51232
|
+
}
|
|
51233
|
+
}
|
|
51234
|
+
/**
|
|
51235
|
+
* Enable click-based download tracking. Detects anchor clicks that point
|
|
51236
|
+
* at a file whose extension appears in the configured list and fires a
|
|
51237
|
+
* `file_download` event with `filename`, `extension` and `href` props.
|
|
51238
|
+
*/
|
|
51239
|
+
enableAutoDownloadTracking(options = {}) {
|
|
51240
|
+
var _a;
|
|
51241
|
+
if (this.downloadCleanup) {
|
|
51242
|
+
return;
|
|
51243
|
+
}
|
|
51244
|
+
if (typeof document === 'undefined') {
|
|
51245
|
+
return;
|
|
51246
|
+
}
|
|
51247
|
+
const extensions = ((_a = options.extensions) !== null && _a !== void 0 ? _a : DEFAULT_DOWNLOAD_EXTENSIONS).map((ext) => ext.toLowerCase().replace(/^\./, ''));
|
|
51248
|
+
const extensionSet = new Set(extensions);
|
|
51249
|
+
const clickHandler = (event) => {
|
|
51250
|
+
var _a, _b;
|
|
51251
|
+
const anchor = this.findAnchor(event.target);
|
|
51252
|
+
if (!anchor || !anchor.href) {
|
|
51253
|
+
return;
|
|
51254
|
+
}
|
|
51255
|
+
const url = this.parseUrl(anchor.href);
|
|
51256
|
+
if (!url) {
|
|
51257
|
+
return;
|
|
51258
|
+
}
|
|
51259
|
+
const filename = (_a = url.pathname.split('/').pop()) !== null && _a !== void 0 ? _a : '';
|
|
51260
|
+
const extension = filename.includes('.')
|
|
51261
|
+
? (_b = filename.split('.').pop()) === null || _b === void 0 ? void 0 : _b.toLowerCase()
|
|
51262
|
+
: undefined;
|
|
51263
|
+
if (!extension || !extensionSet.has(extension)) {
|
|
51264
|
+
return;
|
|
51265
|
+
}
|
|
51266
|
+
this.track('file_download', {
|
|
51267
|
+
url: url.href,
|
|
51268
|
+
props: { filename, extension, href: url.href },
|
|
51269
|
+
});
|
|
51270
|
+
};
|
|
51271
|
+
document.addEventListener('click', clickHandler, { capture: true });
|
|
51272
|
+
this.downloadCleanup = () => document.removeEventListener('click', clickHandler, {
|
|
51273
|
+
capture: true,
|
|
51274
|
+
});
|
|
51275
|
+
}
|
|
51276
|
+
/**
|
|
51277
|
+
* Disable file-download tracking installed by `enableAutoDownloadTracking`.
|
|
51278
|
+
* Safe to call when auto-download was never enabled.
|
|
51279
|
+
*/
|
|
51280
|
+
disableAutoDownloadTracking() {
|
|
51281
|
+
if (this.downloadCleanup) {
|
|
51282
|
+
this.downloadCleanup();
|
|
51283
|
+
this.downloadCleanup = undefined;
|
|
51284
|
+
}
|
|
51285
|
+
}
|
|
51286
|
+
/**
|
|
51287
|
+
* Enable passive scroll-depth tracking. Records the maximum percent of the
|
|
51288
|
+
* document scrolled and reports it on `beforeunload` and on SPA route
|
|
51289
|
+
* changes. Uses a throttled passive listener so it is safe on hot paths.
|
|
51290
|
+
*/
|
|
51291
|
+
enableAutoScrollDepth() {
|
|
51292
|
+
if (this.scrollCleanups.length > 0) {
|
|
51293
|
+
return;
|
|
51294
|
+
}
|
|
51295
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
51296
|
+
return;
|
|
51297
|
+
}
|
|
51298
|
+
this.maxScrollDepth = 0;
|
|
51299
|
+
this.lastScrollReport = 0;
|
|
51300
|
+
const scrollHandler = () => {
|
|
51301
|
+
if (this.scrollTicking) {
|
|
51302
|
+
return;
|
|
51303
|
+
}
|
|
51304
|
+
this.scrollTicking = true;
|
|
51305
|
+
window.requestAnimationFrame(() => {
|
|
51306
|
+
const now = Date.now();
|
|
51307
|
+
if (now - this.lastScrollReport < SCROLL_DEPTH_THROTTLE_MS) {
|
|
51308
|
+
this.scrollTicking = false;
|
|
51309
|
+
return;
|
|
51310
|
+
}
|
|
51311
|
+
this.lastScrollReport = now;
|
|
51312
|
+
const depth = this.computeScrollDepth();
|
|
51313
|
+
if (depth > this.maxScrollDepth) {
|
|
51314
|
+
this.maxScrollDepth = depth;
|
|
51315
|
+
}
|
|
51316
|
+
this.scrollTicking = false;
|
|
51317
|
+
});
|
|
51318
|
+
};
|
|
51319
|
+
const unloadHandler = () => {
|
|
51320
|
+
this.flushScrollDepth(this.currentPageUrl());
|
|
51321
|
+
};
|
|
51322
|
+
window.addEventListener('scroll', scrollHandler, { passive: true });
|
|
51323
|
+
window.addEventListener('beforeunload', unloadHandler);
|
|
51324
|
+
window.addEventListener('pagehide', unloadHandler);
|
|
51325
|
+
this.scrollCleanups.push(() => {
|
|
51326
|
+
window.removeEventListener('scroll', scrollHandler);
|
|
51327
|
+
window.removeEventListener('beforeunload', unloadHandler);
|
|
51328
|
+
window.removeEventListener('pagehide', unloadHandler);
|
|
51329
|
+
});
|
|
51330
|
+
}
|
|
51331
|
+
/**
|
|
51332
|
+
* Disable scroll-depth tracking installed by `enableAutoScrollDepth`. Safe
|
|
51333
|
+
* to call when auto-scroll-depth was never enabled. Any accumulated depth
|
|
51334
|
+
* for the current page is dropped.
|
|
51335
|
+
*/
|
|
51336
|
+
disableAutoScrollDepth() {
|
|
51337
|
+
for (const cleanup of this.scrollCleanups) {
|
|
51338
|
+
cleanup();
|
|
51339
|
+
}
|
|
51340
|
+
this.scrollCleanups = [];
|
|
51341
|
+
this.maxScrollDepth = 0;
|
|
51342
|
+
this.scrollTicking = false;
|
|
51343
|
+
this.lastScrollReport = 0;
|
|
51344
|
+
}
|
|
51345
|
+
/**
|
|
51346
|
+
* Enable active engagement-time tracking. Counts time the tab is visible
|
|
51347
|
+
* and uses `visibilitychange` to exclude background time.
|
|
51348
|
+
*
|
|
51349
|
+
* Delivery follows Plausible's model rather than a single total at the
|
|
51350
|
+
* end of the visit: an `engagement_time` event is emitted at every natural
|
|
51351
|
+
* checkpoint — the tab going hidden, an SPA route change, and finally
|
|
51352
|
+
* `beforeunload`/`pagehide`. Unload is kept only as a best-effort last
|
|
51353
|
+
* flush; it is the least reliable moment to send anything (browsers
|
|
51354
|
+
* routinely cancel in-flight requests there, and `sendBeacon` cannot set
|
|
51355
|
+
* the `X-Appwrite-Project` header the endpoint requires), so it must never
|
|
51356
|
+
* be the only delivery.
|
|
51357
|
+
*
|
|
51358
|
+
* Each event carries a **delta** — the seconds accrued since the previous
|
|
51359
|
+
* flush, not a running total — so the values are additive per session and
|
|
51360
|
+
* a lost event costs only its own slice.
|
|
51361
|
+
*
|
|
51362
|
+
* There is deliberately no periodic ping. The cadence is driven by
|
|
51363
|
+
* navigation and tab switches, so request volume tracks what the visitor
|
|
51364
|
+
* actually does instead of multiplying with time on page.
|
|
51365
|
+
*/
|
|
51366
|
+
enableAutoEngagementTime() {
|
|
51367
|
+
if (this.engagementCleanups.length > 0) {
|
|
51368
|
+
return;
|
|
51369
|
+
}
|
|
51370
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
51371
|
+
return;
|
|
51372
|
+
}
|
|
51373
|
+
this.engagementAccumulatedMs = 0;
|
|
51374
|
+
// Do not start the clock for a tab that is already hidden (prerender,
|
|
51375
|
+
// background tab restore); `visibilitychange` starts it when it is
|
|
51376
|
+
// actually looked at.
|
|
51377
|
+
if (document.visibilityState !== 'hidden') {
|
|
51378
|
+
this.startEngagement();
|
|
51379
|
+
}
|
|
51380
|
+
const visibilityHandler = () => {
|
|
51381
|
+
if (document.visibilityState === 'hidden') {
|
|
51382
|
+
// Flush, don't just pause. The page is still fully alive here,
|
|
51383
|
+
// which makes this the most reliable delivery point in the
|
|
51384
|
+
// whole visit — and it is the same moment Plausible reports on.
|
|
51385
|
+
this.flushEngagement(this.currentPageUrl());
|
|
51386
|
+
}
|
|
51387
|
+
else if (document.visibilityState === 'visible') {
|
|
51388
|
+
this.startEngagement();
|
|
51389
|
+
}
|
|
51390
|
+
};
|
|
51391
|
+
const unloadHandler = () => {
|
|
51392
|
+
this.flushEngagement(this.currentPageUrl());
|
|
51393
|
+
};
|
|
51394
|
+
const pageshowHandler = (event) => {
|
|
51395
|
+
// When the page is restored from the back-forward cache the
|
|
51396
|
+
// engagement timer is in a stopped state (flushEngagement paused
|
|
51397
|
+
// it on pagehide and does not auto-restart). Kick off a fresh
|
|
51398
|
+
// engagementStart so bfcache dwell time is not billed as
|
|
51399
|
+
// engagement.
|
|
51400
|
+
if (event.persisted) {
|
|
51401
|
+
this.startEngagement();
|
|
51402
|
+
}
|
|
51403
|
+
};
|
|
51404
|
+
document.addEventListener('visibilitychange', visibilityHandler);
|
|
51405
|
+
window.addEventListener('beforeunload', unloadHandler);
|
|
51406
|
+
window.addEventListener('pagehide', unloadHandler);
|
|
51407
|
+
window.addEventListener('pageshow', pageshowHandler);
|
|
51408
|
+
this.engagementCleanups.push(() => {
|
|
51409
|
+
document.removeEventListener('visibilitychange', visibilityHandler);
|
|
51410
|
+
window.removeEventListener('beforeunload', unloadHandler);
|
|
51411
|
+
window.removeEventListener('pagehide', unloadHandler);
|
|
51412
|
+
window.removeEventListener('pageshow', pageshowHandler);
|
|
51413
|
+
});
|
|
51414
|
+
}
|
|
51415
|
+
/**
|
|
51416
|
+
* Disable engagement-time tracking installed by `enableAutoEngagementTime`.
|
|
51417
|
+
* Safe to call when auto-engagement was never enabled. Any accumulated
|
|
51418
|
+
* engagement time is dropped without being emitted.
|
|
51419
|
+
*/
|
|
51420
|
+
disableAutoEngagementTime() {
|
|
51421
|
+
for (const cleanup of this.engagementCleanups) {
|
|
51422
|
+
cleanup();
|
|
51423
|
+
}
|
|
51424
|
+
this.engagementCleanups = [];
|
|
51425
|
+
this.engagementActive = false;
|
|
51426
|
+
this.engagementAccumulatedMs = 0;
|
|
51427
|
+
this.engagementStart = 0;
|
|
51428
|
+
}
|
|
51429
|
+
/**
|
|
51430
|
+
* Merge the configured `propertyId` into an event's options. Returns the
|
|
51431
|
+
* caller's object untouched when no default is configured (or the event
|
|
51432
|
+
* already carries one), so emitters written against the pre-`propertyId`
|
|
51433
|
+
* shape keep receiving exactly what they received before.
|
|
51434
|
+
*/
|
|
51435
|
+
withPropertyId(options) {
|
|
51436
|
+
if (this.propertyId === undefined ||
|
|
51437
|
+
(options === null || options === void 0 ? void 0 : options.propertyId) !== undefined) {
|
|
51438
|
+
return options;
|
|
51439
|
+
}
|
|
51440
|
+
return Object.assign(Object.assign({}, (options !== null && options !== void 0 ? options : {})), { propertyId: this.propertyId });
|
|
51441
|
+
}
|
|
51442
|
+
canTrack() {
|
|
51443
|
+
if (!this.respectDoNotTrack) {
|
|
51444
|
+
return true;
|
|
51445
|
+
}
|
|
51446
|
+
if (typeof navigator === 'undefined') {
|
|
51447
|
+
return true;
|
|
51448
|
+
}
|
|
51449
|
+
return navigator.doNotTrack !== '1';
|
|
51450
|
+
}
|
|
51451
|
+
currentPageUrl() {
|
|
51452
|
+
if (typeof window === 'undefined' || !window.location) {
|
|
51453
|
+
return '';
|
|
51454
|
+
}
|
|
51455
|
+
return window.location.href;
|
|
51456
|
+
}
|
|
51457
|
+
findAnchor(target) {
|
|
51458
|
+
let node = target;
|
|
51459
|
+
while (node) {
|
|
51460
|
+
if (node.tagName === 'A') {
|
|
51461
|
+
return node;
|
|
51462
|
+
}
|
|
51463
|
+
node = node.parentNode;
|
|
51464
|
+
}
|
|
51465
|
+
return null;
|
|
51466
|
+
}
|
|
51467
|
+
parseUrl(href) {
|
|
51468
|
+
try {
|
|
51469
|
+
return new URL(href, window.location.href);
|
|
51470
|
+
}
|
|
51471
|
+
catch (_a) {
|
|
51472
|
+
return null;
|
|
51473
|
+
}
|
|
51474
|
+
}
|
|
51475
|
+
isExternal(target, includeSubdomains) {
|
|
51476
|
+
if (target.protocol !== 'http:' && target.protocol !== 'https:') {
|
|
51477
|
+
return false;
|
|
51478
|
+
}
|
|
51479
|
+
if (target.hostname === window.location.hostname) {
|
|
51480
|
+
return false;
|
|
51481
|
+
}
|
|
51482
|
+
if (includeSubdomains) {
|
|
51483
|
+
return true;
|
|
51484
|
+
}
|
|
51485
|
+
const root = this.rootDomain(window.location.hostname);
|
|
51486
|
+
return this.rootDomain(target.hostname) !== root;
|
|
51487
|
+
}
|
|
51488
|
+
rootDomain(hostname) {
|
|
51489
|
+
const parts = hostname.split('.');
|
|
51490
|
+
if (parts.length <= 2) {
|
|
51491
|
+
return hostname;
|
|
51492
|
+
}
|
|
51493
|
+
// Taking the last two labels is wrong wherever the registry sells names
|
|
51494
|
+
// one level down: `shop.example.co.uk` and `google.co.uk` both reduce to
|
|
51495
|
+
// `co.uk`, so every outbound click between two `.co.uk` sites looks
|
|
51496
|
+
// internal and is dropped. Take three labels after a known two-part
|
|
51497
|
+
// suffix instead.
|
|
51498
|
+
//
|
|
51499
|
+
// This is a heuristic, not the Public Suffix List — the full list is
|
|
51500
|
+
// orders of magnitude larger than this whole file, and a tracking
|
|
51501
|
+
// snippet cannot carry it. Sites on a suffix that is missing here can
|
|
51502
|
+
// pass `includeSubdomains: true` to treat every other host as outbound.
|
|
51503
|
+
const suffix = parts.slice(-2).join('.');
|
|
51504
|
+
if (parts.length > 2 && MULTI_PART_SUFFIXES.has(suffix)) {
|
|
51505
|
+
return parts.slice(-3).join('.');
|
|
51506
|
+
}
|
|
51507
|
+
return suffix;
|
|
51508
|
+
}
|
|
51509
|
+
computeScrollDepth() {
|
|
51510
|
+
const scrollTop = window.scrollY || document.documentElement.scrollTop;
|
|
51511
|
+
const viewport = window.innerHeight || document.documentElement.clientHeight;
|
|
51512
|
+
const total = document.documentElement.scrollHeight;
|
|
51513
|
+
if (total <= viewport) {
|
|
51514
|
+
return 100;
|
|
51515
|
+
}
|
|
51516
|
+
const depth = Math.round(((scrollTop + viewport) / total) * 100);
|
|
51517
|
+
return Math.max(0, Math.min(100, depth));
|
|
51518
|
+
}
|
|
51519
|
+
flushScrollDepth(url) {
|
|
51520
|
+
if (this.scrollCleanups.length === 0) {
|
|
51521
|
+
return;
|
|
51522
|
+
}
|
|
51523
|
+
if (this.maxScrollDepth <= 0) {
|
|
51524
|
+
return;
|
|
51525
|
+
}
|
|
51526
|
+
this.track('scroll_depth', {
|
|
51527
|
+
url,
|
|
51528
|
+
scrollDepth: this.maxScrollDepth,
|
|
51529
|
+
});
|
|
51530
|
+
this.maxScrollDepth = 0;
|
|
51531
|
+
}
|
|
51532
|
+
startEngagement() {
|
|
51533
|
+
if (this.engagementActive) {
|
|
51534
|
+
return;
|
|
51535
|
+
}
|
|
51536
|
+
this.engagementActive = true;
|
|
51537
|
+
this.engagementStart = Date.now();
|
|
51538
|
+
}
|
|
51539
|
+
pauseEngagement() {
|
|
51540
|
+
if (!this.engagementActive) {
|
|
51541
|
+
return;
|
|
51542
|
+
}
|
|
51543
|
+
this.engagementActive = false;
|
|
51544
|
+
this.engagementAccumulatedMs += Date.now() - this.engagementStart;
|
|
51545
|
+
}
|
|
51546
|
+
flushEngagement(url) {
|
|
51547
|
+
if (this.engagementCleanups.length === 0) {
|
|
51548
|
+
return;
|
|
51549
|
+
}
|
|
51550
|
+
this.pauseEngagement();
|
|
51551
|
+
// Deltas, not a running total: emit only what accrued since the last
|
|
51552
|
+
// flush. `floor` plus keeping the sub-second remainder in the
|
|
51553
|
+
// accumulator is what makes repeated flushes safe — nothing is emitted
|
|
51554
|
+
// twice, and a visit chopped into many short segments does not lose a
|
|
51555
|
+
// fraction of a second to rounding on every one of them.
|
|
51556
|
+
const seconds = Math.floor(this.engagementAccumulatedMs / 1000);
|
|
51557
|
+
if (seconds > 0) {
|
|
51558
|
+
// Deduct before emitting so a synchronous emitter that re-enters
|
|
51559
|
+
// (or throws) can never bill the same seconds again.
|
|
51560
|
+
this.engagementAccumulatedMs -= seconds * 1000;
|
|
51561
|
+
this.track('engagement_time', {
|
|
51562
|
+
url,
|
|
51563
|
+
engagementTime: seconds,
|
|
51564
|
+
});
|
|
51565
|
+
}
|
|
51566
|
+
// NOTE: intentionally do NOT call startEngagement() here. flushEngagement
|
|
51567
|
+
// runs on `pagehide`, which is also the last hook before the browser
|
|
51568
|
+
// may freeze the page into the back-forward cache. Auto-restarting
|
|
51569
|
+
// would snapshot engagementStart just before the freeze; the next
|
|
51570
|
+
// pauseEngagement (after bfcache restore) would then bill the entire
|
|
51571
|
+
// bfcache dwell as active engagement. Restart is driven by explicit
|
|
51572
|
+
// resume signals: `pageshow` (with `persisted === true`),
|
|
51573
|
+
// `visibilitychange` back to visible, or the SPA navigation flow in
|
|
51574
|
+
// `enableAutoPageviews`.
|
|
51575
|
+
}
|
|
51576
|
+
}
|
|
51577
|
+
|
|
50574
51578
|
/**
|
|
50575
51579
|
* Helper class to generate permission strings for resources.
|
|
50576
51580
|
*/
|
|
@@ -51277,6 +52281,40 @@
|
|
|
51277
52281
|
OAuthProvider["Zoom"] = "zoom";
|
|
51278
52282
|
})(exports.OAuthProvider || (exports.OAuthProvider = {}));
|
|
51279
52283
|
|
|
52284
|
+
exports.AnalyticsInterval = void 0;
|
|
52285
|
+
(function (AnalyticsInterval) {
|
|
52286
|
+
AnalyticsInterval["OneHour"] = "1h";
|
|
52287
|
+
AnalyticsInterval["OneDay"] = "1d";
|
|
52288
|
+
AnalyticsInterval["OneWeek"] = "1w";
|
|
52289
|
+
AnalyticsInterval["OneMonth"] = "1m";
|
|
52290
|
+
})(exports.AnalyticsInterval || (exports.AnalyticsInterval = {}));
|
|
52291
|
+
|
|
52292
|
+
exports.AnalyticsDimension = void 0;
|
|
52293
|
+
(function (AnalyticsDimension) {
|
|
52294
|
+
AnalyticsDimension["Country"] = "country";
|
|
52295
|
+
AnalyticsDimension["Region"] = "region";
|
|
52296
|
+
AnalyticsDimension["City"] = "city";
|
|
52297
|
+
AnalyticsDimension["Browser"] = "browser";
|
|
52298
|
+
AnalyticsDimension["OperatingSystem"] = "operatingSystem";
|
|
52299
|
+
AnalyticsDimension["Device"] = "device";
|
|
52300
|
+
AnalyticsDimension["ScreenSize"] = "screenSize";
|
|
52301
|
+
AnalyticsDimension["ReferrerSource"] = "referrerSource";
|
|
52302
|
+
AnalyticsDimension["Channel"] = "channel";
|
|
52303
|
+
AnalyticsDimension["UtmSource"] = "utmSource";
|
|
52304
|
+
AnalyticsDimension["UtmMedium"] = "utmMedium";
|
|
52305
|
+
AnalyticsDimension["UtmCampaign"] = "utmCampaign";
|
|
52306
|
+
AnalyticsDimension["UtmContent"] = "utmContent";
|
|
52307
|
+
AnalyticsDimension["UtmTerm"] = "utmTerm";
|
|
52308
|
+
AnalyticsDimension["Page"] = "page";
|
|
52309
|
+
AnalyticsDimension["Hostname"] = "hostname";
|
|
52310
|
+
AnalyticsDimension["EntryPage"] = "entryPage";
|
|
52311
|
+
AnalyticsDimension["ExitPage"] = "exitPage";
|
|
52312
|
+
AnalyticsDimension["TrafficType"] = "trafficType";
|
|
52313
|
+
AnalyticsDimension["BotName"] = "botName";
|
|
52314
|
+
AnalyticsDimension["BotCategory"] = "botCategory";
|
|
52315
|
+
AnalyticsDimension["EventName"] = "eventName";
|
|
52316
|
+
})(exports.AnalyticsDimension || (exports.AnalyticsDimension = {}));
|
|
52317
|
+
|
|
51280
52318
|
exports.Browser = void 0;
|
|
51281
52319
|
(function (Browser) {
|
|
51282
52320
|
Browser["AvantBrowser"] = "aa";
|
|
@@ -52092,6 +53130,7 @@
|
|
|
52092
53130
|
QuerySuggestionResource["ResourceTokens"] = "resourcetokens";
|
|
52093
53131
|
QuerySuggestionResource["Transactions"] = "transactions";
|
|
52094
53132
|
QuerySuggestionResource["TransactionLogs"] = "transactionlogs";
|
|
53133
|
+
QuerySuggestionResource["AnalyticsProperties"] = "analyticsproperties";
|
|
52095
53134
|
QuerySuggestionResource["DedicatedDatabases"] = "dedicateddatabases";
|
|
52096
53135
|
QuerySuggestionResource["DedicatedDatabaseConfigs"] = "dedicateddatabaseconfigs";
|
|
52097
53136
|
QuerySuggestionResource["DedicatedDatabaseRuntimes"] = "dedicateddatabaseruntimes";
|
|
@@ -52532,6 +53571,8 @@
|
|
|
52532
53571
|
ProjectKeyScopes["Oauth2Read"] = "oauth2.read";
|
|
52533
53572
|
ProjectKeyScopes["Oauth2Write"] = "oauth2.write";
|
|
52534
53573
|
ProjectKeyScopes["Oauth2Introspect"] = "oauth2.introspect";
|
|
53574
|
+
ProjectKeyScopes["AnalyticsRead"] = "analytics.read";
|
|
53575
|
+
ProjectKeyScopes["AnalyticsWrite"] = "analytics.write";
|
|
52535
53576
|
})(exports.ProjectKeyScopes || (exports.ProjectKeyScopes = {}));
|
|
52536
53577
|
|
|
52537
53578
|
exports.FunctionTemplateUseCase = void 0;
|
|
@@ -53166,6 +54207,9 @@
|
|
|
53166
54207
|
|
|
53167
54208
|
exports.UsageEventMetric = void 0;
|
|
53168
54209
|
(function (UsageEventMetric) {
|
|
54210
|
+
UsageEventMetric["AnalyticsEvents"] = "analytics.events";
|
|
54211
|
+
UsageEventMetric["AnalyticsPageviews"] = "analytics.pageviews";
|
|
54212
|
+
UsageEventMetric["AnalyticsBotsEvents"] = "analytics.bots.events";
|
|
53169
54213
|
UsageEventMetric["NetworkRequests"] = "network.requests";
|
|
53170
54214
|
UsageEventMetric["NetworkInbound"] = "network.inbound";
|
|
53171
54215
|
UsageEventMetric["NetworkOutbound"] = "network.outbound";
|
|
@@ -53283,6 +54327,7 @@
|
|
|
53283
54327
|
|
|
53284
54328
|
exports.UsageGaugeMetric = void 0;
|
|
53285
54329
|
(function (UsageGaugeMetric) {
|
|
54330
|
+
UsageGaugeMetric["AnalyticsProperties"] = "analytics.properties";
|
|
53286
54331
|
UsageGaugeMetric["Teams"] = "teams";
|
|
53287
54332
|
UsageGaugeMetric["Users"] = "users";
|
|
53288
54333
|
UsageGaugeMetric["Messages"] = "messages";
|
|
@@ -53558,6 +54603,7 @@
|
|
|
53558
54603
|
(function (ProxyRuleDeploymentResourceType) {
|
|
53559
54604
|
ProxyRuleDeploymentResourceType["Function"] = "function";
|
|
53560
54605
|
ProxyRuleDeploymentResourceType["Site"] = "site";
|
|
54606
|
+
ProxyRuleDeploymentResourceType["DedicatedDatabase"] = "dedicatedDatabase";
|
|
53561
54607
|
})(exports.ProxyRuleDeploymentResourceType || (exports.ProxyRuleDeploymentResourceType = {}));
|
|
53562
54608
|
|
|
53563
54609
|
exports.ProxyRuleStatus = void 0;
|
|
@@ -55639,6 +56685,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
55639
56685
|
exports.Activities = Activities;
|
|
55640
56686
|
exports.Advisor = Advisor;
|
|
55641
56687
|
exports.Affiliates = Affiliates;
|
|
56688
|
+
exports.Analytics = Analytics;
|
|
56689
|
+
exports.AnalyticsTracking = AnalyticsTracking;
|
|
55642
56690
|
exports.Apps = Apps;
|
|
55643
56691
|
exports.AppwriteException = AppwriteException;
|
|
55644
56692
|
exports.Assistant = Assistant;
|