PluginProbe
Extendify / 3.0.6
Extendify v3.0.6
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / AutoLaunch / functions / insights.js

insights.js in Extendify 3.0.6, at src/AutoLaunch/functions/insights.js

65 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useLaunchDataStore } from '@auto-launch/state/launch-data';
2 import { INSIGHTS_HOST } from '@constants';
3 import { reqDataBasics } from '@shared/lib/data';
4
5 const headers = {
6 'Content-type': 'application/json',
7 Accept: 'application/json',
8 'X-Extendify': 'true',
9 };
10
11 const { urlParams } = window.extLaunchData;
12 export const checkIn = ({
13 stage,
14 siteProfile = {},
15 sitePlugins = [],
16 siteStyle = {},
17 } = {}) => {
18 const { type, category, structure, objective } = siteProfile;
19 const { siteId, partnerId, homeUrl, wpLanguage } = reqDataBasics;
20 const attempt = useLaunchDataStore.getState()?.attempt || 1;
21
22 const payload = JSON.stringify({
23 ...reqDataBasics,
24 autoLaunch: true,
25 stage,
26 attempt,
27 skippedDescription: Boolean(urlParams?.title || urlParams?.description),
28 insightsId: siteId,
29 hostpartner: partnerId,
30 siteURL: homeUrl,
31 language: wpLanguage,
32 sitePlugins: sitePlugins?.map((p) => p?.name),
33 urlParameters: urlParams,
34 siteStyle,
35 style: siteStyle?.colorPalette,
36 siteProfile,
37 siteType: type,
38 siteCategory: category,
39 siteStructure: structure,
40 siteObjective: objective,
41 extra: {
42 userAgent: window?.navigator?.userAgent,
43 vendor: window?.navigator?.vendor || 'unknown',
44 platform:
45 window?.navigator?.userAgentData?.platform ||
46 window?.navigator?.platform ||
47 'unknown',
48 mobile: window?.navigator?.userAgentData?.mobile,
49 width: window.innerWidth,
50 height: window.innerHeight,
51 screenHeight: window.screen.height,
52 screenWidth: window.screen.width,
53 orientation: window.screen.orientation?.type,
54 touchSupport: 'ontouchstart' in window || navigator.maxTouchPoints > 0,
55 },
56 });
57
58 return fetch(`${INSIGHTS_HOST}/api/v1/launch`, {
59 method: 'POST',
60 headers,
61 body: payload,
62 keepalive: true,
63 });
64 };
65