@plentymarkets/shop-core 1.24.0 → 1.25.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/dist/module.json +1 -1
- package/dist/module.mjs +5 -5
- package/dist/runtime/composables/usePlentyLogs.d.ts +2 -0
- package/dist/runtime/composables/{usePlentyAnalytics.js → usePlentyLogs.js} +1 -1
- package/dist/runtime/plugins/{analytics.client.d.ts → logs.client.d.ts} +3 -3
- package/dist/runtime/plugins/{analytics.client.js → logs.client.js} +7 -6
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/log-events.d.ts +5 -0
- package/dist/runtime/types/module.d.ts +1 -1
- package/dist/runtime/utils/logTracker.d.ts +17 -0
- package/dist/runtime/utils/{analyticsTracker.js → logTracker.js} +1 -1
- package/package.json +2 -2
- package/dist/runtime/composables/usePlentyAnalytics.d.ts +0 -2
- package/dist/runtime/types/analytics-events.d.ts +0 -14
- package/dist/runtime/utils/analyticsTracker.d.ts +0 -16
- /package/dist/runtime/types/{analytics-events.js → log-events.js} +0 -0
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -168,7 +168,7 @@ const module$1 = defineNuxtModule({
|
|
|
168
168
|
configId: _options.configId,
|
|
169
169
|
experimental: {
|
|
170
170
|
enableSSRMetrics: _options.experimental?.enableSSRMetrics ?? false,
|
|
171
|
-
|
|
171
|
+
enablePlentyLogs: _options.experimental?.enablePlentyLogs ?? true
|
|
172
172
|
},
|
|
173
173
|
middlewareSSRUrl: _options.middlewareSSRUrl,
|
|
174
174
|
logger: {
|
|
@@ -245,7 +245,7 @@ export type ShopCoreConfig = ${genInlineTypeImport(projectRootResolver.resolve("
|
|
|
245
245
|
});
|
|
246
246
|
addPlugin(resolver.resolve("./runtime/plugins/sdk"));
|
|
247
247
|
addPlugin(resolver.resolve("./runtime/plugins/cache-control.server"));
|
|
248
|
-
addPlugin(resolver.resolve("./runtime/plugins/
|
|
248
|
+
addPlugin(resolver.resolve("./runtime/plugins/logs.client"));
|
|
249
249
|
addImports({
|
|
250
250
|
name: "useSdk",
|
|
251
251
|
as: "useSdk",
|
|
@@ -312,9 +312,9 @@ export type ShopCoreConfig = ${genInlineTypeImport(projectRootResolver.resolve("
|
|
|
312
312
|
from: resolver.resolve("./runtime/composables/useT")
|
|
313
313
|
});
|
|
314
314
|
addImports({
|
|
315
|
-
name: "
|
|
316
|
-
as: "
|
|
317
|
-
from: resolver.resolve("./runtime/composables/
|
|
315
|
+
name: "usePlentyLogs",
|
|
316
|
+
as: "usePlentyLogs",
|
|
317
|
+
from: resolver.resolve("./runtime/composables/usePlentyLogs")
|
|
318
318
|
});
|
|
319
319
|
addImports({
|
|
320
320
|
name: "getSSRMetrics",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ShopLogEventInput } from '../types/log-events.js';
|
|
2
2
|
declare const _default: import("#app").Plugin<{
|
|
3
|
-
trackEvent: (_event:
|
|
3
|
+
trackEvent: (_event: ShopLogEventInput) => void;
|
|
4
4
|
collectEvents: () => Promise<void>;
|
|
5
5
|
stopCollectInterval: () => void;
|
|
6
6
|
}> & import("#app").ObjectPlugin<{
|
|
7
|
-
trackEvent: (_event:
|
|
7
|
+
trackEvent: (_event: ShopLogEventInput) => void;
|
|
8
8
|
collectEvents: () => Promise<void>;
|
|
9
9
|
stopCollectInterval: () => void;
|
|
10
10
|
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineNuxtPlugin, useRuntimeConfig, useState } from "#app";
|
|
2
|
-
import {
|
|
2
|
+
import { createLogsTracker } from "../utils/logTracker.js";
|
|
3
|
+
import { useSdk } from "../composables/useSdk.js";
|
|
3
4
|
export default defineNuxtPlugin(() => {
|
|
4
5
|
const config = useRuntimeConfig();
|
|
5
6
|
let trackEvent = (_event) => {
|
|
@@ -8,12 +9,12 @@ export default defineNuxtPlugin(() => {
|
|
|
8
9
|
};
|
|
9
10
|
let stopCollectInterval = () => {
|
|
10
11
|
};
|
|
11
|
-
if (config.public.shopCore.experimental.
|
|
12
|
-
const queue = useState("plenty-
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
if (config.public.shopCore.experimental.enablePlentyLogs) {
|
|
13
|
+
const queue = useState("plenty-log-event-queue", () => []);
|
|
14
|
+
const sendLogs = async (payload) => {
|
|
15
|
+
return useSdk().plentysystems.doAddShopLogs(payload);
|
|
15
16
|
};
|
|
16
|
-
const tracker =
|
|
17
|
+
const tracker = createLogsTracker({ queue, fetcher: sendLogs });
|
|
17
18
|
trackEvent = tracker.trackEvent;
|
|
18
19
|
collectEvents = tracker.collectEvents;
|
|
19
20
|
stopCollectInterval = tracker.stopCollectInterval;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ShopLogEvent } from '@plentymarkets/shop-api';
|
|
2
|
+
import type { ShopLogEventInput } from '../types/log-events.js';
|
|
3
|
+
interface QueueRef {
|
|
4
|
+
value: ShopLogEvent[];
|
|
5
|
+
}
|
|
6
|
+
interface LogsTrackerDeps {
|
|
7
|
+
queue: QueueRef;
|
|
8
|
+
fetcher: (payload: ShopLogEvent[]) => Promise<unknown>;
|
|
9
|
+
intervalMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const createLogsTracker: (deps: LogsTrackerDeps) => {
|
|
12
|
+
trackEvent: (event: ShopLogEventInput) => void;
|
|
13
|
+
collectEvents: () => Promise<void>;
|
|
14
|
+
startCollectInterval: () => void;
|
|
15
|
+
stopCollectInterval: () => void;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plentymarkets/shop-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.1",
|
|
4
4
|
"description": "Core module for PlentyONE Shop",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@noble/hashes": "^2.0.1",
|
|
53
|
-
"@plentymarkets/shop-api": "^0.
|
|
53
|
+
"@plentymarkets/shop-api": "^0.170.1",
|
|
54
54
|
"@vue-storefront/sdk": "^3.4.1",
|
|
55
55
|
"cookie-es": "^2.0.0",
|
|
56
56
|
"knitwork": "^1.3.0",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type ISODateString = string & {
|
|
2
|
-
readonly __brand: 'ISODateString';
|
|
3
|
-
};
|
|
4
|
-
export declare const toISODateString: (value: Date | string) => ISODateString;
|
|
5
|
-
export interface PlentyAnalyticsEvent {
|
|
6
|
-
name: string;
|
|
7
|
-
loggableType: string;
|
|
8
|
-
loggableId: string;
|
|
9
|
-
payload: Record<string, unknown>;
|
|
10
|
-
triggeredAt: ISODateString;
|
|
11
|
-
}
|
|
12
|
-
export type PlentyAnalyticsEventInput = Omit<PlentyAnalyticsEvent, 'triggeredAt'> & {
|
|
13
|
-
triggeredAt?: ISODateString;
|
|
14
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { PlentyAnalyticsEvent, PlentyAnalyticsEventInput } from '../types/analytics-events.js';
|
|
2
|
-
interface QueueRef {
|
|
3
|
-
value: PlentyAnalyticsEvent[];
|
|
4
|
-
}
|
|
5
|
-
interface AnalyticsTrackerDeps {
|
|
6
|
-
queue: QueueRef;
|
|
7
|
-
fetcher: (payload: PlentyAnalyticsEvent[]) => Promise<unknown>;
|
|
8
|
-
intervalMs?: number;
|
|
9
|
-
}
|
|
10
|
-
export declare const createAnalyticsTracker: (deps: AnalyticsTrackerDeps) => {
|
|
11
|
-
trackEvent: (event: PlentyAnalyticsEventInput) => void;
|
|
12
|
-
collectEvents: () => Promise<void>;
|
|
13
|
-
startCollectInterval: () => void;
|
|
14
|
-
stopCollectInterval: () => void;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
File without changes
|