@walkeros/web-destination-pinterest 3.3.0-next-1776098542393

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.
@@ -0,0 +1,168 @@
1
+ import { Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ /**
5
+ * Pinterest Tag global. The queue-based function created by the Pinterest
6
+ * snippet. Before core.js loads, calls are queued on `pintrk.queue`.
7
+ * After core.js resolves the queue, `pintrk` is replaced with the real
8
+ * implementation. Both shapes accept the same argument signatures.
9
+ */
10
+ interface Pintrk {
11
+ (command: 'load', tagId: string, identify?: IdentifyFields): void;
12
+ (command: 'page'): void;
13
+ (command: 'track', eventName: string, eventData?: EventData, callback?: (didInit: boolean, error?: unknown) => void): void;
14
+ (command: 'set', userData: IdentifyFields): void;
15
+ queue?: unknown[][];
16
+ version?: string;
17
+ }
18
+ declare global {
19
+ interface Window {
20
+ pintrk?: Pintrk;
21
+ }
22
+ }
23
+ /**
24
+ * Pinterest standard event taxonomy. See Pinterest Tag documentation.
25
+ * Client-side names are lowercase concatenated strings (addtocart,
26
+ * not add_to_cart). Sending the wrong name means the event will not
27
+ * appear correctly in Pinterest's conversion reports.
28
+ */
29
+ type StandardEventName = 'pagevisit' | 'viewcategory' | 'search' | 'addtocart' | 'checkout' | 'watchvideo' | 'signup' | 'lead' | 'addpaymentinfo' | 'addtowishlist' | 'initiatecheckout' | 'subscribe' | 'viewcontent' | 'contact' | 'customizeproduct' | 'findlocation' | 'schedule' | 'starttrial' | 'submitapplication' | 'custom';
30
+ /** Open union — any string is still passed through to pintrk. */
31
+ type EventName = StandardEventName | (string & {});
32
+ /**
33
+ * Enhanced matching fields. Web destination strictly limits to the two
34
+ * documented client-side Pinterest Tag fields. CAPI-only fields (ph, fn,
35
+ * ln, address, country, ip, ua) belong to a future server destination
36
+ * and are intentionally not accepted here.
37
+ *
38
+ * The Pinterest JS tag auto-hashes `em` with SHA-256 before transmission —
39
+ * the destination does NOT hash.
40
+ */
41
+ interface IdentifyFields {
42
+ em?: string;
43
+ external_id?: string;
44
+ }
45
+ /**
46
+ * Event data payload for pintrk('track', ...). Pinterest has a prescribed
47
+ * set of parameter names. Common parameters across events plus an open
48
+ * `[key: string]: unknown` for event-specific fields (search_query,
49
+ * video_title, lead_type, opt_out_type, custom properties, etc.).
50
+ */
51
+ interface EventData {
52
+ value?: number;
53
+ order_quantity?: number;
54
+ currency?: string;
55
+ event_id?: string;
56
+ order_id?: string;
57
+ promo_code?: string;
58
+ property?: string;
59
+ product_name?: string;
60
+ product_id?: string;
61
+ product_category?: string;
62
+ product_brand?: string;
63
+ product_price?: number;
64
+ product_quantity?: number;
65
+ product_variant_id?: string;
66
+ product_variant?: string;
67
+ line_items?: LineItem[];
68
+ search_query?: string;
69
+ video_title?: string;
70
+ lead_type?: string;
71
+ opt_out_type?: 'LDP';
72
+ [key: string]: unknown;
73
+ }
74
+ interface LineItem {
75
+ product_name?: string;
76
+ product_id?: string;
77
+ product_category?: string;
78
+ product_brand?: string;
79
+ product_price?: number;
80
+ product_quantity?: number;
81
+ product_variant_id?: string;
82
+ product_variant?: string;
83
+ [key: string]: unknown;
84
+ }
85
+ /**
86
+ * Destination-level settings.
87
+ *
88
+ * @property apiKey — Pinterest Tag ID (numeric string). Required. Passed
89
+ * to pintrk('load', tagId) on init.
90
+ * @property pageview — Fire pintrk('page') once in init after core.js
91
+ * loads. Default true (matches Pinterest's base code convention).
92
+ * Set false when walkerOS sources already emit page view events and
93
+ * you would otherwise get a duplicate initial fire.
94
+ * @property identify — walkerOS mapping value resolving to IdentifyFields.
95
+ * Enhanced matching data for pintrk('load', tagId, data) and subsequent
96
+ * pintrk('set', data) calls when the resolved identity changes.
97
+ * @property include — walkerOS event sections forwarded as prefixed
98
+ * properties in the track event data. Pinterest strongly prefers
99
+ * explicit mapping.data over include — include is a fallback for
100
+ * forwarding auxiliary context.
101
+ */
102
+ interface Settings {
103
+ apiKey: string;
104
+ pageview?: boolean;
105
+ identify?: Mapping$1.Value;
106
+ /**
107
+ * Runtime-only state. Not serialized to schema, not configurable by users.
108
+ * The destination uses this to diff enhanced matching across pushes and
109
+ * to suppress track() calls after consent revocation.
110
+ */
111
+ _state?: {
112
+ lastIdentify?: IdentifyFields;
113
+ consentGranted?: boolean;
114
+ };
115
+ }
116
+ type InitSettings = Partial<Settings>;
117
+ /**
118
+ * Per-event mapping settings (on rule.settings).
119
+ *
120
+ * @property identify — Per-event identity override. Resolves to
121
+ * IdentifyFields passed to pintrk('set', data).
122
+ * @property include — Overrides destination-level include for this rule.
123
+ */
124
+ interface Mapping {
125
+ identify?: Mapping$1.Value;
126
+ }
127
+ /**
128
+ * Env — mock surface for tests. Pinterest Tag uses window.pintrk, so
129
+ * the env extends DestinationWeb.Env (which already provides window
130
+ * and document).
131
+ */
132
+ interface Env extends DestinationWeb.Env {
133
+ window: {
134
+ pintrk?: Pintrk;
135
+ };
136
+ }
137
+ type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
138
+ type Destination = DestinationWeb.Destination<Types>;
139
+ type Config = DestinationWeb.Config<Types>;
140
+ interface PinterestDestination extends Destination {
141
+ env?: Env;
142
+ }
143
+ type Rule = Mapping$1.Rule<Mapping>;
144
+ type Rules = Mapping$1.Rules<Rule>;
145
+
146
+ type index_Config = Config;
147
+ type index_Destination = Destination;
148
+ type index_Env = Env;
149
+ type index_EventData = EventData;
150
+ type index_EventName = EventName;
151
+ type index_IdentifyFields = IdentifyFields;
152
+ type index_InitSettings = InitSettings;
153
+ type index_LineItem = LineItem;
154
+ type index_Mapping = Mapping;
155
+ type index_PinterestDestination = PinterestDestination;
156
+ type index_Pintrk = Pintrk;
157
+ type index_Rule = Rule;
158
+ type index_Rules = Rules;
159
+ type index_Settings = Settings;
160
+ type index_StandardEventName = StandardEventName;
161
+ type index_Types = Types;
162
+ declare namespace index {
163
+ export type { index_Config as Config, index_Destination as Destination, index_Env as Env, index_EventData as EventData, index_EventName as EventName, index_IdentifyFields as IdentifyFields, index_InitSettings as InitSettings, index_LineItem as LineItem, index_Mapping as Mapping, index_PinterestDestination as PinterestDestination, index_Pintrk as Pintrk, index_Rule as Rule, index_Rules as Rules, index_Settings as Settings, index_StandardEventName as StandardEventName, index_Types as Types };
164
+ }
165
+
166
+ declare const destinationPinterest: Destination;
167
+
168
+ export { index as DestinationPinterest, destinationPinterest as default, destinationPinterest };
@@ -0,0 +1,168 @@
1
+ import { Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ /**
5
+ * Pinterest Tag global. The queue-based function created by the Pinterest
6
+ * snippet. Before core.js loads, calls are queued on `pintrk.queue`.
7
+ * After core.js resolves the queue, `pintrk` is replaced with the real
8
+ * implementation. Both shapes accept the same argument signatures.
9
+ */
10
+ interface Pintrk {
11
+ (command: 'load', tagId: string, identify?: IdentifyFields): void;
12
+ (command: 'page'): void;
13
+ (command: 'track', eventName: string, eventData?: EventData, callback?: (didInit: boolean, error?: unknown) => void): void;
14
+ (command: 'set', userData: IdentifyFields): void;
15
+ queue?: unknown[][];
16
+ version?: string;
17
+ }
18
+ declare global {
19
+ interface Window {
20
+ pintrk?: Pintrk;
21
+ }
22
+ }
23
+ /**
24
+ * Pinterest standard event taxonomy. See Pinterest Tag documentation.
25
+ * Client-side names are lowercase concatenated strings (addtocart,
26
+ * not add_to_cart). Sending the wrong name means the event will not
27
+ * appear correctly in Pinterest's conversion reports.
28
+ */
29
+ type StandardEventName = 'pagevisit' | 'viewcategory' | 'search' | 'addtocart' | 'checkout' | 'watchvideo' | 'signup' | 'lead' | 'addpaymentinfo' | 'addtowishlist' | 'initiatecheckout' | 'subscribe' | 'viewcontent' | 'contact' | 'customizeproduct' | 'findlocation' | 'schedule' | 'starttrial' | 'submitapplication' | 'custom';
30
+ /** Open union — any string is still passed through to pintrk. */
31
+ type EventName = StandardEventName | (string & {});
32
+ /**
33
+ * Enhanced matching fields. Web destination strictly limits to the two
34
+ * documented client-side Pinterest Tag fields. CAPI-only fields (ph, fn,
35
+ * ln, address, country, ip, ua) belong to a future server destination
36
+ * and are intentionally not accepted here.
37
+ *
38
+ * The Pinterest JS tag auto-hashes `em` with SHA-256 before transmission —
39
+ * the destination does NOT hash.
40
+ */
41
+ interface IdentifyFields {
42
+ em?: string;
43
+ external_id?: string;
44
+ }
45
+ /**
46
+ * Event data payload for pintrk('track', ...). Pinterest has a prescribed
47
+ * set of parameter names. Common parameters across events plus an open
48
+ * `[key: string]: unknown` for event-specific fields (search_query,
49
+ * video_title, lead_type, opt_out_type, custom properties, etc.).
50
+ */
51
+ interface EventData {
52
+ value?: number;
53
+ order_quantity?: number;
54
+ currency?: string;
55
+ event_id?: string;
56
+ order_id?: string;
57
+ promo_code?: string;
58
+ property?: string;
59
+ product_name?: string;
60
+ product_id?: string;
61
+ product_category?: string;
62
+ product_brand?: string;
63
+ product_price?: number;
64
+ product_quantity?: number;
65
+ product_variant_id?: string;
66
+ product_variant?: string;
67
+ line_items?: LineItem[];
68
+ search_query?: string;
69
+ video_title?: string;
70
+ lead_type?: string;
71
+ opt_out_type?: 'LDP';
72
+ [key: string]: unknown;
73
+ }
74
+ interface LineItem {
75
+ product_name?: string;
76
+ product_id?: string;
77
+ product_category?: string;
78
+ product_brand?: string;
79
+ product_price?: number;
80
+ product_quantity?: number;
81
+ product_variant_id?: string;
82
+ product_variant?: string;
83
+ [key: string]: unknown;
84
+ }
85
+ /**
86
+ * Destination-level settings.
87
+ *
88
+ * @property apiKey — Pinterest Tag ID (numeric string). Required. Passed
89
+ * to pintrk('load', tagId) on init.
90
+ * @property pageview — Fire pintrk('page') once in init after core.js
91
+ * loads. Default true (matches Pinterest's base code convention).
92
+ * Set false when walkerOS sources already emit page view events and
93
+ * you would otherwise get a duplicate initial fire.
94
+ * @property identify — walkerOS mapping value resolving to IdentifyFields.
95
+ * Enhanced matching data for pintrk('load', tagId, data) and subsequent
96
+ * pintrk('set', data) calls when the resolved identity changes.
97
+ * @property include — walkerOS event sections forwarded as prefixed
98
+ * properties in the track event data. Pinterest strongly prefers
99
+ * explicit mapping.data over include — include is a fallback for
100
+ * forwarding auxiliary context.
101
+ */
102
+ interface Settings {
103
+ apiKey: string;
104
+ pageview?: boolean;
105
+ identify?: Mapping$1.Value;
106
+ /**
107
+ * Runtime-only state. Not serialized to schema, not configurable by users.
108
+ * The destination uses this to diff enhanced matching across pushes and
109
+ * to suppress track() calls after consent revocation.
110
+ */
111
+ _state?: {
112
+ lastIdentify?: IdentifyFields;
113
+ consentGranted?: boolean;
114
+ };
115
+ }
116
+ type InitSettings = Partial<Settings>;
117
+ /**
118
+ * Per-event mapping settings (on rule.settings).
119
+ *
120
+ * @property identify — Per-event identity override. Resolves to
121
+ * IdentifyFields passed to pintrk('set', data).
122
+ * @property include — Overrides destination-level include for this rule.
123
+ */
124
+ interface Mapping {
125
+ identify?: Mapping$1.Value;
126
+ }
127
+ /**
128
+ * Env — mock surface for tests. Pinterest Tag uses window.pintrk, so
129
+ * the env extends DestinationWeb.Env (which already provides window
130
+ * and document).
131
+ */
132
+ interface Env extends DestinationWeb.Env {
133
+ window: {
134
+ pintrk?: Pintrk;
135
+ };
136
+ }
137
+ type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
138
+ type Destination = DestinationWeb.Destination<Types>;
139
+ type Config = DestinationWeb.Config<Types>;
140
+ interface PinterestDestination extends Destination {
141
+ env?: Env;
142
+ }
143
+ type Rule = Mapping$1.Rule<Mapping>;
144
+ type Rules = Mapping$1.Rules<Rule>;
145
+
146
+ type index_Config = Config;
147
+ type index_Destination = Destination;
148
+ type index_Env = Env;
149
+ type index_EventData = EventData;
150
+ type index_EventName = EventName;
151
+ type index_IdentifyFields = IdentifyFields;
152
+ type index_InitSettings = InitSettings;
153
+ type index_LineItem = LineItem;
154
+ type index_Mapping = Mapping;
155
+ type index_PinterestDestination = PinterestDestination;
156
+ type index_Pintrk = Pintrk;
157
+ type index_Rule = Rule;
158
+ type index_Rules = Rules;
159
+ type index_Settings = Settings;
160
+ type index_StandardEventName = StandardEventName;
161
+ type index_Types = Types;
162
+ declare namespace index {
163
+ export type { index_Config as Config, index_Destination as Destination, index_Env as Env, index_EventData as EventData, index_EventName as EventName, index_IdentifyFields as IdentifyFields, index_InitSettings as InitSettings, index_LineItem as LineItem, index_Mapping as Mapping, index_PinterestDestination as PinterestDestination, index_Pintrk as Pintrk, index_Rule as Rule, index_Rules as Rules, index_Settings as Settings, index_StandardEventName as StandardEventName, index_Types as Types };
164
+ }
165
+
166
+ declare const destinationPinterest: Destination;
167
+
168
+ export { index as DestinationPinterest, destinationPinterest as default, destinationPinterest };