@blotoutio/providers-tiktok-sdk 0.10.3 → 0.10.5
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 +41 -41
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -161,54 +161,54 @@ var ProvidersTiktokSdk = (function () {
|
|
|
161
161
|
}
|
|
162
162
|
if (data['contents'] &&
|
|
163
163
|
Array.isArray(data['contents']) &&
|
|
164
|
-
data['contents'].length >
|
|
165
|
-
payload['content_type'] =
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
content
|
|
164
|
+
data['contents'].length > 0) {
|
|
165
|
+
payload['content_type'] = payload['content_type'] || 'product';
|
|
166
|
+
if (data['contents'].length > 1) {
|
|
167
|
+
payload['content_type'] = data['contents'][0].type;
|
|
168
|
+
payload['contents'] = data['contents'].map((item) => {
|
|
169
|
+
const content = {};
|
|
170
|
+
if (item.id) {
|
|
171
|
+
content['content_id'] = item.id;
|
|
172
|
+
}
|
|
173
|
+
if (item.quantity) {
|
|
174
|
+
content['quantity'] = item.quantity;
|
|
175
|
+
}
|
|
176
|
+
if (item.item_price) {
|
|
177
|
+
content['price'] = item.item_price;
|
|
178
|
+
}
|
|
179
|
+
if (item.category) {
|
|
180
|
+
content['content_category'] = item.category;
|
|
181
|
+
}
|
|
182
|
+
if (item.title) {
|
|
183
|
+
content['content_name'] = item.title;
|
|
184
|
+
}
|
|
185
|
+
if (item.type) {
|
|
186
|
+
content['content_type'] = item.type;
|
|
187
|
+
}
|
|
188
|
+
return content;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
else if (data['contents'].length === 1) {
|
|
192
|
+
if (data['contents'][0].item_price) {
|
|
193
|
+
payload['price'] = data['contents'][0].item_price;
|
|
170
194
|
}
|
|
171
|
-
if (
|
|
172
|
-
|
|
195
|
+
if (data['contents'][0].quantity) {
|
|
196
|
+
payload['quantity'] = data['contents'][0].quantity;
|
|
173
197
|
}
|
|
174
|
-
if (
|
|
175
|
-
|
|
198
|
+
if (data['contents'][0].id) {
|
|
199
|
+
payload['content_id'] = data['contents'][0].id;
|
|
176
200
|
}
|
|
177
|
-
if (
|
|
178
|
-
|
|
201
|
+
if (data['contents'][0].title) {
|
|
202
|
+
payload['content_name'] = data['contents'][0].title;
|
|
179
203
|
}
|
|
180
|
-
if (
|
|
181
|
-
|
|
204
|
+
if (data['contents'][0].type) {
|
|
205
|
+
payload['content_type'] = data['contents'][0].type;
|
|
182
206
|
}
|
|
183
|
-
if (
|
|
184
|
-
|
|
207
|
+
if (data['contents'][0].category) {
|
|
208
|
+
payload['content_category'] = data['contents'][0].category;
|
|
185
209
|
}
|
|
186
|
-
return content;
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
if (data['contents'] &&
|
|
190
|
-
Array.isArray(data['contents']) &&
|
|
191
|
-
data['contents'].length === 1) {
|
|
192
|
-
if (data['contents'][0].item_price) {
|
|
193
|
-
payload['price'] = data['contents'][0].item_price;
|
|
194
|
-
}
|
|
195
|
-
if (data['contents'][0].quantity) {
|
|
196
|
-
payload['quantity'] = data['contents'][0].quantity;
|
|
197
|
-
}
|
|
198
|
-
if (data['contents'][0].id) {
|
|
199
|
-
payload['content_id'] = data['contents'][0].id;
|
|
200
|
-
}
|
|
201
|
-
if (data['contents'][0].title) {
|
|
202
|
-
payload['content_name'] = data['contents'][0].title;
|
|
203
|
-
}
|
|
204
|
-
if (data['contents'][0].type) {
|
|
205
|
-
payload['content_type'] = data['contents'][0].type;
|
|
206
|
-
}
|
|
207
|
-
if (data['contents'][0].category) {
|
|
208
|
-
payload['content_category'] = data['contents'][0].category;
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
|
-
payload['content_type'] = payload['content_type'] || 'product';
|
|
212
212
|
return payload;
|
|
213
213
|
};
|
|
214
214
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
@@ -217,7 +217,7 @@ var ProvidersTiktokSdk = (function () {
|
|
|
217
217
|
window.ttq.instance(manifestVariables['pixelId']).track(tiktokEventName, Object.assign(Object.assign({}, prepareData(data)), { event_id: eventId }));
|
|
218
218
|
}
|
|
219
219
|
return {
|
|
220
|
-
sdkVersion: "0.10.
|
|
220
|
+
sdkVersion: "0.10.5" ,
|
|
221
221
|
};
|
|
222
222
|
};
|
|
223
223
|
|