@yametrica/core 0.0.2 → 0.1.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 +47 -0
- package/dist/e-commerce/actions.d.ts +15 -0
- package/dist/e-commerce/actions.d.ts.map +1 -0
- package/dist/e-commerce/actions.js +2 -0
- package/dist/e-commerce/actions.js.map +1 -0
- package/dist/e-commerce/client.d.ts +43 -0
- package/dist/e-commerce/client.d.ts.map +1 -0
- package/dist/e-commerce/client.js +2 -0
- package/dist/e-commerce/client.js.map +1 -0
- package/dist/{types.d.ts → e-commerce/types.d.ts} +2 -99
- package/dist/e-commerce/types.d.ts.map +1 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +1 -1
- package/dist/metrica/client.d.ts +32 -0
- package/dist/metrica/client.d.ts.map +1 -0
- package/dist/metrica/client.js +2 -0
- package/dist/metrica/client.js.map +1 -0
- package/dist/{methods.d.ts → metrica/methods.d.ts} +4 -4
- package/dist/metrica/methods.d.ts.map +1 -0
- package/dist/metrica/methods.js +2 -0
- package/dist/metrica/methods.js.map +1 -0
- package/dist/{script.d.ts → metrica/script.d.ts} +1 -1
- package/dist/metrica/script.d.ts.map +1 -0
- package/dist/metrica/script.js.map +1 -0
- package/dist/metrica/types.d.ts +83 -0
- package/dist/metrica/types.d.ts.map +1 -0
- package/dist/metrica/ym.js.map +1 -0
- package/package.json +5 -1
- package/dist/client.d.ts +0 -32
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -2
- package/dist/client.js.map +0 -1
- package/dist/e-commerce.d.ts +0 -72
- package/dist/e-commerce.d.ts.map +0 -1
- package/dist/e-commerce.js +0 -2
- package/dist/e-commerce.js.map +0 -1
- package/dist/methods.d.ts.map +0 -1
- package/dist/script.d.ts.map +0 -1
- package/dist/script.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/ym.js.map +0 -1
- /package/dist/{script.js → metrica/script.js} +0 -0
- /package/dist/{ym.js → metrica/ym.js} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @yametrica/core
|
|
2
|
+
|
|
3
|
+
Framework agnostic client for Yandex Metrica and e-Commerce
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
#npm
|
|
9
|
+
npm i @yametrica/core
|
|
10
|
+
|
|
11
|
+
#pnpm
|
|
12
|
+
pnpm i @yametrica/core
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
First, add metrica script tag to your html.
|
|
18
|
+
We provide helper function to generate metrica script tag:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { createYandexMetricaScript } from '@yametrica/core';
|
|
22
|
+
|
|
23
|
+
const script = document.createElement('script');
|
|
24
|
+
script.text = createYandexMetricaScript();
|
|
25
|
+
document.body.prepend(script);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
After the script is added to the page, you can use the client:
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { createYandexMetrica } from '@yametrica/core';
|
|
32
|
+
|
|
33
|
+
const metrica = createYandexMetrica({ clientID: "XXXXX" });
|
|
34
|
+
// you should explicitly init the counter with options
|
|
35
|
+
metrica.init({ clickmap: true, accurateTrackBounce:true });
|
|
36
|
+
|
|
37
|
+
metrica.hit('https://example.com');
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
There is also a separate client for e-Commerce
|
|
41
|
+
```typescript
|
|
42
|
+
import { createYandexECommerce } from '@yametrica/core';
|
|
43
|
+
|
|
44
|
+
const ecommerce = createYandexECommerce();
|
|
45
|
+
|
|
46
|
+
ecommerce.add({ products: [ /* ... */ ] });
|
|
47
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/e-commerce/actions.d.ts
|
|
2
|
+
declare const ECommerceAction: {
|
|
3
|
+
readonly impressions: "impressions";
|
|
4
|
+
readonly click: "click";
|
|
5
|
+
readonly detail: "detail";
|
|
6
|
+
readonly add: "add";
|
|
7
|
+
readonly remove: "remove";
|
|
8
|
+
readonly purchase: "purchase";
|
|
9
|
+
readonly promoView: "promoView";
|
|
10
|
+
readonly promoClick: "promoClick";
|
|
11
|
+
};
|
|
12
|
+
type ECommerceAction = (typeof ECommerceAction)[keyof typeof ECommerceAction];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ECommerceAction };
|
|
15
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","names":[],"sources":["../../src/e-commerce/actions.ts"],"mappings":";cAAa,eAAA;EAAA;;;;;;;;;KAWD,eAAA,WAA0B,eAAA,eAA8B,eAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","names":[],"sources":["../../src/e-commerce/actions.ts"],"sourcesContent":["export const ECommerceAction = {\r\n impressions: \"impressions\",\r\n click: \"click\",\r\n detail: \"detail\",\r\n add: \"add\",\r\n remove: \"remove\",\r\n purchase: \"purchase\",\r\n promoView: \"promoView\",\r\n promoClick: \"promoClick\",\r\n} as const;\r\n\r\nexport type ECommerceAction = (typeof ECommerceAction)[keyof typeof ECommerceAction];\r\n"],"mappings":"AAAA,MAAa,EAAkB,CAC3B,YAAa,cACb,MAAO,QACP,OAAQ,SACR,IAAK,MACL,OAAQ,SACR,SAAU,WACV,UAAW,YACX,WAAY,aACf"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ActionField, CurrencyCode, ProductField, PromoField } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/e-commerce/client.d.ts
|
|
4
|
+
type YandexECommerceParams = {
|
|
5
|
+
/** Enable console log on method calls @default false */debug?: boolean; /** Enable sending data to Yandex Metrica @default true */
|
|
6
|
+
enabled?: boolean; /** @default "RUB" */
|
|
7
|
+
defaultCurrencyCode?: CurrencyCode;
|
|
8
|
+
};
|
|
9
|
+
type YandexECommerce = {
|
|
10
|
+
impressions: (data: {
|
|
11
|
+
products: ProductField[];
|
|
12
|
+
}, currencyCode?: CurrencyCode) => void;
|
|
13
|
+
click: (data: {
|
|
14
|
+
products: ProductField[];
|
|
15
|
+
}, currencyCode?: CurrencyCode) => void;
|
|
16
|
+
detail: (data: {
|
|
17
|
+
products: ProductField[];
|
|
18
|
+
}, currencyCode?: CurrencyCode) => void;
|
|
19
|
+
add: (data: {
|
|
20
|
+
products: ProductField[];
|
|
21
|
+
}, currencyCode?: CurrencyCode) => void;
|
|
22
|
+
remove: (data: {
|
|
23
|
+
products: ProductField[];
|
|
24
|
+
}, currencyCode?: CurrencyCode) => void;
|
|
25
|
+
purchase: (data: {
|
|
26
|
+
actionField: ActionField;
|
|
27
|
+
products: ProductField[];
|
|
28
|
+
}, currencyCode?: CurrencyCode) => void;
|
|
29
|
+
promoView: (data: {
|
|
30
|
+
promotions: PromoField[];
|
|
31
|
+
}, currencyCode?: CurrencyCode) => void;
|
|
32
|
+
promoClick: (data: {
|
|
33
|
+
promotions: PromoField[];
|
|
34
|
+
}, currencyCode?: CurrencyCode) => void;
|
|
35
|
+
};
|
|
36
|
+
declare function createYandexECommerce({
|
|
37
|
+
debug,
|
|
38
|
+
enabled,
|
|
39
|
+
defaultCurrencyCode
|
|
40
|
+
}: YandexECommerceParams): YandexECommerce;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { YandexECommerce, YandexECommerceParams, createYandexECommerce };
|
|
43
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/e-commerce/client.ts"],"mappings":";;;KAGY,qBAAA;0DAER,KAAA,YAF6B;EAI7B,OAAA,YAEkC;EAAlC,mBAAA,GAAsB,YAAA;AAAA;AAAA,KAGd,eAAA;EACR,WAAA,GAAc,IAAA;IAAQ,QAAA,EAAU,YAAA;EAAA,GAAkB,YAAA,GAAe,YAAA;EACjE,KAAA,GAAQ,IAAA;IAAQ,QAAA,EAAU,YAAA;EAAA,GAAkB,YAAA,GAAe,YAAA;EAC3D,MAAA,GAAS,IAAA;IAAQ,QAAA,EAAU,YAAA;EAAA,GAAkB,YAAA,GAAe,YAAA;EAC5D,GAAA,GAAM,IAAA;IAAQ,QAAA,EAAU,YAAA;EAAA,GAAkB,YAAA,GAAe,YAAA;EACzD,MAAA,GAAS,IAAA;IAAQ,QAAA,EAAU,YAAA;EAAA,GAAkB,YAAA,GAAe,YAAA;EAC5D,QAAA,GAAW,IAAA;IAAQ,WAAA,EAAa,WAAA;IAAa,QAAA,EAAU,YAAA;EAAA,GAAkB,YAAA,GAAe,YAAA;EACxF,SAAA,GAAY,IAAA;IAAQ,UAAA,EAAY,UAAA;EAAA,GAAgB,YAAA,GAAe,YAAA;EAC/D,UAAA,GAAa,IAAA;IAAQ,UAAA,EAAY,UAAA;EAAA,GAAgB,YAAA,GAAe,YAAA;AAAA;AAAA,iBAGpD,qBAAA,CAAA;EACZ,KAAA;EACA,OAAA;EACA;AAAA,GACD,qBAAA,GAAwB,eAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e({debug:e=!1,enabled:t=!0,defaultCurrencyCode:n=`RUB`}){return new Proxy({},{get:(r,i)=>(...r)=>{window.dataLayer??=[];let a={ecommerce:{currencyCode:r[1]??n,[i]:r[0]}};e&&console.log(`[yandex-metrica] ecommerce ${i}`,a),t&&window.dataLayer.push(a)}})}export{e as createYandexECommerce};
|
|
2
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../src/e-commerce/client.ts"],"sourcesContent":["import type { ECommerceAction } from \"./actions\";\r\nimport type { ActionField, CurrencyCode, ProductField, PromoField } from \"./types\";\r\n\r\nexport type YandexECommerceParams = {\r\n /** Enable console log on method calls @default false */\r\n debug?: boolean;\r\n /** Enable sending data to Yandex Metrica @default true */\r\n enabled?: boolean;\r\n /** @default \"RUB\" */\r\n defaultCurrencyCode?: CurrencyCode;\r\n};\r\n\r\nexport type YandexECommerce = {\r\n impressions: (data: { products: ProductField[] }, currencyCode?: CurrencyCode) => void;\r\n click: (data: { products: ProductField[] }, currencyCode?: CurrencyCode) => void;\r\n detail: (data: { products: ProductField[] }, currencyCode?: CurrencyCode) => void;\r\n add: (data: { products: ProductField[] }, currencyCode?: CurrencyCode) => void;\r\n remove: (data: { products: ProductField[] }, currencyCode?: CurrencyCode) => void;\r\n purchase: (data: { actionField: ActionField; products: ProductField[] }, currencyCode?: CurrencyCode) => void;\r\n promoView: (data: { promotions: PromoField[] }, currencyCode?: CurrencyCode) => void;\r\n promoClick: (data: { promotions: PromoField[] }, currencyCode?: CurrencyCode) => void;\r\n};\r\n\r\nexport function createYandexECommerce({\r\n debug = false,\r\n enabled = true,\r\n defaultCurrencyCode = \"RUB\",\r\n}: YandexECommerceParams): YandexECommerce {\r\n return new Proxy({} as YandexECommerce, {\r\n get: (_, action: ECommerceAction) => {\r\n return (...args: Parameters<YandexECommerce[typeof action]>) => {\r\n window.dataLayer ??= [];\r\n\r\n const container = { ecommerce: { currencyCode: args[1] ?? defaultCurrencyCode, [action]: args[0] } };\r\n\r\n if (debug) console.log(`[yandex-metrica] ecommerce ${action}`, container);\r\n\r\n if (enabled) window.dataLayer.push(container);\r\n };\r\n },\r\n });\r\n}\r\n"],"mappings":"AAuBA,SAAgB,EAAsB,CAClC,QAAQ,GACR,UAAU,GACV,sBAAsB,OACiB,CACvC,OAAO,IAAI,MAAM,EAAE,CAAqB,CACpC,KAAM,EAAG,KACG,GAAG,IAAqD,CAC5D,OAAO,YAAc,EAAE,CAEvB,IAAM,EAAY,CAAE,UAAW,CAAE,aAAc,EAAK,IAAM,GAAsB,GAAS,EAAK,GAAI,CAAE,CAEhG,GAAO,QAAQ,IAAI,8BAA8B,IAAU,EAAU,CAErE,GAAS,OAAO,UAAU,KAAK,EAAU,EAGxD,CAAC"}
|
|
@@ -1,102 +1,5 @@
|
|
|
1
|
-
//#region src/types.d.ts
|
|
2
|
-
/** biome-ignore-all lint/suspicious/noExplicitAny: Who knows the spec? */
|
|
3
|
-
declare global {
|
|
4
|
-
interface Window {
|
|
5
|
-
ym: ((...args: any[]) => void) & {
|
|
6
|
-
a: any[];
|
|
7
|
-
l: number;
|
|
8
|
-
};
|
|
9
|
-
dataLayer: any[] | undefined;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
interface VisitParameters {
|
|
13
|
-
order_price?: number;
|
|
14
|
-
currency?: string;
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}
|
|
17
|
-
interface UserParameters {
|
|
18
|
-
UserID?: number;
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
}
|
|
21
|
-
/** @see https://yandex.ru/support/metrica/code/counter-initialize.html */
|
|
22
|
-
interface InitParameters {
|
|
23
|
-
/** Точный показатель отказов. Параметр может принимать значения: */
|
|
24
|
-
accurateTrackBounce?: boolean | number;
|
|
25
|
-
/** Признак записи содержимого iframe без счетчика в дочернем окне */
|
|
26
|
-
childIframe?: boolean;
|
|
27
|
-
/** Признак сбора данных для карты кликов */
|
|
28
|
-
clickmap?: boolean;
|
|
29
|
-
/** Признак отключения автоматической отправки данных при инициализации счетчика */
|
|
30
|
-
defer?: boolean;
|
|
31
|
-
/** Сбор данных электронной коммерции. */
|
|
32
|
-
ecommerce?: boolean | string;
|
|
33
|
-
/**
|
|
34
|
-
* Параметры визита, передаваемые во время инициализации счетчика.
|
|
35
|
-
*
|
|
36
|
-
* Для передачи параметров визита в произвольный момент времени используется метод params
|
|
37
|
-
*/
|
|
38
|
-
params?: VisitParameters | VisitParameters[];
|
|
39
|
-
/**
|
|
40
|
-
* Параметры посетителей сайта, передаваемые во время инициализации счетчика.
|
|
41
|
-
*
|
|
42
|
-
* Для передачи параметров посетителей в произвольный момент времени используется метод userParams
|
|
43
|
-
*/
|
|
44
|
-
userParams?: UserParameters;
|
|
45
|
-
/** Признак отслеживания изменений хеша в адресной строке браузера */
|
|
46
|
-
trackHash?: boolean;
|
|
47
|
-
/** Признак отслеживания переходов по внешним ссылкам */
|
|
48
|
-
trackLinks?: boolean;
|
|
49
|
-
/** Признак доверенного домена для записи содержимого дочернего окна iframe. Содержит адрес домена родительского окна */
|
|
50
|
-
trustedDomains?: string[];
|
|
51
|
-
/** Тип счетчика. Для РСЯ равен 1 */
|
|
52
|
-
type?: number;
|
|
53
|
-
/** Признак использования Вебвизора */
|
|
54
|
-
webvisor?: boolean;
|
|
55
|
-
/** Признак проверки готовности счетчика */
|
|
56
|
-
triggerEvent?: boolean;
|
|
57
|
-
/** Запись заголовков. Если в заголовках есть приватные данные, при инициализации счетчика укажите значение `false` */
|
|
58
|
-
sendTitle: boolean;
|
|
59
|
-
}
|
|
60
|
-
interface HitOptions<CTX> {
|
|
61
|
-
callback?: (this: CTX) => void;
|
|
62
|
-
ctx?: CTX;
|
|
63
|
-
params?: VisitParameters;
|
|
64
|
-
referer?: string;
|
|
65
|
-
title?: string;
|
|
66
|
-
}
|
|
67
|
-
interface People {
|
|
68
|
-
email?: string;
|
|
69
|
-
phone_number?: string;
|
|
70
|
-
first_name?: string;
|
|
71
|
-
last_name?: string;
|
|
72
|
-
yandex_cid?: number;
|
|
73
|
-
home_address?: {
|
|
74
|
-
street?: string;
|
|
75
|
-
city?: string;
|
|
76
|
-
region?: string;
|
|
77
|
-
postal_code?: number;
|
|
78
|
-
country?: string;
|
|
79
|
-
};
|
|
80
|
-
}
|
|
1
|
+
//#region src/e-commerce/types.d.ts
|
|
81
2
|
type CurrencyCode = "AUD" | "EUR" | "AZN" | "EUR" | "ALL" | "DZD" | "USD" | "XCD" | "AOA" | "EUR" | "XCD" | "SYP" | "ARS" | "AMD" | "AWG" | "AFN" | "BSD" | "BDT" | "BBD" | "BHD" | "BYR" | "BZD" | "EUR" | "XOF" | "BMD" | "BGN" | "BOB" | "BOV" | "USD" | "BAM" | "BWP" | "BRL" | "USD" | "USD" | "BND" | "XOF" | "BIF" | "BTN" | "INR" | "VUV" | "EUR" | "GBP" | "HUF" | "VEF" | "USD" | "VND" | "GMD" | "XAF" | "HTG" | "USD" | "GYD" | "GHS" | "EUR" | "GTQ" | "EUR" | "GNF" | "XOF" | "EUR" | "GBP" | "GIP" | "EUR" | "HNL" | "HKD" | "XCD" | "DKK" | "EUR" | "GEL" | "USD" | "DKK" | "GBP" | "DJF" | "XCD" | "DOP" | "EUR" | "EGP" | "ZMW" | "MAD" | "USD" | "ZWL" | "ILS" | "INR" | "IDR" | "JOD" | "IQD" | "IRR" | "EUR" | "ISK" | "EUR" | "EUR" | "YER" | "CVE" | "KZT" | "KYD" | "KHR" | "XAF" | "CAD" | "QAR" | "KES" | "EUR" | "AUD" | "CNY" | "AUD" | "COP" | "COU" | "KMF" | "CDF" | "XAF" | "KPW" | "CRC" | "XOF" | "CUC" | "CUP" | "KWD" | "KGS" | "ANG" | "LAK" | "EUR" | "LSL" | "ZAR" | "LRD" | "LBP" | "LYD" | "EUR" | "CHF" | "EUR" | "MUR" | "MRO" | "MGA" | "EUR" | "MOP" | "MKD" | "MWK" | "MYR" | "XOF" | "FKP" | "MVR" | "EUR" | "MAD" | "EUR" | "USD" | "XDR" | "MXN" | "MXV" | "USD" | "MZN" | "MDL" | "EUR" | "MNT" | "XCD" | "MMK" | "NAD" | "ZAR" | "AUD" | "NPR" | "XOF" | "NGN" | "NIO" | "NZD" | "NZD" | "XPF" | "NOK" | "NOK" | "AED" | "OMR" | "NOK" | "GBP" | "AUD" | "AUD" | "SHP" | "AUD" | "NZD" | "NZD" | "USD" | "PKR" | "USD" | "PAB" | "USD" | "PGK" | "PYG" | "PEN" | "PLN" | "EUR" | "USD" | "EUR" | "RUB" | "RWF" | "RON" | "SVC" | "USD" | "WST" | "EUR" | "STD" | "XCD" | "SAR" | "SZL" | "USD" | "SCR" | "EUR" | "EUR" | "EUR" | "XOF" | "XCD" | "XCD" | "RSD" | "SGD" | "ANG" | "XSU" | "EUR" | "EUR" | "SBD" | "SOS" | "XUA" | "SDG" | "SRD" | "ZAR" | "USD" | "USN" | "SLL" | "TJS" | "THB" | "TWD" | "TZS" | "XOF" | "NZD" | "TOP" | "TTD" | "AUD" | "TND" | "TMT" | "TRY" | "USD" | "UGX" | "UZS" | "UAH" | "XPF" | "UYI" | "UYU" | "DKK" | "FJD" | "PHP" | "EUR" | "EUR" | "XPF" | "EUR" | "HRK" | "XAF" | "XAF" | "EUR" | "CZK" | "CLF" | "CLP" | "CHE" | "CHF" | "CHW" | "SEK" | "LKR" | "USD" | "XAF" | "ERN" | "EUR" | "ETB" | "KRW" | "SSP" | "JMD" | "JPY";
|
|
82
|
-
type ECommerceActionType = "impressions" | "click" | "detail" | "add" | "remove" | "purchase" | "promoView" | "promoClick";
|
|
83
|
-
type ECommerceActionData = {
|
|
84
|
-
/** Список описаний товаров, с которыми было произведено указанное действие. */products?: Array<ProductField>; /** Список описаний рекламной кампании, с которой было произведено указанное действие */
|
|
85
|
-
promotions?: Array<PromoField>;
|
|
86
|
-
};
|
|
87
|
-
type ECommerceActionsData = { [Action in Exclude<ECommerceActionType, "purchase">]: { [Key in Action]: ECommerceActionData } } & {
|
|
88
|
-
purchase: {
|
|
89
|
-
purchase: ECommerceActionData & {
|
|
90
|
-
actionField: ActionField;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
type ECommerceActions = ECommerceActionsData[keyof ECommerceActionsData];
|
|
95
|
-
type ECommerceContainer = {
|
|
96
|
-
ecommerce: {
|
|
97
|
-
currencyCode: CurrencyCode;
|
|
98
|
-
} & ECommerceActions;
|
|
99
|
-
};
|
|
100
3
|
/**
|
|
101
4
|
* @see https://yandex.ru/support/metrica/ecommerce/data.html#about__action_data
|
|
102
5
|
*/
|
|
@@ -148,5 +51,5 @@ type PromoField = {
|
|
|
148
51
|
position?: string;
|
|
149
52
|
};
|
|
150
53
|
//#endregion
|
|
151
|
-
export { ActionField, CurrencyCode,
|
|
54
|
+
export { ActionField, CurrencyCode, ProductField, PromoField };
|
|
152
55
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/e-commerce/types.ts"],"mappings":";KAAY,YAAA;AAAZ;;;AAAA,KA8QY,WAAA;EA9QY,4BAgRpB,EAAA,UAFmB;EAInB,MAAA,WAJmB;EAMnB,OAAA;EACA,OAAA;AAAA;;KAIQ,YAAA;EAJD;AAIX;;;;EAMI,EAAA;EAMA;;;;;EAAA,IAAA,WAoBA;EAlBA,KAAA;EAsBA;;;;AAKJ;EArBI,QAAA;EAEA,MAAA,WAqBA;EAnBA,QAAA;EAuBA;;;;;EAjBA,IAAA;EAEA,QAAA;EAEA,KAAA;EAEA,QAAA;EAEA,OAAA;AAAA;AAAA,KAGQ,UAAA;qCAER,EAAA;EAEA,IAAA;EAEA,QAAA;EAEA,aAAA;EAEA,QAAA;AAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { YandexECommerce, YandexECommerceParams, createYandexECommerce } from "./e-commerce.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { ECommerceAction } from "./e-commerce/actions.js";
|
|
2
|
+
import { ActionField, CurrencyCode, ProductField, PromoField } from "./e-commerce/types.js";
|
|
3
|
+
import { YandexECommerce, YandexECommerceParams, createYandexECommerce } from "./e-commerce/client.js";
|
|
4
|
+
import { MetricaMethods } from "./metrica/methods.js";
|
|
5
|
+
import { HitOptions, InitParameters, People, UserParameters, VisitParameters } from "./metrica/types.js";
|
|
6
|
+
import { YandexMetrica, YandexMetricaParams, createYandexMetrica } from "./metrica/client.js";
|
|
7
|
+
import { createYandexMetricaNoscript, createYandexMetricaScript } from "./metrica/script.js";
|
|
8
|
+
export { ActionField, CurrencyCode, ECommerceAction, HitOptions, InitParameters, MetricaMethods, People, ProductField, PromoField, UserParameters, VisitParameters, YandexECommerce, YandexECommerceParams, YandexMetrica, YandexMetricaParams, createYandexECommerce, createYandexMetrica, createYandexMetricaNoscript, createYandexMetricaScript };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ECommerceAction as e}from"./e-commerce/actions.js";import{createYandexECommerce as t}from"./e-commerce/client.js";import{createYandexMetrica as n}from"./metrica/client.js";import{MetricaMethods as r}from"./metrica/methods.js";import{createYandexMetricaNoscript as i,createYandexMetricaScript as a}from"./metrica/script.js";export{e as ECommerceAction,r as MetricaMethods,t as createYandexECommerce,n as createYandexMetrica,i as createYandexMetricaNoscript,a as createYandexMetricaScript};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MetricaMethods } from "./methods.js";
|
|
2
|
+
import { HitOptions, InitParameters, People, UserParameters, VisitParameters } from "./types.js";
|
|
3
|
+
|
|
4
|
+
//#region src/metrica/client.d.ts
|
|
5
|
+
type YandexMetricaParams = {
|
|
6
|
+
clientID: string; /** Enable console log on method calls @default false */
|
|
7
|
+
debug?: boolean; /** Enable sending data to Yandex Metrica @default true */
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
type YandexMetrica = {
|
|
11
|
+
[MetricaMethods.Init]: (options?: Partial<InitParameters>) => void;
|
|
12
|
+
[MetricaMethods.AddFileExtension]: (extensions?: string | string[]) => void;
|
|
13
|
+
[MetricaMethods.ExtLink]: <CTX>(url: string, options?: Omit<HitOptions<CTX>, "referer">) => void;
|
|
14
|
+
[MetricaMethods.File]: <CTX>(url: string, options?: HitOptions<CTX>) => void;
|
|
15
|
+
[MetricaMethods.FirstPartyParams]: (people: People) => void;
|
|
16
|
+
[MetricaMethods.FirstPartyParamsHashed]: (people: People) => void;
|
|
17
|
+
[MetricaMethods.GetClientID]: (cb: (clientID: number) => void) => void;
|
|
18
|
+
[MetricaMethods.Hit]: <CTX>(url?: string, options?: HitOptions<CTX>) => void;
|
|
19
|
+
[MetricaMethods.NotBounce]: <CTX>(options?: Pick<HitOptions<CTX>, "ctx" | "callback">) => void;
|
|
20
|
+
[MetricaMethods.Params]: (params?: VisitParameters) => void;
|
|
21
|
+
[MetricaMethods.ReachGoal]: <CTX>(target: string, params?: VisitParameters, callback?: (this: CTX) => void, ctx?: CTX) => void;
|
|
22
|
+
[MetricaMethods.SetUserID]: (userId: string) => void;
|
|
23
|
+
[MetricaMethods.UserParams]: (params?: UserParameters) => void;
|
|
24
|
+
};
|
|
25
|
+
declare function createYandexMetrica({
|
|
26
|
+
clientID,
|
|
27
|
+
debug,
|
|
28
|
+
enabled
|
|
29
|
+
}: YandexMetricaParams): YandexMetrica;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { YandexMetrica, YandexMetricaParams, createYandexMetrica };
|
|
32
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/metrica/client.ts"],"mappings":";;;;KAIY,mBAAA;EACR,QAAA,UADQ;EAGR,KAAA;EAEA,OAAA;AAAA;AAAA,KAGQ,aAAA;EAAA,CACP,cAAA,CAAe,IAAA,IAAQ,OAAA,GAAU,OAAA,CAAQ,cAAA;EAAA,CACzC,cAAA,CAAe,gBAAA,IAAoB,UAAA;EAAA,CACnC,cAAA,CAAe,OAAA,SAAgB,GAAA,UAAa,OAAA,GAAU,IAAA,CAAK,UAAA,CAAW,GAAA;EAAA,CACtE,cAAA,CAAe,IAAA,SAAa,GAAA,UAAa,OAAA,GAAU,UAAA,CAAW,GAAA;EAAA,CAC9D,cAAA,CAAe,gBAAA,IAAoB,MAAA,EAAQ,MAAA;EAAA,CAC3C,cAAA,CAAe,sBAAA,IAA0B,MAAA,EAAQ,MAAA;EAAA,CACjD,cAAA,CAAe,WAAA,IAAe,EAAA,GAAK,QAAA;EAAA,CACnC,cAAA,CAAe,GAAA,SAAY,GAAA,WAAc,OAAA,GAAU,UAAA,CAAW,GAAA;EAAA,CAC9D,cAAA,CAAe,SAAA,SAAkB,OAAA,GAAU,IAAA,CAAK,UAAA,CAAW,GAAA;EAAA,CAC3D,cAAA,CAAe,MAAA,IAAU,MAAA,GAAS,eAAA;EAAA,CAClC,cAAA,CAAe,SAAA,SACZ,MAAA,UACA,MAAA,GAAS,eAAA,EACT,QAAA,IAAY,IAAA,EAAM,GAAA,WAClB,GAAA,GAAM,GAAA;EAAA,CAET,cAAA,CAAe,SAAA,IAAa,MAAA;EAAA,CAC5B,cAAA,CAAe,UAAA,IAAc,MAAA,GAAS,cAAA;AAAA;AAAA,iBAG3B,mBAAA,CAAA;EAAsB,QAAA;EAAU,KAAA;EAAe;AAAA,GAAkB,mBAAA,GAAsB,aAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../src/metrica/client.ts"],"sourcesContent":["import type { MetricaMethods } from \"./methods\";\r\nimport type { HitOptions, InitParameters, People, UserParameters, VisitParameters } from \"./types\";\r\nimport { ym } from \"./ym\";\r\n\r\nexport type YandexMetricaParams = {\r\n clientID: string;\r\n /** Enable console log on method calls @default false */\r\n debug?: boolean;\r\n /** Enable sending data to Yandex Metrica @default true */\r\n enabled?: boolean;\r\n};\r\n\r\nexport type YandexMetrica = {\r\n [MetricaMethods.Init]: (options?: Partial<InitParameters>) => void;\r\n [MetricaMethods.AddFileExtension]: (extensions?: string | string[]) => void;\r\n [MetricaMethods.ExtLink]: <CTX>(url: string, options?: Omit<HitOptions<CTX>, \"referer\">) => void;\r\n [MetricaMethods.File]: <CTX>(url: string, options?: HitOptions<CTX>) => void;\r\n [MetricaMethods.FirstPartyParams]: (people: People) => void;\r\n [MetricaMethods.FirstPartyParamsHashed]: (people: People) => void;\r\n [MetricaMethods.GetClientID]: (cb: (clientID: number) => void) => void;\r\n [MetricaMethods.Hit]: <CTX>(url?: string, options?: HitOptions<CTX>) => void;\r\n [MetricaMethods.NotBounce]: <CTX>(options?: Pick<HitOptions<CTX>, \"ctx\" | \"callback\">) => void;\r\n [MetricaMethods.Params]: (params?: VisitParameters) => void;\r\n [MetricaMethods.ReachGoal]: <CTX>(\r\n target: string,\r\n params?: VisitParameters,\r\n callback?: (this: CTX) => void,\r\n ctx?: CTX,\r\n ) => void;\r\n [MetricaMethods.SetUserID]: (userId: string) => void;\r\n [MetricaMethods.UserParams]: (params?: UserParameters) => void;\r\n};\r\n\r\nexport function createYandexMetrica({ clientID, debug = false, enabled = true }: YandexMetricaParams): YandexMetrica {\r\n return new Proxy({} as YandexMetrica, {\r\n get: (_, method: MetricaMethods) => {\r\n return (...args: unknown[]) => {\r\n if (debug) console.log(`[yandex-metrica] (${clientID}) ${method}:`, ...args);\r\n\r\n if (enabled) ym(clientID, method, ...args);\r\n };\r\n },\r\n });\r\n}\r\n"],"mappings":"6BAiCA,SAAgB,EAAoB,CAAE,WAAU,QAAQ,GAAO,UAAU,IAA4C,CACjH,OAAO,IAAI,MAAM,EAAE,CAAmB,CAClC,KAAM,EAAG,KACG,GAAG,IAAoB,CACvB,GAAO,QAAQ,IAAI,qBAAqB,EAAS,IAAI,EAAO,GAAI,GAAG,EAAK,CAExE,GAAS,EAAG,EAAU,EAAQ,GAAG,EAAK,EAGrD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
//#region src/methods.d.ts
|
|
2
|
-
declare const
|
|
1
|
+
//#region src/metrica/methods.d.ts
|
|
2
|
+
declare const MetricaMethods: {
|
|
3
3
|
readonly Init: "init";
|
|
4
4
|
readonly AddFileExtension: "addFileExtension";
|
|
5
5
|
readonly ExtLink: "extLink";
|
|
@@ -14,7 +14,7 @@ declare const Methods: {
|
|
|
14
14
|
readonly SetUserID: "setUserID";
|
|
15
15
|
readonly UserParams: "userParams";
|
|
16
16
|
};
|
|
17
|
-
type
|
|
17
|
+
type MetricaMethods = (typeof MetricaMethods)[keyof typeof MetricaMethods];
|
|
18
18
|
//#endregion
|
|
19
|
-
export {
|
|
19
|
+
export { MetricaMethods };
|
|
20
20
|
//# sourceMappingURL=methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.d.ts","names":[],"sources":["../../src/metrica/methods.ts"],"mappings":";cAAa,cAAA;EAAA;;;;;;;;;;;;;;KAgBD,cAAA,WAAyB,cAAA,eAA6B,cAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e={Init:`init`,AddFileExtension:`addFileExtension`,ExtLink:`extLink`,File:`file`,FirstPartyParams:`firstPartyParams`,FirstPartyParamsHashed:`firstPartyParamsHashed`,GetClientID:`getClientID`,Hit:`hit`,NotBounce:`notBounce`,Params:`params`,ReachGoal:`reachGoal`,SetUserID:`setUserID`,UserParams:`userParams`};export{e as MetricaMethods};
|
|
2
|
+
//# sourceMappingURL=methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.js","names":[],"sources":["../../src/metrica/methods.ts"],"sourcesContent":["export const MetricaMethods = {\r\n Init: \"init\",\r\n AddFileExtension: \"addFileExtension\",\r\n ExtLink: \"extLink\",\r\n File: \"file\",\r\n FirstPartyParams: \"firstPartyParams\",\r\n FirstPartyParamsHashed: \"firstPartyParamsHashed\",\r\n GetClientID: \"getClientID\",\r\n Hit: \"hit\",\r\n NotBounce: \"notBounce\",\r\n Params: \"params\",\r\n ReachGoal: \"reachGoal\",\r\n SetUserID: \"setUserID\",\r\n UserParams: \"userParams\",\r\n} as const;\r\n\r\nexport type MetricaMethods = (typeof MetricaMethods)[keyof typeof MetricaMethods];\r\n"],"mappings":"AAAA,MAAa,EAAiB,CAC1B,KAAM,OACN,iBAAkB,mBAClB,QAAS,UACT,KAAM,OACN,iBAAkB,mBAClB,uBAAwB,yBACxB,YAAa,cACb,IAAK,MACL,UAAW,YACX,OAAQ,SACR,UAAW,YACX,UAAW,YACX,WAAY,aACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script.d.ts","names":[],"sources":["../../src/metrica/script.ts"],"mappings":";;AAMA;;;;;iBAAgB,yBAAA,CAA0B,GAAA;;;;iBAY1B,2BAAA,CAA4B,QAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script.js","names":[],"sources":["../../src/metrica/script.ts"],"sourcesContent":["/** Create string for Yandex Metrica script tag\n *\n * Default src is https://mc.yandex.ru/metrika/tag.js\n *\n * You could also use a CDN version: https://cdn.jsdelivr.net/npm/yandex-metrica-watch/tag.js\n */\nexport function createYandexMetricaScript(src: string = \"https://mc.yandex.ru/metrika/tag.js\") {\n return `\n(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};\nm[i].l=1*new Date();\nfor (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}\nk=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})\n(window, document, \"script\", \"${src}\", \"ym\");`;\n}\n\n/**\n * Create inner html string for Yandex Metrica noscript tag\n */\nexport function createYandexMetricaNoscript(clientID: string) {\n return `<div><img src=\"https://mc.yandex.ru/watch/${clientID}\" style=\"position:absolute; left:-9999px;\" alt=\"\" /></div>`;\n}\n"],"mappings":"AAMA,SAAgB,EAA0B,EAAc,sCAAuC,CAC3F,MAAO;;;;;gCAKqB,EAAI,WAMpC,SAAgB,EAA4B,EAAkB,CAC1D,MAAO,6CAA6C,EAAS"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//#region src/metrica/types.d.ts
|
|
2
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: Who knows the spec? */
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
ym: ((...args: any[]) => void) & {
|
|
6
|
+
a: any[];
|
|
7
|
+
l: number;
|
|
8
|
+
};
|
|
9
|
+
dataLayer: any[] | undefined;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
interface VisitParameters {
|
|
13
|
+
order_price?: number;
|
|
14
|
+
currency?: string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
interface UserParameters {
|
|
18
|
+
UserID?: number;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
/** @see https://yandex.ru/support/metrica/code/counter-initialize.html */
|
|
22
|
+
interface InitParameters {
|
|
23
|
+
/** Точный показатель отказов. Параметр может принимать значения: */
|
|
24
|
+
accurateTrackBounce?: boolean | number;
|
|
25
|
+
/** Признак записи содержимого iframe без счетчика в дочернем окне */
|
|
26
|
+
childIframe?: boolean;
|
|
27
|
+
/** Признак сбора данных для карты кликов */
|
|
28
|
+
clickmap?: boolean;
|
|
29
|
+
/** Признак отключения автоматической отправки данных при инициализации счетчика */
|
|
30
|
+
defer?: boolean;
|
|
31
|
+
/** Сбор данных электронной коммерции. */
|
|
32
|
+
ecommerce?: boolean | string;
|
|
33
|
+
/**
|
|
34
|
+
* Параметры визита, передаваемые во время инициализации счетчика.
|
|
35
|
+
*
|
|
36
|
+
* Для передачи параметров визита в произвольный момент времени используется метод params
|
|
37
|
+
*/
|
|
38
|
+
params?: VisitParameters | VisitParameters[];
|
|
39
|
+
/**
|
|
40
|
+
* Параметры посетителей сайта, передаваемые во время инициализации счетчика.
|
|
41
|
+
*
|
|
42
|
+
* Для передачи параметров посетителей в произвольный момент времени используется метод userParams
|
|
43
|
+
*/
|
|
44
|
+
userParams?: UserParameters;
|
|
45
|
+
/** Признак отслеживания изменений хеша в адресной строке браузера */
|
|
46
|
+
trackHash?: boolean;
|
|
47
|
+
/** Признак отслеживания переходов по внешним ссылкам */
|
|
48
|
+
trackLinks?: boolean;
|
|
49
|
+
/** Признак доверенного домена для записи содержимого дочернего окна iframe. Содержит адрес домена родительского окна */
|
|
50
|
+
trustedDomains?: string[];
|
|
51
|
+
/** Тип счетчика. Для РСЯ равен 1 */
|
|
52
|
+
type?: number;
|
|
53
|
+
/** Признак использования Вебвизора */
|
|
54
|
+
webvisor?: boolean;
|
|
55
|
+
/** Признак проверки готовности счетчика */
|
|
56
|
+
triggerEvent?: boolean;
|
|
57
|
+
/** Запись заголовков. Если в заголовках есть приватные данные, при инициализации счетчика укажите значение `false` */
|
|
58
|
+
sendTitle: boolean;
|
|
59
|
+
}
|
|
60
|
+
interface HitOptions<CTX> {
|
|
61
|
+
callback?: (this: CTX) => void;
|
|
62
|
+
ctx?: CTX;
|
|
63
|
+
params?: VisitParameters;
|
|
64
|
+
referer?: string;
|
|
65
|
+
title?: string;
|
|
66
|
+
}
|
|
67
|
+
interface People {
|
|
68
|
+
email?: string;
|
|
69
|
+
phone_number?: string;
|
|
70
|
+
first_name?: string;
|
|
71
|
+
last_name?: string;
|
|
72
|
+
yandex_cid?: number;
|
|
73
|
+
home_address?: {
|
|
74
|
+
street?: string;
|
|
75
|
+
city?: string;
|
|
76
|
+
region?: string;
|
|
77
|
+
postal_code?: number;
|
|
78
|
+
country?: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { HitOptions, InitParameters, People, UserParameters, VisitParameters };
|
|
83
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/metrica/types.ts"],"mappings":";;QAEQ,MAAA;EAAA,UACM,MAAA;IACN,EAAA,OAAS,IAAA;MAA0B,CAAA;MAAU,CAAA;IAAA;IAC7C,SAAA;EAAA;AAAA;AAAA,UAIS,eAAA;EACb,WAAA;EACA,QAAA;EAAA,CAEC,GAAA;AAAA;AAAA,UAGY,cAAA;EACb,MAAA;EAAA,CAEC,GAAA;AAAA;;UAIY,cAAA;EAVZ;EAYD,mBAAA;EAZY;EAcZ,WAAA;EAX2B;EAa3B,QAAA;EAZA;EAcA,KAAA;EARa;EAUb,SAAA;;;;;;EAMA,MAAA,GAAS,eAAA,GAAkB,eAAA;EAd3B;;;;;EAoBA,UAAA,GAAa,cAAA;EANJ;EAQT,SAAA;EAFA;EAIA,UAAA;EAFA;EAIA,cAAA;EAAA;EAEA,IAAA;EAEA;EAAA,QAAA;EAIA;EAFA,YAAA;EAES;EAAT,SAAA;AAAA;AAAA,UAGa,UAAA;EACb,QAAA,IAAY,IAAA,EAAM,GAAA;EAClB,GAAA,GAAM,GAAA;EACN,MAAA,GAAS,eAAA;EACT,OAAA;EACA,KAAA;AAAA;AAAA,UAGa,MAAA;EACb,KAAA;EACA,YAAA;EACA,UAAA;EACA,SAAA;EACA,UAAA;EACA,YAAA;IACI,MAAA;IACA,IAAA;IACA,MAAA;IACA,WAAA;IACA,OAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ym.js","names":[],"sources":["../../src/metrica/ym.ts"],"sourcesContent":["import type { MetricaMethods } from \"./methods\";\r\n\r\nexport function ym<M extends MetricaMethods>(clientID: string, method: M, ...args: unknown[]) {\r\n if (typeof window === \"undefined\" || !window.ym) return console.error(\"[yandex-metrica] Script is not loaded!\");\r\n\r\n window.ym(clientID, method, ...args);\r\n}\r\n"],"mappings":"AAEA,SAAgB,EAA6B,EAAkB,EAAW,GAAG,EAAiB,CAC1F,GAAI,OAAO,OAAW,KAAe,CAAC,OAAO,GAAI,OAAO,QAAQ,MAAM,yCAAyC,CAE/G,OAAO,GAAG,EAAU,EAAQ,GAAG,EAAK"}
|
package/package.json
CHANGED
package/dist/client.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Methods } from "./methods.js";
|
|
2
|
-
import { HitOptions, InitParameters, People, UserParameters, VisitParameters } from "./types.js";
|
|
3
|
-
|
|
4
|
-
//#region src/client.d.ts
|
|
5
|
-
type YandexMetricaClientParams = {
|
|
6
|
-
clientID: string; /** Enable console log on method calls @default false */
|
|
7
|
-
debug?: boolean; /** Enable sending data to Yandex Metrica @default false */
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
};
|
|
10
|
-
type YandexMetricaClient = {
|
|
11
|
-
[Methods.Init]: (options?: Partial<InitParameters>) => void;
|
|
12
|
-
[Methods.AddFileExtension]: (extensions?: string | string[]) => void;
|
|
13
|
-
[Methods.ExtLink]: <CTX>(url: string, options?: Omit<HitOptions<CTX>, "referer">) => void;
|
|
14
|
-
[Methods.File]: <CTX>(url: string, options?: HitOptions<CTX>) => void;
|
|
15
|
-
[Methods.FirstPartyParams]: (people: People) => void;
|
|
16
|
-
[Methods.FirstPartyParamsHashed]: (people: People) => void;
|
|
17
|
-
[Methods.GetClientID]: (cb: (clientID: number) => void) => void;
|
|
18
|
-
[Methods.Hit]: <CTX>(url?: string, options?: HitOptions<CTX>) => void;
|
|
19
|
-
[Methods.NotBounce]: <CTX>(options?: Pick<HitOptions<CTX>, "ctx" | "callback">) => void;
|
|
20
|
-
[Methods.Params]: (params?: VisitParameters) => void;
|
|
21
|
-
[Methods.ReachGoal]: <CTX>(target: string, params?: VisitParameters, callback?: (this: CTX) => void, ctx?: CTX) => void;
|
|
22
|
-
[Methods.SetUserID]: (userId: string) => void;
|
|
23
|
-
[Methods.UserParams]: (params?: UserParameters) => void;
|
|
24
|
-
};
|
|
25
|
-
declare function createYandexMetricaClient({
|
|
26
|
-
clientID,
|
|
27
|
-
debug,
|
|
28
|
-
enabled
|
|
29
|
-
}: YandexMetricaClientParams): YandexMetricaClient;
|
|
30
|
-
//#endregion
|
|
31
|
-
export { YandexMetricaClient, YandexMetricaClientParams, createYandexMetricaClient };
|
|
32
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","names":[],"sources":["../src/client.ts"],"mappings":";;;;KAIY,yBAAA;EACR,QAAA,UADQ;EAGR,KAAA;EAEA,OAAA;AAAA;AAAA,KAGQ,mBAAA;EAAA,CACP,OAAA,CAAQ,IAAA,IAAQ,OAAA,GAAU,OAAA,CAAQ,cAAA;EAAA,CAClC,OAAA,CAAQ,gBAAA,IAAoB,UAAA;EAAA,CAC5B,OAAA,CAAQ,OAAA,SAAgB,GAAA,UAAa,OAAA,GAAU,IAAA,CAAK,UAAA,CAAW,GAAA;EAAA,CAC/D,OAAA,CAAQ,IAAA,SAAa,GAAA,UAAa,OAAA,GAAU,UAAA,CAAW,GAAA;EAAA,CACvD,OAAA,CAAQ,gBAAA,IAAoB,MAAA,EAAQ,MAAA;EAAA,CACpC,OAAA,CAAQ,sBAAA,IAA0B,MAAA,EAAQ,MAAA;EAAA,CAC1C,OAAA,CAAQ,WAAA,IAAe,EAAA,GAAK,QAAA;EAAA,CAC5B,OAAA,CAAQ,GAAA,SAAY,GAAA,WAAc,OAAA,GAAU,UAAA,CAAW,GAAA;EAAA,CACvD,OAAA,CAAQ,SAAA,SAAkB,OAAA,GAAU,IAAA,CAAK,UAAA,CAAW,GAAA;EAAA,CACpD,OAAA,CAAQ,MAAA,IAAU,MAAA,GAAS,eAAA;EAAA,CAC3B,OAAA,CAAQ,SAAA,SACL,MAAA,UACA,MAAA,GAAS,eAAA,EACT,QAAA,IAAY,IAAA,EAAM,GAAA,WAClB,GAAA,GAAM,GAAA;EAAA,CAET,OAAA,CAAQ,SAAA,IAAa,MAAA;EAAA,CACrB,OAAA,CAAQ,UAAA,IAAc,MAAA,GAAS,cAAA;AAAA;AAAA,iBAGpB,yBAAA,CAAA;EACZ,QAAA;EACA,KAAA;EACA;AAAA,GACD,yBAAA,GAA4B,mBAAA"}
|
package/dist/client.js
DELETED
package/dist/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { Methods } from \"./methods\";\r\nimport type { HitOptions, InitParameters, People, UserParameters, VisitParameters } from \"./types\";\r\nimport { ym } from \"./ym\";\r\n\r\nexport type YandexMetricaClientParams = {\r\n clientID: string;\r\n /** Enable console log on method calls @default false */\r\n debug?: boolean;\r\n /** Enable sending data to Yandex Metrica @default false */\r\n enabled?: boolean;\r\n};\r\n\r\nexport type YandexMetricaClient = {\r\n [Methods.Init]: (options?: Partial<InitParameters>) => void;\r\n [Methods.AddFileExtension]: (extensions?: string | string[]) => void;\r\n [Methods.ExtLink]: <CTX>(url: string, options?: Omit<HitOptions<CTX>, \"referer\">) => void;\r\n [Methods.File]: <CTX>(url: string, options?: HitOptions<CTX>) => void;\r\n [Methods.FirstPartyParams]: (people: People) => void;\r\n [Methods.FirstPartyParamsHashed]: (people: People) => void;\r\n [Methods.GetClientID]: (cb: (clientID: number) => void) => void;\r\n [Methods.Hit]: <CTX>(url?: string, options?: HitOptions<CTX>) => void;\r\n [Methods.NotBounce]: <CTX>(options?: Pick<HitOptions<CTX>, \"ctx\" | \"callback\">) => void;\r\n [Methods.Params]: (params?: VisitParameters) => void;\r\n [Methods.ReachGoal]: <CTX>(\r\n target: string,\r\n params?: VisitParameters,\r\n callback?: (this: CTX) => void,\r\n ctx?: CTX,\r\n ) => void;\r\n [Methods.SetUserID]: (userId: string) => void;\r\n [Methods.UserParams]: (params?: UserParameters) => void;\r\n};\r\n\r\nexport function createYandexMetricaClient({\r\n clientID,\r\n debug = false,\r\n enabled = false,\r\n}: YandexMetricaClientParams): YandexMetricaClient {\r\n return new Proxy({} as YandexMetricaClient, {\r\n get: (_, method: Methods) => {\r\n return (...args: unknown[]) => {\r\n if (debug) console.log(`[yandex-metrica] (${clientID}) ${method}:`, ...args);\r\n\r\n if (enabled) ym(clientID, method, ...args);\r\n };\r\n },\r\n });\r\n}\r\n"],"mappings":"6BAiCA,SAAgB,EAA0B,CACtC,WACA,QAAQ,GACR,UAAU,IACqC,CAC/C,OAAO,IAAI,MAAM,EAAE,CAAyB,CACxC,KAAM,EAAG,KACG,GAAG,IAAoB,CACvB,GAAO,QAAQ,IAAI,qBAAqB,EAAS,IAAI,EAAO,GAAI,GAAG,EAAK,CAExE,GAAS,EAAG,EAAU,EAAQ,GAAG,EAAK,EAGrD,CAAC"}
|
package/dist/e-commerce.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { ActionField, CurrencyCode, ProductField, PromoField } from "./types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/e-commerce.d.ts
|
|
4
|
-
type YandexECommerceParams = {
|
|
5
|
-
/** Enable console log on method calls @default false */debug?: boolean; /** Enable sending data to Yandex Metrica @default false */
|
|
6
|
-
enabled?: boolean; /** @default "RUB" */
|
|
7
|
-
defaultCurrencyCode?: CurrencyCode;
|
|
8
|
-
};
|
|
9
|
-
declare function createYandexECommerce(params: YandexECommerceParams): {
|
|
10
|
-
impressions: ({
|
|
11
|
-
products,
|
|
12
|
-
currencyCode
|
|
13
|
-
}: {
|
|
14
|
-
products: ProductField[];
|
|
15
|
-
currencyCode?: CurrencyCode;
|
|
16
|
-
}) => void;
|
|
17
|
-
click: ({
|
|
18
|
-
products,
|
|
19
|
-
currencyCode
|
|
20
|
-
}: {
|
|
21
|
-
products: ProductField[];
|
|
22
|
-
currencyCode?: CurrencyCode;
|
|
23
|
-
}) => void;
|
|
24
|
-
detail: ({
|
|
25
|
-
products,
|
|
26
|
-
currencyCode
|
|
27
|
-
}: {
|
|
28
|
-
products: ProductField[];
|
|
29
|
-
currencyCode?: CurrencyCode;
|
|
30
|
-
}) => void;
|
|
31
|
-
add: ({
|
|
32
|
-
products,
|
|
33
|
-
currencyCode
|
|
34
|
-
}: {
|
|
35
|
-
products: ProductField[];
|
|
36
|
-
currencyCode?: CurrencyCode;
|
|
37
|
-
}) => void;
|
|
38
|
-
remove: ({
|
|
39
|
-
products,
|
|
40
|
-
currencyCode
|
|
41
|
-
}: {
|
|
42
|
-
products: ProductField[];
|
|
43
|
-
currencyCode?: CurrencyCode;
|
|
44
|
-
}) => void;
|
|
45
|
-
purchase: ({
|
|
46
|
-
products,
|
|
47
|
-
actionField,
|
|
48
|
-
currencyCode
|
|
49
|
-
}: {
|
|
50
|
-
actionField: ActionField;
|
|
51
|
-
products: ProductField[];
|
|
52
|
-
currencyCode?: CurrencyCode;
|
|
53
|
-
}) => void;
|
|
54
|
-
promoView: ({
|
|
55
|
-
promotions,
|
|
56
|
-
currencyCode
|
|
57
|
-
}: {
|
|
58
|
-
promotions: PromoField[];
|
|
59
|
-
currencyCode?: CurrencyCode;
|
|
60
|
-
}) => void;
|
|
61
|
-
promoClick: ({
|
|
62
|
-
promotions,
|
|
63
|
-
currencyCode
|
|
64
|
-
}: {
|
|
65
|
-
promotions: PromoField[];
|
|
66
|
-
currencyCode?: CurrencyCode;
|
|
67
|
-
}) => void;
|
|
68
|
-
};
|
|
69
|
-
type YandexECommerce = ReturnType<typeof createYandexECommerce>;
|
|
70
|
-
//#endregion
|
|
71
|
-
export { YandexECommerce, YandexECommerceParams, createYandexECommerce };
|
|
72
|
-
//# sourceMappingURL=e-commerce.d.ts.map
|
package/dist/e-commerce.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"e-commerce.d.ts","names":[],"sources":["../src/e-commerce.ts"],"mappings":";;;KASY,qBAAA;0DAER,KAAA,YAF6B;EAI7B,OAAA,YAEkC;EAAlC,mBAAA,GAAsB,YAAA;AAAA;AAAA,iBAGV,qBAAA,CAAsB,MAAA,EAAQ,qBAAA;;;;;IAgBtC,QAAA,EAAU,YAAA;IACV,YAAA,GAAe,YAAA;EAAA;;;;;IAmBf,QAAA,EAAU,YAAA;IACV,YAAA,GAAe,YAAA;EAAA;;;;;IAmBf,QAAA,EAAU,YAAA;IACV,YAAA,GAAe,YAAA;EAAA;;;;;IAkBf,QAAA,EAAU,YAAA;IACV,YAAA,GAAe,YAAA;EAAA;;;;;IAkBf,QAAA,EAAU,YAAA;IACV,YAAA,GAAe,YAAA;EAAA;;;;;;IAmBf,WAAA,EAAa,WAAA;IACb,QAAA,EAAU,YAAA;IACV,YAAA,GAAe,YAAA;EAAA;;;;;IAmBf,UAAA,EAAY,UAAA;IACZ,YAAA,GAAe,YAAA;EAAA;;;;;IAkBf,UAAA,EAAY,UAAA;IACZ,YAAA,GAAe,YAAA;EAAA;AAAA;AAAA,KA2BX,eAAA,GAAkB,UAAA,QAAkB,qBAAA"}
|
package/dist/e-commerce.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function e(e){let t=e.defaultCurrencyCode??`RUB`;function n(t,n){if(!window.dataLayer)return console.error("[yandex-metrica] `ecommerce` must be set to `true` in your metrica client options");e.debug&&console.log(`[yandex-metrica] ecommerce ${n??`push`}`,t),e.enabled&&window.dataLayer.push(t)}function r({products:e,currencyCode:r=t}){n({ecommerce:{currencyCode:r,impressions:{products:e}}},`impressions`)}function i({products:e,currencyCode:r=t}){n({ecommerce:{currencyCode:r,click:{products:e}}},`click`)}function a({products:e,currencyCode:r=t}){n({ecommerce:{currencyCode:r,detail:{products:e}}},`detail`)}function o({products:e,currencyCode:r=t}){n({ecommerce:{currencyCode:r,add:{products:e}}},`add`)}function s({products:e,currencyCode:r=t}){n({ecommerce:{currencyCode:r,remove:{products:e}}},`remove`)}function c({products:e,actionField:r,currencyCode:i=t}){n({ecommerce:{currencyCode:i,purchase:{actionField:r,products:e}}},`purchase`)}function l({promotions:e,currencyCode:r=t}){n({ecommerce:{currencyCode:r,promoView:{promotions:e}}},`promoView`)}function u({promotions:e,currencyCode:r=t}){n({ecommerce:{currencyCode:r,promoClick:{promotions:e}}},`promoClick`)}return{impressions:r,click:i,detail:a,add:o,remove:s,purchase:c,promoView:l,promoClick:u}}export{e as createYandexECommerce};
|
|
2
|
-
//# sourceMappingURL=e-commerce.js.map
|
package/dist/e-commerce.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"e-commerce.js","names":[],"sources":["../src/e-commerce.ts"],"sourcesContent":["import type {\n ActionField,\n CurrencyCode,\n ECommerceActionType,\n ECommerceContainer,\n ProductField,\n PromoField,\n} from \"./types\";\n\nexport type YandexECommerceParams = {\n /** Enable console log on method calls @default false */\n debug?: boolean;\n /** Enable sending data to Yandex Metrica @default false */\n enabled?: boolean;\n /** @default \"RUB\" */\n defaultCurrencyCode?: CurrencyCode;\n};\n\nexport function createYandexECommerce(params: YandexECommerceParams) {\n const defaultCurrencyCode = params.defaultCurrencyCode ?? \"RUB\";\n\n function push(container: ECommerceContainer, action?: ECommerceActionType) {\n if (!window.dataLayer)\n return console.error(\"[yandex-metrica] `ecommerce` must be set to `true` in your metrica client options\");\n\n if (params.debug) console.log(`[yandex-metrica] ecommerce ${action ?? \"push\"}`, container);\n\n if (params.enabled) window.dataLayer.push(container);\n }\n\n function impressions({\n products,\n currencyCode = defaultCurrencyCode,\n }: {\n products: ProductField[];\n currencyCode?: CurrencyCode;\n }) {\n push(\n {\n ecommerce: {\n currencyCode,\n impressions: {\n products,\n },\n },\n },\n \"impressions\",\n );\n }\n\n function click({\n products,\n currencyCode = defaultCurrencyCode,\n }: {\n products: ProductField[];\n currencyCode?: CurrencyCode;\n }) {\n push(\n {\n ecommerce: {\n currencyCode,\n click: {\n products,\n },\n },\n },\n \"click\",\n );\n }\n\n function detail({\n products,\n currencyCode = defaultCurrencyCode,\n }: {\n products: ProductField[];\n currencyCode?: CurrencyCode;\n }) {\n push(\n {\n ecommerce: {\n currencyCode,\n detail: {\n products,\n },\n },\n },\n \"detail\",\n );\n }\n function add({\n products,\n currencyCode = defaultCurrencyCode,\n }: {\n products: ProductField[];\n currencyCode?: CurrencyCode;\n }) {\n push(\n {\n ecommerce: {\n currencyCode,\n add: {\n products,\n },\n },\n },\n \"add\",\n );\n }\n function remove({\n products,\n currencyCode = defaultCurrencyCode,\n }: {\n products: ProductField[];\n currencyCode?: CurrencyCode;\n }) {\n push(\n {\n ecommerce: {\n currencyCode,\n remove: {\n products,\n },\n },\n },\n \"remove\",\n );\n }\n function purchase({\n products,\n actionField,\n currencyCode = defaultCurrencyCode,\n }: {\n actionField: ActionField;\n products: ProductField[];\n currencyCode?: CurrencyCode;\n }) {\n push(\n {\n ecommerce: {\n currencyCode,\n purchase: {\n actionField,\n products,\n },\n },\n },\n \"purchase\",\n );\n }\n function promoView({\n promotions,\n currencyCode = defaultCurrencyCode,\n }: {\n promotions: PromoField[];\n currencyCode?: CurrencyCode;\n }) {\n push(\n {\n ecommerce: {\n currencyCode,\n promoView: {\n promotions,\n },\n },\n },\n \"promoView\",\n );\n }\n function promoClick({\n promotions,\n currencyCode = defaultCurrencyCode,\n }: {\n promotions: PromoField[];\n currencyCode?: CurrencyCode;\n }) {\n push(\n {\n ecommerce: {\n currencyCode,\n promoClick: {\n promotions,\n },\n },\n },\n \"promoClick\",\n );\n }\n\n return {\n impressions,\n click,\n detail,\n add,\n remove,\n purchase,\n promoView,\n promoClick,\n } satisfies Record<ECommerceActionType, unknown>;\n}\n\nexport type YandexECommerce = ReturnType<typeof createYandexECommerce>;\n"],"mappings":"AAkBA,SAAgB,EAAsB,EAA+B,CACjE,IAAM,EAAsB,EAAO,qBAAuB,MAE1D,SAAS,EAAK,EAA+B,EAA8B,CACvE,GAAI,CAAC,OAAO,UACR,OAAO,QAAQ,MAAM,oFAAoF,CAEzG,EAAO,OAAO,QAAQ,IAAI,8BAA8B,GAAU,SAAU,EAAU,CAEtF,EAAO,SAAS,OAAO,UAAU,KAAK,EAAU,CAGxD,SAAS,EAAY,CACjB,WACA,eAAe,GAIhB,CACC,EACI,CACI,UAAW,CACP,eACA,YAAa,CACT,WACH,CACJ,CACJ,CACD,cACH,CAGL,SAAS,EAAM,CACX,WACA,eAAe,GAIhB,CACC,EACI,CACI,UAAW,CACP,eACA,MAAO,CACH,WACH,CACJ,CACJ,CACD,QACH,CAGL,SAAS,EAAO,CACZ,WACA,eAAe,GAIhB,CACC,EACI,CACI,UAAW,CACP,eACA,OAAQ,CACJ,WACH,CACJ,CACJ,CACD,SACH,CAEL,SAAS,EAAI,CACT,WACA,eAAe,GAIhB,CACC,EACI,CACI,UAAW,CACP,eACA,IAAK,CACD,WACH,CACJ,CACJ,CACD,MACH,CAEL,SAAS,EAAO,CACZ,WACA,eAAe,GAIhB,CACC,EACI,CACI,UAAW,CACP,eACA,OAAQ,CACJ,WACH,CACJ,CACJ,CACD,SACH,CAEL,SAAS,EAAS,CACd,WACA,cACA,eAAe,GAKhB,CACC,EACI,CACI,UAAW,CACP,eACA,SAAU,CACN,cACA,WACH,CACJ,CACJ,CACD,WACH,CAEL,SAAS,EAAU,CACf,aACA,eAAe,GAIhB,CACC,EACI,CACI,UAAW,CACP,eACA,UAAW,CACP,aACH,CACJ,CACJ,CACD,YACH,CAEL,SAAS,EAAW,CAChB,aACA,eAAe,GAIhB,CACC,EACI,CACI,UAAW,CACP,eACA,WAAY,CACR,aACH,CACJ,CACJ,CACD,aACH,CAGL,MAAO,CACH,cACA,QACA,SACA,MACA,SACA,WACA,YACA,aACH"}
|
package/dist/methods.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"methods.d.ts","names":[],"sources":["../src/methods.ts"],"mappings":";cAAa,OAAA;EAAA;;;;;;;;;;;;;;KAgBD,OAAA,WAAkB,OAAA,eAAsB,OAAA"}
|
package/dist/script.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"script.d.ts","names":[],"sources":["../src/script.ts"],"mappings":";;AAMA;;;;;iBAAgB,yBAAA,CAA0B,GAAA;;;;iBAY1B,2BAAA,CAA4B,QAAA"}
|
package/dist/script.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"script.js","names":[],"sources":["../src/script.ts"],"sourcesContent":["/** Create string for Yandex Metrica script tag\n *\n * Default src is https://mc.yandex.ru/metrika/tag.js\n *\n * You could also use a CDN version: https://cdn.jsdelivr.net/npm/yandex-metrica-watch/tag.js\n */\nexport function createYandexMetricaScript(src: string = \"https://mc.yandex.ru/metrika/tag.js\") {\n return `\n(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};\nm[i].l=1*new Date();\nfor (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}\nk=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})\n(window, document, \"script\", \"${src}\", \"ym\");`;\n}\n\n/**\n * Create inner html string for Yandex Metrica noscript tag\n */\nexport function createYandexMetricaNoscript(clientID: string) {\n return `<div><img src=\"https://mc.yandex.ru/watch/${clientID}\" style=\"position:absolute; left:-9999px;\" alt=\"\" /></div>`;\n}\n"],"mappings":"AAMA,SAAgB,EAA0B,EAAc,sCAAuC,CAC3F,MAAO;;;;;gCAKqB,EAAI,WAMpC,SAAgB,EAA4B,EAAkB,CAC1D,MAAO,6CAA6C,EAAS"}
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;QAEQ,MAAA;EAAA,UACM,MAAA;IACN,EAAA,OAAS,IAAA;MAA0B,CAAA;MAAU,CAAA;IAAA;IAC7C,SAAA;EAAA;AAAA;AAAA,UAIS,eAAA;EACb,WAAA;EACA,QAAA;EAAA,CAEC,GAAA;AAAA;AAAA,UAGY,cAAA;EACb,MAAA;EAAA,CAEC,GAAA;AAAA;;UAIY,cAAA;EAVZ;EAYD,mBAAA;EAZY;EAcZ,WAAA;EAX2B;EAa3B,QAAA;EAZA;EAcA,KAAA;EARa;EAUb,SAAA;;;;;;EAMA,MAAA,GAAS,eAAA,GAAkB,eAAA;EAd3B;;;;;EAoBA,UAAA,GAAa,cAAA;EANJ;EAQT,SAAA;EAFA;EAIA,UAAA;EAFA;EAIA,cAAA;EAAA;EAEA,IAAA;EAEA;EAAA,QAAA;EAIA;EAFA,YAAA;EAES;EAAT,SAAA;AAAA;AAAA,UAGa,UAAA;EACb,QAAA,IAAY,IAAA,EAAM,GAAA;EAClB,GAAA,GAAM,GAAA;EACN,MAAA,GAAS,eAAA;EACT,OAAA;EACA,KAAA;AAAA;AAAA,UAGa,MAAA;EACb,KAAA;EACA,YAAA;EACA,UAAA;EACA,SAAA;EACA,UAAA;EACA,YAAA;IACI,MAAA;IACA,IAAA;IACA,MAAA;IACA,WAAA;IACA,OAAA;EAAA;AAAA;AAAA,KAII,YAAA;AAAA,KA2QA,mBAAA;AAAA,KAUA,mBAAA;EAjSR,+EAmSA,QAAA,GAAW,KAAA,CAAM,YAAA,GAjSjB;EAmSA,UAAA,GAAa,KAAA,CAAM,UAAA;AAAA;AAAA,KAGX,oBAAA,gBACG,OAAA,CAAQ,mBAAA,0BACP,MAAA,GAAS,mBAAA;EAGrB,QAAA;IACI,QAAA,EAAU,mBAAA;MACN,WAAA,EAAa,WAAA;IAAA;EAAA;AAAA;AAAA,KAKb,gBAAA,GAAmB,oBAAA,OAA2B,oBAAA;AAAA,KAE9C,kBAAA;EACR,SAAA;IACI,YAAA,EAAc,YAAA;EAAA,IACd,gBAAA;AAAA;;;;KAMI,WAAA;EA1BW,4BA4BnB,EAAA,UA5BkB;EA8BlB,MAAA,WAhCA;EAkCA,OAAA;EACA,OAAA;AAAA;;KAIQ,YAAA;EArCqB;;AAGjC;;;EAwCI,EAAA;EAvCW;;;;;EA6CX,IAAA,WAvCgC;EAyChC,KAAA;EA/CW;;;;;EAqDX,QAAA,WAhDI;EAkDJ,MAAA,WAjDQ;EAmDR,QAAA;EAnDgC;;AAKpC;;;EAoDI,IAAA,WApD0E;EAsD1E,QAAA,WApD0B;EAsD1B,KAAA,WAnDoB;EAqDpB,QAAA,WAtDI;EAwDJ,OAAA;AAAA;AAAA,KAGQ,UAAA;EA1DY,mCA4DpB,EAAA,UAtDmB;EAwDnB,IAAA,WAxDmB;EA0DnB,QAAA,WAtDA;EAwDA,aAAA,WArDA;EAuDA,QAAA;AAAA"}
|
package/dist/ym.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ym.js","names":[],"sources":["../src/ym.ts"],"sourcesContent":["import type { Methods } from \"./methods\";\r\n\r\nexport function ym<M extends Methods>(clientID: string, method: M, ...args: unknown[]) {\r\n if (typeof window === \"undefined\" || !window.ym) return console.error(\"[yandex-metrica] Script is not loaded!\");\r\n\r\n window.ym(clientID, method, ...args);\r\n}\r\n"],"mappings":"AAEA,SAAgB,EAAsB,EAAkB,EAAW,GAAG,EAAiB,CACnF,GAAI,OAAO,OAAW,KAAe,CAAC,OAAO,GAAI,OAAO,QAAQ,MAAM,yCAAyC,CAE/G,OAAO,GAAG,EAAU,EAAQ,GAAG,EAAK"}
|
|
File without changes
|
|
File without changes
|