@chordcommerce/analytics 1.18.2 → 1.18.3-beta.1
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/dist/cjs/client/cdp.js
CHANGED
|
@@ -75,10 +75,18 @@ var addCdpSnippet = function (options) { return __awaiter(void 0, void 0, void 0
|
|
|
75
75
|
case 1:
|
|
76
76
|
// Wait for CDP to be ready before setting up consent
|
|
77
77
|
_a.sent();
|
|
78
|
-
if (options.consent)
|
|
79
|
-
|
|
78
|
+
if (!options.consent) return [3 /*break*/, 3];
|
|
79
|
+
if (options.debug && options.enableLogging) {
|
|
80
|
+
console.log('Chord CDP: Setting up consent management');
|
|
80
81
|
}
|
|
81
|
-
return [
|
|
82
|
+
return [4 /*yield*/, (0, index_js_1.addCdpConsent)(options).init()];
|
|
83
|
+
case 2:
|
|
84
|
+
_a.sent();
|
|
85
|
+
if (options.debug && options.enableLogging) {
|
|
86
|
+
console.log('Chord CDP: Consent management setup complete');
|
|
87
|
+
}
|
|
88
|
+
_a.label = 3;
|
|
89
|
+
case 3: return [2 /*return*/];
|
|
82
90
|
}
|
|
83
91
|
});
|
|
84
92
|
}); };
|
|
@@ -209,7 +209,7 @@ var addCdpConsent = function (options) {
|
|
|
209
209
|
* Returns a promise that resolves to true if CDP should be loaded, false otherwise.
|
|
210
210
|
*/
|
|
211
211
|
var init = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
212
|
-
var canBeTracked;
|
|
212
|
+
var canBeTracked, error_1;
|
|
213
213
|
return __generator(this, function (_a) {
|
|
214
214
|
switch (_a.label) {
|
|
215
215
|
case 0:
|
|
@@ -226,11 +226,18 @@ var addCdpConsent = function (options) {
|
|
|
226
226
|
return [2 /*return*/, false];
|
|
227
227
|
_a.label = 2;
|
|
228
228
|
case 2:
|
|
229
|
-
|
|
230
|
-
setupConsentManagement()
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
return [
|
|
229
|
+
_a.trys.push([2, 4, , 5]);
|
|
230
|
+
return [4 /*yield*/, setupConsentManagement()];
|
|
231
|
+
case 3:
|
|
232
|
+
_a.sent();
|
|
233
|
+
return [3 /*break*/, 5];
|
|
234
|
+
case 4:
|
|
235
|
+
error_1 = _a.sent();
|
|
236
|
+
if (options.debug && options.enableLogging) {
|
|
237
|
+
console.error('Error setting up consent management:', error_1);
|
|
238
|
+
}
|
|
239
|
+
return [3 /*break*/, 5];
|
|
240
|
+
case 5: return [2 /*return*/, true];
|
|
234
241
|
}
|
|
235
242
|
});
|
|
236
243
|
}); };
|
package/dist/client/cdp.js
CHANGED
|
@@ -40,7 +40,13 @@ export const addCdpSnippet = (options) => __awaiter(void 0, void 0, void 0, func
|
|
|
40
40
|
// Wait for CDP to be ready before setting up consent
|
|
41
41
|
yield cdpReadyPromise;
|
|
42
42
|
if (options.consent) {
|
|
43
|
-
|
|
43
|
+
if (options.debug && options.enableLogging) {
|
|
44
|
+
console.log('Chord CDP: Setting up consent management');
|
|
45
|
+
}
|
|
46
|
+
yield addCdpConsent(options).init();
|
|
47
|
+
if (options.debug && options.enableLogging) {
|
|
48
|
+
console.log('Chord CDP: Consent management setup complete');
|
|
49
|
+
}
|
|
44
50
|
}
|
|
45
51
|
});
|
|
46
52
|
/*
|
|
@@ -148,10 +148,14 @@ export const addCdpConsent = (options) => {
|
|
|
148
148
|
if (!canBeTracked)
|
|
149
149
|
return false;
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
try {
|
|
152
|
+
yield setupConsentManagement();
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
if (options.debug && options.enableLogging) {
|
|
156
|
+
console.error('Error setting up consent management:', error);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
155
159
|
return true;
|
|
156
160
|
});
|
|
157
161
|
return {
|
package/package.json
CHANGED