@appwrite.io/console 18.3.0-rc.1 → 18.3.0
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 +59 -1095
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +60 -1094
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +59 -1095
- package/package.json +1 -1
- package/types/enums/project-key-scopes.d.ts +1 -3
- package/types/enums/proxy-rule-deployment-resource-type.d.ts +1 -2
- package/types/enums/query-suggestion-resource.d.ts +0 -1
- package/types/enums/usage-event-metric.d.ts +0 -3
- package/types/enums/usage-gauge-metric.d.ts +0 -1
- package/types/index.d.ts +0 -5
- package/types/models.d.ts +25 -141
- package/types/service.d.ts +11 -0
- package/types/services/functions.d.ts +12 -6
- package/types/services/projects.d.ts +7 -4
- package/types/services/push.d.ts +2 -2
- package/types/enums/analytics-dimension.d.ts +0 -24
- package/types/enums/analytics-interval.d.ts +0 -6
- package/types/services/analytics-tracking.d.ts +0 -211
- package/types/services/analytics.d.ts +0 -254
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.3.0
|
|
4470
|
+
'x-sdk-version': '18.3.0',
|
|
4471
4471
|
'X-Appwrite-Response-Format': '2.3.0',
|
|
4472
4472
|
};
|
|
4473
4473
|
this.realtime = {
|
|
@@ -5320,6 +5320,29 @@
|
|
|
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
|
+
|
|
5323
5346
|
class Account {
|
|
5324
5347
|
constructor(client) {
|
|
5325
5348
|
this.client = client;
|
|
@@ -7381,7 +7404,7 @@
|
|
|
7381
7404
|
}
|
|
7382
7405
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
7383
7406
|
apiPayload['project'] = this.client.config.project;
|
|
7384
|
-
for (const [key, value] of Object.entries(
|
|
7407
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
7385
7408
|
uri.searchParams.append(key, value);
|
|
7386
7409
|
}
|
|
7387
7410
|
if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
|
|
@@ -7790,7 +7813,7 @@
|
|
|
7790
7813
|
}
|
|
7791
7814
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
7792
7815
|
apiPayload['project'] = this.client.config.project;
|
|
7793
|
-
for (const [key, value] of Object.entries(
|
|
7816
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
7794
7817
|
uri.searchParams.append(key, value);
|
|
7795
7818
|
}
|
|
7796
7819
|
if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
|
|
@@ -8358,369 +8381,6 @@
|
|
|
8358
8381
|
}
|
|
8359
8382
|
}
|
|
8360
8383
|
|
|
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
|
-
|
|
8724
8384
|
class Apps {
|
|
8725
8385
|
constructor(client) {
|
|
8726
8386
|
this.client = client;
|
|
@@ -9613,7 +9273,7 @@
|
|
|
9613
9273
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9614
9274
|
apiPayload['project'] = this.client.config.project;
|
|
9615
9275
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9616
|
-
for (const [key, value] of Object.entries(
|
|
9276
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
9617
9277
|
uri.searchParams.append(key, value);
|
|
9618
9278
|
}
|
|
9619
9279
|
return uri.toString();
|
|
@@ -9658,7 +9318,7 @@
|
|
|
9658
9318
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9659
9319
|
apiPayload['project'] = this.client.config.project;
|
|
9660
9320
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9661
|
-
for (const [key, value] of Object.entries(
|
|
9321
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
9662
9322
|
uri.searchParams.append(key, value);
|
|
9663
9323
|
}
|
|
9664
9324
|
return uri.toString();
|
|
@@ -9687,7 +9347,7 @@
|
|
|
9687
9347
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9688
9348
|
apiPayload['project'] = this.client.config.project;
|
|
9689
9349
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9690
|
-
for (const [key, value] of Object.entries(
|
|
9350
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
9691
9351
|
uri.searchParams.append(key, value);
|
|
9692
9352
|
}
|
|
9693
9353
|
return uri.toString();
|
|
@@ -9732,7 +9392,7 @@
|
|
|
9732
9392
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9733
9393
|
apiPayload['project'] = this.client.config.project;
|
|
9734
9394
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9735
|
-
for (const [key, value] of Object.entries(
|
|
9395
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
9736
9396
|
uri.searchParams.append(key, value);
|
|
9737
9397
|
}
|
|
9738
9398
|
return uri.toString();
|
|
@@ -9771,7 +9431,7 @@
|
|
|
9771
9431
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9772
9432
|
apiPayload['project'] = this.client.config.project;
|
|
9773
9433
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9774
|
-
for (const [key, value] of Object.entries(
|
|
9434
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
9775
9435
|
uri.searchParams.append(key, value);
|
|
9776
9436
|
}
|
|
9777
9437
|
return uri.toString();
|
|
@@ -9813,7 +9473,7 @@
|
|
|
9813
9473
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9814
9474
|
apiPayload['project'] = this.client.config.project;
|
|
9815
9475
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9816
|
-
for (const [key, value] of Object.entries(
|
|
9476
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
9817
9477
|
uri.searchParams.append(key, value);
|
|
9818
9478
|
}
|
|
9819
9479
|
return uri.toString();
|
|
@@ -9875,7 +9535,7 @@
|
|
|
9875
9535
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9876
9536
|
apiPayload['project'] = this.client.config.project;
|
|
9877
9537
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9878
|
-
for (const [key, value] of Object.entries(
|
|
9538
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
9879
9539
|
uri.searchParams.append(key, value);
|
|
9880
9540
|
}
|
|
9881
9541
|
return uri.toString();
|
|
@@ -9969,7 +9629,7 @@
|
|
|
9969
9629
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9970
9630
|
apiPayload['project'] = this.client.config.project;
|
|
9971
9631
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
9972
|
-
for (const [key, value] of Object.entries(
|
|
9632
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
9973
9633
|
uri.searchParams.append(key, value);
|
|
9974
9634
|
}
|
|
9975
9635
|
return uri.toString();
|
|
@@ -10093,7 +9753,7 @@
|
|
|
10093
9753
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
10094
9754
|
apiPayload['project'] = this.client.config.project;
|
|
10095
9755
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
10096
|
-
for (const [key, value] of Object.entries(
|
|
9756
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
10097
9757
|
uri.searchParams.append(key, value);
|
|
10098
9758
|
}
|
|
10099
9759
|
return uri.toString();
|
|
@@ -18853,6 +18513,7 @@
|
|
|
18853
18513
|
buildSpecification: rest[18],
|
|
18854
18514
|
runtimeSpecification: rest[19],
|
|
18855
18515
|
deploymentRetention: rest[20],
|
|
18516
|
+
interval: rest[21],
|
|
18856
18517
|
};
|
|
18857
18518
|
}
|
|
18858
18519
|
const functionId = params.functionId;
|
|
@@ -18877,6 +18538,7 @@
|
|
|
18877
18538
|
const buildSpecification = params.buildSpecification;
|
|
18878
18539
|
const runtimeSpecification = params.runtimeSpecification;
|
|
18879
18540
|
const deploymentRetention = params.deploymentRetention;
|
|
18541
|
+
const interval = params.interval;
|
|
18880
18542
|
if (typeof functionId === 'undefined') {
|
|
18881
18543
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
18882
18544
|
}
|
|
@@ -18954,6 +18616,9 @@
|
|
|
18954
18616
|
if (typeof deploymentRetention !== 'undefined') {
|
|
18955
18617
|
apiPayload['deploymentRetention'] = deploymentRetention;
|
|
18956
18618
|
}
|
|
18619
|
+
if (typeof interval !== 'undefined') {
|
|
18620
|
+
apiPayload['interval'] = interval;
|
|
18621
|
+
}
|
|
18957
18622
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
18958
18623
|
const apiHeaders = {
|
|
18959
18624
|
'X-Appwrite-Project': this.client.config.project,
|
|
@@ -19151,6 +18816,7 @@
|
|
|
19151
18816
|
buildSpecification: rest[18],
|
|
19152
18817
|
runtimeSpecification: rest[19],
|
|
19153
18818
|
deploymentRetention: rest[20],
|
|
18819
|
+
interval: rest[21],
|
|
19154
18820
|
};
|
|
19155
18821
|
}
|
|
19156
18822
|
const functionId = params.functionId;
|
|
@@ -19175,6 +18841,7 @@
|
|
|
19175
18841
|
const buildSpecification = params.buildSpecification;
|
|
19176
18842
|
const runtimeSpecification = params.runtimeSpecification;
|
|
19177
18843
|
const deploymentRetention = params.deploymentRetention;
|
|
18844
|
+
const interval = params.interval;
|
|
19178
18845
|
if (typeof functionId === 'undefined' || functionId === '') {
|
|
19179
18846
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
19180
18847
|
}
|
|
@@ -19246,6 +18913,9 @@
|
|
|
19246
18913
|
if (typeof deploymentRetention !== 'undefined') {
|
|
19247
18914
|
apiPayload['deploymentRetention'] = deploymentRetention;
|
|
19248
18915
|
}
|
|
18916
|
+
if (typeof interval !== 'undefined') {
|
|
18917
|
+
apiPayload['interval'] = interval;
|
|
18918
|
+
}
|
|
19249
18919
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
19250
18920
|
const apiHeaders = {
|
|
19251
18921
|
'X-Appwrite-Project': this.client.config.project,
|
|
@@ -19669,7 +19339,7 @@
|
|
|
19669
19339
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
19670
19340
|
apiPayload['project'] = this.client.config.project;
|
|
19671
19341
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
19672
|
-
for (const [key, value] of Object.entries(
|
|
19342
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
19673
19343
|
uri.searchParams.append(key, value);
|
|
19674
19344
|
}
|
|
19675
19345
|
return uri.toString();
|
|
@@ -30308,7 +29978,7 @@
|
|
|
30308
29978
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
30309
29979
|
apiPayload['project'] = this.client.config.project;
|
|
30310
29980
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
30311
|
-
for (const [key, value] of Object.entries(
|
|
29981
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
30312
29982
|
uri.searchParams.append(key, value);
|
|
30313
29983
|
}
|
|
30314
29984
|
return uri.toString();
|
|
@@ -30415,7 +30085,7 @@
|
|
|
30415
30085
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
30416
30086
|
apiPayload['project'] = this.client.config.project;
|
|
30417
30087
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
30418
|
-
for (const [key, value] of Object.entries(
|
|
30088
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
30419
30089
|
uri.searchParams.append(key, value);
|
|
30420
30090
|
}
|
|
30421
30091
|
return uri.toString();
|
|
@@ -36994,6 +36664,7 @@
|
|
|
36994
36664
|
schedule: rest[2],
|
|
36995
36665
|
active: rest[3],
|
|
36996
36666
|
data: rest[4],
|
|
36667
|
+
interval: rest[5],
|
|
36997
36668
|
};
|
|
36998
36669
|
}
|
|
36999
36670
|
const projectId = params.projectId;
|
|
@@ -37002,6 +36673,7 @@
|
|
|
37002
36673
|
const schedule = params.schedule;
|
|
37003
36674
|
const active = params.active;
|
|
37004
36675
|
const data = params.data;
|
|
36676
|
+
const interval = params.interval;
|
|
37005
36677
|
if (typeof projectId === 'undefined' || projectId === '') {
|
|
37006
36678
|
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
37007
36679
|
}
|
|
@@ -37011,9 +36683,6 @@
|
|
|
37011
36683
|
if (typeof resourceId === 'undefined') {
|
|
37012
36684
|
throw new AppwriteException('Missing required parameter: "resourceId"');
|
|
37013
36685
|
}
|
|
37014
|
-
if (typeof schedule === 'undefined') {
|
|
37015
|
-
throw new AppwriteException('Missing required parameter: "schedule"');
|
|
37016
|
-
}
|
|
37017
36686
|
const apiPath = '/projects/{projectId}/schedules'.replace('{projectId}', encodeURIComponent(String(projectId)));
|
|
37018
36687
|
const apiPayload = {};
|
|
37019
36688
|
if (typeof resourceType !== 'undefined') {
|
|
@@ -37031,6 +36700,9 @@
|
|
|
37031
36700
|
if (typeof data !== 'undefined') {
|
|
37032
36701
|
apiPayload['data'] = data;
|
|
37033
36702
|
}
|
|
36703
|
+
if (typeof interval !== 'undefined') {
|
|
36704
|
+
apiPayload['interval'] = interval;
|
|
36705
|
+
}
|
|
37034
36706
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
37035
36707
|
const apiHeaders = {
|
|
37036
36708
|
'X-Appwrite-Project': this.client.config.project,
|
|
@@ -38599,7 +38271,7 @@
|
|
|
38599
38271
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
38600
38272
|
apiPayload['project'] = this.client.config.project;
|
|
38601
38273
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
38602
|
-
for (const [key, value] of Object.entries(
|
|
38274
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
38603
38275
|
uri.searchParams.append(key, value);
|
|
38604
38276
|
}
|
|
38605
38277
|
return uri.toString();
|
|
@@ -39430,7 +39102,7 @@
|
|
|
39430
39102
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
39431
39103
|
apiPayload['project'] = this.client.config.project;
|
|
39432
39104
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
39433
|
-
for (const [key, value] of Object.entries(
|
|
39105
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
39434
39106
|
uri.searchParams.append(key, value);
|
|
39435
39107
|
}
|
|
39436
39108
|
return uri.toString();
|
|
@@ -39523,7 +39195,7 @@
|
|
|
39523
39195
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
39524
39196
|
apiPayload['project'] = this.client.config.project;
|
|
39525
39197
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
39526
|
-
for (const [key, value] of Object.entries(
|
|
39198
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
39527
39199
|
uri.searchParams.append(key, value);
|
|
39528
39200
|
}
|
|
39529
39201
|
return uri.toString();
|
|
@@ -39561,7 +39233,7 @@
|
|
|
39561
39233
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
39562
39234
|
apiPayload['project'] = this.client.config.project;
|
|
39563
39235
|
apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
|
|
39564
|
-
for (const [key, value] of Object.entries(
|
|
39236
|
+
for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
|
|
39565
39237
|
uri.searchParams.append(key, value);
|
|
39566
39238
|
}
|
|
39567
39239
|
return uri.toString();
|
|
@@ -50140,8 +49812,9 @@
|
|
|
50140
49812
|
* );
|
|
50141
49813
|
* // sub.update({ background: true }); sub.unsubscribe();
|
|
50142
49814
|
*/
|
|
50143
|
-
class Push {
|
|
49815
|
+
class Push extends Service {
|
|
50144
49816
|
constructor(client) {
|
|
49817
|
+
super(client);
|
|
50145
49818
|
this.mqtt = null;
|
|
50146
49819
|
this.connecting = null;
|
|
50147
49820
|
this.Buffer = null;
|
|
@@ -50171,7 +49844,6 @@
|
|
|
50171
49844
|
this.connectedKey = '';
|
|
50172
49845
|
this.connectionEpoch = 0;
|
|
50173
49846
|
this.subscriptions = new Map();
|
|
50174
|
-
this.client = client;
|
|
50175
49847
|
}
|
|
50176
49848
|
// The broker subscription for a filter uses the highest QoS any local subscription on
|
|
50177
49849
|
// it wants, so a QoS-0 subscription never downgrades a QoS-1 one sharing the filter.
|
|
@@ -50911,670 +50583,6 @@
|
|
|
50911
50583
|
return filterParts.length === topicParts.length;
|
|
50912
50584
|
}
|
|
50913
50585
|
|
|
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
|
-
|
|
51578
50586
|
/**
|
|
51579
50587
|
* Helper class to generate permission strings for resources.
|
|
51580
50588
|
*/
|
|
@@ -52281,40 +51289,6 @@
|
|
|
52281
51289
|
OAuthProvider["Zoom"] = "zoom";
|
|
52282
51290
|
})(exports.OAuthProvider || (exports.OAuthProvider = {}));
|
|
52283
51291
|
|
|
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
|
-
|
|
52318
51292
|
exports.Browser = void 0;
|
|
52319
51293
|
(function (Browser) {
|
|
52320
51294
|
Browser["AvantBrowser"] = "aa";
|
|
@@ -53130,7 +52104,6 @@
|
|
|
53130
52104
|
QuerySuggestionResource["ResourceTokens"] = "resourcetokens";
|
|
53131
52105
|
QuerySuggestionResource["Transactions"] = "transactions";
|
|
53132
52106
|
QuerySuggestionResource["TransactionLogs"] = "transactionlogs";
|
|
53133
|
-
QuerySuggestionResource["AnalyticsProperties"] = "analyticsproperties";
|
|
53134
52107
|
QuerySuggestionResource["DedicatedDatabases"] = "dedicateddatabases";
|
|
53135
52108
|
QuerySuggestionResource["DedicatedDatabaseConfigs"] = "dedicateddatabaseconfigs";
|
|
53136
52109
|
QuerySuggestionResource["DedicatedDatabaseRuntimes"] = "dedicateddatabaseruntimes";
|
|
@@ -53571,8 +52544,6 @@
|
|
|
53571
52544
|
ProjectKeyScopes["Oauth2Read"] = "oauth2.read";
|
|
53572
52545
|
ProjectKeyScopes["Oauth2Write"] = "oauth2.write";
|
|
53573
52546
|
ProjectKeyScopes["Oauth2Introspect"] = "oauth2.introspect";
|
|
53574
|
-
ProjectKeyScopes["AnalyticsRead"] = "analytics.read";
|
|
53575
|
-
ProjectKeyScopes["AnalyticsWrite"] = "analytics.write";
|
|
53576
52547
|
})(exports.ProjectKeyScopes || (exports.ProjectKeyScopes = {}));
|
|
53577
52548
|
|
|
53578
52549
|
exports.FunctionTemplateUseCase = void 0;
|
|
@@ -54207,9 +53178,6 @@
|
|
|
54207
53178
|
|
|
54208
53179
|
exports.UsageEventMetric = void 0;
|
|
54209
53180
|
(function (UsageEventMetric) {
|
|
54210
|
-
UsageEventMetric["AnalyticsEvents"] = "analytics.events";
|
|
54211
|
-
UsageEventMetric["AnalyticsPageviews"] = "analytics.pageviews";
|
|
54212
|
-
UsageEventMetric["AnalyticsBotsEvents"] = "analytics.bots.events";
|
|
54213
53181
|
UsageEventMetric["NetworkRequests"] = "network.requests";
|
|
54214
53182
|
UsageEventMetric["NetworkInbound"] = "network.inbound";
|
|
54215
53183
|
UsageEventMetric["NetworkOutbound"] = "network.outbound";
|
|
@@ -54327,7 +53295,6 @@
|
|
|
54327
53295
|
|
|
54328
53296
|
exports.UsageGaugeMetric = void 0;
|
|
54329
53297
|
(function (UsageGaugeMetric) {
|
|
54330
|
-
UsageGaugeMetric["AnalyticsProperties"] = "analytics.properties";
|
|
54331
53298
|
UsageGaugeMetric["Teams"] = "teams";
|
|
54332
53299
|
UsageGaugeMetric["Users"] = "users";
|
|
54333
53300
|
UsageGaugeMetric["Messages"] = "messages";
|
|
@@ -54603,7 +53570,6 @@
|
|
|
54603
53570
|
(function (ProxyRuleDeploymentResourceType) {
|
|
54604
53571
|
ProxyRuleDeploymentResourceType["Function"] = "function";
|
|
54605
53572
|
ProxyRuleDeploymentResourceType["Site"] = "site";
|
|
54606
|
-
ProxyRuleDeploymentResourceType["DedicatedDatabase"] = "dedicatedDatabase";
|
|
54607
53573
|
})(exports.ProxyRuleDeploymentResourceType || (exports.ProxyRuleDeploymentResourceType = {}));
|
|
54608
53574
|
|
|
54609
53575
|
exports.ProxyRuleStatus = void 0;
|
|
@@ -56685,8 +55651,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
56685
55651
|
exports.Activities = Activities;
|
|
56686
55652
|
exports.Advisor = Advisor;
|
|
56687
55653
|
exports.Affiliates = Affiliates;
|
|
56688
|
-
exports.Analytics = Analytics;
|
|
56689
|
-
exports.AnalyticsTracking = AnalyticsTracking;
|
|
56690
55654
|
exports.Apps = Apps;
|
|
56691
55655
|
exports.AppwriteException = AppwriteException;
|
|
56692
55656
|
exports.Assistant = Assistant;
|