@segment/action-destinations 3.65.1-alpha.10 → 3.65.1-alpha.11

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.
@@ -1,4 +1,4 @@
1
- import { DestinationDefinition } from '@segment/actions-core';
1
+ import type { DestinationDefinition } from '@segment/actions-core';
2
2
  import type { Settings } from './generated-types';
3
3
  declare const destination: DestinationDefinition<Settings>;
4
4
  export default destination;
@@ -3,146 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const actions_core_1 = require("@segment/actions-core");
7
6
  const reportConversionEvent_1 = __importDefault(require("./reportConversionEvent"));
8
- const defaultVals = { ...actions_core_1.defaultValues(reportConversionEvent_1.default.fields) };
9
- const presets = [
10
- {
11
- name: 'Add Billing',
12
- subscribe: 'event = "Payment Info Entered"',
13
- partnerAction: 'reportConversionEvent',
14
- mapping: {
15
- ...defaultVals,
16
- event_type: 'ADD_BILLING'
17
- }
18
- },
19
- {
20
- name: 'Add to Cart',
21
- subscribe: 'event = "Product Added"',
22
- partnerAction: 'reportConversionEvent',
23
- mapping: {
24
- ...defaultVals,
25
- event_type: 'ADD_CART'
26
- }
27
- },
28
- {
29
- name: 'Add to Wishlist',
30
- subscribe: 'event = "Product Added to Wishlist"',
31
- partnerAction: 'reportConversionEvent',
32
- mapping: {
33
- ...defaultVals,
34
- event_type: 'ADD_TO_WISHLIST'
35
- }
36
- },
37
- {
38
- name: 'App Install',
39
- subscribe: 'event = "Application Installed"',
40
- partnerAction: 'reportConversionEvent',
41
- mapping: {
42
- ...defaultVals,
43
- event_type: 'APP_INSTALL'
44
- }
45
- },
46
- {
47
- name: 'App Open',
48
- subscribe: 'event = "Application Opened"',
49
- partnerAction: 'reportConversionEvent',
50
- mapping: {
51
- ...defaultVals,
52
- event_type: 'APP_OPEN'
53
- }
54
- },
55
- {
56
- name: '',
57
- subscribe: 'event = ""',
58
- partnerAction: 'reportConversionEvent',
59
- mapping: {
60
- ...defaultVals,
61
- event: ''
62
- }
63
- },
64
- {
65
- name: 'List View',
66
- subscribe: 'event = "Product List Viewed"',
67
- partnerAction: 'reportConversionEvent',
68
- mapping: {
69
- ...defaultVals,
70
- event: 'LIST_VIEW'
71
- }
72
- },
73
- {
74
- name: 'Login',
75
- subscribe: 'event = "Signed In"',
76
- partnerAction: 'reportConversionEvent',
77
- mapping: {
78
- ...defaultVals,
79
- event_type: 'LOGIN'
80
- }
81
- },
82
- {
83
- name: 'Page View',
84
- subscribe: 'type = "page"',
85
- partnerAction: 'reportConversionEvent',
86
- mapping: {
87
- ...defaultVals,
88
- event_type: 'PAGE_VIEW'
89
- }
90
- },
91
- {
92
- name: 'Purchase',
93
- subscribe: 'event = "Order Completed"',
94
- partnerAction: 'reportConversionEvent',
95
- mapping: {
96
- ...defaultVals,
97
- event_type: 'PURCHASE'
98
- }
99
- },
100
- {
101
- name: 'Search',
102
- subscribe: 'event = "Products Searched"',
103
- partnerAction: 'reportConversionEvent',
104
- mapping: {
105
- ...defaultVals,
106
- event_type: 'SEARCH'
107
- }
108
- },
109
- {
110
- name: 'Share',
111
- subscribe: 'event = "Product Shared"',
112
- partnerAction: 'reportConversionEvent',
113
- mapping: {
114
- ...defaultVals,
115
- event_type: 'SHARE'
116
- }
117
- },
118
- {
119
- name: 'Sign Up',
120
- subscribe: 'event = "Signed Up"',
121
- partnerAction: 'reportConversionEvent',
122
- mapping: {
123
- ...defaultVals,
124
- event_type: 'SIGN_UP'
125
- }
126
- },
127
- {
128
- name: 'Start Checkout',
129
- subscribe: 'event = "Checkout Started"',
130
- partnerAction: 'reportConversionEvent',
131
- mapping: {
132
- ...defaultVals,
133
- event_type: 'START_CHECKOUT'
134
- }
135
- },
136
- {
137
- name: 'View Content',
138
- subscribe: 'event = "Product Viewed"',
139
- partnerAction: 'reportConversionEvent',
140
- mapping: {
141
- ...defaultVals,
142
- event_type: 'VIEW_CONTENT'
143
- }
144
- }
145
- ];
146
7
  const destination = {
147
8
  name: 'Snap Conversions Api',
148
9
  slug: 'actions-snap-conversions',
@@ -165,28 +26,8 @@ const destination = {
165
26
  description: 'The unique ID assigned for a given application. It should be numeric for iOS, and the human interpretable string for Android. Required for app events.',
166
27
  type: 'string'
167
28
  }
168
- },
169
- refreshAccessToken: async (request, { auth }) => {
170
- const res = await request('https://accounts.snapchat.com/login/oauth2/access_token', {
171
- method: 'POST',
172
- body: new URLSearchParams({
173
- refresh_token: auth.refreshToken,
174
- client_id: auth.clientId,
175
- client_secret: auth.clientSecret,
176
- grant_type: 'refresh_token'
177
- })
178
- });
179
- return { accessToken: res.data.access_token };
180
29
  }
181
30
  },
182
- extendRequest({ auth }) {
183
- return {
184
- headers: {
185
- authorization: `Bearer ${auth?.accessToken}`
186
- }
187
- };
188
- },
189
- presets,
190
31
  actions: {
191
32
  reportConversionEvent: reportConversionEvent_1.default
192
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/snap-conversions-api/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAG5E,oFAA2D;AAE3D,MAAM,WAAW,GAAG,EAAE,GAAG,4BAAa,CAAC,+BAAqB,CAAC,MAAM,CAAC,EAAE,CAAA;AAOtE,MAAM,OAAO,GAAqC;IAChD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,gCAAgC;QAC3C,aAAa,EAAE,uBAAuB;QACtC,OAAO,EAAE;YACP,GAAG,WAAW;YACd,UAAU,EAAE,aAAa;SAC1B;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,yBAAyB;QACpC,aAAa,EAAE,uBAAuB;QACtC,OAAO,EAAE;YACP,GAAG,WAAW;YACd,UAAU,EAAE,UAAU;SACvB;KACF;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,SAAS,EAAE,qCAAqC;QAChD,aAAa,EAAE,uB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,CAAuB,yDAAyD,EAAE;gBACzG,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,eAAe,CAAC;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,SAAS,EAAE,IAAI,CAAC,QAAQ;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,UAAU,EAAE,eAAe;iBAC5B,CAAC;aACH,CAAC,CAAA;YAEF,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAA;QAC/C,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IACD,OAAO;IACP,OAAO,EAAE;QACP,qBAAqB,EAArB,+BAAqB;KACtB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/snap-conversions-api/index.ts"],"names":[],"mappings":";;;;;AAGA,oFAA2D;AAE3D,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,KAAK,EAAE,UAAU;gBACjB,WAAW,EAAE,iFAAiF;gBAC9F,IAAI,EAAE,QAAQ;aACf;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,aAAa;gBACpB,WAAW,EACT,gKAAgK;gBAClK,IAAI,EAAE,QAAQ;aACf;YACD,KAAK,EAAE;gBACL,KAAK,EAAE,QAAQ;gBACf,WAAW,EACT,wJAAwJ;gBAC1J,IAAI,EAAE,QAAQ;aACf;SACF;KAkCF;IACD,OAAO,EAAE;QACP,qBAAqB,EAArB,+BAAqB;KACtB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -1,28 +1,2 @@
1
1
  export interface Payload {
2
- snap_app_id?: string;
3
- app_id?: string;
4
- pixel_id?: string;
5
- item_category?: string;
6
- item_ids?: string;
7
- description?: string;
8
- number_items?: string | number;
9
- price?: string | number;
10
- currency?: string;
11
- transaction_id?: string;
12
- level?: string;
13
- client_dedup_id?: string;
14
- search_string?: string;
15
- page_url?: string;
16
- sign_up_method?: string;
17
- ip_address?: string;
18
- user_agent?: string;
19
- idfv?: string;
20
- uuid_c1?: string;
21
- event_tag?: string;
22
- event_conversion_type: string;
23
- event_type: string;
24
- mobile_ad_id?: string;
25
- email?: string;
26
- phone_number?: string;
27
- timestamp: string;
28
2
  }
@@ -1,47 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const snap_capi_properties_1 = require("../snap-capi-properties");
7
- const lodash_1 = __importDefault(require("lodash"));
8
3
  const action = {
9
4
  title: 'Report Conversion Event',
10
- description: '',
11
- fields: {
12
- event_type: { ...snap_capi_properties_1.event_type, required: true },
13
- event_conversion_type: { ...snap_capi_properties_1.event_conversion_type, required: true },
14
- event_tag: snap_capi_properties_1.event_tag,
15
- timestamp: { ...snap_capi_properties_1.timestamp, required: true },
16
- email: snap_capi_properties_1.email,
17
- mobile_ad_id: snap_capi_properties_1.mobile_ad_id,
18
- uuid_c1: snap_capi_properties_1.uuid_c1,
19
- idfv: snap_capi_properties_1.idfv,
20
- phone_number: snap_capi_properties_1.phone_number,
21
- user_agent: snap_capi_properties_1.user_agent,
22
- ip_address: snap_capi_properties_1.ip_address,
23
- item_category: snap_capi_properties_1.item_category,
24
- item_ids: snap_capi_properties_1.item_ids,
25
- description: snap_capi_properties_1.description,
26
- number_items: snap_capi_properties_1.number_items,
27
- price: snap_capi_properties_1.price,
28
- currency: snap_capi_properties_1.currency,
29
- transaction_id: snap_capi_properties_1.transaction_id,
30
- level: snap_capi_properties_1.level,
31
- client_dedup_id: snap_capi_properties_1.client_dedup_id,
32
- search_string: snap_capi_properties_1.search_string,
33
- page_url: snap_capi_properties_1.page_url,
34
- sign_up_method: snap_capi_properties_1.sign_up_method
35
- },
36
- perform: (request, data) => {
37
- let payload = lodash_1.default.omitBy(snap_capi_properties_1.formatPayload(data.payload), lodash_1.default.isNil);
38
- return request('https://tr.snapchat.com/v2/conversion', {
39
- method: 'post',
40
- json: {
41
- ...payload,
42
- ...data.settings
43
- }
44
- });
5
+ description: 'TODO',
6
+ fields: {},
7
+ perform: () => {
8
+ return;
45
9
  }
46
10
  };
47
11
  exports.default = action;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/snap-conversions-api/reportConversionEvent/index.ts"],"names":[],"mappings":";;;;;AAGA,kEA0BgC;AAChC,oDAAsB;AAEtB,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,EAAE;IACf,MAAM,EAAE;QACN,UAAU,EAAE,EAAE,GAAG,iCAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7C,qBAAqB,EAAE,EAAE,GAAG,4CAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE;QACnE,SAAS,EAAE,gCAAS;QACpB,SAAS,EAAE,EAAE,GAAG,gCAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC3C,KAAK,EAAE,4BAAK;QACZ,YAAY,EAAE,mCAAY;QAC1B,OAAO,EAAE,8BAAO;QAChB,IAAI,EAAE,2BAAI;QACV,YAAY,EAAE,mCAAY;QAC1B,UAAU,EAAE,iCAAU;QACtB,UAAU,EAAE,iCAAU;QACtB,aAAa,EAAE,oCAAa;QAC5B,QAAQ,EAAE,+BAAQ;QAClB,WAAW,EAAE,kCAAW;QACxB,YAAY,EAAE,mCAAY;QAC1B,KAAK,EAAE,4BAAK;QACZ,QAAQ,EAAE,+BAAQ;QAClB,cAAc,EAAE,qCAAc;QAC9B,KAAK,EAAE,4BAAK;QACZ,eAAe,EAAE,sCAAe;QAChC,aAAa,EAAE,oCAAa;QAC5B,QAAQ,EAAE,+BAAQ;QAClB,cAAc,EAAE,qCAAc;KAC/B;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;QACzB,IAAI,OAAO,GAAW,gBAAC,CAAC,MAAM,CAAC,oCAAa,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,gBAAC,CAAC,KAAK,CAAC,CAAA;QAepE,OAAO,OAAO,CAAC,uCAAuC,EAAE;YACtD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,GAAG,OAAO;gBACV,GAAG,IAAI,CAAC,QAAQ;aACjB;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/snap-conversions-api/reportConversionEvent/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,GAAG,EAAE;QAOZ,OAAM;IACR,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@segment/action-destinations",
3
3
  "description": "Destination Actions engine and definitions.",
4
- "version": "3.65.1-alpha.10",
4
+ "version": "3.65.1-alpha.11",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -62,5 +62,5 @@
62
62
  "<rootDir>/test/setup-after-env.ts"
63
63
  ]
64
64
  },
65
- "gitHead": "f3ca1e303ab29661c4d99b836f63109fac375e93"
65
+ "gitHead": "65770c5da966417d46d87c334fae97f6f5e839e5"
66
66
  }
@@ -1,27 +0,0 @@
1
- import { InputField } from '@segment/actions-core/src/destination-kit/types';
2
- import { Payload } from './reportConversionEvent/generated-types';
3
- export declare const event_type: InputField;
4
- export declare const event_conversion_type: InputField;
5
- export declare const event_tag: InputField;
6
- export declare const timestamp: InputField;
7
- export declare const email: InputField;
8
- export declare const mobile_ad_id: InputField;
9
- export declare const uuid_c1: InputField;
10
- export declare const idfv: InputField;
11
- export declare const phone_number: InputField;
12
- export declare const user_agent: InputField;
13
- export declare const ip_address: InputField;
14
- export declare const item_category: InputField;
15
- export declare const item_ids: InputField;
16
- export declare const description: InputField;
17
- export declare const number_items: InputField;
18
- export declare const price: InputField;
19
- export declare const currency: InputField;
20
- export declare const transaction_id: InputField;
21
- export declare const level: InputField;
22
- export declare const client_dedup_id: InputField;
23
- export declare const search_string: InputField;
24
- export declare const page_url: InputField;
25
- export declare const sign_up_method: InputField;
26
- export declare const hash: (value: string | undefined) => string | undefined;
27
- export declare const formatPayload: (payload: Payload) => Object;
@@ -1,227 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatPayload = exports.hash = exports.sign_up_method = exports.page_url = exports.search_string = exports.client_dedup_id = exports.level = exports.transaction_id = exports.currency = exports.price = exports.number_items = exports.description = exports.item_ids = exports.item_category = exports.ip_address = exports.user_agent = exports.phone_number = exports.idfv = exports.uuid_c1 = exports.mobile_ad_id = exports.email = exports.timestamp = exports.event_tag = exports.event_conversion_type = exports.event_type = void 0;
4
- const crypto_1 = require("crypto");
5
- exports.event_type = {
6
- label: 'Event Type',
7
- description: "The conversion event type. Please refer to the possible event types in [Snapchat Marketing API docs](https://marketingapi.snapchat.com/docs/conversion.html#conversion-parameters).",
8
- type: 'string',
9
- };
10
- exports.event_conversion_type = {
11
- label: "Event Conversion Type",
12
- description: 'Where the event took place. This must be OFFLINE, WEB, or MOBILE_APP.',
13
- type: 'string',
14
- choices: [
15
- { label: 'Offline', value: "OFFLINE" },
16
- { label: 'Web', value: 'WEB' },
17
- { label: 'Mobile App', value: 'MOBILE_APP' }
18
- ]
19
- };
20
- exports.event_tag = {
21
- label: 'Event Tag',
22
- description: 'Custom event label',
23
- type: 'string',
24
- };
25
- exports.timestamp = {
26
- label: 'Event Timestamp',
27
- description: 'The Epoch timestamp for when the conversion happened. The timestamp cannot be more than 28 days in the past',
28
- type: 'string',
29
- default: {
30
- '@path': '$.timestamp'
31
- }
32
- };
33
- exports.email = {
34
- label: 'Email',
35
- description: 'Email address of the user who triggered the conversion event. Segment will normalize and hash this value before sending to Snapchat.',
36
- type: 'string',
37
- default: {
38
- '@if': {
39
- exists: { '@path': '$properties.email' },
40
- then: { '@path': '$properties.email' },
41
- else: { '@path': '$traits.email' }
42
- }
43
- }
44
- };
45
- exports.mobile_ad_id = {
46
- label: 'Mobile Ad Indeentifier',
47
- description: 'Mobile ad identifier (IDFA or AAID) of the user who triggered the conversion event. Segment will normalize and hash this value before sending to Snapchat.',
48
- type: 'string',
49
- default: {
50
- '@path': '$context.device.advertisingId'
51
- }
52
- };
53
- exports.uuid_c1 = {
54
- label: "uuid_c1 Cookie",
55
- description: 'Unique user ID cookie. If you are using the Pixel SDK, you can access a cookie1 by looking at the _scid value.',
56
- type: 'string'
57
- };
58
- exports.idfv = {
59
- label: 'Indentifier for Vendor',
60
- description: 'IDFV of the user’s device. Segment will normalize and hash this value before sending to Snapchat.',
61
- type: 'string',
62
- default: {
63
- '@path': '$context.device.id'
64
- }
65
- };
66
- exports.phone_number = {
67
- label: 'Phone Number',
68
- description: 'Phone number of the user who triggered the conversion event. Segment will normalize and hash this value before sending to Snapchat.',
69
- type: 'string',
70
- default: {
71
- '@if': {
72
- exists: { '@path': '$properties.phone' },
73
- then: { '@path': '$properties.phone' },
74
- else: { '@path': '$traits.phone' }
75
- }
76
- }
77
- };
78
- exports.user_agent = {
79
- label: 'User Agent',
80
- description: 'User agent from the user’s device.',
81
- type: 'string',
82
- default: {
83
- '@path': '$context.userAgent'
84
- }
85
- };
86
- exports.ip_address = {
87
- label: 'IP Address',
88
- description: 'IP address of the device or browser. Segment will normalize and hash this value before sending to Snapchat.',
89
- type: 'string',
90
- default: {
91
- '@path': '$context.ip'
92
- }
93
- };
94
- exports.item_category = {
95
- label: 'Item Category',
96
- description: 'Category of the item.',
97
- type: 'string',
98
- default: {
99
- '@path': '$properties.category'
100
- }
101
- };
102
- exports.item_ids = {
103
- label: 'Item IDs',
104
- description: 'International Article Number (EAN) when applicable, or other product or category identifier. ',
105
- type: 'string',
106
- default: {
107
- '@path': '$properties.product_id'
108
- }
109
- };
110
- exports.description = {
111
- label: 'Description',
112
- description: 'A string description for additional info.',
113
- type: 'string'
114
- };
115
- exports.number_items = {
116
- label: 'Number of Items',
117
- description: 'Number of items.',
118
- type: 'string',
119
- default: {
120
- '@path': '$properties.quantity'
121
- }
122
- };
123
- exports.price = {
124
- label: 'Price',
125
- description: 'Value of the purchase.',
126
- type: 'number',
127
- default: {
128
- '@if': {
129
- exists: { '@path': '$properties.price' },
130
- then: { '@path': '$properties.price' },
131
- else: { '@path': '$properties.value' }
132
- }
133
- }
134
- };
135
- exports.currency = {
136
- label: 'Currency',
137
- description: 'Currency for the value specified as ISO 4217 code.',
138
- type: 'string',
139
- default: {
140
- '@path': '$.properties.currency'
141
- }
142
- };
143
- exports.transaction_id = {
144
- label: 'Transaction ID',
145
- description: 'Transaction ID or order ID tied to the conversion event. Please refer to the [Snapchat Marketing API docs](https://marketingapi.snapchat.com/docs/conversion.html#deduplication) for information on how this field is used for deduplication against Snap Pixel SDK and App Adds Kit events.',
146
- type: 'string',
147
- default: {
148
- '@path': '$.properties.order_id'
149
- }
150
- };
151
- exports.level = {
152
- label: 'Level',
153
- description: 'Represents a level in the context of a game.',
154
- type: 'string',
155
- };
156
- exports.client_dedup_id = {
157
- label: 'Client Deduplication ID',
158
- description: 'If you are reporting events via more than one method (Snap Pixel, App Ads Kit, Conversions API) you should use the same client_dedup_id across all methods. Please refer to the [Snapchat Marketing API docs](https://marketingapi.snapchat.com/docs/conversion.html#deduplication) for information on how this field is used for deduplication against Snap Pixel SDK and App Adds Kit events.',
159
- type: 'string',
160
- };
161
- exports.search_string = {
162
- label: 'Search String',
163
- description: 'The text string that was searched for.',
164
- type: 'string',
165
- default: {
166
- '@path': '$.properties.query'
167
- }
168
- };
169
- exports.page_url = {
170
- label: 'Page URL',
171
- description: 'The URL of the web page where the event took place.',
172
- type: 'string',
173
- default: {
174
- '@path': '$.context.page.url'
175
- }
176
- };
177
- exports.sign_up_method = {
178
- label: 'Sign Up Method',
179
- description: 'A string indicating the sign up method.',
180
- type: 'string'
181
- };
182
- const hash = (value) => {
183
- if (value === undefined)
184
- return;
185
- const hash = crypto_1.createHash('sha256');
186
- hash.update(value);
187
- return hash.digest('hex');
188
- };
189
- exports.hash = hash;
190
- const formatPayload = (payload) => {
191
- if (payload.email) {
192
- payload.email = payload.email.replace(/\s/g, '').toLowerCase();
193
- }
194
- if (payload.phone_number) {
195
- payload.phone_number = payload.phone_number.replace(/\D|^0+/g, '');
196
- }
197
- if (payload.mobile_ad_id) {
198
- payload.mobile_ad_id = payload.mobile_ad_id.toLowerCase();
199
- }
200
- return {
201
- event_type: payload?.event_type,
202
- event_conversion_type: payload?.event_conversion_type,
203
- event_tag: payload?.event_tag,
204
- timestamp: Date.parse(payload?.timestamp),
205
- hashed_email: exports.hash(payload?.email),
206
- mobile_ad_id: exports.hash(payload?.mobile_ad_id),
207
- uuid_c1: payload?.uuid_c1,
208
- hashed_idfv: exports.hash(payload?.idfv),
209
- hashed_phone_number: exports.hash(payload?.phone_number),
210
- user_agent: payload?.user_agent,
211
- hashed_ip_address: exports.hash(payload?.ip_address),
212
- item_category: payload?.item_category,
213
- item_ids: payload?.item_ids,
214
- description: payload?.description,
215
- number_items: payload?.number_items,
216
- price: payload?.price,
217
- currency: payload?.currency,
218
- transaction_id: payload?.transaction_id,
219
- level: payload?.level,
220
- client_dedup_id: payload?.client_dedup_id,
221
- search_string: payload?.search_string,
222
- page_url: payload?.page_url,
223
- sign_up_method: payload?.sign_up_method
224
- };
225
- };
226
- exports.formatPayload = formatPayload;
227
- //# sourceMappingURL=snap-capi-properties.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snap-capi-properties.js","sourceRoot":"","sources":["../../../src/destinations/snap-conversions-api/snap-capi-properties.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AAKtB,QAAA,UAAU,GAAe;IAClC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,qLAAqL;IAClM,IAAI,EAAE,QAAQ;CAGjB,CAAA;AAEY,QAAA,qBAAqB,GAAe;IAC7C,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EAAE,uEAAuE;IACpF,IAAI,EAAE,QAAQ;IAEd,OAAO,EAAE;QACL,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;QACtC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;QAC9B,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;KAC/C;CACJ,CAAA;AAEY,QAAA,SAAS,GAAe;IACjC,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,oBAAoB;IACjC,IAAI,EAAE,QAAQ;CAGjB,CAAA;AAGY,QAAA,SAAS,GAAe;IACjC,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,8GAA8G;IAC3H,IAAI,EAAE,QAAQ;IAEd,OAAO,EAAE;QACL,OAAO,EAAE,aAAa;KACzB;CACJ,CAAA;AAEY,QAAA,KAAK,GAAe;IAC7B,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,sIAAsI;IACnJ,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACL,KAAK,EAAE;YACH,MAAM,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;YACxC,IAAI,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;YACtC,IAAI,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;SACrC;KACJ;CACJ,CAAA;AAEY,QAAA,YAAY,GAAe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