@depict-ai/dpc 2.6.1 → 2.6.3
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 +14 -13
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +14 -13
- package/dist/index.cjs +14 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -13
- package/latest/index.cjs +9 -11
- package/latest/index.d.ts +1 -1
- package/latest/index.js +9 -11
- package/package.json +1 -1
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 = "2.6.
|
|
20
|
+
const $fcc8287091fb489d$export$83d89fbfd8236492 = "2.6.3";
|
|
21
21
|
let $405164bc961cc106$export$8ae64f3d447c14f7;
|
|
22
22
|
(function (ProductCardType) {
|
|
23
23
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -107,9 +107,8 @@ const $5323e9ffea4e414a$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
107
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
|
-
|
|
111
|
-
const
|
|
112
|
-
const depict = (_window2 = window).depict || (_window2.depict = {});
|
|
110
|
+
const dpq = globalThis.dpq || (globalThis.dpq = $5323e9ffea4e414a$var$create_dpq());
|
|
111
|
+
const depict = globalThis.depict || (globalThis.depict = {});
|
|
113
112
|
depict.dpq = dpq; // refrencing dpq into the depict object
|
|
114
113
|
depict.eventHistory = dpq.queue; // making this more visible in the depict object
|
|
115
114
|
depict.dpc = dpc;
|
|
@@ -149,7 +148,7 @@ var $89ae37e3a26189b4$var$_sendTrackingEvent = /*#__PURE__*/new WeakSet();
|
|
|
149
148
|
var $89ae37e3a26189b4$var$_getProductId = /*#__PURE__*/new WeakSet();
|
|
150
149
|
class $89ae37e3a26189b4$export$820526014323765f {
|
|
151
150
|
/** 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
|
-
var
|
|
151
|
+
var _globalThis$depict;
|
|
153
152
|
$89ae37e3a26189b4$var$_classPrivateMethodInitSpec(this, $89ae37e3a26189b4$var$_getProductId);
|
|
154
153
|
$89ae37e3a26189b4$var$_classPrivateMethodInitSpec(this, $89ae37e3a26189b4$var$_sendTrackingEvent);
|
|
155
154
|
$89ae37e3a26189b4$var$_classPrivateMethodInitSpec(this, $89ae37e3a26189b4$var$_getContextData);
|
|
@@ -167,9 +166,9 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
167
166
|
});
|
|
168
167
|
$parcel$interopDefault($9AWcE$babelruntimehelpersdefineProperty)(this, "tracked_elements", new WeakSet());
|
|
169
168
|
// Make sure we do not construct dpc more than once.
|
|
170
|
-
if (((
|
|
169
|
+
if ((globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$depict = globalThis.depict) === null || _globalThis$depict === void 0 ? void 0 : _globalThis$depict.dpc) instanceof $89ae37e3a26189b4$export$820526014323765f) {
|
|
171
170
|
$9AWcE$depictaiutilishared.dlog("DPC already initialized. Returning existing instance.");
|
|
172
|
-
return
|
|
171
|
+
return globalThis === null || globalThis === void 0 ? void 0 : globalThis.depict.dpc;
|
|
173
172
|
}
|
|
174
173
|
this.merchant = merchant;
|
|
175
174
|
$89ae37e3a26189b4$var$_classPrivateMethodGet(this, $89ae37e3a26189b4$var$_parseOptions, $89ae37e3a26189b4$var$_parseOptions2).call(this, _options);
|
|
@@ -346,9 +345,10 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
346
345
|
* Update the product_id used for add-to-cart and pageview events on PDPs.
|
|
347
346
|
*/
|
|
348
347
|
setProductId(product_id) {
|
|
348
|
+
var _globalThis$location;
|
|
349
349
|
$9AWcE$depictaiutilishared.dlog("Setting product id", product_id);
|
|
350
350
|
this.latest_product_id = product_id;
|
|
351
|
-
this.latest_product_id_path = location.pathname;
|
|
351
|
+
this.latest_product_id_path = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location = globalThis.location) === null || _globalThis$location === void 0 ? void 0 : _globalThis$location.pathname;
|
|
352
352
|
if (!$parcel$interopDefault($9AWcE$babelruntimehelpersclassPrivateFieldGet)(this, $89ae37e3a26189b4$var$_has_sent_pageview_for_current_href)) {
|
|
353
353
|
$89ae37e3a26189b4$var$_classPrivateMethodGet(this, $89ae37e3a26189b4$var$_sendTrackingEvent, $89ae37e3a26189b4$var$_sendTrackingEvent2).call(this, {
|
|
354
354
|
type: "page_view",
|
|
@@ -404,11 +404,11 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
function $89ae37e3a26189b4$var$_resetSentPageViewForCurrentHref2() {
|
|
407
|
-
|
|
407
|
+
var _globalThis$location2;
|
|
408
|
+
let url = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location2 = globalThis.location) === null || _globalThis$location2 === void 0 ? void 0 : _globalThis$location2.href;
|
|
408
409
|
(0, $9AWcE$depictaiutilishared.instant_exec_on_suspect_history_change).add($9AWcE$depictaiutilishared.catchify(() => {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
} = location;
|
|
410
|
+
var _globalThis$location3;
|
|
411
|
+
const new_href = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location3 = globalThis.location) === null || _globalThis$location3 === void 0 ? void 0 : _globalThis$location3.href;
|
|
412
412
|
if (url !== new_href) {
|
|
413
413
|
$parcel$interopDefault($9AWcE$babelruntimehelpersclassPrivateFieldSet)(this, $89ae37e3a26189b4$var$_has_sent_pageview_for_current_href, false);
|
|
414
414
|
url = new_href;
|
|
@@ -442,7 +442,8 @@ function $89ae37e3a26189b4$var$_sendTrackingEvent2(payload) {
|
|
|
442
442
|
}], true);
|
|
443
443
|
}
|
|
444
444
|
function $89ae37e3a26189b4$var$_getProductId2() {
|
|
445
|
-
|
|
445
|
+
var _globalThis$location4;
|
|
446
|
+
if (this.latest_product_id_path !== (globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location4 = globalThis.location) === null || _globalThis$location4 === void 0 ? void 0 : _globalThis$location4.pathname)) return undefined;
|
|
446
447
|
return this.latest_product_id;
|
|
447
448
|
}
|
|
448
449
|
$9AWcE$depictaiutilishared.add_to_version_info("dpc", (0, $fcc8287091fb489d$export$83d89fbfd8236492));
|
package/ES10/index.d.ts
CHANGED
package/ES10/index.js
CHANGED
|
@@ -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 = "2.6.
|
|
9
|
+
const $3242b911de3d57ad$export$83d89fbfd8236492 = "2.6.3";
|
|
10
10
|
let $983195e3c4979825$export$8ae64f3d447c14f7;
|
|
11
11
|
(function (ProductCardType) {
|
|
12
12
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -96,9 +96,8 @@ const $f06bf37f1e6136a4$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
96
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
|
-
|
|
100
|
-
const
|
|
101
|
-
const depict = (_window2 = window).depict || (_window2.depict = {});
|
|
99
|
+
const dpq = globalThis.dpq || (globalThis.dpq = $f06bf37f1e6136a4$var$create_dpq());
|
|
100
|
+
const depict = globalThis.depict || (globalThis.depict = {});
|
|
102
101
|
depict.dpq = dpq; // refrencing dpq into the depict object
|
|
103
102
|
depict.eventHistory = dpq.queue; // making this more visible in the depict object
|
|
104
103
|
depict.dpc = dpc;
|
|
@@ -138,7 +137,7 @@ var $53af71a3700e1e90$var$_sendTrackingEvent = /*#__PURE__*/new WeakSet();
|
|
|
138
137
|
var $53af71a3700e1e90$var$_getProductId = /*#__PURE__*/new WeakSet();
|
|
139
138
|
class $53af71a3700e1e90$export$820526014323765f {
|
|
140
139
|
/** 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
|
-
var
|
|
140
|
+
var _globalThis$depict;
|
|
142
141
|
$53af71a3700e1e90$var$_classPrivateMethodInitSpec(this, $53af71a3700e1e90$var$_getProductId);
|
|
143
142
|
$53af71a3700e1e90$var$_classPrivateMethodInitSpec(this, $53af71a3700e1e90$var$_sendTrackingEvent);
|
|
144
143
|
$53af71a3700e1e90$var$_classPrivateMethodInitSpec(this, $53af71a3700e1e90$var$_getContextData);
|
|
@@ -156,9 +155,9 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
156
155
|
});
|
|
157
156
|
$4uUHR$babelruntimehelpersdefineProperty(this, "tracked_elements", new WeakSet());
|
|
158
157
|
// Make sure we do not construct dpc more than once.
|
|
159
|
-
if (((
|
|
158
|
+
if ((globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$depict = globalThis.depict) === null || _globalThis$depict === void 0 ? void 0 : _globalThis$depict.dpc) instanceof $53af71a3700e1e90$export$820526014323765f) {
|
|
160
159
|
$4uUHR$dlog("DPC already initialized. Returning existing instance.");
|
|
161
|
-
return
|
|
160
|
+
return globalThis === null || globalThis === void 0 ? void 0 : globalThis.depict.dpc;
|
|
162
161
|
}
|
|
163
162
|
this.merchant = merchant;
|
|
164
163
|
$53af71a3700e1e90$var$_classPrivateMethodGet(this, $53af71a3700e1e90$var$_parseOptions, $53af71a3700e1e90$var$_parseOptions2).call(this, _options);
|
|
@@ -335,9 +334,10 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
335
334
|
* Update the product_id used for add-to-cart and pageview events on PDPs.
|
|
336
335
|
*/
|
|
337
336
|
setProductId(product_id) {
|
|
337
|
+
var _globalThis$location;
|
|
338
338
|
$4uUHR$dlog("Setting product id", product_id);
|
|
339
339
|
this.latest_product_id = product_id;
|
|
340
|
-
this.latest_product_id_path = location.pathname;
|
|
340
|
+
this.latest_product_id_path = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location = globalThis.location) === null || _globalThis$location === void 0 ? void 0 : _globalThis$location.pathname;
|
|
341
341
|
if (!$4uUHR$babelruntimehelpersclassPrivateFieldGet(this, $53af71a3700e1e90$var$_has_sent_pageview_for_current_href)) {
|
|
342
342
|
$53af71a3700e1e90$var$_classPrivateMethodGet(this, $53af71a3700e1e90$var$_sendTrackingEvent, $53af71a3700e1e90$var$_sendTrackingEvent2).call(this, {
|
|
343
343
|
type: "page_view",
|
|
@@ -393,11 +393,11 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
function $53af71a3700e1e90$var$_resetSentPageViewForCurrentHref2() {
|
|
396
|
-
|
|
396
|
+
var _globalThis$location2;
|
|
397
|
+
let url = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location2 = globalThis.location) === null || _globalThis$location2 === void 0 ? void 0 : _globalThis$location2.href;
|
|
397
398
|
(0, $4uUHR$instant_exec_on_suspect_history_change).add($4uUHR$catchify(() => {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
} = location;
|
|
399
|
+
var _globalThis$location3;
|
|
400
|
+
const new_href = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location3 = globalThis.location) === null || _globalThis$location3 === void 0 ? void 0 : _globalThis$location3.href;
|
|
401
401
|
if (url !== new_href) {
|
|
402
402
|
$4uUHR$babelruntimehelpersclassPrivateFieldSet(this, $53af71a3700e1e90$var$_has_sent_pageview_for_current_href, false);
|
|
403
403
|
url = new_href;
|
|
@@ -431,7 +431,8 @@ function $53af71a3700e1e90$var$_sendTrackingEvent2(payload) {
|
|
|
431
431
|
}], true);
|
|
432
432
|
}
|
|
433
433
|
function $53af71a3700e1e90$var$_getProductId2() {
|
|
434
|
-
|
|
434
|
+
var _globalThis$location4;
|
|
435
|
+
if (this.latest_product_id_path !== (globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location4 = globalThis.location) === null || _globalThis$location4 === void 0 ? void 0 : _globalThis$location4.pathname)) return undefined;
|
|
435
436
|
return this.latest_product_id;
|
|
436
437
|
}
|
|
437
438
|
$4uUHR$add_to_version_info("dpc", (0, $3242b911de3d57ad$export$83d89fbfd8236492));
|
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 = "2.6.
|
|
20
|
+
const $fcc8287091fb489d$export$83d89fbfd8236492 = "2.6.3";
|
|
21
21
|
let $405164bc961cc106$export$8ae64f3d447c14f7;
|
|
22
22
|
(function (ProductCardType) {
|
|
23
23
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -107,9 +107,8 @@ const $5323e9ffea4e414a$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
107
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
|
-
|
|
111
|
-
const
|
|
112
|
-
const depict = (_window2 = window).depict || (_window2.depict = {});
|
|
110
|
+
const dpq = globalThis.dpq || (globalThis.dpq = $5323e9ffea4e414a$var$create_dpq());
|
|
111
|
+
const depict = globalThis.depict || (globalThis.depict = {});
|
|
113
112
|
depict.dpq = dpq; // refrencing dpq into the depict object
|
|
114
113
|
depict.eventHistory = dpq.queue; // making this more visible in the depict object
|
|
115
114
|
depict.dpc = dpc;
|
|
@@ -149,7 +148,7 @@ var $89ae37e3a26189b4$var$_sendTrackingEvent = /*#__PURE__*/new WeakSet();
|
|
|
149
148
|
var $89ae37e3a26189b4$var$_getProductId = /*#__PURE__*/new WeakSet();
|
|
150
149
|
class $89ae37e3a26189b4$export$820526014323765f {
|
|
151
150
|
/** 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
|
-
var
|
|
151
|
+
var _globalThis$depict;
|
|
153
152
|
$89ae37e3a26189b4$var$_classPrivateMethodInitSpec(this, $89ae37e3a26189b4$var$_getProductId);
|
|
154
153
|
$89ae37e3a26189b4$var$_classPrivateMethodInitSpec(this, $89ae37e3a26189b4$var$_sendTrackingEvent);
|
|
155
154
|
$89ae37e3a26189b4$var$_classPrivateMethodInitSpec(this, $89ae37e3a26189b4$var$_getContextData);
|
|
@@ -167,9 +166,9 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
167
166
|
});
|
|
168
167
|
$parcel$interopDefault($9AWcE$babelruntimehelpersdefineProperty)(this, "tracked_elements", new WeakSet());
|
|
169
168
|
// Make sure we do not construct dpc more than once.
|
|
170
|
-
if (((
|
|
169
|
+
if ((globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$depict = globalThis.depict) === null || _globalThis$depict === void 0 ? void 0 : _globalThis$depict.dpc) instanceof $89ae37e3a26189b4$export$820526014323765f) {
|
|
171
170
|
$9AWcE$depictaiutilishared.dlog("DPC already initialized. Returning existing instance.");
|
|
172
|
-
return
|
|
171
|
+
return globalThis === null || globalThis === void 0 ? void 0 : globalThis.depict.dpc;
|
|
173
172
|
}
|
|
174
173
|
this.merchant = merchant;
|
|
175
174
|
$89ae37e3a26189b4$var$_classPrivateMethodGet(this, $89ae37e3a26189b4$var$_parseOptions, $89ae37e3a26189b4$var$_parseOptions2).call(this, _options);
|
|
@@ -346,9 +345,10 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
346
345
|
* Update the product_id used for add-to-cart and pageview events on PDPs.
|
|
347
346
|
*/
|
|
348
347
|
setProductId(product_id) {
|
|
348
|
+
var _globalThis$location;
|
|
349
349
|
$9AWcE$depictaiutilishared.dlog("Setting product id", product_id);
|
|
350
350
|
this.latest_product_id = product_id;
|
|
351
|
-
this.latest_product_id_path = location.pathname;
|
|
351
|
+
this.latest_product_id_path = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location = globalThis.location) === null || _globalThis$location === void 0 ? void 0 : _globalThis$location.pathname;
|
|
352
352
|
if (!$parcel$interopDefault($9AWcE$babelruntimehelpersclassPrivateFieldGet)(this, $89ae37e3a26189b4$var$_has_sent_pageview_for_current_href)) {
|
|
353
353
|
$89ae37e3a26189b4$var$_classPrivateMethodGet(this, $89ae37e3a26189b4$var$_sendTrackingEvent, $89ae37e3a26189b4$var$_sendTrackingEvent2).call(this, {
|
|
354
354
|
type: "page_view",
|
|
@@ -404,11 +404,11 @@ class $89ae37e3a26189b4$export$820526014323765f {
|
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
function $89ae37e3a26189b4$var$_resetSentPageViewForCurrentHref2() {
|
|
407
|
-
|
|
407
|
+
var _globalThis$location2;
|
|
408
|
+
let url = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location2 = globalThis.location) === null || _globalThis$location2 === void 0 ? void 0 : _globalThis$location2.href;
|
|
408
409
|
(0, $9AWcE$depictaiutilishared.instant_exec_on_suspect_history_change).add($9AWcE$depictaiutilishared.catchify(() => {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
} = location;
|
|
410
|
+
var _globalThis$location3;
|
|
411
|
+
const new_href = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location3 = globalThis.location) === null || _globalThis$location3 === void 0 ? void 0 : _globalThis$location3.href;
|
|
412
412
|
if (url !== new_href) {
|
|
413
413
|
$parcel$interopDefault($9AWcE$babelruntimehelpersclassPrivateFieldSet)(this, $89ae37e3a26189b4$var$_has_sent_pageview_for_current_href, false);
|
|
414
414
|
url = new_href;
|
|
@@ -442,7 +442,8 @@ function $89ae37e3a26189b4$var$_sendTrackingEvent2(payload) {
|
|
|
442
442
|
}], true);
|
|
443
443
|
}
|
|
444
444
|
function $89ae37e3a26189b4$var$_getProductId2() {
|
|
445
|
-
|
|
445
|
+
var _globalThis$location4;
|
|
446
|
+
if (this.latest_product_id_path !== (globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location4 = globalThis.location) === null || _globalThis$location4 === void 0 ? void 0 : _globalThis$location4.pathname)) return undefined;
|
|
446
447
|
return this.latest_product_id;
|
|
447
448
|
}
|
|
448
449
|
$9AWcE$depictaiutilishared.add_to_version_info("dpc", (0, $fcc8287091fb489d$export$83d89fbfd8236492));
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -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 = "2.6.
|
|
9
|
+
const $3242b911de3d57ad$export$83d89fbfd8236492 = "2.6.3";
|
|
10
10
|
let $983195e3c4979825$export$8ae64f3d447c14f7;
|
|
11
11
|
(function (ProductCardType) {
|
|
12
12
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -96,9 +96,8 @@ const $f06bf37f1e6136a4$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
96
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
|
-
|
|
100
|
-
const
|
|
101
|
-
const depict = (_window2 = window).depict || (_window2.depict = {});
|
|
99
|
+
const dpq = globalThis.dpq || (globalThis.dpq = $f06bf37f1e6136a4$var$create_dpq());
|
|
100
|
+
const depict = globalThis.depict || (globalThis.depict = {});
|
|
102
101
|
depict.dpq = dpq; // refrencing dpq into the depict object
|
|
103
102
|
depict.eventHistory = dpq.queue; // making this more visible in the depict object
|
|
104
103
|
depict.dpc = dpc;
|
|
@@ -138,7 +137,7 @@ var $53af71a3700e1e90$var$_sendTrackingEvent = /*#__PURE__*/new WeakSet();
|
|
|
138
137
|
var $53af71a3700e1e90$var$_getProductId = /*#__PURE__*/new WeakSet();
|
|
139
138
|
class $53af71a3700e1e90$export$820526014323765f {
|
|
140
139
|
/** 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
|
-
var
|
|
140
|
+
var _globalThis$depict;
|
|
142
141
|
$53af71a3700e1e90$var$_classPrivateMethodInitSpec(this, $53af71a3700e1e90$var$_getProductId);
|
|
143
142
|
$53af71a3700e1e90$var$_classPrivateMethodInitSpec(this, $53af71a3700e1e90$var$_sendTrackingEvent);
|
|
144
143
|
$53af71a3700e1e90$var$_classPrivateMethodInitSpec(this, $53af71a3700e1e90$var$_getContextData);
|
|
@@ -156,9 +155,9 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
156
155
|
});
|
|
157
156
|
$4uUHR$babelruntimehelpersdefineProperty(this, "tracked_elements", new WeakSet());
|
|
158
157
|
// Make sure we do not construct dpc more than once.
|
|
159
|
-
if (((
|
|
158
|
+
if ((globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$depict = globalThis.depict) === null || _globalThis$depict === void 0 ? void 0 : _globalThis$depict.dpc) instanceof $53af71a3700e1e90$export$820526014323765f) {
|
|
160
159
|
$4uUHR$dlog("DPC already initialized. Returning existing instance.");
|
|
161
|
-
return
|
|
160
|
+
return globalThis === null || globalThis === void 0 ? void 0 : globalThis.depict.dpc;
|
|
162
161
|
}
|
|
163
162
|
this.merchant = merchant;
|
|
164
163
|
$53af71a3700e1e90$var$_classPrivateMethodGet(this, $53af71a3700e1e90$var$_parseOptions, $53af71a3700e1e90$var$_parseOptions2).call(this, _options);
|
|
@@ -335,9 +334,10 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
335
334
|
* Update the product_id used for add-to-cart and pageview events on PDPs.
|
|
336
335
|
*/
|
|
337
336
|
setProductId(product_id) {
|
|
337
|
+
var _globalThis$location;
|
|
338
338
|
$4uUHR$dlog("Setting product id", product_id);
|
|
339
339
|
this.latest_product_id = product_id;
|
|
340
|
-
this.latest_product_id_path = location.pathname;
|
|
340
|
+
this.latest_product_id_path = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location = globalThis.location) === null || _globalThis$location === void 0 ? void 0 : _globalThis$location.pathname;
|
|
341
341
|
if (!$4uUHR$babelruntimehelpersclassPrivateFieldGet(this, $53af71a3700e1e90$var$_has_sent_pageview_for_current_href)) {
|
|
342
342
|
$53af71a3700e1e90$var$_classPrivateMethodGet(this, $53af71a3700e1e90$var$_sendTrackingEvent, $53af71a3700e1e90$var$_sendTrackingEvent2).call(this, {
|
|
343
343
|
type: "page_view",
|
|
@@ -393,11 +393,11 @@ class $53af71a3700e1e90$export$820526014323765f {
|
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
function $53af71a3700e1e90$var$_resetSentPageViewForCurrentHref2() {
|
|
396
|
-
|
|
396
|
+
var _globalThis$location2;
|
|
397
|
+
let url = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location2 = globalThis.location) === null || _globalThis$location2 === void 0 ? void 0 : _globalThis$location2.href;
|
|
397
398
|
(0, $4uUHR$instant_exec_on_suspect_history_change).add($4uUHR$catchify(() => {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
} = location;
|
|
399
|
+
var _globalThis$location3;
|
|
400
|
+
const new_href = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location3 = globalThis.location) === null || _globalThis$location3 === void 0 ? void 0 : _globalThis$location3.href;
|
|
401
401
|
if (url !== new_href) {
|
|
402
402
|
$4uUHR$babelruntimehelpersclassPrivateFieldSet(this, $53af71a3700e1e90$var$_has_sent_pageview_for_current_href, false);
|
|
403
403
|
url = new_href;
|
|
@@ -431,7 +431,8 @@ function $53af71a3700e1e90$var$_sendTrackingEvent2(payload) {
|
|
|
431
431
|
}], true);
|
|
432
432
|
}
|
|
433
433
|
function $53af71a3700e1e90$var$_getProductId2() {
|
|
434
|
-
|
|
434
|
+
var _globalThis$location4;
|
|
435
|
+
if (this.latest_product_id_path !== (globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$location4 = globalThis.location) === null || _globalThis$location4 === void 0 ? void 0 : _globalThis$location4.pathname)) return undefined;
|
|
435
436
|
return this.latest_product_id;
|
|
436
437
|
}
|
|
437
438
|
$4uUHR$add_to_version_info("dpc", (0, $3242b911de3d57ad$export$83d89fbfd8236492));
|
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 = "2.6.
|
|
14
|
+
const $9c6b4a5c4c4f318d$export$83d89fbfd8236492 = "2.6.3";
|
|
15
15
|
let $02e69dba644a2ef8$export$8ae64f3d447c14f7;
|
|
16
16
|
(function (ProductCardType) {
|
|
17
17
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -101,8 +101,8 @@ const $9ccf446d29413158$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
101
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
|
-
const dpq =
|
|
105
|
-
const depict =
|
|
104
|
+
const dpq = globalThis.dpq ||= $9ccf446d29413158$var$create_dpq();
|
|
105
|
+
const depict = globalThis.depict ||= {};
|
|
106
106
|
depict.dpq = dpq; // refrencing dpq into the depict object
|
|
107
107
|
depict.eventHistory = dpq.queue; // making this more visible in the depict object
|
|
108
108
|
depict.dpc = dpc;
|
|
@@ -124,9 +124,9 @@ class $15e3eebad2263636$export$820526014323765f {
|
|
|
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.
|
|
127
|
-
if (
|
|
127
|
+
if (globalThis?.depict?.dpc instanceof $15e3eebad2263636$export$820526014323765f) {
|
|
128
128
|
$dwOGf$depictaiutilishared.dlog("DPC already initialized. Returning existing instance.");
|
|
129
|
-
return
|
|
129
|
+
return globalThis?.depict.dpc;
|
|
130
130
|
}
|
|
131
131
|
this.merchant = merchant;
|
|
132
132
|
this.#parseOptions(options);
|
|
@@ -138,11 +138,9 @@ class $15e3eebad2263636$export$820526014323765f {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
#resetSentPageViewForCurrentHref() {
|
|
141
|
-
let url = location
|
|
141
|
+
let url = globalThis?.location?.href;
|
|
142
142
|
(0, $dwOGf$depictaiutilishared.instant_exec_on_suspect_history_change).add($dwOGf$depictaiutilishared.catchify(() => {
|
|
143
|
-
const
|
|
144
|
-
href: new_href
|
|
145
|
-
} = location;
|
|
143
|
+
const new_href = globalThis?.location?.href;
|
|
146
144
|
if (url !== new_href) {
|
|
147
145
|
this.#has_sent_pageview_for_current_href = false;
|
|
148
146
|
url = new_href;
|
|
@@ -345,7 +343,7 @@ class $15e3eebad2263636$export$820526014323765f {
|
|
|
345
343
|
setProductId(product_id) {
|
|
346
344
|
$dwOGf$depictaiutilishared.dlog("Setting product id", product_id);
|
|
347
345
|
this.latest_product_id = product_id;
|
|
348
|
-
this.latest_product_id_path = location
|
|
346
|
+
this.latest_product_id_path = globalThis?.location?.pathname;
|
|
349
347
|
if (!this.#has_sent_pageview_for_current_href) {
|
|
350
348
|
this.#sendTrackingEvent({
|
|
351
349
|
type: "page_view",
|
|
@@ -355,7 +353,7 @@ class $15e3eebad2263636$export$820526014323765f {
|
|
|
355
353
|
}
|
|
356
354
|
}
|
|
357
355
|
#getProductId() {
|
|
358
|
-
if (this.latest_product_id_path !== location
|
|
356
|
+
if (this.latest_product_id_path !== globalThis?.location?.pathname) return undefined;
|
|
359
357
|
return this.latest_product_id;
|
|
360
358
|
}
|
|
361
359
|
/**
|
package/latest/index.d.ts
CHANGED
package/latest/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { add_to_version_info as $lbGMC$add_to_version_info, dlog as $lbGMC$dlog,
|
|
|
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 = "2.6.
|
|
6
|
+
const $3b068891cefe570d$export$83d89fbfd8236492 = "2.6.3";
|
|
7
7
|
let $ba8dc1a552d27224$export$8ae64f3d447c14f7;
|
|
8
8
|
(function (ProductCardType) {
|
|
9
9
|
ProductCardType[ProductCardType["Recommendation"] = 0] = "Recommendation";
|
|
@@ -93,8 +93,8 @@ const $b1ff6e3aa9b3b030$var$event_handler = (dpc, eventName, eventData) => {
|
|
|
93
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
|
-
const dpq =
|
|
97
|
-
const depict =
|
|
96
|
+
const dpq = globalThis.dpq ||= $b1ff6e3aa9b3b030$var$create_dpq();
|
|
97
|
+
const depict = globalThis.depict ||= {};
|
|
98
98
|
depict.dpq = dpq; // refrencing dpq into the depict object
|
|
99
99
|
depict.eventHistory = dpq.queue; // making this more visible in the depict object
|
|
100
100
|
depict.dpc = dpc;
|
|
@@ -116,9 +116,9 @@ class $fe563348936ab010$export$820526014323765f {
|
|
|
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.
|
|
119
|
-
if (
|
|
119
|
+
if (globalThis?.depict?.dpc instanceof $fe563348936ab010$export$820526014323765f) {
|
|
120
120
|
$lbGMC$dlog("DPC already initialized. Returning existing instance.");
|
|
121
|
-
return
|
|
121
|
+
return globalThis?.depict.dpc;
|
|
122
122
|
}
|
|
123
123
|
this.merchant = merchant;
|
|
124
124
|
this.#parseOptions(options);
|
|
@@ -130,11 +130,9 @@ class $fe563348936ab010$export$820526014323765f {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
#resetSentPageViewForCurrentHref() {
|
|
133
|
-
let url = location
|
|
133
|
+
let url = globalThis?.location?.href;
|
|
134
134
|
(0, $lbGMC$instant_exec_on_suspect_history_change).add($lbGMC$catchify(() => {
|
|
135
|
-
const
|
|
136
|
-
href: new_href
|
|
137
|
-
} = location;
|
|
135
|
+
const new_href = globalThis?.location?.href;
|
|
138
136
|
if (url !== new_href) {
|
|
139
137
|
this.#has_sent_pageview_for_current_href = false;
|
|
140
138
|
url = new_href;
|
|
@@ -337,7 +335,7 @@ class $fe563348936ab010$export$820526014323765f {
|
|
|
337
335
|
setProductId(product_id) {
|
|
338
336
|
$lbGMC$dlog("Setting product id", product_id);
|
|
339
337
|
this.latest_product_id = product_id;
|
|
340
|
-
this.latest_product_id_path = location
|
|
338
|
+
this.latest_product_id_path = globalThis?.location?.pathname;
|
|
341
339
|
if (!this.#has_sent_pageview_for_current_href) {
|
|
342
340
|
this.#sendTrackingEvent({
|
|
343
341
|
type: "page_view",
|
|
@@ -347,7 +345,7 @@ class $fe563348936ab010$export$820526014323765f {
|
|
|
347
345
|
}
|
|
348
346
|
}
|
|
349
347
|
#getProductId() {
|
|
350
|
-
if (this.latest_product_id_path !== location
|
|
348
|
+
if (this.latest_product_id_path !== globalThis?.location?.pathname) return undefined;
|
|
351
349
|
return this.latest_product_id;
|
|
352
350
|
}
|
|
353
351
|
/**
|