glitch-javascript-sdk 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +374 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Scheduler.d.ts +10 -0
- package/dist/esm/api/WebsiteAnalytics.d.ts +187 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +374 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/WebsiteAnalyticsRoute.d.ts +7 -0
- package/dist/esm/util/Session.d.ts +8 -0
- package/dist/index.d.ts +204 -0
- package/package.json +2 -1
- package/src/api/Scheduler.ts +13 -0
- package/src/api/WebsiteAnalytics.ts +308 -0
- package/src/api/index.ts +3 -1
- package/src/index.ts +3 -1
- package/src/routes/SchedulerRoute.ts +1 -0
- package/src/routes/WebsiteAnalyticsRoute.ts +69 -0
- package/src/util/Session.ts +92 -4
package/dist/cjs/index.js
CHANGED
|
@@ -25352,6 +25352,7 @@ var SchedulerRoute = /** @class */ (function () {
|
|
|
25352
25352
|
getSchedulePosts: { url: '/schedulers/{scheduler_id}/posts', method: HTTP_METHODS.GET },
|
|
25353
25353
|
// Title Update Routes
|
|
25354
25354
|
listUpdates: { url: '/schedulers/{scheduler_id}/updates', method: HTTP_METHODS.GET },
|
|
25355
|
+
searchUpdates: { url: '/schedulers/{scheduler_id}/updates/search', method: HTTP_METHODS.GET },
|
|
25355
25356
|
createUpdate: { url: '/schedulers/{scheduler_id}/updates', method: HTTP_METHODS.POST },
|
|
25356
25357
|
getUpdate: { url: '/schedulers/{scheduler_id}/updates/{update_id}', method: HTTP_METHODS.GET },
|
|
25357
25358
|
updateUpdate: { url: '/schedulers/{scheduler_id}/updates/{update_id}', method: HTTP_METHODS.PUT },
|
|
@@ -25537,6 +25538,18 @@ var Scheduler = /** @class */ (function () {
|
|
|
25537
25538
|
Scheduler.listUpdates = function (scheduler_id, params) {
|
|
25538
25539
|
return Requests.processRoute(SchedulerRoute.routes.listUpdates, {}, { scheduler_id: scheduler_id }, params);
|
|
25539
25540
|
};
|
|
25541
|
+
/**
|
|
25542
|
+
* Search the updates related to a promotion schedule.
|
|
25543
|
+
*
|
|
25544
|
+
* @see https://api.glitch.fun/api/documentation#/Scheduler/searchTitleUpdates
|
|
25545
|
+
*
|
|
25546
|
+
* @param scheduler_id The ID of the promotion schedule.
|
|
25547
|
+
*
|
|
25548
|
+
* @returns promise
|
|
25549
|
+
*/
|
|
25550
|
+
Scheduler.searchUpdates = function (scheduler_id, params) {
|
|
25551
|
+
return Requests.processRoute(SchedulerRoute.routes.listUpdates, {}, { scheduler_id: scheduler_id }, params);
|
|
25552
|
+
};
|
|
25540
25553
|
/**
|
|
25541
25554
|
* Create a new title update for a promotion schedule.
|
|
25542
25555
|
*
|
|
@@ -26157,6 +26170,292 @@ var Hashtags = /** @class */ (function () {
|
|
|
26157
26170
|
return Hashtags;
|
|
26158
26171
|
}());
|
|
26159
26172
|
|
|
26173
|
+
var WebsiteAnalyticsRoute = /** @class */ (function () {
|
|
26174
|
+
function WebsiteAnalyticsRoute() {
|
|
26175
|
+
}
|
|
26176
|
+
WebsiteAnalyticsRoute.routes = {
|
|
26177
|
+
listSessions: {
|
|
26178
|
+
url: '/analytics/sessions',
|
|
26179
|
+
method: HTTP_METHODS.GET
|
|
26180
|
+
},
|
|
26181
|
+
listPageviews: {
|
|
26182
|
+
url: '/analytics/pageviews',
|
|
26183
|
+
method: HTTP_METHODS.GET
|
|
26184
|
+
},
|
|
26185
|
+
listEvents: {
|
|
26186
|
+
url: '/analytics/events',
|
|
26187
|
+
method: HTTP_METHODS.GET
|
|
26188
|
+
},
|
|
26189
|
+
overview: {
|
|
26190
|
+
url: '/analytics/overview',
|
|
26191
|
+
method: HTTP_METHODS.GET
|
|
26192
|
+
},
|
|
26193
|
+
collect: {
|
|
26194
|
+
url: '/analytics/collect',
|
|
26195
|
+
method: HTTP_METHODS.POST
|
|
26196
|
+
},
|
|
26197
|
+
sessionsAverage: {
|
|
26198
|
+
url: '/analytics/sessions/average',
|
|
26199
|
+
method: HTTP_METHODS.GET
|
|
26200
|
+
},
|
|
26201
|
+
sessionsHistogram: {
|
|
26202
|
+
url: '/analytics/sessions/histogram',
|
|
26203
|
+
method: HTTP_METHODS.GET
|
|
26204
|
+
},
|
|
26205
|
+
pageviewsOverTime: {
|
|
26206
|
+
url: '/analytics/pageviews/over-time',
|
|
26207
|
+
method: HTTP_METHODS.GET
|
|
26208
|
+
},
|
|
26209
|
+
topPages: {
|
|
26210
|
+
url: '/analytics/pageviews/top-pages',
|
|
26211
|
+
method: HTTP_METHODS.GET
|
|
26212
|
+
},
|
|
26213
|
+
eventsSummary: {
|
|
26214
|
+
url: '/analytics/events/summary',
|
|
26215
|
+
method: HTTP_METHODS.GET
|
|
26216
|
+
},
|
|
26217
|
+
popularEvents: {
|
|
26218
|
+
url: '/analytics/events/popular',
|
|
26219
|
+
method: HTTP_METHODS.GET
|
|
26220
|
+
},
|
|
26221
|
+
geoDistribution: {
|
|
26222
|
+
url: '/analytics/geo-distribution',
|
|
26223
|
+
method: HTTP_METHODS.GET
|
|
26224
|
+
},
|
|
26225
|
+
deviceBreakdown: {
|
|
26226
|
+
url: '/analytics/device-breakdown',
|
|
26227
|
+
method: HTTP_METHODS.GET
|
|
26228
|
+
},
|
|
26229
|
+
referrers: {
|
|
26230
|
+
url: '/analytics/referrers',
|
|
26231
|
+
method: HTTP_METHODS.GET
|
|
26232
|
+
},
|
|
26233
|
+
utmPerformance: {
|
|
26234
|
+
url: '/analytics/utm-performance',
|
|
26235
|
+
method: HTTP_METHODS.GET
|
|
26236
|
+
}
|
|
26237
|
+
};
|
|
26238
|
+
return WebsiteAnalyticsRoute;
|
|
26239
|
+
}());
|
|
26240
|
+
|
|
26241
|
+
var WebsiteAnalytics = /** @class */ (function () {
|
|
26242
|
+
function WebsiteAnalytics() {
|
|
26243
|
+
}
|
|
26244
|
+
/**
|
|
26245
|
+
* List website analytics sessions with comprehensive filtering
|
|
26246
|
+
*
|
|
26247
|
+
* @param params Filtering options:
|
|
26248
|
+
* - title_id?: string - Filter by title ID
|
|
26249
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26250
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26251
|
+
* - device_type?: 'desktop'|'mobile'|'tablet'|'bot'|'other'
|
|
26252
|
+
* - country_code?: string - 2-letter country code
|
|
26253
|
+
* - is_bot?: boolean - Filter by bot status
|
|
26254
|
+
* - sort?: 'started_at'|'total_duration'|'pageview_count' - Sort field
|
|
26255
|
+
* - order?: 'asc'|'desc' - Sort order
|
|
26256
|
+
* - per_page?: number - Items per page (max 100)
|
|
26257
|
+
* @returns Promise with paginated sessions data
|
|
26258
|
+
*/
|
|
26259
|
+
WebsiteAnalytics.listSessions = function (params) {
|
|
26260
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.listSessions, {}, undefined, params);
|
|
26261
|
+
};
|
|
26262
|
+
/**
|
|
26263
|
+
* Get a paginated list of pageviews with filtering options
|
|
26264
|
+
*
|
|
26265
|
+
* @param params Filtering options:
|
|
26266
|
+
* - title_id?: string - Filter by title ID
|
|
26267
|
+
* - analytics_session_id?: string - Filter by session ID
|
|
26268
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26269
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26270
|
+
* - is_exit?: boolean - Filter by exit pageviews
|
|
26271
|
+
* - sort?: 'occurred_at'|'load_time_ms'|'dom_complete_ms' - Sort field
|
|
26272
|
+
* - order?: 'asc'|'desc' - Sort order
|
|
26273
|
+
* - per_page?: number - Items per page (max 100)
|
|
26274
|
+
* @returns Promise with paginated pageviews data
|
|
26275
|
+
*/
|
|
26276
|
+
WebsiteAnalytics.listPageviews = function (params) {
|
|
26277
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.listPageviews, {}, undefined, params);
|
|
26278
|
+
};
|
|
26279
|
+
/**
|
|
26280
|
+
* Get a paginated list of events with filtering options
|
|
26281
|
+
*
|
|
26282
|
+
* @param params Filtering options:
|
|
26283
|
+
* - title_id?: string - Filter by title ID
|
|
26284
|
+
* - analytics_session_id?: string - Filter by session ID
|
|
26285
|
+
* - event_name?: string - Filter by event name
|
|
26286
|
+
* - event_category?: string - Filter by event category
|
|
26287
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26288
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26289
|
+
* - sort?: 'occurred_at'|'event_name' - Sort field
|
|
26290
|
+
* - order?: 'asc'|'desc' - Sort order
|
|
26291
|
+
* - per_page?: number - Items per page (max 100)
|
|
26292
|
+
* @returns Promise with paginated events data
|
|
26293
|
+
*/
|
|
26294
|
+
WebsiteAnalytics.listEvents = function (params) {
|
|
26295
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.listEvents, {}, undefined, params);
|
|
26296
|
+
};
|
|
26297
|
+
/**
|
|
26298
|
+
* Get an analytics overview with summarized metrics
|
|
26299
|
+
*
|
|
26300
|
+
* @param params Overview options:
|
|
26301
|
+
* - title_id: string - Required title ID
|
|
26302
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26303
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26304
|
+
* - group_by?: 'day'|'week'|'month'|'year' - Grouping period
|
|
26305
|
+
* - include_breakdowns?: boolean - Include detailed breakdowns
|
|
26306
|
+
* @returns Promise with overview data
|
|
26307
|
+
*/
|
|
26308
|
+
WebsiteAnalytics.overview = function (params) {
|
|
26309
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.overview, {}, undefined, params);
|
|
26310
|
+
};
|
|
26311
|
+
/**
|
|
26312
|
+
* Single ingestion endpoint for sessions, pageviews and events
|
|
26313
|
+
*
|
|
26314
|
+
* @param data Analytics data payload with type property:
|
|
26315
|
+
* - type: 'session'|'pageview'|'event' - Type of analytics data
|
|
26316
|
+
* - title_id: string - Title ID
|
|
26317
|
+
* - tracking_token: string - HMAC token for verification
|
|
26318
|
+
* - plus type-specific fields
|
|
26319
|
+
* @returns Promise with acceptance response
|
|
26320
|
+
*/
|
|
26321
|
+
WebsiteAnalytics.collect = function (data) {
|
|
26322
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.collect, data);
|
|
26323
|
+
};
|
|
26324
|
+
/**
|
|
26325
|
+
* Get average session length data with optional grouping
|
|
26326
|
+
*
|
|
26327
|
+
* @param params Filtering options:
|
|
26328
|
+
* - title_id?: string - Filter by title ID
|
|
26329
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26330
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26331
|
+
* - group_by?: 'day'|'week'|'month' - Grouping period
|
|
26332
|
+
* - device_type?: string - Filter by device type
|
|
26333
|
+
* - country_code?: string - Filter by country
|
|
26334
|
+
* @returns Promise with average session data
|
|
26335
|
+
*/
|
|
26336
|
+
WebsiteAnalytics.sessionsAverage = function (params) {
|
|
26337
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.sessionsAverage, {}, undefined, params);
|
|
26338
|
+
};
|
|
26339
|
+
/**
|
|
26340
|
+
* Get session duration histogram data
|
|
26341
|
+
*
|
|
26342
|
+
* @param params Filtering options:
|
|
26343
|
+
* - title_id?: string - Filter by title ID
|
|
26344
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26345
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26346
|
+
* - bucket_size?: number - Duration bucket size in seconds
|
|
26347
|
+
* @returns Promise with histogram data
|
|
26348
|
+
*/
|
|
26349
|
+
WebsiteAnalytics.sessionsHistogram = function (params) {
|
|
26350
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.sessionsHistogram, {}, undefined, params);
|
|
26351
|
+
};
|
|
26352
|
+
/**
|
|
26353
|
+
* Get pageviews over time with optional grouping
|
|
26354
|
+
*
|
|
26355
|
+
* @param params Filtering options:
|
|
26356
|
+
* - title_id?: string - Filter by title ID
|
|
26357
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26358
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26359
|
+
* - group_by?: 'hour'|'day'|'week'|'month' - Grouping period
|
|
26360
|
+
* - path?: string - Filter by specific path
|
|
26361
|
+
* @returns Promise with pageviews over time data
|
|
26362
|
+
*/
|
|
26363
|
+
WebsiteAnalytics.pageviewsOverTime = function (params) {
|
|
26364
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.pageviewsOverTime, {}, undefined, params);
|
|
26365
|
+
};
|
|
26366
|
+
/**
|
|
26367
|
+
* Get top pages by views
|
|
26368
|
+
*
|
|
26369
|
+
* @param params Filtering options:
|
|
26370
|
+
* - title_id?: string - Filter by title ID
|
|
26371
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26372
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26373
|
+
* - limit?: number - Number of top pages to return
|
|
26374
|
+
* @returns Promise with top pages data
|
|
26375
|
+
*/
|
|
26376
|
+
WebsiteAnalytics.topPages = function (params) {
|
|
26377
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.topPages, {}, undefined, params);
|
|
26378
|
+
};
|
|
26379
|
+
/**
|
|
26380
|
+
* Get summary of events
|
|
26381
|
+
*
|
|
26382
|
+
* @param params Filtering options:
|
|
26383
|
+
* - title_id?: string - Filter by title ID
|
|
26384
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26385
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26386
|
+
* - event_category?: string - Filter by event category
|
|
26387
|
+
* @returns Promise with events summary data
|
|
26388
|
+
*/
|
|
26389
|
+
WebsiteAnalytics.eventsSummary = function (params) {
|
|
26390
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.eventsSummary, {}, undefined, params);
|
|
26391
|
+
};
|
|
26392
|
+
/**
|
|
26393
|
+
* Get most popular events
|
|
26394
|
+
*
|
|
26395
|
+
* @param params Filtering options:
|
|
26396
|
+
* - title_id?: string - Filter by title ID
|
|
26397
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26398
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26399
|
+
* - limit?: number - Number of events to return
|
|
26400
|
+
* @returns Promise with popular events data
|
|
26401
|
+
*/
|
|
26402
|
+
WebsiteAnalytics.popularEvents = function (params) {
|
|
26403
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.popularEvents, {}, undefined, params);
|
|
26404
|
+
};
|
|
26405
|
+
/**
|
|
26406
|
+
* Get geographic distribution of visitors
|
|
26407
|
+
*
|
|
26408
|
+
* @param params Filtering options:
|
|
26409
|
+
* - title_id?: string - Filter by title ID
|
|
26410
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26411
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26412
|
+
* - limit?: number - Number of countries to return
|
|
26413
|
+
* @returns Promise with geo distribution data
|
|
26414
|
+
*/
|
|
26415
|
+
WebsiteAnalytics.geoDistribution = function (params) {
|
|
26416
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.geoDistribution, {}, undefined, params);
|
|
26417
|
+
};
|
|
26418
|
+
/**
|
|
26419
|
+
* Get device type breakdown
|
|
26420
|
+
*
|
|
26421
|
+
* @param params Filtering options:
|
|
26422
|
+
* - title_id?: string - Filter by title ID
|
|
26423
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26424
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26425
|
+
* @returns Promise with device breakdown data
|
|
26426
|
+
*/
|
|
26427
|
+
WebsiteAnalytics.deviceBreakdown = function (params) {
|
|
26428
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.deviceBreakdown, {}, undefined, params);
|
|
26429
|
+
};
|
|
26430
|
+
/**
|
|
26431
|
+
* Get top referrers
|
|
26432
|
+
*
|
|
26433
|
+
* @param params Filtering options:
|
|
26434
|
+
* - title_id?: string - Filter by title ID
|
|
26435
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26436
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26437
|
+
* - limit?: number - Number of referrers to return
|
|
26438
|
+
* @returns Promise with referrers data
|
|
26439
|
+
*/
|
|
26440
|
+
WebsiteAnalytics.referrers = function (params) {
|
|
26441
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.referrers, {}, undefined, params);
|
|
26442
|
+
};
|
|
26443
|
+
/**
|
|
26444
|
+
* Get UTM campaign performance
|
|
26445
|
+
*
|
|
26446
|
+
* @param params Filtering options:
|
|
26447
|
+
* - title_id?: string - Filter by title ID
|
|
26448
|
+
* - start_date?: string - Start date (YYYY-MM-DD)
|
|
26449
|
+
* - end_date?: string - End date (YYYY-MM-DD)
|
|
26450
|
+
* - group_by?: 'source'|'medium'|'campaign' - Grouping field
|
|
26451
|
+
* @returns Promise with UTM performance data
|
|
26452
|
+
*/
|
|
26453
|
+
WebsiteAnalytics.utmPerformance = function (params) {
|
|
26454
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.utmPerformance, {}, undefined, params);
|
|
26455
|
+
};
|
|
26456
|
+
return WebsiteAnalytics;
|
|
26457
|
+
}());
|
|
26458
|
+
|
|
26160
26459
|
var Parser = /** @class */ (function () {
|
|
26161
26460
|
function Parser() {
|
|
26162
26461
|
}
|
|
@@ -26180,6 +26479,54 @@ var Parser = /** @class */ (function () {
|
|
|
26180
26479
|
return Parser;
|
|
26181
26480
|
}());
|
|
26182
26481
|
|
|
26482
|
+
// Browser implementation using crypto-js
|
|
26483
|
+
var BrowserCrypto = /** @class */ (function () {
|
|
26484
|
+
function BrowserCrypto() {
|
|
26485
|
+
}
|
|
26486
|
+
BrowserCrypto.prototype.createHmac = function (algorithm, secret) {
|
|
26487
|
+
var CryptoJS = require('crypto-js');
|
|
26488
|
+
var data = '';
|
|
26489
|
+
var hmac = {
|
|
26490
|
+
update: function (updateData) {
|
|
26491
|
+
data = updateData;
|
|
26492
|
+
return hmac;
|
|
26493
|
+
},
|
|
26494
|
+
digest: function (encoding) {
|
|
26495
|
+
if (encoding !== 'hex') {
|
|
26496
|
+
throw new Error('Only hex encoding is supported in browser implementation');
|
|
26497
|
+
}
|
|
26498
|
+
return CryptoJS.HmacSHA256(data, secret).toString(CryptoJS.enc.Hex);
|
|
26499
|
+
}
|
|
26500
|
+
};
|
|
26501
|
+
return hmac;
|
|
26502
|
+
};
|
|
26503
|
+
return BrowserCrypto;
|
|
26504
|
+
}());
|
|
26505
|
+
// Node.js implementation using native crypto
|
|
26506
|
+
var NodeCrypto = /** @class */ (function () {
|
|
26507
|
+
function NodeCrypto() {
|
|
26508
|
+
this.crypto = require('crypto');
|
|
26509
|
+
}
|
|
26510
|
+
NodeCrypto.prototype.createHmac = function (algorithm, secret) {
|
|
26511
|
+
return this.crypto.createHmac(algorithm, secret);
|
|
26512
|
+
};
|
|
26513
|
+
return NodeCrypto;
|
|
26514
|
+
}());
|
|
26515
|
+
// Determine which crypto implementation to use
|
|
26516
|
+
var getCrypto = function () {
|
|
26517
|
+
try {
|
|
26518
|
+
// Check if we're in Node.js environment
|
|
26519
|
+
if (typeof process !== 'undefined' && process.versions && process.versions.node) {
|
|
26520
|
+
return new NodeCrypto();
|
|
26521
|
+
}
|
|
26522
|
+
// Fall back to browser implementation
|
|
26523
|
+
return new BrowserCrypto();
|
|
26524
|
+
}
|
|
26525
|
+
catch (e) {
|
|
26526
|
+
return new BrowserCrypto();
|
|
26527
|
+
}
|
|
26528
|
+
};
|
|
26529
|
+
var crypto = getCrypto();
|
|
26183
26530
|
var Session = /** @class */ (function () {
|
|
26184
26531
|
function Session() {
|
|
26185
26532
|
}
|
|
@@ -26226,6 +26573,31 @@ var Session = /** @class */ (function () {
|
|
|
26226
26573
|
Storage.set(Session._email_key, data.email);
|
|
26227
26574
|
Config.setAuthToken(data.token.access_token);
|
|
26228
26575
|
};
|
|
26576
|
+
/**
|
|
26577
|
+
* Generate a tracking token for analytics collection
|
|
26578
|
+
* @param titleId The title ID to generate token for
|
|
26579
|
+
* @param secret The secret key (should match server config)
|
|
26580
|
+
* @returns HMAC-SHA256 token
|
|
26581
|
+
* @throws Error if crypto operations fail
|
|
26582
|
+
*/
|
|
26583
|
+
Session.generateTrackingToken = function (titleId, secret) {
|
|
26584
|
+
try {
|
|
26585
|
+
if (!titleId) {
|
|
26586
|
+
throw new Error('titleId is required');
|
|
26587
|
+
}
|
|
26588
|
+
if (!secret) {
|
|
26589
|
+
throw new Error('secret is required');
|
|
26590
|
+
}
|
|
26591
|
+
return crypto
|
|
26592
|
+
.createHmac('sha256', secret)
|
|
26593
|
+
.update(titleId)
|
|
26594
|
+
.digest('hex');
|
|
26595
|
+
}
|
|
26596
|
+
catch (error) {
|
|
26597
|
+
console.error('Failed to generate tracking token:', error);
|
|
26598
|
+
throw new Error('Failed to generate tracking token');
|
|
26599
|
+
}
|
|
26600
|
+
};
|
|
26229
26601
|
Session._id_key = 'user_id';
|
|
26230
26602
|
Session._first_name_key = 'user_first_name';
|
|
26231
26603
|
Session._last_name_key = 'user_last_name';
|
|
@@ -26586,7 +26958,8 @@ var Glitch = /** @class */ (function () {
|
|
|
26586
26958
|
Media: Media,
|
|
26587
26959
|
Scheduler: Scheduler,
|
|
26588
26960
|
Funnel: Funnel,
|
|
26589
|
-
SocialStats: SocialStats
|
|
26961
|
+
SocialStats: SocialStats,
|
|
26962
|
+
WebsiteAnalytics: WebsiteAnalytics
|
|
26590
26963
|
};
|
|
26591
26964
|
Glitch.util = {
|
|
26592
26965
|
Requests: Requests,
|