@vnejs/plugins.platform.metric 0.0.4 → 0.0.6
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/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/modules/yandex.d.ts +2 -4
- package/dist/modules/yandex.js +3 -7
- package/dist/types.d.ts +1 -2
- package/dist/utils/metric.d.ts +0 -7
- package/package.json +1 -2
- package/src/index.ts +2 -0
- package/src/modules/yandex.ts +4 -9
- package/src/types.ts +1 -3
- package/src/utils/metric.ts +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import "@vnejs/plugins.platform.metric.contract";
|
package/dist/index.js
CHANGED
package/dist/modules/yandex.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { Module } from "@vnejs/module";
|
|
2
|
+
import type { StackEmitPayload } from "@vnejs/plugins.core.stack.contract";
|
|
2
3
|
import type { MetricPluginConstants, MetricPluginEvents, MetricPluginParams, MetricPluginSettings } from "../types.js";
|
|
3
|
-
import type { MetricSavePayload, MetricStackPayload } from "../utils/metric.js";
|
|
4
4
|
export declare class YaMetrika extends Module<MetricPluginEvents, MetricPluginConstants, MetricPluginSettings, MetricPluginParams> {
|
|
5
5
|
name: string;
|
|
6
6
|
subscribe: () => void;
|
|
7
7
|
init: () => void;
|
|
8
|
-
onStack: ({
|
|
9
|
-
onSave: ({ key }?: MetricSavePayload) => void | undefined;
|
|
10
|
-
onLoad: ({ key }?: MetricSavePayload) => void | undefined;
|
|
8
|
+
onStack: ({ label, args }?: StackEmitPayload) => void | undefined;
|
|
11
9
|
onParams: (params: Record<string, unknown>) => void | undefined;
|
|
12
10
|
onReachGoal: (target: string) => void | undefined;
|
|
13
11
|
}
|
package/dist/modules/yandex.js
CHANGED
|
@@ -6,15 +6,11 @@ export class YaMetrika extends Module {
|
|
|
6
6
|
if (!this.PARAMS.METRIC.YA_COUNTER_ID)
|
|
7
7
|
return;
|
|
8
8
|
this.on(this.EVENTS.STACK.EMIT, this.onStack);
|
|
9
|
-
this.on(this.EVENTS.
|
|
10
|
-
this.on(this.EVENTS.
|
|
11
|
-
this.on(this.EVENTS.METRIC.METRIC_GOAL, this.onReachGoal);
|
|
12
|
-
this.on(this.EVENTS.METRIC.METRIC_PARAMS, this.onParams);
|
|
9
|
+
this.on(this.EVENTS.METRIC.GOAL, this.onReachGoal);
|
|
10
|
+
this.on(this.EVENTS.METRIC.PARAMS, this.onParams);
|
|
13
11
|
};
|
|
14
12
|
init = () => initYandexMetrika(this.PARAMS.METRIC.YA_COUNTER_ID);
|
|
15
|
-
onStack = ({
|
|
16
|
-
onSave = ({ key } = {}) => this.onParams({ VNE_SAVE: { key } });
|
|
17
|
-
onLoad = ({ key } = {}) => this.onParams({ VNE_LOAD: { key } });
|
|
13
|
+
onStack = ({ label, args } = {}) => this.onParams({ VNE_STACK: { label, args } });
|
|
18
14
|
onParams = (params) => window.ym?.(this.PARAMS.METRIC.YA_COUNTER_ID, "params", params);
|
|
19
15
|
onReachGoal = (target) => window.ym?.(this.PARAMS.METRIC.YA_COUNTER_ID, "reachGoal", target);
|
|
20
16
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
|
|
2
2
|
import type { PluginName as StackPluginName, SubscribeEvents as StackSubscribeEvents } from "@vnejs/plugins.core.stack.contract";
|
|
3
3
|
import type { PluginName, Params, SubscribeEvents } from "@vnejs/plugins.platform.metric.contract";
|
|
4
|
-
|
|
5
|
-
export type MetricPluginEvents = VnePluginEventsMapRegistry & Record<PluginName, SubscribeEvents> & Record<StackPluginName, StackSubscribeEvents> & Record<SavePluginName, SaveSubscribeEvents>;
|
|
4
|
+
export type MetricPluginEvents = VnePluginEventsMapRegistry & Record<PluginName, SubscribeEvents> & Record<StackPluginName, StackSubscribeEvents>;
|
|
6
5
|
export type MetricPluginConstants = VnePluginConstantsMapRegistry;
|
|
7
6
|
export type MetricPluginSettings = VnePluginSettingsMapRegistry;
|
|
8
7
|
export type MetricPluginParams = VnePluginParamsMapRegistry & Record<PluginName, Params>;
|
package/dist/utils/metric.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export type MetricStackPayload = {
|
|
2
|
-
action?: string;
|
|
3
|
-
label?: string;
|
|
4
|
-
};
|
|
5
|
-
export type MetricSavePayload = {
|
|
6
|
-
key?: string;
|
|
7
|
-
};
|
|
8
1
|
export type YmFunction = ((counterId: number, method: string, ...args: unknown[]) => void) & {
|
|
9
2
|
a?: unknown[][];
|
|
10
3
|
l?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/plugins.platform.metric",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@vnejs/module": "~0.0.1",
|
|
37
37
|
"@vnejs/plugins.core.stack.contract": "~0.0.1",
|
|
38
|
-
"@vnejs/plugins.save.contract": "~0.0.1",
|
|
39
38
|
"@vnejs/shared": "~0.0.9"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
package/src/index.ts
CHANGED
package/src/modules/yandex.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Module } from "@vnejs/module";
|
|
2
|
+
import type { StackEmitPayload } from "@vnejs/plugins.core.stack.contract";
|
|
2
3
|
|
|
3
4
|
import type { MetricPluginConstants, MetricPluginEvents, MetricPluginParams, MetricPluginSettings } from "../types.js";
|
|
4
|
-
import type { MetricSavePayload, MetricStackPayload } from "../utils/metric.js";
|
|
5
5
|
import { initYandexMetrika } from "../utils/metric.js";
|
|
6
6
|
|
|
7
7
|
export class YaMetrika extends Module<MetricPluginEvents, MetricPluginConstants, MetricPluginSettings, MetricPluginParams> {
|
|
@@ -12,18 +12,13 @@ export class YaMetrika extends Module<MetricPluginEvents, MetricPluginConstants,
|
|
|
12
12
|
|
|
13
13
|
this.on(this.EVENTS.STACK.EMIT, this.onStack);
|
|
14
14
|
|
|
15
|
-
this.on(this.EVENTS.
|
|
16
|
-
this.on(this.EVENTS.
|
|
17
|
-
|
|
18
|
-
this.on(this.EVENTS.METRIC.METRIC_GOAL, this.onReachGoal);
|
|
19
|
-
this.on(this.EVENTS.METRIC.METRIC_PARAMS, this.onParams);
|
|
15
|
+
this.on(this.EVENTS.METRIC.GOAL, this.onReachGoal);
|
|
16
|
+
this.on(this.EVENTS.METRIC.PARAMS, this.onParams);
|
|
20
17
|
};
|
|
21
18
|
|
|
22
19
|
init = () => initYandexMetrika(this.PARAMS.METRIC.YA_COUNTER_ID);
|
|
23
20
|
|
|
24
|
-
onStack = ({
|
|
25
|
-
onSave = ({ key }: MetricSavePayload = {}) => this.onParams({ VNE_SAVE: { key } });
|
|
26
|
-
onLoad = ({ key }: MetricSavePayload = {}) => this.onParams({ VNE_LOAD: { key } });
|
|
21
|
+
onStack = ({ label, args }: StackEmitPayload = {}) => this.onParams({ VNE_STACK: { label, args } });
|
|
27
22
|
|
|
28
23
|
onParams = (params: Record<string, unknown>) => window.ym?.(this.PARAMS.METRIC.YA_COUNTER_ID, "params", params);
|
|
29
24
|
onReachGoal = (target: string) => window.ym?.(this.PARAMS.METRIC.YA_COUNTER_ID, "reachGoal", target);
|
package/src/types.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
|
|
2
2
|
import type { PluginName as StackPluginName, SubscribeEvents as StackSubscribeEvents } from "@vnejs/plugins.core.stack.contract";
|
|
3
3
|
import type { PluginName, Params, SubscribeEvents } from "@vnejs/plugins.platform.metric.contract";
|
|
4
|
-
import type { PluginName as SavePluginName, SubscribeEvents as SaveSubscribeEvents } from "@vnejs/plugins.save.contract";
|
|
5
4
|
|
|
6
5
|
export type MetricPluginEvents = VnePluginEventsMapRegistry &
|
|
7
6
|
Record<PluginName, SubscribeEvents> &
|
|
8
|
-
Record<StackPluginName, StackSubscribeEvents
|
|
9
|
-
Record<SavePluginName, SaveSubscribeEvents>;
|
|
7
|
+
Record<StackPluginName, StackSubscribeEvents>;
|
|
10
8
|
|
|
11
9
|
export type MetricPluginConstants = VnePluginConstantsMapRegistry;
|
|
12
10
|
|
package/src/utils/metric.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
export type MetricStackPayload = {
|
|
2
|
-
action?: string;
|
|
3
|
-
label?: string;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
export type MetricSavePayload = {
|
|
7
|
-
key?: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
1
|
export type YmFunction = ((counterId: number, method: string, ...args: unknown[]) => void) & {
|
|
11
2
|
a?: unknown[][];
|
|
12
3
|
l?: number;
|