From f161fcf150ac0a19ada74ffadb972ff529aae061 Mon Sep 17 00:00:00 2001 From: Andrey Polischuk Date: Wed, 14 Aug 2024 17:56:02 +0300 Subject: [PATCH] chore: docs, size limit --- .size-limit.json | 12 ++++++++++++ README.md | 3 +++ packages/top-100/index.ts | 8 ++++++++ packages/yandex-metrica/index.ts | 8 +++++++- yarn.lock | 5 +++++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.size-limit.json b/.size-limit.json index d68bbdd..811aca6 100644 --- a/.size-limit.json +++ b/.size-limit.json @@ -15,8 +15,20 @@ "path": "packages/session-storage/dist/index.js", "limit": "290 B" }, + { + "path": "packages/tns-counter/dist/index.js", + "limit": "450 B" + }, + { + "path": "packages/top-100/dist/index.js", + "limit": "4.1 KB" + }, { "path": "packages/url/dist/index.js", "limit": "675 B" + }, + { + "path": "packages/yandex-metrica/dist/index.js", + "limit": "4.0 B" } ] diff --git a/README.md b/README.md index c74b522..c52f00d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,10 @@ Common utils used by Rambler team - [@rambler-tech/lhci-report](packages/lhci-report) - [@rambler-tech/local-storage](packages/local-storage) - [@rambler-tech/session-storage](packages/session-storage) +- [@rambler-tech/tns-counter](packages/tns-counter) +- [@rambler-tech/top-100](packages/top-100) - [@rambler-tech/url](packages/url) +- [@rambler-tech/yandex-metrica](packages/yandex-metrica) ## Contributing diff --git a/packages/top-100/index.ts b/packages/top-100/index.ts index a847b79..8a8eecb 100644 --- a/packages/top-100/index.ts +++ b/packages/top-100/index.ts @@ -11,8 +11,12 @@ export interface Top100Options { params?: Record } +/** Top 100 counter */ export class Top100 { + /** Counter options */ options: Top100Options + + /** Promise that resolves when counter is ready */ ready: Promise constructor(options: Top100Options) { @@ -84,18 +88,22 @@ export class Top100 { } catch {} } + /** Send custom vars */ async sendCustomVars(params: Record) { await this.run('sendCustomVars', params) } + /** Track page view */ async trackPageview() { await this.run('trackPageview') } + /** Track event */ async trackEvent(eventName: string, eventData: Record) { await this.run('trackEvent', eventName, eventData) } + /** Update counter options */ async updateOptions(options: Record) { await this.run('updateOptions', options) } diff --git a/packages/yandex-metrica/index.ts b/packages/yandex-metrica/index.ts index b63e69c..4ef971e 100644 --- a/packages/yandex-metrica/index.ts +++ b/packages/yandex-metrica/index.ts @@ -19,9 +19,12 @@ export interface YandexMetricaOptions { params?: Record } -/** Yandex Metrica */ +/** Yandex Metrica counter */ export class YandexMetrica { + /** Counter options */ options: YandexMetricaOptions + + /** Promise that resolves when counter is ready */ ready: Promise constructor(options: YandexMetricaOptions) { @@ -74,14 +77,17 @@ export class YandexMetrica { } catch {} } + /** Track hit */ async hit(params: Record) { await this.run('hit', params) } + /** Set params */ async setParams(params: Record) { await this.run('params', params) } + /** Reach goal */ async reachGoal(...args: any[]) { await this.run('reachGoal', ...args) } diff --git a/yarn.lock b/yarn.lock index 21bea1b..7a7b0f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8760,6 +8760,11 @@ w3c-xmlserializer@^4.0.0: dependencies: xml-name-validator "^4.0.0" +wait-for-target@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/wait-for-target/-/wait-for-target-0.3.0.tgz#1e2c2453e656dff3161ae1cdc1213fede7a235a4" + integrity sha512-PgcDZJbWRXxGb0Cm0YyufPq3Crx7ZfqAIQaxaJLOoJSiHKFtkH7wy4R5M9DZxBEnDCPJdTYyxTR+8+JzP8JlIg== + walker@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f"