gotrip-fx-transaction-form 1.0.211-dev → 1.0.213-dev
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/index.js +12539 -12467
- package/package.json +1 -1
- package/types/store/useTrackingStore.d.ts +8 -0
- package/types/types/tracking.dto.d.ts +19 -0
- package/types/util/tracking.d.ts +29 -0
package/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TrackingDto } from '../types/tracking.dto';
|
|
2
|
+
export type TrackingState = {
|
|
3
|
+
anonymousId: string | null;
|
|
4
|
+
getAnonymousUid: () => string;
|
|
5
|
+
getTrackingData: () => TrackingDto;
|
|
6
|
+
_saveAnonymousUid: (uid: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const useTrackingStore: import('zustand').UseBoundStore<import('zustand').StoreApi<TrackingState>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracking DTO interface for tracking user behavior
|
|
3
|
+
* This interface can be extended with additional tracking fields in the future
|
|
4
|
+
*/
|
|
5
|
+
export interface TrackingDto {
|
|
6
|
+
/** Anonymous user ID for tracking unauthenticated users */
|
|
7
|
+
anonymousId?: string;
|
|
8
|
+
/** Google Click ID for tracking Google Ads campaigns */
|
|
9
|
+
gclid?: string;
|
|
10
|
+
/** Facebook Click ID for tracking Facebook Ads campaigns */
|
|
11
|
+
fbid?: string;
|
|
12
|
+
/** Campaign identifier */
|
|
13
|
+
campaign?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Type helper to extend any DTO with tracking fields
|
|
17
|
+
* Usage: type MyDtoWithTracking = WithTracking<MyDto>
|
|
18
|
+
*/
|
|
19
|
+
export type WithTracking<T> = T & TrackingDto;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a new anonymous user ID (15 chars, url-safe).
|
|
3
|
+
* @see https://alex7kom.github.io/nano-nanoid-cc/
|
|
4
|
+
*/
|
|
5
|
+
export declare const generateAnonymousUid: (size?: number) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Save anonymous UID to both cookie and localStorage
|
|
8
|
+
* This ensures persistence across different storage mechanisms
|
|
9
|
+
*/
|
|
10
|
+
export declare const saveAnonymousUid: (uid: string) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Get anonymous UID with priority: cookie first, then localStorage
|
|
13
|
+
* If not found, generates a new one and saves it
|
|
14
|
+
*/
|
|
15
|
+
export declare const getAnonymousUid: () => string;
|
|
16
|
+
/**
|
|
17
|
+
* Parse tracking parameters from URL query string
|
|
18
|
+
* Extracts gclid, fbid, campaign, etc. from URL
|
|
19
|
+
*/
|
|
20
|
+
export declare const parseTrackingParamsFromUrl: () => {
|
|
21
|
+
gclid?: string;
|
|
22
|
+
fbid?: string;
|
|
23
|
+
campaign?: string;
|
|
24
|
+
[key: string]: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Validate tracking data
|
|
28
|
+
*/
|
|
29
|
+
export declare const validateTrackingData: (data: any) => boolean;
|