@phygitallabs/tapquest-core 6.7.16 → 6.7.17
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.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -12
- package/dist/index.d.ts +2 -12
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -2
- package/src/modules/consent/index.ts +8 -7
- package/src/modules/data-tracking/DataTrackingConsentSync.tsx +64 -63
- package/src/modules/data-tracking/hooks/index.ts +10 -8
- package/src/modules/data-tracking/index.ts +2 -1
- package/src/modules/user-campaign/index.ts +1 -1
- package/src/providers/ServicesProvider.tsx +6 -2
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -33,9 +33,9 @@ export * from "./modules/session-replay";
|
|
|
33
33
|
|
|
34
34
|
export * from "./modules/action-logs";
|
|
35
35
|
|
|
36
|
-
export * from "./modules/consent";
|
|
37
|
-
|
|
36
|
+
// export * from "./modules/consent";
|
|
38
37
|
|
|
38
|
+
export * from "./modules/user-campaign";
|
|
39
39
|
|
|
40
40
|
// Export types
|
|
41
41
|
export * from "./types/common";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
// Consent implementation commented out
|
|
2
|
+
// export {
|
|
3
|
+
// PhygitalConsentProvider,
|
|
4
|
+
// usePhygitalConsent,
|
|
5
|
+
// useLatestConsentByUserId,
|
|
6
|
+
// CookieConsentBanner,
|
|
7
|
+
// PolicyPopup,
|
|
8
|
+
// } from "@phygitallabs/phygital-consent";
|
|
@@ -1,73 +1,74 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
// Consent implementation commented out
|
|
4
|
+
// import { usePhygitalConsent } from "@phygitallabs/phygital-consent";
|
|
5
|
+
// import { useEffect } from "react";
|
|
6
|
+
// import { useDataTracking } from "./hooks";
|
|
6
7
|
|
|
7
|
-
type GtagConsent = (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
) => void;
|
|
8
|
+
// type GtagConsent = (
|
|
9
|
+
// command: "consent",
|
|
10
|
+
// action: "default" | "update",
|
|
11
|
+
// params: Record<string, string>
|
|
12
|
+
// ) => void;
|
|
12
13
|
|
|
13
|
-
/** Consent Mode v2: block analytics and ad tags until user accepts. */
|
|
14
|
-
const GTAG_CONSENT_DENIED = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} as const;
|
|
14
|
+
// /** Consent Mode v2: block analytics and ad tags until user accepts. */
|
|
15
|
+
// const GTAG_CONSENT_DENIED = {
|
|
16
|
+
// analytics_storage: "denied",
|
|
17
|
+
// ad_storage: "denied",
|
|
18
|
+
// ad_user_data: "denied",
|
|
19
|
+
// ad_personalization: "denied",
|
|
20
|
+
// } as const;
|
|
20
21
|
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export function DataTrackingConsentSync() {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
// /**
|
|
23
|
+
// * Syncs cookie consent to GA, GTM, PostHog, OpenReplay, and Google AdSense.
|
|
24
|
+
// * - On mount: sets gtag/GTM consent default to denied.
|
|
25
|
+
// * - When analytics allowed: grants analytics_storage (GA/GTM), opts in PostHog, starts OpenReplay.
|
|
26
|
+
// * - When advertising allowed: grants ad_storage, ad_user_data, ad_personalization (AdSense).
|
|
27
|
+
// * Must be used under PhygitalConsentProvider; for OpenReplay also under SessionReplayProvider.
|
|
28
|
+
// * Renders nothing.
|
|
29
|
+
// */
|
|
30
|
+
// export function DataTrackingConsentSync() {
|
|
31
|
+
// const consent = usePhygitalConsent() as {
|
|
32
|
+
// isAnalyticsAllowed?: boolean;
|
|
33
|
+
// isAdvertisingAllowed?: boolean;
|
|
34
|
+
// };
|
|
35
|
+
// const isAnalyticsAllowed = consent.isAnalyticsAllowed ?? false;
|
|
36
|
+
// const isAdvertisingAllowed = consent.isAdvertisingAllowed ?? false;
|
|
37
|
+
// const { togglePostHog, toggleOpenReplay, toggleGoogleAdSense, pauseGoogleAdSense } =
|
|
38
|
+
// useDataTracking();
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
// // Default: deny all consent (run once on mount)
|
|
41
|
+
// useEffect(() => {
|
|
42
|
+
// if (typeof window === "undefined") return;
|
|
43
|
+
// const w = window as Window & { dataLayer?: unknown[]; gtag?: GtagConsent };
|
|
44
|
+
// w.dataLayer = w.dataLayer || [];
|
|
45
|
+
// if (typeof w.gtag === "function") {
|
|
46
|
+
// w.gtag("consent", "default", { ...GTAG_CONSENT_DENIED });
|
|
47
|
+
// } else {
|
|
48
|
+
// (w.dataLayer as unknown[]).push(["consent", "default", { ...GTAG_CONSENT_DENIED }]);
|
|
49
|
+
// }
|
|
50
|
+
// }, []);
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
// // Google AdSense: grant ad consent when allowed, revoke (pause) when denied
|
|
53
|
+
// useEffect(() => {
|
|
54
|
+
// if (isAdvertisingAllowed) {
|
|
55
|
+
// toggleGoogleAdSense();
|
|
56
|
+
// } else {
|
|
57
|
+
// pauseGoogleAdSense();
|
|
58
|
+
// }
|
|
59
|
+
// }, [isAdvertisingAllowed, toggleGoogleAdSense, pauseGoogleAdSense]);
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
// // PostHog: opt in when analytics allowed
|
|
62
|
+
// useEffect(() => {
|
|
63
|
+
// if (!isAnalyticsAllowed) return;
|
|
64
|
+
// togglePostHog();
|
|
65
|
+
// }, [isAnalyticsAllowed, togglePostHog]);
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
// // OpenReplay: init and start when analytics allowed
|
|
68
|
+
// useEffect(() => {
|
|
69
|
+
// if (!isAnalyticsAllowed) return;
|
|
70
|
+
// toggleOpenReplay();
|
|
71
|
+
// }, [isAnalyticsAllowed, toggleOpenReplay]);
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
}
|
|
73
|
+
// return null;
|
|
74
|
+
// }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// Consent implementation commented out
|
|
2
|
+
// import { usePhygitalConsent } from "@phygitallabs/phygital-consent";
|
|
2
3
|
import posthog from "posthog-js";
|
|
3
4
|
import { useSessionReplay } from "../../../modules/session-replay";
|
|
4
5
|
|
|
@@ -53,16 +54,17 @@ const pushEventToPosthog = (eventName: string, eventData: Record<string, any>) =
|
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
/** Consent flags from PhygitalConsentProvider (isAdvertisingAllowed may be added in newer versions). */
|
|
56
|
-
interface ConsentFlags {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
57
|
+
// interface ConsentFlags {
|
|
58
|
+
// isAnalyticsAllowed: boolean;
|
|
59
|
+
// isAdvertisingAllowed?: boolean;
|
|
60
|
+
// }
|
|
60
61
|
|
|
61
62
|
function useDataTracking() {
|
|
62
63
|
const { initTracker, startTracking, setUserId, setMetadata } = useSessionReplay();
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
const
|
|
64
|
+
// Consent implementation commented out: no provider, use stub (tracking off)
|
|
65
|
+
// const consent = usePhygitalConsent() as unknown as ConsentFlags;
|
|
66
|
+
const isAnalyticsAllowed = false; // consent.isAnalyticsAllowed ?? false;
|
|
67
|
+
const isAdvertisingAllowed = false; // consent.isAdvertisingAllowed ?? false;
|
|
66
68
|
|
|
67
69
|
/** Load GA script and grant analytics consent. No-op if analytics consent is denied or script already loaded. */
|
|
68
70
|
const loadGA = (gaId: string) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useUserCampaignAction } from "@phygitallabs/api-core";
|
|
1
|
+
export { useUserCampaignAction } from "@phygitallabs/api-core";
|
|
@@ -4,8 +4,9 @@ import { PGLCoreServiceProvider } from "@phygitallabs/api-core";
|
|
|
4
4
|
import { RewardServiceProvider } from "@phygitallabs/reward";
|
|
5
5
|
import { AchievementServiceProvider } from "@phygitallabs/achievement";
|
|
6
6
|
import { GenerateCertificateServiceProvider } from "@phygitallabs/generate-certificate";
|
|
7
|
-
|
|
8
|
-
import {
|
|
7
|
+
// Consent implementation commented out
|
|
8
|
+
// import { PhygitalConsentProvider } from "@phygitallabs/phygital-consent";
|
|
9
|
+
// import { DataTrackingConsentSync } from "../modules/data-tracking";
|
|
9
10
|
|
|
10
11
|
import serviceApiUrl from "../constants/service";
|
|
11
12
|
import { APIConfig, ServiceConfig } from "../types/service";
|
|
@@ -141,6 +142,7 @@ export const ServicesProvider: React.FC<ServicesProviderProps> = ({
|
|
|
141
142
|
{...commonServiceConfig}
|
|
142
143
|
baseURL={`${serviceApiUrl[environment].API_GENERATE_CERTIFICATE_URL}/v1`}
|
|
143
144
|
>
|
|
145
|
+
{/* Consent implementation commented out
|
|
144
146
|
<PhygitalConsentProvider
|
|
145
147
|
{...commonServiceConfig}
|
|
146
148
|
deviceId={deviceUid}
|
|
@@ -154,6 +156,8 @@ export const ServicesProvider: React.FC<ServicesProviderProps> = ({
|
|
|
154
156
|
<DataTrackingConsentSync />
|
|
155
157
|
{children}
|
|
156
158
|
</PhygitalConsentProvider>
|
|
159
|
+
*/}
|
|
160
|
+
{children}
|
|
157
161
|
</GenerateCertificateServiceProvider>
|
|
158
162
|
</AchievementServiceProvider>
|
|
159
163
|
</RewardServiceProvider>
|