@coframe/sdk 1.1.32 → 1.1.33
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/pkg/cf.cjs.js +16 -1
- package/dist/pkg/cf.esm.mjs +16 -1
- package/package.json +1 -1
package/dist/pkg/cf.cjs.js
CHANGED
|
@@ -3807,6 +3807,20 @@ const COMPILED_REPLAY_SCRIPT_URL = `${"https://edge.cofra.me"}/replay/latest.js`
|
|
|
3807
3807
|
function configureReplayScriptUrl(url) {
|
|
3808
3808
|
replayScriptUrl = (url === null || url === void 0 ? void 0 : url.trim()) || undefined;
|
|
3809
3809
|
}
|
|
3810
|
+
function replayConsentAllowed() {
|
|
3811
|
+
var _a;
|
|
3812
|
+
try {
|
|
3813
|
+
const privacy = (_a = window.Shopify) === null || _a === void 0 ? void 0 : _a.customerPrivacy;
|
|
3814
|
+
const analyticsAllowed = !privacy ||
|
|
3815
|
+
typeof privacy.analyticsProcessingAllowed !== 'function' ||
|
|
3816
|
+
privacy.analyticsProcessingAllowed() === true;
|
|
3817
|
+
return (navigator
|
|
3818
|
+
.globalPrivacyControl !== true && analyticsAllowed);
|
|
3819
|
+
}
|
|
3820
|
+
catch (_b) {
|
|
3821
|
+
return false;
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3810
3824
|
function createMonitoringPayload(coframe, monitoringType, metadata) {
|
|
3811
3825
|
return {
|
|
3812
3826
|
event_id: generateUUID(),
|
|
@@ -3834,7 +3848,7 @@ function createStartContext(coframe, settings, forceSample) {
|
|
|
3834
3848
|
getPageViewId: () => coframe.sessionId,
|
|
3835
3849
|
getUserToken: () => coframe.userToken,
|
|
3836
3850
|
getVariantIds: () => { var _a; return ((_a = coframe.experimentInfo) !== null && _a !== void 0 ? _a : []).map((experiment) => experiment.variant_id); },
|
|
3837
|
-
canSend: shouldSendEvents,
|
|
3851
|
+
canSend: () => shouldSendEvents() && replayConsentAllowed(),
|
|
3838
3852
|
onEventsFlushed: (callback) => {
|
|
3839
3853
|
if (queuedEvents.length === 0 && queuedSessions.length === 0) {
|
|
3840
3854
|
callback();
|
|
@@ -3853,6 +3867,7 @@ function startReplayIfEnabled(coframe, project, nonce) {
|
|
|
3853
3867
|
if ((settings === null || settings === void 0 ? void 0 : settings.enabled) !== true ||
|
|
3854
3868
|
typeof CompressionStream !== 'function' ||
|
|
3855
3869
|
!shouldSendEvents() ||
|
|
3870
|
+
!replayConsentAllowed() ||
|
|
3856
3871
|
startRequested) {
|
|
3857
3872
|
return;
|
|
3858
3873
|
}
|
package/dist/pkg/cf.esm.mjs
CHANGED
|
@@ -3805,6 +3805,20 @@ const COMPILED_REPLAY_SCRIPT_URL = `${"https://edge.cofra.me"}/replay/latest.js`
|
|
|
3805
3805
|
function configureReplayScriptUrl(url) {
|
|
3806
3806
|
replayScriptUrl = (url === null || url === void 0 ? void 0 : url.trim()) || undefined;
|
|
3807
3807
|
}
|
|
3808
|
+
function replayConsentAllowed() {
|
|
3809
|
+
var _a;
|
|
3810
|
+
try {
|
|
3811
|
+
const privacy = (_a = window.Shopify) === null || _a === void 0 ? void 0 : _a.customerPrivacy;
|
|
3812
|
+
const analyticsAllowed = !privacy ||
|
|
3813
|
+
typeof privacy.analyticsProcessingAllowed !== 'function' ||
|
|
3814
|
+
privacy.analyticsProcessingAllowed() === true;
|
|
3815
|
+
return (navigator
|
|
3816
|
+
.globalPrivacyControl !== true && analyticsAllowed);
|
|
3817
|
+
}
|
|
3818
|
+
catch (_b) {
|
|
3819
|
+
return false;
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3808
3822
|
function createMonitoringPayload(coframe, monitoringType, metadata) {
|
|
3809
3823
|
return {
|
|
3810
3824
|
event_id: generateUUID(),
|
|
@@ -3832,7 +3846,7 @@ function createStartContext(coframe, settings, forceSample) {
|
|
|
3832
3846
|
getPageViewId: () => coframe.sessionId,
|
|
3833
3847
|
getUserToken: () => coframe.userToken,
|
|
3834
3848
|
getVariantIds: () => { var _a; return ((_a = coframe.experimentInfo) !== null && _a !== void 0 ? _a : []).map((experiment) => experiment.variant_id); },
|
|
3835
|
-
canSend: shouldSendEvents,
|
|
3849
|
+
canSend: () => shouldSendEvents() && replayConsentAllowed(),
|
|
3836
3850
|
onEventsFlushed: (callback) => {
|
|
3837
3851
|
if (queuedEvents.length === 0 && queuedSessions.length === 0) {
|
|
3838
3852
|
callback();
|
|
@@ -3851,6 +3865,7 @@ function startReplayIfEnabled(coframe, project, nonce) {
|
|
|
3851
3865
|
if ((settings === null || settings === void 0 ? void 0 : settings.enabled) !== true ||
|
|
3852
3866
|
typeof CompressionStream !== 'function' ||
|
|
3853
3867
|
!shouldSendEvents() ||
|
|
3868
|
+
!replayConsentAllowed() ||
|
|
3854
3869
|
startRequested) {
|
|
3855
3870
|
return;
|
|
3856
3871
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coframe/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.33",
|
|
4
4
|
"description": "Coframe optimizes your website using generative AI to deliver maximum impact to your audience and allow your site to improve itself as you sleep. Learn more at coframe.com.",
|
|
5
5
|
"main": "dist/pkg/cf.cjs.js",
|
|
6
6
|
"module": "dist/pkg/cf.esm.mjs",
|