@coframe/sdk 1.1.42 → 1.1.43
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
CHANGED
|
@@ -4275,7 +4275,7 @@ const EXPLICIT_CONSENT_WAIT_MS = 60000;
|
|
|
4275
4275
|
function configureReplayScriptUrl(url) {
|
|
4276
4276
|
replayScriptUrl = (url === null || url === void 0 ? void 0 : url.trim()) || undefined;
|
|
4277
4277
|
}
|
|
4278
|
-
function readReplayConsent() {
|
|
4278
|
+
function readReplayConsent(settings) {
|
|
4279
4279
|
try {
|
|
4280
4280
|
if (navigator
|
|
4281
4281
|
.globalPrivacyControl === true) {
|
|
@@ -4296,9 +4296,14 @@ function readReplayConsent() {
|
|
|
4296
4296
|
return { state: 'allowed', source };
|
|
4297
4297
|
if (signal === 'denied')
|
|
4298
4298
|
return { state: 'denied', reason: 'consent_denied' };
|
|
4299
|
-
if (signal === 'pending')
|
|
4299
|
+
if (signal === 'pending') {
|
|
4300
|
+
if (settings.consent_required === false)
|
|
4301
|
+
continue;
|
|
4300
4302
|
return { state: 'pending', detected: true };
|
|
4303
|
+
}
|
|
4301
4304
|
}
|
|
4305
|
+
if (settings.consent_required === false)
|
|
4306
|
+
return { state: 'allowed', source: 'not_required' };
|
|
4302
4307
|
return { state: 'pending', detected: isWaitingForCookies() };
|
|
4303
4308
|
}
|
|
4304
4309
|
const customerPrivacy = shopify.customerPrivacy;
|
|
@@ -4348,7 +4353,9 @@ function createStartContext(coframe, settings, forceSample, consentSource) {
|
|
|
4348
4353
|
getPageViewId: () => coframe.sessionId,
|
|
4349
4354
|
getUserToken: () => coframe.userToken,
|
|
4350
4355
|
getVariantIds: () => { var _a; return ((_a = coframe.experimentInfo) !== null && _a !== void 0 ? _a : []).map((experiment) => experiment.variant_id); },
|
|
4351
|
-
canSend: () => shouldSendEvents(
|
|
4356
|
+
canSend: () => shouldSendEvents({
|
|
4357
|
+
ignoreConsent: window.Shopify === undefined,
|
|
4358
|
+
}) && readReplayConsent(settings).state === 'allowed',
|
|
4352
4359
|
onEventsFlushed: (callback) => {
|
|
4353
4360
|
if (queuedEvents.length === 0 && queuedSessions.length === 0) {
|
|
4354
4361
|
callback();
|
|
@@ -4413,7 +4420,7 @@ function startReplayIfEnabled(coframe, project, nonce) {
|
|
|
4413
4420
|
let waited = 0;
|
|
4414
4421
|
const decide = () => {
|
|
4415
4422
|
var _a;
|
|
4416
|
-
const consent = readReplayConsent();
|
|
4423
|
+
const consent = readReplayConsent(settings);
|
|
4417
4424
|
if (consent.state === 'allowed') {
|
|
4418
4425
|
insertReplayScript(coframe, settings, consent.source, nonce);
|
|
4419
4426
|
}
|
package/dist/pkg/cf.esm.mjs
CHANGED
|
@@ -4273,7 +4273,7 @@ const EXPLICIT_CONSENT_WAIT_MS = 60000;
|
|
|
4273
4273
|
function configureReplayScriptUrl(url) {
|
|
4274
4274
|
replayScriptUrl = (url === null || url === void 0 ? void 0 : url.trim()) || undefined;
|
|
4275
4275
|
}
|
|
4276
|
-
function readReplayConsent() {
|
|
4276
|
+
function readReplayConsent(settings) {
|
|
4277
4277
|
try {
|
|
4278
4278
|
if (navigator
|
|
4279
4279
|
.globalPrivacyControl === true) {
|
|
@@ -4294,9 +4294,14 @@ function readReplayConsent() {
|
|
|
4294
4294
|
return { state: 'allowed', source };
|
|
4295
4295
|
if (signal === 'denied')
|
|
4296
4296
|
return { state: 'denied', reason: 'consent_denied' };
|
|
4297
|
-
if (signal === 'pending')
|
|
4297
|
+
if (signal === 'pending') {
|
|
4298
|
+
if (settings.consent_required === false)
|
|
4299
|
+
continue;
|
|
4298
4300
|
return { state: 'pending', detected: true };
|
|
4301
|
+
}
|
|
4299
4302
|
}
|
|
4303
|
+
if (settings.consent_required === false)
|
|
4304
|
+
return { state: 'allowed', source: 'not_required' };
|
|
4300
4305
|
return { state: 'pending', detected: isWaitingForCookies() };
|
|
4301
4306
|
}
|
|
4302
4307
|
const customerPrivacy = shopify.customerPrivacy;
|
|
@@ -4346,7 +4351,9 @@ function createStartContext(coframe, settings, forceSample, consentSource) {
|
|
|
4346
4351
|
getPageViewId: () => coframe.sessionId,
|
|
4347
4352
|
getUserToken: () => coframe.userToken,
|
|
4348
4353
|
getVariantIds: () => { var _a; return ((_a = coframe.experimentInfo) !== null && _a !== void 0 ? _a : []).map((experiment) => experiment.variant_id); },
|
|
4349
|
-
canSend: () => shouldSendEvents(
|
|
4354
|
+
canSend: () => shouldSendEvents({
|
|
4355
|
+
ignoreConsent: window.Shopify === undefined,
|
|
4356
|
+
}) && readReplayConsent(settings).state === 'allowed',
|
|
4350
4357
|
onEventsFlushed: (callback) => {
|
|
4351
4358
|
if (queuedEvents.length === 0 && queuedSessions.length === 0) {
|
|
4352
4359
|
callback();
|
|
@@ -4411,7 +4418,7 @@ function startReplayIfEnabled(coframe, project, nonce) {
|
|
|
4411
4418
|
let waited = 0;
|
|
4412
4419
|
const decide = () => {
|
|
4413
4420
|
var _a;
|
|
4414
|
-
const consent = readReplayConsent();
|
|
4421
|
+
const consent = readReplayConsent(settings);
|
|
4415
4422
|
if (consent.state === 'allowed') {
|
|
4416
4423
|
insertReplayScript(coframe, settings, consent.source, nonce);
|
|
4417
4424
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coframe/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.43",
|
|
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",
|