aesirx-analytics 2.1.1 → 2.2.0

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.
@@ -144,6 +144,7 @@ function warn() {
144
144
  }
145
145
  if (typeof args[0] === "string")
146
146
  args[0] = `react-i18next:: ${args[0]}`;
147
+ console.warn(...args);
147
148
  }
148
149
  }
149
150
  var alreadyWarned = {};
@@ -473,7 +474,7 @@ var common_default2 = {
473
474
  txt_revoke_consent: "Revoke Consent",
474
475
  txt_yes_i_consent: "Yes, I consent",
475
476
  txt_reject_consent: "Reject Consent",
476
- txt_please_connect: "Please connect your Concordium wallet",
477
+ txt_please_connect: "Please connect your Web3 wallet",
477
478
  txt_please_sign: "Please sign the message on your wallet twice and wait for it to be saved.",
478
479
  txt_saving: "Saving...",
479
480
  txt_please_connect_your_wallet: "Please connect to your wallet",
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AnalyticsContext,
3
3
  AnalyticsContextProvider_default
4
- } from "./chunk-OGDZQCIU.js";
4
+ } from "./chunk-ZYCOHH2R.js";
5
5
 
6
6
  // src/AnalyticsNext/index.tsx
7
7
  import React2 from "react";
@@ -90,6 +90,7 @@ var startTracker = async (endpoint, url, referer, user_agent) => {
90
90
  });
91
91
  return responseStart;
92
92
  } catch (error) {
93
+ console.error("Analytics Error: ", error);
93
94
  }
94
95
  };
95
96
  var trackEvent = async (endpoint, referer, data) => {
@@ -108,26 +109,30 @@ var trackEvent = async (endpoint, referer, data) => {
108
109
  const device = browser?.platform?.model ?? browser?.platform?.type;
109
110
  const ip = "";
110
111
  const fpPromise = FingerprintJS.load({ monitoring: false });
111
- const body = fpPromise.then((fp) => fp.get()).then(async (result) => {
112
+ const responseStart = fpPromise.then((fp) => fp.get()).then(async (result) => {
112
113
  const fingerprint = result.visitorId;
113
- return {
114
- fingerprint,
115
- url,
116
- ...referer !== "/" && referer && {
117
- referer
118
- },
119
- user_agent,
120
- ip,
121
- browser_name,
122
- browser_version,
123
- lang,
124
- device,
125
- ...data
126
- };
114
+ const headers = { type: "application/json" };
115
+ const blobData = new Blob(
116
+ [
117
+ JSON.stringify({
118
+ fingerprint,
119
+ url,
120
+ ...referer !== "/" && referer && {
121
+ referer
122
+ },
123
+ user_agent,
124
+ ip,
125
+ browser_name,
126
+ browser_version,
127
+ lang,
128
+ device,
129
+ ...data
130
+ })
131
+ ],
132
+ headers
133
+ );
134
+ return navigator.sendBeacon(createRequestV2(endpoint, "start"), blobData);
127
135
  });
128
- const headers = { type: "application/json" };
129
- const blob = new Blob([JSON.stringify(body)], headers);
130
- const responseStart = navigator.sendBeacon(createRequestV2(endpoint, "start"), blob);
131
136
  return responseStart;
132
137
  };
133
138
  var endTracker = (endPoint, event_uuid, visitor_uuid) => {
@@ -217,9 +222,15 @@ var handle_default = AnalyticsHandle;
217
222
 
218
223
  // src/AnalyticsNext/index.tsx
219
224
  import dynamic from "next/dynamic";
220
- var ConsentComponent = dynamic(() => import("./Consent-MKSHHJAP.js"), { ssr: false });
225
+ var ConsentComponent = dynamic(() => import("./Consent-HSP2HBSL.js"), { ssr: false });
221
226
  var AnalyticsNext = ({ router, children }) => {
222
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(AnalyticsContextProvider_default, null, /* @__PURE__ */ React2.createElement(handle_default, { router }, children, process.env.NEXT_PUBLIC_DISABLE_ANALYTICS_CONSENT !== "true" && /* @__PURE__ */ React2.createElement(ConsentComponent, { endpoint: process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL }))));
227
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(AnalyticsContextProvider_default, null, /* @__PURE__ */ React2.createElement(handle_default, { router }, children, process.env.NEXT_PUBLIC_DISABLE_ANALYTICS_CONSENT !== "true" && /* @__PURE__ */ React2.createElement(
228
+ ConsentComponent,
229
+ {
230
+ endpoint: process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL,
231
+ aesirXEndpoint: process.env.NEXT_PUBLIC_ENDPOINT_URL ?? "https://api.aesirx.io"
232
+ }
233
+ ))));
223
234
  };
224
235
  var AnalyticsNext_default = AnalyticsNext;
225
236
 
@@ -263,9 +274,15 @@ var AnalyticsHandle2 = ({ location, history, children }) => {
263
274
  var handle_default2 = AnalyticsHandle2;
264
275
 
265
276
  // src/AnalyticsReact/index.tsx
266
- var ConsentComponent2 = React4.lazy(() => import("./Consent-MKSHHJAP.js"));
277
+ var ConsentComponent2 = React4.lazy(() => import("./Consent-HSP2HBSL.js"));
267
278
  var AnalyticsReact = ({ location, history, children }) => {
268
- return /* @__PURE__ */ React4.createElement(AnalyticsContextProvider_default, null, /* @__PURE__ */ React4.createElement(handle_default2, { location, history }, children, process.env.REACT_APP_DISABLE_ANALYTICS_CONSENT !== "true" && /* @__PURE__ */ React4.createElement(Suspense, { fallback: /* @__PURE__ */ React4.createElement(React4.Fragment, null) }, /* @__PURE__ */ React4.createElement(ConsentComponent2, { endpoint: process.env.REACT_APP_ENDPOINT_ANALYTICS_URL }))));
279
+ return /* @__PURE__ */ React4.createElement(AnalyticsContextProvider_default, null, /* @__PURE__ */ React4.createElement(handle_default2, { location, history }, children, process.env.REACT_APP_DISABLE_ANALYTICS_CONSENT !== "true" && /* @__PURE__ */ React4.createElement(Suspense, { fallback: /* @__PURE__ */ React4.createElement(React4.Fragment, null) }, /* @__PURE__ */ React4.createElement(
280
+ ConsentComponent2,
281
+ {
282
+ endpoint: process.env.REACT_APP_ENDPOINT_ANALYTICS_URL,
283
+ aesirXEndpoint: process.env.REACT_APP_ENDPOINT_URL ?? "https://api.aesirx.io"
284
+ }
285
+ ))));
269
286
  };
270
287
  var AnalyticsReact_default = AnalyticsReact;
271
288
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aesirx-analytics",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "license": "GPL-3.0-only",
5
5
  "author": "AesirX",
6
6
  "repository": "https://gitlab.redweb.dk/aesirx/analytics",
@@ -12,32 +12,36 @@
12
12
  "@concordium/browser-wallet-api-helpers": "^2",
13
13
  "@concordium/react-components": "^0.3.0",
14
14
  "@concordium/web-sdk": "^6",
15
- "@fingerprintjs/fingerprintjs": "^4.0.1",
16
- "aesirx-sso": "^1.2.1",
15
+ "@fingerprintjs/fingerprintjs": "3.4.2",
16
+ "@web3modal/ethereum": "^2.7.0",
17
+ "@web3modal/react": "^2.7.0",
18
+ "aesirx-sso": "^1.4.1",
17
19
  "axios": "^1.4.0",
18
- "bootstrap": "^5.3.0",
20
+ "bootstrap": "^5.3.2",
19
21
  "bowser": "^2.11.0",
20
22
  "buffer": "^6.0.3",
23
+ "ethers": "^6.6.5",
21
24
  "i18next": "^23.4.4",
22
25
  "i18next-browser-languagedetector": "^7.1.0",
23
- "next": "^13.4.19",
26
+ "next": "^13.5.4",
24
27
  "query-string": "^7.1.1",
25
28
  "react": "^18.2.0",
26
29
  "react-bootstrap": "^2.8.0",
27
30
  "react-content-loader": "^6.2.1",
28
31
  "react-device-detect": "^2.2.3",
29
32
  "react-dom": "18",
30
- "react-toastify": "^9.1.3"
33
+ "react-toastify": "^9.1.3",
34
+ "wagmi": "^1.3.2"
31
35
  },
32
36
  "scripts": {
33
- "dev": "tsup --watch --onSuccess 'yalc push --changed --no-scripts'",
37
+ "dev": "NODE_ENV=development tsup --watch",
34
38
  "build": "tsup",
35
39
  "lint": "eslint --fix \"src/**/\"",
36
40
  "lint:check": "eslint \"src/**/\"",
37
41
  "lint:nowarns": "eslint --quiet \"src/**/\"",
38
42
  "prepublishOnly": "yarn run build",
39
- "format:check": "prettier --check 'src/**/*.{js,jsx,ts,tsx}'",
40
- "format:write": "prettier --write 'src/**/*.{js,jsx,ts,tsx}'",
43
+ "format:check": "prettier --check \"./src/**/*.{js,jsx,ts,tsx}\"",
44
+ "format:write": "prettier --write \"./src/**/*.{js,jsx,ts,tsx}\"",
41
45
  "test": "jest"
42
46
  },
43
47
  "eslintConfig": {
@@ -60,10 +64,10 @@
60
64
  },
61
65
  "devDependencies": {
62
66
  "@babel/preset-env": "^7.21.5",
63
- "@babel/preset-typescript": "^7.21.5",
64
- "@jest/globals": "^29.6.4",
67
+ "@babel/preset-typescript": "^7.23.0",
68
+ "@jest/globals": "^29.7.0",
65
69
  "@types/jest": "^29.5.0",
66
- "@types/node": "^20.1.4",
70
+ "@types/node": "^20.8.0",
67
71
  "@types/react": "^18.2.21",
68
72
  "@types/react-dom": "^18.2.4",
69
73
  "@typescript-eslint/eslint-plugin": "^5.57.0",
@@ -71,7 +75,7 @@
71
75
  "@walletconnect/types": "^2.10.0",
72
76
  "dotenv": "^16.0.3",
73
77
  "esbuild-plugin-inline-image": "^0.0.9",
74
- "esbuild-sass-plugin": "^2.10.0",
78
+ "esbuild-sass-plugin": "^2.15.0",
75
79
  "esbuild-scss-modules-plugin": "^1.1.1",
76
80
  "eslint": "^8.48.0",
77
81
  "eslint-plugin-react": "^7.31.10",
@@ -86,5 +90,8 @@
86
90
  },
87
91
  "files": [
88
92
  "dist"
89
- ]
93
+ ],
94
+ "resolutions": {
95
+ "postcss": "^8"
96
+ }
90
97
  }