@surfside/ads-react 0.1.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.
- package/README.md +127 -0
- package/lib/cjs/index.js +16325 -0
- package/lib/esm/index.js +16299 -0
- package/lib/types/components/SurfsideBanner.d.ts +67 -0
- package/lib/types/components/SurfsideCarousel.d.ts +24 -0
- package/lib/types/components/SurfsideDynamicZone.d.ts +12 -0
- package/lib/types/components/SurfsideProduct.d.ts +1 -0
- package/lib/types/components/SurfsideVideo.d.ts +72 -0
- package/lib/types/components/index.d.ts +5 -0
- package/lib/types/hooks/index.d.ts +4 -0
- package/lib/types/hooks/useSurfDynamicZone.d.ts +7 -0
- package/lib/types/hooks/useSurfsideBanner.d.ts +252 -0
- package/lib/types/hooks/useSurfsideDynamicZone.d.ts +179 -0
- package/lib/types/hooks/useSurfsideProducts.d.ts +215 -0
- package/lib/types/hooks/useSurfsideVideo.d.ts +265 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/provider/SurfsideContextProvider.d.ts +140 -0
- package/lib/types/provider/index.d.ts +1 -0
- package/lib/types/types.d.ts +33 -0
- package/lib/types/utils/Analytics.d.ts +73 -0
- package/lib/types/utils/analytics.d.ts +58 -0
- package/lib/types/utils/index.d.ts +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { IBanner, IVideo } from '../hooks';
|
|
2
|
+
import type { IProductInformation } from '@surfside/ads-core';
|
|
3
|
+
/**
|
|
4
|
+
* Utility functions for tracking analytics events
|
|
5
|
+
*/
|
|
6
|
+
export interface IImpressionAnalytics {
|
|
7
|
+
timestamp: number;
|
|
8
|
+
zoneId: string;
|
|
9
|
+
productIds?: string[];
|
|
10
|
+
bannerId?: string;
|
|
11
|
+
locationId?: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface IClickAnalytics {
|
|
15
|
+
timestamp: number;
|
|
16
|
+
zoneId: string;
|
|
17
|
+
productId?: string;
|
|
18
|
+
bannerId?: string;
|
|
19
|
+
locationId?: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Track a product click event
|
|
24
|
+
* @param product The product that was clicked
|
|
25
|
+
* @param zoneId The zone ID where the product was displayed
|
|
26
|
+
* @param callback Optional callback for custom tracking
|
|
27
|
+
*/
|
|
28
|
+
export declare const trackProductClick: (product: IProductInformation, zoneId: string, callback?: (product: IProductInformation, analytics: IClickAnalytics) => void) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Track a banner click event
|
|
31
|
+
* @param banner The banner that was clicked
|
|
32
|
+
* @param zoneId The zone ID where the banner was displayed
|
|
33
|
+
* @param callback Optional callback for custom tracking
|
|
34
|
+
*/
|
|
35
|
+
export declare const trackBannerClick: (banner: IBanner, zoneId: string, callback?: (analytics: IClickAnalytics) => void) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Track product impressions
|
|
38
|
+
* @param products The products that were impressed
|
|
39
|
+
* @param zoneId The zone ID where the products were displayed
|
|
40
|
+
* @param callback Optional callback for custom tracking
|
|
41
|
+
*/
|
|
42
|
+
export declare const trackProductImpressions: (products: IProductInformation[], zoneId: string, callback?: (products: IProductInformation[], analytics: IImpressionAnalytics) => void) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Track banner impressions
|
|
45
|
+
* @param banner The banner that was impressed
|
|
46
|
+
* @param zoneId The zone ID where the banner was displayed
|
|
47
|
+
* @param callback Optional callback for custom tracking
|
|
48
|
+
*/
|
|
49
|
+
export declare const trackBannerImpression: (banner: IBanner, zoneId: string, callback?: (analytics: IImpressionAnalytics) => void) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Track video impression
|
|
52
|
+
* @param video The video that was impressed
|
|
53
|
+
* @param zoneId The zone ID where the video was displayed
|
|
54
|
+
* @param callback Optional callback for custom tracking
|
|
55
|
+
*/
|
|
56
|
+
export declare const trackVideoImpression: (video: IVideo, zoneId: string, callback?: (analytics: Record<string, unknown>) => void) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Track video events (play, pause, complete, etc.)
|
|
59
|
+
* @param video The video object
|
|
60
|
+
* @param zoneId The zone ID where the video was displayed
|
|
61
|
+
* @param eventType The type of event (play, pause, complete, etc.)
|
|
62
|
+
* @param position Current position in the video (seconds)
|
|
63
|
+
* @param callback Optional callback for custom tracking
|
|
64
|
+
*/
|
|
65
|
+
export declare const trackVideoEvent: (video: IVideo, zoneId: string, eventType: string, position: number, callback?: (analytics: Record<string, unknown>) => void) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Track zone events (ready, no content, error)
|
|
68
|
+
* @param zoneId The zone ID
|
|
69
|
+
* @param eventType The type of event (ready, no-content, error)
|
|
70
|
+
* @param data Additional data for the event
|
|
71
|
+
* @param callback Optional callback for custom tracking
|
|
72
|
+
*/
|
|
73
|
+
export declare const trackZoneEvent: (zoneId: string, eventType: "ready" | "no-content" | "error", data?: Record<string, unknown>, callback?: (eventType: string, zoneId: string, data?: Record<string, unknown>) => void) => void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { IBanner, IClickAnalytics, IImpressionAnalytics } from '../types';
|
|
2
|
+
import { IVideo } from '../hooks/useSurfsideVideo';
|
|
3
|
+
import { IProductInformation } from '@surfside/ads-core';
|
|
4
|
+
/**
|
|
5
|
+
* Utility functions for tracking analytics events
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Track a product click event
|
|
9
|
+
* @param product The product that was clicked
|
|
10
|
+
* @param zoneId The zone ID where the product was displayed
|
|
11
|
+
* @param callback Optional callback for custom tracking
|
|
12
|
+
*/
|
|
13
|
+
export declare const trackProductClick: (product: IProductInformation, zoneId: string, callback?: (product: IProductInformation, analytics: IClickAnalytics) => void) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Track a banner click event
|
|
16
|
+
* @param banner The banner that was clicked
|
|
17
|
+
* @param zoneId The zone ID where the banner was displayed
|
|
18
|
+
* @param callback Optional callback for custom tracking
|
|
19
|
+
*/
|
|
20
|
+
export declare const trackBannerClick: (banner: IBanner, zoneId: string, callback?: (analytics: IClickAnalytics) => void) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Track product impressions
|
|
23
|
+
* @param products The products that were impressed
|
|
24
|
+
* @param zoneId The zone ID where the products were displayed
|
|
25
|
+
* @param callback Optional callback for custom tracking
|
|
26
|
+
*/
|
|
27
|
+
export declare const trackProductImpressions: (products: IProductInformation[], zoneId: string, callback?: (products: IProductInformation[], analytics: IImpressionAnalytics) => void) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Track banner impressions
|
|
30
|
+
* @param banner The banner that was impressed
|
|
31
|
+
* @param zoneId The zone ID where the banner was displayed
|
|
32
|
+
* @param callback Optional callback for custom tracking
|
|
33
|
+
*/
|
|
34
|
+
export declare const trackBannerImpression: (banner: IBanner, zoneId: string, callback?: (analytics: IImpressionAnalytics) => void) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Track video impression
|
|
37
|
+
* @param video The video that was impressed
|
|
38
|
+
* @param zoneId The zone ID where the video was displayed
|
|
39
|
+
* @param callback Optional callback for custom tracking
|
|
40
|
+
*/
|
|
41
|
+
export declare const trackVideoImpression: (video: IVideo, zoneId: string, callback?: (analytics: Record<string, unknown>) => void) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Track video events (play, pause, complete, etc.)
|
|
44
|
+
* @param video The video object
|
|
45
|
+
* @param zoneId The zone ID where the video was displayed
|
|
46
|
+
* @param eventType The type of event (play, pause, complete, etc.)
|
|
47
|
+
* @param position Current position in the video (seconds)
|
|
48
|
+
* @param callback Optional callback for custom tracking
|
|
49
|
+
*/
|
|
50
|
+
export declare const trackVideoEvent: (video: IVideo, zoneId: string, eventType: string, position: number, callback?: (analytics: Record<string, unknown>) => void) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Track zone events (ready, no content, error)
|
|
53
|
+
* @param zoneId The zone ID
|
|
54
|
+
* @param eventType The type of event (ready, no-content, error)
|
|
55
|
+
* @param data Additional data for the event
|
|
56
|
+
* @param callback Optional callback for custom tracking
|
|
57
|
+
*/
|
|
58
|
+
export declare const trackZoneEvent: (zoneId: string, eventType: "ready" | "no-content" | "error", data?: Record<string, unknown>, callback?: (eventType: string, zoneId: string, data?: Record<string, unknown>) => void) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Analytics';
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@surfside/ads-react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React components for Surfside Ads",
|
|
5
|
+
"main": "./lib/cjs/index.js",
|
|
6
|
+
"module": "./lib/esm/index.js",
|
|
7
|
+
"types": "./lib/types/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"license": "UNLICENSED",
|
|
10
|
+
"files": [
|
|
11
|
+
"lib/",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "bun run bun.build.ts",
|
|
16
|
+
"lint": "npx eslint"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"react": "^19",
|
|
20
|
+
"react-dom": ">=16.8.0",
|
|
21
|
+
"typescript": "^5.8.3"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@surfside/ads-core-web": "^0.1.0",
|
|
25
|
+
"@surfside/ads-core-mock": "^0.1.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/bun": "latest",
|
|
29
|
+
"@types/react": "^18.0.0",
|
|
30
|
+
"@types/react-dom": "^18.0.0",
|
|
31
|
+
"@surfside/ads-core-web": "^0.1.0",
|
|
32
|
+
"typedoc": "^0.28.5"
|
|
33
|
+
}
|
|
34
|
+
}
|