@g2crowd/buyer-intent-provider-sdk 0.2.0 → 0.4.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/index.d.ts DELETED
@@ -1,183 +0,0 @@
1
- import type * as React from 'react';
2
-
3
- export type BuyerIntentInitOptions = {
4
- activityEndpoint?: string;
5
- origin?: string;
6
- viewName?: string;
7
- /** @deprecated Use viewName instead */
8
- pageviewName?: string;
9
- distinctId?: string;
10
- userType?: string;
11
- };
12
-
13
- export type BuyerIntentTagOptions = {
14
- productIds?: number[];
15
- categoryIds?: number[];
16
- tag?: string;
17
- sourceLocation?: string;
18
- context?: Record<string, unknown>;
19
- };
20
-
21
- export type BuyerIntentBaseOptions = {
22
- origin?: string;
23
- distinctId?: string;
24
- userType?: string;
25
- };
26
-
27
- export type BuyerIntentVisitProperties = {
28
- ip?: string;
29
- referrer?: string;
30
- landing_page?: string;
31
- user_agent?: string;
32
- utm_source?: string;
33
- utm_medium?: string;
34
- utm_campaign?: string;
35
- utm_term?: string;
36
- utm_content?: string;
37
- [key: string]: unknown;
38
- };
39
-
40
- export type BuyerIntentSDK = {
41
- init: (options?: BuyerIntentInitOptions) => void;
42
- trackPageview: (element?: Element) => boolean;
43
- trackClick: (element: Element) => boolean;
44
- trackTaggedPageview: (element: Element) => boolean;
45
- tagPage: (options?: BuyerIntentTagOptions) => void;
46
- setBaseProperties: (options?: BuyerIntentBaseOptions) => void;
47
- setVisitProperties: (options?: BuyerIntentVisitProperties) => void;
48
- setActivityEndpoint: (endpoint: string) => void;
49
- trackNextRouter: (nextRouter: {
50
- events?: {
51
- on: (event: string, handler: () => void) => void;
52
- off: (event: string, handler: () => void) => void;
53
- };
54
- }) => () => void;
55
- };
56
-
57
- export function createBuyerIntentSDK(): BuyerIntentSDK;
58
- export const buyerIntent: BuyerIntentSDK;
59
-
60
- export type TrackerProps = {
61
- productIds?: number[];
62
- categoryIds?: number[];
63
- tag?: string;
64
- sourceLocation?: string;
65
- context?: Record<string, unknown>;
66
- origin?: string;
67
- activityEndpoint?: string;
68
- userType?: string;
69
- distinctId?: string;
70
- eventName?: string;
71
- children?: React.ReactNode;
72
- };
73
-
74
- export const ViewTracker: React.FC<TrackerProps>;
75
- export const ClickTracker: React.FC<TrackerProps>;
76
-
77
- type TrackerConfig = {
78
- sourceLocation?: string;
79
- context?: Record<string, unknown>;
80
- origin?: string;
81
- activityEndpoint?: string;
82
- userType?: string;
83
- distinctId?: string;
84
- eventName?: string;
85
- children?: React.ReactNode;
86
- };
87
-
88
- type ProductIdsTrackerProps = TrackerConfig & { productIds: number[] };
89
- type ProductIdTrackerProps = TrackerConfig & { productId: number };
90
- type CategoryTrackerProps = TrackerConfig & { categoryId: number };
91
-
92
- export const CompareView: React.FC<ProductIdsTrackerProps>;
93
- export const CompetitorsView: React.FC<ProductIdTrackerProps>;
94
- export const ProfileView: React.FC<ProductIdTrackerProps>;
95
- export const PricingView: React.FC<ProductIdTrackerProps>;
96
- export const CategoryView: React.FC<CategoryTrackerProps>;
97
- export const WriteReviewView: React.FC<ProductIdTrackerProps>;
98
- export const AdClick: React.FC<ProductIdTrackerProps>;
99
- export const LeadCreateClick: React.FC<ProductIdTrackerProps>;
100
-
101
- export const BuyerIntent: {
102
- ViewTracker: React.FC<TrackerProps>;
103
- ClickTracker: React.FC<TrackerProps>;
104
- CompareView: React.FC<ProductIdsTrackerProps>;
105
- CompetitorsView: React.FC<ProductIdTrackerProps>;
106
- ProfileView: React.FC<ProductIdTrackerProps>;
107
- PricingView: React.FC<ProductIdTrackerProps>;
108
- CategoryView: React.FC<CategoryTrackerProps>;
109
- WriteReviewView: React.FC<ProductIdTrackerProps>;
110
- AdClick: React.FC<ProductIdTrackerProps>;
111
- LeadCreateClick: React.FC<ProductIdTrackerProps>;
112
- };
113
-
114
- export type ActivityHandlerOptions = {
115
- topic?: string;
116
- partnerId?: string;
117
- topicPrefix?: string;
118
- kafkaBrokers?: string[];
119
- kafkaClientId?: string;
120
- producer?: {
121
- send: (payload: {
122
- topic: string;
123
- messages: Array<{ value: string }>;
124
- }) => Promise<unknown>;
125
- };
126
- nowFn?: () => string;
127
- uuidFn?: () => string;
128
- getIp?: (args: {
129
- headers?: Record<string, string> | Headers;
130
- request?: { ip?: string };
131
- }) => string | undefined;
132
- };
133
-
134
- export type ActivityHandlerResponse = {
135
- status: number;
136
- body: { ok: boolean; error?: string };
137
- setCookies: Array<{
138
- name: string;
139
- value: string;
140
- options: { httpOnly: boolean; sameSite: string };
141
- }>;
142
- };
143
-
144
- export function createActivityHandler(
145
- options?: ActivityHandlerOptions
146
- ): (args: {
147
- body: {
148
- name: string;
149
- properties?: Record<string, unknown>;
150
- visit?: { properties?: Record<string, unknown> };
151
- };
152
- headers?: Record<string, string> | Headers;
153
- cookies?:
154
- | Record<string, string>
155
- | { get: (name: string) => { value?: string } | string | undefined };
156
- request?: { ip?: string };
157
- }) => Promise<ActivityHandlerResponse>;
158
-
159
- export function createNextRouteHandler(
160
- options?: ActivityHandlerOptions
161
- ): (req: {
162
- json: () => Promise<{
163
- name: string;
164
- properties?: Record<string, unknown>;
165
- visit?: { properties?: Record<string, unknown> };
166
- }>;
167
- headers: Headers;
168
- cookies: { get: (name: string) => { value?: string } | string | undefined };
169
- }) => Promise<unknown>;
170
-
171
- export function createDevLoggerProducer(options?: {
172
- log?: (message: string, payload: { topic: string; value: string }) => void;
173
- }): {
174
- send: (payload: {
175
- topic: string;
176
- messages: Array<{ value: string }>;
177
- }) => Promise<unknown>;
178
- };
179
-
180
- export function topicName(options?: {
181
- partnerId?: string;
182
- prefix?: string;
183
- }): string | undefined;
package/index.js DELETED
@@ -1,15 +0,0 @@
1
- export {
2
- buyerIntent,
3
- createBuyerIntentSDK,
4
- BuyerIntent,
5
- ViewTracker,
6
- ClickTracker,
7
- CompareView,
8
- CompetitorsView,
9
- ProfileView,
10
- PricingView,
11
- CategoryView,
12
- WriteReviewView,
13
- AdClick,
14
- LeadCreateClick,
15
- } from './browser/index.js';
File without changes
File without changes
File without changes
File without changes