@depict-ai/dpc 1.0.45 → 2.0.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/ES10/index.cjs +4 -18
- package/ES10/index.d.ts +6 -13
- package/ES10/index.js +5 -19
- package/dist/index.cjs +4 -18
- package/dist/index.d.ts +6 -13
- package/dist/index.js +5 -19
- package/latest/index.cjs +4 -18
- package/latest/index.d.ts +6 -13
- package/latest/index.js +5 -19
- package/package.json +5 -5
package/ES10/index.cjs
CHANGED
|
@@ -17,7 +17,7 @@ function $parcel$interopDefault(a) {
|
|
|
17
17
|
$parcel$export(module.exports, "DPC", () => $89ae37e3a26189b4$export$820526014323765f);
|
|
18
18
|
$parcel$export(module.exports, "version", () => $fcc8287091fb489d$export$83d89fbfd8236492);
|
|
19
19
|
/*! Depict PerformanceClient */
|
|
20
|
-
const $fcc8287091fb489d$export$83d89fbfd8236492 = "
|
|
20
|
+
const $fcc8287091fb489d$export$83d89fbfd8236492 = "2.0.0";
|
|
21
21
|
let $405164bc961cc106$export$8ae64f3d447c14f7;
|
|
22
22
|
(function (ProductCardType) {
|
|
23
23
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -104,7 +104,7 @@ const $5323e9ffea4e414a$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
104
104
|
if (typeof eventData == "number") eventData = eventData.toString();
|
|
105
105
|
if (eventName === "addToCart") dpc.sendAddToCartEvent({
|
|
106
106
|
product_id: $5323e9ffea4e414a$var$string_guard(eventName, eventData)
|
|
107
|
-
});else if (eventName === "setMarket") dpc.setMarket($5323e9ffea4e414a$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($5323e9ffea4e414a$var$string_guard(eventName, eventData));else if (eventName === "
|
|
107
|
+
});else if (eventName === "setMarket") dpc.setMarket($5323e9ffea4e414a$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($5323e9ffea4e414a$var$string_guard(eventName, eventData));else if (eventName === "setSessionId") dpc.setSessionId($5323e9ffea4e414a$var$nullable_undefined_string_guard(eventName, eventData));
|
|
108
108
|
};
|
|
109
109
|
const $5323e9ffea4e414a$export$7a1bb429756ced60 = dpc => {
|
|
110
110
|
var _window, _window2;
|
|
@@ -148,7 +148,7 @@ var $89ae37e3a26189b4$var$_getContextData = /*#__PURE__*/new WeakSet();
|
|
|
148
148
|
var $89ae37e3a26189b4$var$_sendTrackingEvent = /*#__PURE__*/new WeakSet();
|
|
149
149
|
var $89ae37e3a26189b4$var$_getProductId = /*#__PURE__*/new WeakSet();
|
|
150
150
|
class $89ae37e3a26189b4$export$820526014323765f {
|
|
151
|
-
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /**
|
|
151
|
+
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /** if we've sent a page view event for the current href */constructor(merchant, _options) {
|
|
152
152
|
var _window$depict;
|
|
153
153
|
$89ae37e3a26189b4$var$_classPrivateMethodInitSpec(this, $89ae37e3a26189b4$var$_getProductId);
|
|
154
154
|
$89ae37e3a26189b4$var$_classPrivateMethodInitSpec(this, $89ae37e3a26189b4$var$_sendTrackingEvent);
|
|
@@ -331,8 +331,6 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
331
331
|
sendPurchaseEvent(data) {
|
|
332
332
|
if (!this.market) throw Error("Market not set");
|
|
333
333
|
const {
|
|
334
|
-
dsid: dsid,
|
|
335
|
-
user_id: user_id,
|
|
336
334
|
session_id: session_id
|
|
337
335
|
} = $89ae37e3a26189b4$var$_classPrivateMethodGet(this, $89ae37e3a26189b4$var$_getContextData, $89ae37e3a26189b4$var$_getContextData2).call(this);
|
|
338
336
|
const items = data.items.map(item => ({
|
|
@@ -343,8 +341,6 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
343
341
|
const request = {
|
|
344
342
|
events: [{
|
|
345
343
|
event_type: "purchase",
|
|
346
|
-
dsid: dsid,
|
|
347
|
-
user_id: user_id,
|
|
348
344
|
session_id: session_id,
|
|
349
345
|
transaction_id: data.transaction_id,
|
|
350
346
|
currency: data.currency,
|
|
@@ -378,15 +374,6 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
378
374
|
}
|
|
379
375
|
}
|
|
380
376
|
/**
|
|
381
|
-
* Set the user_id for logged in users.
|
|
382
|
-
*
|
|
383
|
-
* https://docs.depict.ai/docs/performance-client#informing-depict-of-logged-in-users
|
|
384
|
-
*/
|
|
385
|
-
setUserId(user_id) {
|
|
386
|
-
$9AWcE$depictaiutilishared.dlog("Setting user id", user_id);
|
|
387
|
-
this.latest_user_id = user_id || undefined;
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
377
|
* Set the current session_id.
|
|
391
378
|
*
|
|
392
379
|
* https://docs.depict.ai/docs/performance-client#browser-sessions
|
|
@@ -454,8 +441,7 @@ function $89ae37e3a26189b4$var$_getContextData2() {
|
|
|
454
441
|
const data = {
|
|
455
442
|
market: this.market,
|
|
456
443
|
tenant: this.merchant,
|
|
457
|
-
|
|
458
|
-
session_id: this.latest_session_id
|
|
444
|
+
session_id: this.latest_session_id || $9AWcE$depictaiutilishared.get_session_id()
|
|
459
445
|
};
|
|
460
446
|
return {
|
|
461
447
|
...$9AWcE$depictaiutilishared.get_tracking_event_context_data(),
|
package/ES10/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const version = "
|
|
1
|
+
export const version = "2.0.0";
|
|
2
2
|
enum ProductCardType {
|
|
3
3
|
Recommendation = 0,
|
|
4
4
|
SnakeRecommendation = 1,
|
|
@@ -10,15 +10,15 @@ type TrackingKey = "recommendation_id" | "search_result_id" | "product_listing_r
|
|
|
10
10
|
* The Depict Queue function used to register events to be sent to depict.
|
|
11
11
|
*/
|
|
12
12
|
export type DepictQueue = {
|
|
13
|
-
(eventName:
|
|
14
|
-
send_event?: (eventName:
|
|
15
|
-
queue: [
|
|
13
|
+
(eventName: EventName, ...args: unknown[]): void;
|
|
14
|
+
send_event?: (eventName: EventName, ...args: unknown[]) => void;
|
|
15
|
+
queue: [EventName, unknown][];
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Depict Object containing everything depict-related on the page.
|
|
19
19
|
*/
|
|
20
20
|
export interface DepictObject {
|
|
21
|
-
eventHistory: [
|
|
21
|
+
eventHistory: [EventName, unknown][];
|
|
22
22
|
dpq: DepictQueue;
|
|
23
23
|
dpc: DPC;
|
|
24
24
|
}
|
|
@@ -51,6 +51,7 @@ interface GA4PurchaseItem {
|
|
|
51
51
|
quantity: number;
|
|
52
52
|
[additional: string]: unknown;
|
|
53
53
|
}
|
|
54
|
+
type EventName = "purchase" | "addToCart" | "setMarket" | "setProductId" | "setSessionId";
|
|
54
55
|
interface Options {
|
|
55
56
|
/**
|
|
56
57
|
* The initial market. Should be specified if the market is known at the point of intializing DPC.
|
|
@@ -71,8 +72,6 @@ export class DPC {
|
|
|
71
72
|
latest_product_id_path?: string;
|
|
72
73
|
/** Latest session_id set on the client. Used for all events. */
|
|
73
74
|
latest_session_id?: string;
|
|
74
|
-
/** Latest user_id found in the DOM. Used for all events. */
|
|
75
|
-
latest_user_id?: string;
|
|
76
75
|
constructor(merchant: string, options?: Options);
|
|
77
76
|
tracked_elements: WeakSet<HTMLElement>;
|
|
78
77
|
/**
|
|
@@ -130,12 +129,6 @@ export class DPC {
|
|
|
130
129
|
* Update the product_id used for add-to-cart and pageview events on PDPs.
|
|
131
130
|
*/
|
|
132
131
|
setProductId(product_id: string): void;
|
|
133
|
-
/**
|
|
134
|
-
* Set the user_id for logged in users.
|
|
135
|
-
*
|
|
136
|
-
* https://docs.depict.ai/docs/performance-client#informing-depict-of-logged-in-users
|
|
137
|
-
*/
|
|
138
|
-
setUserId(user_id?: string | null): void;
|
|
139
132
|
/**
|
|
140
133
|
* Set the current session_id.
|
|
141
134
|
*
|
package/ES10/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { add_to_version_info as $4uUHR$add_to_version_info, dlog as $4uUHR$dlog, impression_track_element as $4uUHR$impression_track_element, derror as $4uUHR$derror, depict_click as $4uUHR$depict_click, foolproof_send_beacon as $4uUHR$foolproof_send_beacon, base_url as $4uUHR$base_url, observer as $4uUHR$observer, instant_exec_on_suspect_history_change as $4uUHR$instant_exec_on_suspect_history_change, catchify as $4uUHR$catchify, get_tracking_event_context_data as $4uUHR$get_tracking_event_context_data, send_depict_unfiltered as $4uUHR$send_depict_unfiltered } from "@depict-ai/utilishared/ES10";
|
|
1
|
+
import { add_to_version_info as $4uUHR$add_to_version_info, dlog as $4uUHR$dlog, impression_track_element as $4uUHR$impression_track_element, derror as $4uUHR$derror, depict_click as $4uUHR$depict_click, foolproof_send_beacon as $4uUHR$foolproof_send_beacon, base_url as $4uUHR$base_url, observer as $4uUHR$observer, instant_exec_on_suspect_history_change as $4uUHR$instant_exec_on_suspect_history_change, catchify as $4uUHR$catchify, get_session_id as $4uUHR$get_session_id, get_tracking_event_context_data as $4uUHR$get_tracking_event_context_data, send_depict_unfiltered as $4uUHR$send_depict_unfiltered } from "@depict-ai/utilishared/ES10";
|
|
2
2
|
import $4uUHR$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import $4uUHR$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
|
|
4
4
|
import $4uUHR$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
|
|
@@ -6,7 +6,7 @@ import $4uUHR$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpe
|
|
|
6
6
|
/*! Depict PerformanceClient */
|
|
7
7
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
8
8
|
register_es_version("performance-client", "ES10");
|
|
9
|
-
const $3242b911de3d57ad$export$83d89fbfd8236492 = "
|
|
9
|
+
const $3242b911de3d57ad$export$83d89fbfd8236492 = "2.0.0";
|
|
10
10
|
let $983195e3c4979825$export$8ae64f3d447c14f7;
|
|
11
11
|
(function (ProductCardType) {
|
|
12
12
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -93,7 +93,7 @@ const $f06bf37f1e6136a4$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
93
93
|
if (typeof eventData == "number") eventData = eventData.toString();
|
|
94
94
|
if (eventName === "addToCart") dpc.sendAddToCartEvent({
|
|
95
95
|
product_id: $f06bf37f1e6136a4$var$string_guard(eventName, eventData)
|
|
96
|
-
});else if (eventName === "setMarket") dpc.setMarket($f06bf37f1e6136a4$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($f06bf37f1e6136a4$var$string_guard(eventName, eventData));else if (eventName === "
|
|
96
|
+
});else if (eventName === "setMarket") dpc.setMarket($f06bf37f1e6136a4$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($f06bf37f1e6136a4$var$string_guard(eventName, eventData));else if (eventName === "setSessionId") dpc.setSessionId($f06bf37f1e6136a4$var$nullable_undefined_string_guard(eventName, eventData));
|
|
97
97
|
};
|
|
98
98
|
const $f06bf37f1e6136a4$export$7a1bb429756ced60 = dpc => {
|
|
99
99
|
var _window, _window2;
|
|
@@ -137,7 +137,7 @@ var $53af71a3700e1e90$var$_getContextData = /*#__PURE__*/new WeakSet();
|
|
|
137
137
|
var $53af71a3700e1e90$var$_sendTrackingEvent = /*#__PURE__*/new WeakSet();
|
|
138
138
|
var $53af71a3700e1e90$var$_getProductId = /*#__PURE__*/new WeakSet();
|
|
139
139
|
class $53af71a3700e1e90$export$820526014323765f {
|
|
140
|
-
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /**
|
|
140
|
+
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /** if we've sent a page view event for the current href */constructor(merchant, _options) {
|
|
141
141
|
var _window$depict;
|
|
142
142
|
$53af71a3700e1e90$var$_classPrivateMethodInitSpec(this, $53af71a3700e1e90$var$_getProductId);
|
|
143
143
|
$53af71a3700e1e90$var$_classPrivateMethodInitSpec(this, $53af71a3700e1e90$var$_sendTrackingEvent);
|
|
@@ -320,8 +320,6 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
320
320
|
sendPurchaseEvent(data) {
|
|
321
321
|
if (!this.market) throw Error("Market not set");
|
|
322
322
|
const {
|
|
323
|
-
dsid: dsid,
|
|
324
|
-
user_id: user_id,
|
|
325
323
|
session_id: session_id
|
|
326
324
|
} = $53af71a3700e1e90$var$_classPrivateMethodGet(this, $53af71a3700e1e90$var$_getContextData, $53af71a3700e1e90$var$_getContextData2).call(this);
|
|
327
325
|
const items = data.items.map(item => ({
|
|
@@ -332,8 +330,6 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
332
330
|
const request = {
|
|
333
331
|
events: [{
|
|
334
332
|
event_type: "purchase",
|
|
335
|
-
dsid: dsid,
|
|
336
|
-
user_id: user_id,
|
|
337
333
|
session_id: session_id,
|
|
338
334
|
transaction_id: data.transaction_id,
|
|
339
335
|
currency: data.currency,
|
|
@@ -367,15 +363,6 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
367
363
|
}
|
|
368
364
|
}
|
|
369
365
|
/**
|
|
370
|
-
* Set the user_id for logged in users.
|
|
371
|
-
*
|
|
372
|
-
* https://docs.depict.ai/docs/performance-client#informing-depict-of-logged-in-users
|
|
373
|
-
*/
|
|
374
|
-
setUserId(user_id) {
|
|
375
|
-
$4uUHR$dlog("Setting user id", user_id);
|
|
376
|
-
this.latest_user_id = user_id || undefined;
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
366
|
* Set the current session_id.
|
|
380
367
|
*
|
|
381
368
|
* https://docs.depict.ai/docs/performance-client#browser-sessions
|
|
@@ -443,8 +430,7 @@ function $53af71a3700e1e90$var$_getContextData2() {
|
|
|
443
430
|
const data = {
|
|
444
431
|
market: this.market,
|
|
445
432
|
tenant: this.merchant,
|
|
446
|
-
|
|
447
|
-
session_id: this.latest_session_id
|
|
433
|
+
session_id: this.latest_session_id || $4uUHR$get_session_id()
|
|
448
434
|
};
|
|
449
435
|
return {
|
|
450
436
|
...$4uUHR$get_tracking_event_context_data(),
|
package/dist/index.cjs
CHANGED
|
@@ -17,7 +17,7 @@ function $parcel$interopDefault(a) {
|
|
|
17
17
|
$parcel$export(module.exports, "DPC", () => $89ae37e3a26189b4$export$820526014323765f);
|
|
18
18
|
$parcel$export(module.exports, "version", () => $fcc8287091fb489d$export$83d89fbfd8236492);
|
|
19
19
|
/*! Depict PerformanceClient */
|
|
20
|
-
const $fcc8287091fb489d$export$83d89fbfd8236492 = "
|
|
20
|
+
const $fcc8287091fb489d$export$83d89fbfd8236492 = "2.0.0";
|
|
21
21
|
let $405164bc961cc106$export$8ae64f3d447c14f7;
|
|
22
22
|
(function (ProductCardType) {
|
|
23
23
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -104,7 +104,7 @@ const $5323e9ffea4e414a$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
104
104
|
if (typeof eventData == "number") eventData = eventData.toString();
|
|
105
105
|
if (eventName === "addToCart") dpc.sendAddToCartEvent({
|
|
106
106
|
product_id: $5323e9ffea4e414a$var$string_guard(eventName, eventData)
|
|
107
|
-
});else if (eventName === "setMarket") dpc.setMarket($5323e9ffea4e414a$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($5323e9ffea4e414a$var$string_guard(eventName, eventData));else if (eventName === "
|
|
107
|
+
});else if (eventName === "setMarket") dpc.setMarket($5323e9ffea4e414a$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($5323e9ffea4e414a$var$string_guard(eventName, eventData));else if (eventName === "setSessionId") dpc.setSessionId($5323e9ffea4e414a$var$nullable_undefined_string_guard(eventName, eventData));
|
|
108
108
|
};
|
|
109
109
|
const $5323e9ffea4e414a$export$7a1bb429756ced60 = dpc => {
|
|
110
110
|
var _window, _window2;
|
|
@@ -148,7 +148,7 @@ var $89ae37e3a26189b4$var$_getContextData = /*#__PURE__*/new WeakSet();
|
|
|
148
148
|
var $89ae37e3a26189b4$var$_sendTrackingEvent = /*#__PURE__*/new WeakSet();
|
|
149
149
|
var $89ae37e3a26189b4$var$_getProductId = /*#__PURE__*/new WeakSet();
|
|
150
150
|
class $89ae37e3a26189b4$export$820526014323765f {
|
|
151
|
-
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /**
|
|
151
|
+
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /** if we've sent a page view event for the current href */constructor(merchant, _options) {
|
|
152
152
|
var _window$depict;
|
|
153
153
|
$89ae37e3a26189b4$var$_classPrivateMethodInitSpec(this, $89ae37e3a26189b4$var$_getProductId);
|
|
154
154
|
$89ae37e3a26189b4$var$_classPrivateMethodInitSpec(this, $89ae37e3a26189b4$var$_sendTrackingEvent);
|
|
@@ -331,8 +331,6 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
331
331
|
sendPurchaseEvent(data) {
|
|
332
332
|
if (!this.market) throw Error("Market not set");
|
|
333
333
|
const {
|
|
334
|
-
dsid: dsid,
|
|
335
|
-
user_id: user_id,
|
|
336
334
|
session_id: session_id
|
|
337
335
|
} = $89ae37e3a26189b4$var$_classPrivateMethodGet(this, $89ae37e3a26189b4$var$_getContextData, $89ae37e3a26189b4$var$_getContextData2).call(this);
|
|
338
336
|
const items = data.items.map(item => ({
|
|
@@ -343,8 +341,6 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
343
341
|
const request = {
|
|
344
342
|
events: [{
|
|
345
343
|
event_type: "purchase",
|
|
346
|
-
dsid: dsid,
|
|
347
|
-
user_id: user_id,
|
|
348
344
|
session_id: session_id,
|
|
349
345
|
transaction_id: data.transaction_id,
|
|
350
346
|
currency: data.currency,
|
|
@@ -378,15 +374,6 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
378
374
|
}
|
|
379
375
|
}
|
|
380
376
|
/**
|
|
381
|
-
* Set the user_id for logged in users.
|
|
382
|
-
*
|
|
383
|
-
* https://docs.depict.ai/docs/performance-client#informing-depict-of-logged-in-users
|
|
384
|
-
*/
|
|
385
|
-
setUserId(user_id) {
|
|
386
|
-
$9AWcE$depictaiutilishared.dlog("Setting user id", user_id);
|
|
387
|
-
this.latest_user_id = user_id || undefined;
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
377
|
* Set the current session_id.
|
|
391
378
|
*
|
|
392
379
|
* https://docs.depict.ai/docs/performance-client#browser-sessions
|
|
@@ -454,8 +441,7 @@ function $89ae37e3a26189b4$var$_getContextData2() {
|
|
|
454
441
|
const data = {
|
|
455
442
|
market: this.market,
|
|
456
443
|
tenant: this.merchant,
|
|
457
|
-
|
|
458
|
-
session_id: this.latest_session_id
|
|
444
|
+
session_id: this.latest_session_id || $9AWcE$depictaiutilishared.get_session_id()
|
|
459
445
|
};
|
|
460
446
|
return {
|
|
461
447
|
...$9AWcE$depictaiutilishared.get_tracking_event_context_data(),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const version = "
|
|
1
|
+
export const version = "2.0.0";
|
|
2
2
|
enum ProductCardType {
|
|
3
3
|
Recommendation = 0,
|
|
4
4
|
SnakeRecommendation = 1,
|
|
@@ -10,15 +10,15 @@ type TrackingKey = "recommendation_id" | "search_result_id" | "product_listing_r
|
|
|
10
10
|
* The Depict Queue function used to register events to be sent to depict.
|
|
11
11
|
*/
|
|
12
12
|
export type DepictQueue = {
|
|
13
|
-
(eventName:
|
|
14
|
-
send_event?: (eventName:
|
|
15
|
-
queue: [
|
|
13
|
+
(eventName: EventName, ...args: unknown[]): void;
|
|
14
|
+
send_event?: (eventName: EventName, ...args: unknown[]) => void;
|
|
15
|
+
queue: [EventName, unknown][];
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Depict Object containing everything depict-related on the page.
|
|
19
19
|
*/
|
|
20
20
|
export interface DepictObject {
|
|
21
|
-
eventHistory: [
|
|
21
|
+
eventHistory: [EventName, unknown][];
|
|
22
22
|
dpq: DepictQueue;
|
|
23
23
|
dpc: DPC;
|
|
24
24
|
}
|
|
@@ -51,6 +51,7 @@ interface GA4PurchaseItem {
|
|
|
51
51
|
quantity: number;
|
|
52
52
|
[additional: string]: unknown;
|
|
53
53
|
}
|
|
54
|
+
type EventName = "purchase" | "addToCart" | "setMarket" | "setProductId" | "setSessionId";
|
|
54
55
|
interface Options {
|
|
55
56
|
/**
|
|
56
57
|
* The initial market. Should be specified if the market is known at the point of intializing DPC.
|
|
@@ -71,8 +72,6 @@ export class DPC {
|
|
|
71
72
|
latest_product_id_path?: string;
|
|
72
73
|
/** Latest session_id set on the client. Used for all events. */
|
|
73
74
|
latest_session_id?: string;
|
|
74
|
-
/** Latest user_id found in the DOM. Used for all events. */
|
|
75
|
-
latest_user_id?: string;
|
|
76
75
|
constructor(merchant: string, options?: Options);
|
|
77
76
|
tracked_elements: WeakSet<HTMLElement>;
|
|
78
77
|
/**
|
|
@@ -130,12 +129,6 @@ export class DPC {
|
|
|
130
129
|
* Update the product_id used for add-to-cart and pageview events on PDPs.
|
|
131
130
|
*/
|
|
132
131
|
setProductId(product_id: string): void;
|
|
133
|
-
/**
|
|
134
|
-
* Set the user_id for logged in users.
|
|
135
|
-
*
|
|
136
|
-
* https://docs.depict.ai/docs/performance-client#informing-depict-of-logged-in-users
|
|
137
|
-
*/
|
|
138
|
-
setUserId(user_id?: string | null): void;
|
|
139
132
|
/**
|
|
140
133
|
* Set the current session_id.
|
|
141
134
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { add_to_version_info as $4uUHR$add_to_version_info, dlog as $4uUHR$dlog, impression_track_element as $4uUHR$impression_track_element, derror as $4uUHR$derror, depict_click as $4uUHR$depict_click, foolproof_send_beacon as $4uUHR$foolproof_send_beacon, base_url as $4uUHR$base_url, observer as $4uUHR$observer, instant_exec_on_suspect_history_change as $4uUHR$instant_exec_on_suspect_history_change, catchify as $4uUHR$catchify, get_tracking_event_context_data as $4uUHR$get_tracking_event_context_data, send_depict_unfiltered as $4uUHR$send_depict_unfiltered } from "@depict-ai/utilishared/ES10";
|
|
1
|
+
import { add_to_version_info as $4uUHR$add_to_version_info, dlog as $4uUHR$dlog, impression_track_element as $4uUHR$impression_track_element, derror as $4uUHR$derror, depict_click as $4uUHR$depict_click, foolproof_send_beacon as $4uUHR$foolproof_send_beacon, base_url as $4uUHR$base_url, observer as $4uUHR$observer, instant_exec_on_suspect_history_change as $4uUHR$instant_exec_on_suspect_history_change, catchify as $4uUHR$catchify, get_session_id as $4uUHR$get_session_id, get_tracking_event_context_data as $4uUHR$get_tracking_event_context_data, send_depict_unfiltered as $4uUHR$send_depict_unfiltered } from "@depict-ai/utilishared/ES10";
|
|
2
2
|
import $4uUHR$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import $4uUHR$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
|
|
4
4
|
import $4uUHR$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
|
|
@@ -6,7 +6,7 @@ import $4uUHR$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpe
|
|
|
6
6
|
/*! Depict PerformanceClient */
|
|
7
7
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
8
8
|
register_es_version("performance-client", "ES10");
|
|
9
|
-
const $3242b911de3d57ad$export$83d89fbfd8236492 = "
|
|
9
|
+
const $3242b911de3d57ad$export$83d89fbfd8236492 = "2.0.0";
|
|
10
10
|
let $983195e3c4979825$export$8ae64f3d447c14f7;
|
|
11
11
|
(function (ProductCardType) {
|
|
12
12
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -93,7 +93,7 @@ const $f06bf37f1e6136a4$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
93
93
|
if (typeof eventData == "number") eventData = eventData.toString();
|
|
94
94
|
if (eventName === "addToCart") dpc.sendAddToCartEvent({
|
|
95
95
|
product_id: $f06bf37f1e6136a4$var$string_guard(eventName, eventData)
|
|
96
|
-
});else if (eventName === "setMarket") dpc.setMarket($f06bf37f1e6136a4$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($f06bf37f1e6136a4$var$string_guard(eventName, eventData));else if (eventName === "
|
|
96
|
+
});else if (eventName === "setMarket") dpc.setMarket($f06bf37f1e6136a4$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($f06bf37f1e6136a4$var$string_guard(eventName, eventData));else if (eventName === "setSessionId") dpc.setSessionId($f06bf37f1e6136a4$var$nullable_undefined_string_guard(eventName, eventData));
|
|
97
97
|
};
|
|
98
98
|
const $f06bf37f1e6136a4$export$7a1bb429756ced60 = dpc => {
|
|
99
99
|
var _window, _window2;
|
|
@@ -137,7 +137,7 @@ var $53af71a3700e1e90$var$_getContextData = /*#__PURE__*/new WeakSet();
|
|
|
137
137
|
var $53af71a3700e1e90$var$_sendTrackingEvent = /*#__PURE__*/new WeakSet();
|
|
138
138
|
var $53af71a3700e1e90$var$_getProductId = /*#__PURE__*/new WeakSet();
|
|
139
139
|
class $53af71a3700e1e90$export$820526014323765f {
|
|
140
|
-
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /**
|
|
140
|
+
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /** if we've sent a page view event for the current href */constructor(merchant, _options) {
|
|
141
141
|
var _window$depict;
|
|
142
142
|
$53af71a3700e1e90$var$_classPrivateMethodInitSpec(this, $53af71a3700e1e90$var$_getProductId);
|
|
143
143
|
$53af71a3700e1e90$var$_classPrivateMethodInitSpec(this, $53af71a3700e1e90$var$_sendTrackingEvent);
|
|
@@ -320,8 +320,6 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
320
320
|
sendPurchaseEvent(data) {
|
|
321
321
|
if (!this.market) throw Error("Market not set");
|
|
322
322
|
const {
|
|
323
|
-
dsid: dsid,
|
|
324
|
-
user_id: user_id,
|
|
325
323
|
session_id: session_id
|
|
326
324
|
} = $53af71a3700e1e90$var$_classPrivateMethodGet(this, $53af71a3700e1e90$var$_getContextData, $53af71a3700e1e90$var$_getContextData2).call(this);
|
|
327
325
|
const items = data.items.map(item => ({
|
|
@@ -332,8 +330,6 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
332
330
|
const request = {
|
|
333
331
|
events: [{
|
|
334
332
|
event_type: "purchase",
|
|
335
|
-
dsid: dsid,
|
|
336
|
-
user_id: user_id,
|
|
337
333
|
session_id: session_id,
|
|
338
334
|
transaction_id: data.transaction_id,
|
|
339
335
|
currency: data.currency,
|
|
@@ -367,15 +363,6 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
367
363
|
}
|
|
368
364
|
}
|
|
369
365
|
/**
|
|
370
|
-
* Set the user_id for logged in users.
|
|
371
|
-
*
|
|
372
|
-
* https://docs.depict.ai/docs/performance-client#informing-depict-of-logged-in-users
|
|
373
|
-
*/
|
|
374
|
-
setUserId(user_id) {
|
|
375
|
-
$4uUHR$dlog("Setting user id", user_id);
|
|
376
|
-
this.latest_user_id = user_id || undefined;
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
366
|
* Set the current session_id.
|
|
380
367
|
*
|
|
381
368
|
* https://docs.depict.ai/docs/performance-client#browser-sessions
|
|
@@ -443,8 +430,7 @@ function $53af71a3700e1e90$var$_getContextData2() {
|
|
|
443
430
|
const data = {
|
|
444
431
|
market: this.market,
|
|
445
432
|
tenant: this.merchant,
|
|
446
|
-
|
|
447
|
-
session_id: this.latest_session_id
|
|
433
|
+
session_id: this.latest_session_id || $4uUHR$get_session_id()
|
|
448
434
|
};
|
|
449
435
|
return {
|
|
450
436
|
...$4uUHR$get_tracking_event_context_data(),
|
package/latest/index.cjs
CHANGED
|
@@ -11,7 +11,7 @@ function $parcel$export(e, n, v, s) {
|
|
|
11
11
|
$parcel$export(module.exports, "DPC", () => $15e3eebad2263636$export$820526014323765f);
|
|
12
12
|
$parcel$export(module.exports, "version", () => $9c6b4a5c4c4f318d$export$83d89fbfd8236492);
|
|
13
13
|
/*! Depict PerformanceClient */
|
|
14
|
-
const $9c6b4a5c4c4f318d$export$83d89fbfd8236492 = "
|
|
14
|
+
const $9c6b4a5c4c4f318d$export$83d89fbfd8236492 = "2.0.0";
|
|
15
15
|
let $02e69dba644a2ef8$export$8ae64f3d447c14f7;
|
|
16
16
|
(function (ProductCardType) {
|
|
17
17
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -98,7 +98,7 @@ const $9ccf446d29413158$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
98
98
|
if (typeof eventData == "number") eventData = eventData.toString();
|
|
99
99
|
if (eventName === "addToCart") dpc.sendAddToCartEvent({
|
|
100
100
|
product_id: $9ccf446d29413158$var$string_guard(eventName, eventData)
|
|
101
|
-
});else if (eventName === "setMarket") dpc.setMarket($9ccf446d29413158$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($9ccf446d29413158$var$string_guard(eventName, eventData));else if (eventName === "
|
|
101
|
+
});else if (eventName === "setMarket") dpc.setMarket($9ccf446d29413158$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($9ccf446d29413158$var$string_guard(eventName, eventData));else if (eventName === "setSessionId") dpc.setSessionId($9ccf446d29413158$var$nullable_undefined_string_guard(eventName, eventData));
|
|
102
102
|
};
|
|
103
103
|
const $9ccf446d29413158$export$7a1bb429756ced60 = dpc => {
|
|
104
104
|
const dpq = window.dpq ||= $9ccf446d29413158$var$create_dpq();
|
|
@@ -120,7 +120,7 @@ const $9ccf446d29413158$export$7a1bb429756ced60 = dpc => {
|
|
|
120
120
|
};
|
|
121
121
|
class $15e3eebad2263636$export$820526014323765f {
|
|
122
122
|
auto_observe = true;
|
|
123
|
-
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /**
|
|
123
|
+
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /** if we've sent a page view event for the current href */
|
|
124
124
|
#has_sent_pageview_for_current_href = false;
|
|
125
125
|
constructor(merchant, options) {
|
|
126
126
|
// Make sure we do not construct dpc more than once.
|
|
@@ -159,8 +159,7 @@ class $15e3eebad2263636$export$820526014323765f {
|
|
|
159
159
|
const data = {
|
|
160
160
|
market: this.market,
|
|
161
161
|
tenant: this.merchant,
|
|
162
|
-
|
|
163
|
-
session_id: this.latest_session_id
|
|
162
|
+
session_id: this.latest_session_id || $dwOGf$depictaiutilishared.get_session_id()
|
|
164
163
|
};
|
|
165
164
|
return {
|
|
166
165
|
...$dwOGf$depictaiutilishared.get_tracking_event_context_data(),
|
|
@@ -334,8 +333,6 @@ class $15e3eebad2263636$export$820526014323765f {
|
|
|
334
333
|
sendPurchaseEvent(data) {
|
|
335
334
|
if (!this.market) throw Error("Market not set");
|
|
336
335
|
const {
|
|
337
|
-
dsid: dsid,
|
|
338
|
-
user_id: user_id,
|
|
339
336
|
session_id: session_id
|
|
340
337
|
} = this.#getContextData();
|
|
341
338
|
const items = data.items.map(item => ({
|
|
@@ -346,8 +343,6 @@ class $15e3eebad2263636$export$820526014323765f {
|
|
|
346
343
|
const request = {
|
|
347
344
|
events: [{
|
|
348
345
|
event_type: "purchase",
|
|
349
|
-
dsid: dsid,
|
|
350
|
-
user_id: user_id,
|
|
351
346
|
session_id: session_id,
|
|
352
347
|
transaction_id: data.transaction_id,
|
|
353
348
|
currency: data.currency,
|
|
@@ -385,15 +380,6 @@ class $15e3eebad2263636$export$820526014323765f {
|
|
|
385
380
|
return this.latest_product_id;
|
|
386
381
|
}
|
|
387
382
|
/**
|
|
388
|
-
* Set the user_id for logged in users.
|
|
389
|
-
*
|
|
390
|
-
* https://docs.depict.ai/docs/performance-client#informing-depict-of-logged-in-users
|
|
391
|
-
*/
|
|
392
|
-
setUserId(user_id) {
|
|
393
|
-
$dwOGf$depictaiutilishared.dlog("Setting user id", user_id);
|
|
394
|
-
this.latest_user_id = user_id || undefined;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
383
|
* Set the current session_id.
|
|
398
384
|
*
|
|
399
385
|
* https://docs.depict.ai/docs/performance-client#browser-sessions
|
package/latest/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const version = "
|
|
1
|
+
export const version = "2.0.0";
|
|
2
2
|
enum ProductCardType {
|
|
3
3
|
Recommendation = 0,
|
|
4
4
|
SnakeRecommendation = 1,
|
|
@@ -10,15 +10,15 @@ type TrackingKey = "recommendation_id" | "search_result_id" | "product_listing_r
|
|
|
10
10
|
* The Depict Queue function used to register events to be sent to depict.
|
|
11
11
|
*/
|
|
12
12
|
export type DepictQueue = {
|
|
13
|
-
(eventName:
|
|
14
|
-
send_event?: (eventName:
|
|
15
|
-
queue: [
|
|
13
|
+
(eventName: EventName, ...args: unknown[]): void;
|
|
14
|
+
send_event?: (eventName: EventName, ...args: unknown[]) => void;
|
|
15
|
+
queue: [EventName, unknown][];
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Depict Object containing everything depict-related on the page.
|
|
19
19
|
*/
|
|
20
20
|
export interface DepictObject {
|
|
21
|
-
eventHistory: [
|
|
21
|
+
eventHistory: [EventName, unknown][];
|
|
22
22
|
dpq: DepictQueue;
|
|
23
23
|
dpc: DPC;
|
|
24
24
|
}
|
|
@@ -51,6 +51,7 @@ interface GA4PurchaseItem {
|
|
|
51
51
|
quantity: number;
|
|
52
52
|
[additional: string]: unknown;
|
|
53
53
|
}
|
|
54
|
+
type EventName = "purchase" | "addToCart" | "setMarket" | "setProductId" | "setSessionId";
|
|
54
55
|
interface Options {
|
|
55
56
|
/**
|
|
56
57
|
* The initial market. Should be specified if the market is known at the point of intializing DPC.
|
|
@@ -71,8 +72,6 @@ export class DPC {
|
|
|
71
72
|
latest_product_id_path?: string;
|
|
72
73
|
/** Latest session_id set on the client. Used for all events. */
|
|
73
74
|
latest_session_id?: string;
|
|
74
|
-
/** Latest user_id found in the DOM. Used for all events. */
|
|
75
|
-
latest_user_id?: string;
|
|
76
75
|
constructor(merchant: string, options?: Options);
|
|
77
76
|
tracked_elements: WeakSet<HTMLElement>;
|
|
78
77
|
/**
|
|
@@ -130,12 +129,6 @@ export class DPC {
|
|
|
130
129
|
* Update the product_id used for add-to-cart and pageview events on PDPs.
|
|
131
130
|
*/
|
|
132
131
|
setProductId(product_id: string): void;
|
|
133
|
-
/**
|
|
134
|
-
* Set the user_id for logged in users.
|
|
135
|
-
*
|
|
136
|
-
* https://docs.depict.ai/docs/performance-client#informing-depict-of-logged-in-users
|
|
137
|
-
*/
|
|
138
|
-
setUserId(user_id?: string | null): void;
|
|
139
132
|
/**
|
|
140
133
|
* Set the current session_id.
|
|
141
134
|
*
|
package/latest/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { add_to_version_info as $lbGMC$add_to_version_info, dlog as $lbGMC$dlog, instant_exec_on_suspect_history_change as $lbGMC$instant_exec_on_suspect_history_change, catchify as $lbGMC$catchify, get_tracking_event_context_data as $lbGMC$get_tracking_event_context_data, impression_track_element as $lbGMC$impression_track_element, derror as $lbGMC$derror, send_depict_unfiltered as $lbGMC$send_depict_unfiltered, depict_click as $lbGMC$depict_click, foolproof_send_beacon as $lbGMC$foolproof_send_beacon, base_url as $lbGMC$base_url, observer as $lbGMC$observer } from "@depict-ai/utilishared/latest";
|
|
1
|
+
import { add_to_version_info as $lbGMC$add_to_version_info, dlog as $lbGMC$dlog, instant_exec_on_suspect_history_change as $lbGMC$instant_exec_on_suspect_history_change, catchify as $lbGMC$catchify, get_session_id as $lbGMC$get_session_id, get_tracking_event_context_data as $lbGMC$get_tracking_event_context_data, impression_track_element as $lbGMC$impression_track_element, derror as $lbGMC$derror, send_depict_unfiltered as $lbGMC$send_depict_unfiltered, depict_click as $lbGMC$depict_click, foolproof_send_beacon as $lbGMC$foolproof_send_beacon, base_url as $lbGMC$base_url, observer as $lbGMC$observer } from "@depict-ai/utilishared/latest";
|
|
2
2
|
|
|
3
3
|
/*! Depict PerformanceClient */
|
|
4
4
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
5
5
|
register_es_version("performance-client", "latest");
|
|
6
|
-
const $3b068891cefe570d$export$83d89fbfd8236492 = "
|
|
6
|
+
const $3b068891cefe570d$export$83d89fbfd8236492 = "2.0.0";
|
|
7
7
|
let $ba8dc1a552d27224$export$8ae64f3d447c14f7;
|
|
8
8
|
(function (ProductCardType) {
|
|
9
9
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -90,7 +90,7 @@ const $b1ff6e3aa9b3b030$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
90
90
|
if (typeof eventData == "number") eventData = eventData.toString();
|
|
91
91
|
if (eventName === "addToCart") dpc.sendAddToCartEvent({
|
|
92
92
|
product_id: $b1ff6e3aa9b3b030$var$string_guard(eventName, eventData)
|
|
93
|
-
});else if (eventName === "setMarket") dpc.setMarket($b1ff6e3aa9b3b030$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($b1ff6e3aa9b3b030$var$string_guard(eventName, eventData));else if (eventName === "
|
|
93
|
+
});else if (eventName === "setMarket") dpc.setMarket($b1ff6e3aa9b3b030$var$string_guard(eventName, eventData));else if (eventName === "setProductId") dpc.setProductId($b1ff6e3aa9b3b030$var$string_guard(eventName, eventData));else if (eventName === "setSessionId") dpc.setSessionId($b1ff6e3aa9b3b030$var$nullable_undefined_string_guard(eventName, eventData));
|
|
94
94
|
};
|
|
95
95
|
const $b1ff6e3aa9b3b030$export$7a1bb429756ced60 = dpc => {
|
|
96
96
|
const dpq = window.dpq ||= $b1ff6e3aa9b3b030$var$create_dpq();
|
|
@@ -112,7 +112,7 @@ const $b1ff6e3aa9b3b030$export$7a1bb429756ced60 = dpc => {
|
|
|
112
112
|
};
|
|
113
113
|
class $fe563348936ab010$export$820526014323765f {
|
|
114
114
|
auto_observe = true;
|
|
115
|
-
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /**
|
|
115
|
+
/** Latest product_id found in the DOM. Used in a2c & pageview events on PDPs. */ /** The value of location.pathname when latest_product_id was set */ /** Latest session_id set on the client. Used for all events. */ /** if we've sent a page view event for the current href */
|
|
116
116
|
#has_sent_pageview_for_current_href = false;
|
|
117
117
|
constructor(merchant, options) {
|
|
118
118
|
// Make sure we do not construct dpc more than once.
|
|
@@ -151,8 +151,7 @@ class $fe563348936ab010$export$820526014323765f {
|
|
|
151
151
|
const data = {
|
|
152
152
|
market: this.market,
|
|
153
153
|
tenant: this.merchant,
|
|
154
|
-
|
|
155
|
-
session_id: this.latest_session_id
|
|
154
|
+
session_id: this.latest_session_id || $lbGMC$get_session_id()
|
|
156
155
|
};
|
|
157
156
|
return {
|
|
158
157
|
...$lbGMC$get_tracking_event_context_data(),
|
|
@@ -326,8 +325,6 @@ class $fe563348936ab010$export$820526014323765f {
|
|
|
326
325
|
sendPurchaseEvent(data) {
|
|
327
326
|
if (!this.market) throw Error("Market not set");
|
|
328
327
|
const {
|
|
329
|
-
dsid: dsid,
|
|
330
|
-
user_id: user_id,
|
|
331
328
|
session_id: session_id
|
|
332
329
|
} = this.#getContextData();
|
|
333
330
|
const items = data.items.map(item => ({
|
|
@@ -338,8 +335,6 @@ class $fe563348936ab010$export$820526014323765f {
|
|
|
338
335
|
const request = {
|
|
339
336
|
events: [{
|
|
340
337
|
event_type: "purchase",
|
|
341
|
-
dsid: dsid,
|
|
342
|
-
user_id: user_id,
|
|
343
338
|
session_id: session_id,
|
|
344
339
|
transaction_id: data.transaction_id,
|
|
345
340
|
currency: data.currency,
|
|
@@ -377,15 +372,6 @@ class $fe563348936ab010$export$820526014323765f {
|
|
|
377
372
|
return this.latest_product_id;
|
|
378
373
|
}
|
|
379
374
|
/**
|
|
380
|
-
* Set the user_id for logged in users.
|
|
381
|
-
*
|
|
382
|
-
* https://docs.depict.ai/docs/performance-client#informing-depict-of-logged-in-users
|
|
383
|
-
*/
|
|
384
|
-
setUserId(user_id) {
|
|
385
|
-
$lbGMC$dlog("Setting user id", user_id);
|
|
386
|
-
this.latest_user_id = user_id || undefined;
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
375
|
* Set the current session_id.
|
|
390
376
|
*
|
|
391
377
|
* https://docs.depict.ai/docs/performance-client#browser-sessions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/dpc",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"packageManager": "yarn@3.2.2",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"types": "ES10/index.d.ts",
|
|
@@ -84,16 +84,16 @@
|
|
|
84
84
|
],
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@babel/core": "latest",
|
|
87
|
-
"@parcel/resolver-default": "^2.
|
|
87
|
+
"@parcel/resolver-default": "^2.10.3",
|
|
88
88
|
"@types/node": "^18.11.10",
|
|
89
|
-
"parcel": "^2.
|
|
89
|
+
"parcel": "^2.10.3"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"@babel/plugin-transform-typescript": "^7.22.9",
|
|
93
93
|
"@babel/runtime": "latest",
|
|
94
94
|
"@babel/runtime-corejs3": "^7.22.6",
|
|
95
|
-
"@depict-ai/types": "^
|
|
96
|
-
"@depict-ai/utilishared": "^
|
|
95
|
+
"@depict-ai/types": "^5.0.0",
|
|
96
|
+
"@depict-ai/utilishared": "^2.0.0"
|
|
97
97
|
},
|
|
98
98
|
"main": "ES10/index.cjs",
|
|
99
99
|
"module": "ES10/index.js"
|