@arcblock/ux 3.1.30 → 3.1.32
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/lib/NavMenu/products.js +323 -131
- package/lib/SessionUser/components/logged-in.js +41 -39
- package/lib/package.json.js +1 -1
- package/lib/withTracker/action/bind-wallet.d.ts +14 -0
- package/lib/withTracker/action/bind-wallet.js +1 -0
- package/lib/withTracker/action/login.d.ts +15 -0
- package/lib/withTracker/action/login.js +1 -0
- package/lib/withTracker/action/pay.d.ts +12 -0
- package/lib/withTracker/action/pay.js +1 -0
- package/lib/withTracker/action/switch-passport.d.ts +18 -0
- package/lib/withTracker/action/switch-passport.js +1 -0
- package/lib/withTracker/constant/index.d.ts +3 -0
- package/lib/withTracker/constant/index.js +6 -0
- package/lib/withTracker/env.d.ts +1 -0
- package/lib/withTracker/env.js +4 -0
- package/lib/withTracker/index.d.ts +2 -0
- package/lib/withTracker/index.js +21 -17
- package/package.json +7 -7
- package/src/NavMenu/products.tsx +192 -0
- package/src/SessionUser/components/logged-in.tsx +2 -0
- package/src/withTracker/action/bind-wallet.tsx +17 -0
- package/src/withTracker/action/login.tsx +18 -0
- package/src/withTracker/action/pay.tsx +14 -0
- package/src/withTracker/action/switch-passport.tsx +20 -0
- package/src/withTracker/constant/index.tsx +3 -0
- package/src/withTracker/env.tsx +1 -0
- package/src/withTracker/index.tsx +8 -11
@@ -0,0 +1,14 @@
|
|
1
|
+
export interface PayEvent {
|
2
|
+
action: 'paySuccess' | 'payFailed';
|
3
|
+
checkoutSessionMode: string;
|
4
|
+
success: boolean;
|
5
|
+
}
|
6
|
+
|
7
|
+
export interface PaySuccessEvent extends PayEvent {
|
8
|
+
success: true;
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface PayFailedEvent extends PayEvent {
|
12
|
+
success: false;
|
13
|
+
errorMessage: string;
|
14
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
export interface SwitchPassportEvent {
|
2
|
+
action: 'switchPassportSuccess' | 'switchPassportFailed';
|
3
|
+
success: boolean;
|
4
|
+
}
|
5
|
+
|
6
|
+
export interface SwitchPassportSuccessEvent extends SwitchPassportEvent {
|
7
|
+
success: true;
|
8
|
+
/**
|
9
|
+
*
|
10
|
+
* @example guest -> admin
|
11
|
+
* @type {string}
|
12
|
+
* @memberof SwitchPassportEvent
|
13
|
+
*/
|
14
|
+
change: string;
|
15
|
+
}
|
16
|
+
|
17
|
+
export interface SwitchPassportFailedEvent extends SwitchPassportEvent {
|
18
|
+
success: false;
|
19
|
+
errorMessage: string;
|
20
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export const googleAnalyticsMeasurementId: string = window.blocklet?.GA_MEASUREMENT_ID || '';
|
@@ -1,29 +1,26 @@
|
|
1
1
|
import { useLocation } from 'react-router-dom';
|
2
2
|
import { useMount, useDeepCompareEffect } from 'ahooks';
|
3
3
|
import ReactGA from 'react-ga4';
|
4
|
+
import { googleAnalyticsMeasurementId } from './env';
|
4
5
|
|
6
|
+
if (googleAnalyticsMeasurementId) {
|
7
|
+
ReactGA.initialize(googleAnalyticsMeasurementId);
|
8
|
+
}
|
9
|
+
|
10
|
+
export { ReactGA };
|
5
11
|
export default <P extends object>(WrappedComponent: React.ComponentType<P>) => {
|
6
|
-
const trackingId = window.blocklet?.GA_MEASUREMENT_ID || '';
|
7
12
|
const trackPage = (page: string, title = document.title) => {
|
8
|
-
if (
|
9
|
-
return;
|
10
|
-
}
|
11
|
-
|
12
|
-
if (trackingId) {
|
13
|
+
if (googleAnalyticsMeasurementId) {
|
13
14
|
ReactGA.send({ hitType: 'pageview', page, title });
|
14
15
|
}
|
15
16
|
};
|
16
17
|
|
17
18
|
const trackEvent = (category: string, action: string, label: string, value: number) => {
|
18
|
-
if (
|
19
|
+
if (googleAnalyticsMeasurementId) {
|
19
20
|
ReactGA.event({ category, action, label, value, transport: 'beacon' });
|
20
21
|
}
|
21
22
|
};
|
22
23
|
|
23
|
-
if (trackingId) {
|
24
|
-
ReactGA.initialize(trackingId);
|
25
|
-
}
|
26
|
-
|
27
24
|
// @ts-ignore
|
28
25
|
window.trackPage = trackPage;
|
29
26
|
// @ts-ignore
|