@coframe/sdk 1.1.49 → 1.1.51
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
|
@@ -4665,6 +4665,16 @@ async function modifyPage(Coframe, configResult, projectResult, analytics, lifec
|
|
|
4665
4665
|
setupFlushInterval(Coframe);
|
|
4666
4666
|
}
|
|
4667
4667
|
|
|
4668
|
+
function readCookie(name) {
|
|
4669
|
+
const prefix = `${name}=`;
|
|
4670
|
+
const cookies = document.cookie.split(';');
|
|
4671
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
4672
|
+
const cookie = cookies[i].trim();
|
|
4673
|
+
if (cookie.indexOf(prefix) === 0)
|
|
4674
|
+
return decodeURIComponent(cookie.slice(prefix.length));
|
|
4675
|
+
}
|
|
4676
|
+
return undefined;
|
|
4677
|
+
}
|
|
4668
4678
|
function readClientCommand() {
|
|
4669
4679
|
try {
|
|
4670
4680
|
const cmd = findLastCmd((c) => typeof c.cookiesEnabled === 'boolean');
|
|
@@ -4704,6 +4714,37 @@ function readCookiebot() {
|
|
|
4704
4714
|
return undefined;
|
|
4705
4715
|
}
|
|
4706
4716
|
}
|
|
4717
|
+
function readTrueVault() {
|
|
4718
|
+
try {
|
|
4719
|
+
const cookie = readCookie('polaris_consent_settings');
|
|
4720
|
+
if (cookie === undefined)
|
|
4721
|
+
return undefined;
|
|
4722
|
+
const parsed = JSON.parse(cookie);
|
|
4723
|
+
if (parsed.analyticsPermitted === false || parsed.notOptedOut === false) {
|
|
4724
|
+
return 'denied';
|
|
4725
|
+
}
|
|
4726
|
+
if (parsed.implicit === false && parsed.analyticsPermitted === true)
|
|
4727
|
+
return 'granted';
|
|
4728
|
+
return 'pending';
|
|
4729
|
+
}
|
|
4730
|
+
catch (_a) {
|
|
4731
|
+
return undefined;
|
|
4732
|
+
}
|
|
4733
|
+
}
|
|
4734
|
+
function readUsPrivacy() {
|
|
4735
|
+
try {
|
|
4736
|
+
const cookie = readCookie('us_privacy');
|
|
4737
|
+
if (cookie !== undefined &&
|
|
4738
|
+
/^1[YN-]{3}$/i.test(cookie) &&
|
|
4739
|
+
(cookie[2] === 'Y' || cookie[2] === 'y')) {
|
|
4740
|
+
return 'denied';
|
|
4741
|
+
}
|
|
4742
|
+
return undefined;
|
|
4743
|
+
}
|
|
4744
|
+
catch (_a) {
|
|
4745
|
+
return undefined;
|
|
4746
|
+
}
|
|
4747
|
+
}
|
|
4707
4748
|
function readConsentMode() {
|
|
4708
4749
|
var _a;
|
|
4709
4750
|
try {
|
|
@@ -4752,6 +4793,9 @@ const EXPLICIT_CONSENT_WAIT_MS = 60000;
|
|
|
4752
4793
|
function configureReplayScriptUrl(url) {
|
|
4753
4794
|
replayScriptUrl = (url === null || url === void 0 ? void 0 : url.trim()) || undefined;
|
|
4754
4795
|
}
|
|
4796
|
+
function isOptOut(settings) {
|
|
4797
|
+
return settings.consent_model === 'opt_out';
|
|
4798
|
+
}
|
|
4755
4799
|
function readReplayConsent(settings) {
|
|
4756
4800
|
try {
|
|
4757
4801
|
if (navigator
|
|
@@ -4760,10 +4804,13 @@ function readReplayConsent(settings) {
|
|
|
4760
4804
|
}
|
|
4761
4805
|
const shopify = window.Shopify;
|
|
4762
4806
|
if (shopify === undefined) {
|
|
4807
|
+
if (readUsPrivacy() === 'denied')
|
|
4808
|
+
return { state: 'denied', reason: 'consent_denied' };
|
|
4763
4809
|
const readers = [
|
|
4764
4810
|
[readClientCommand, 'client'],
|
|
4765
4811
|
[readOneTrust, 'onetrust'],
|
|
4766
4812
|
[readCookiebot, 'cookiebot'],
|
|
4813
|
+
[readTrueVault, 'truevault'],
|
|
4767
4814
|
[readConsentMode, 'consent_mode'],
|
|
4768
4815
|
];
|
|
4769
4816
|
for (let i = 0; i < readers.length; i++) {
|
|
@@ -4774,13 +4821,13 @@ function readReplayConsent(settings) {
|
|
|
4774
4821
|
if (signal === 'denied')
|
|
4775
4822
|
return { state: 'denied', reason: 'consent_denied' };
|
|
4776
4823
|
if (signal === 'pending') {
|
|
4777
|
-
if (settings
|
|
4824
|
+
if (isOptOut(settings))
|
|
4778
4825
|
continue;
|
|
4779
4826
|
return { state: 'pending', detected: true };
|
|
4780
4827
|
}
|
|
4781
4828
|
}
|
|
4782
|
-
if (settings
|
|
4783
|
-
return { state: 'allowed', source: '
|
|
4829
|
+
if (isOptOut(settings))
|
|
4830
|
+
return { state: 'allowed', source: 'opt_out' };
|
|
4784
4831
|
return { state: 'pending', detected: isWaitingForCookies() };
|
|
4785
4832
|
}
|
|
4786
4833
|
const customerPrivacy = shopify.customerPrivacy;
|
package/dist/pkg/cf.esm.mjs
CHANGED
|
@@ -4663,6 +4663,16 @@ async function modifyPage(Coframe, configResult, projectResult, analytics, lifec
|
|
|
4663
4663
|
setupFlushInterval(Coframe);
|
|
4664
4664
|
}
|
|
4665
4665
|
|
|
4666
|
+
function readCookie(name) {
|
|
4667
|
+
const prefix = `${name}=`;
|
|
4668
|
+
const cookies = document.cookie.split(';');
|
|
4669
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
4670
|
+
const cookie = cookies[i].trim();
|
|
4671
|
+
if (cookie.indexOf(prefix) === 0)
|
|
4672
|
+
return decodeURIComponent(cookie.slice(prefix.length));
|
|
4673
|
+
}
|
|
4674
|
+
return undefined;
|
|
4675
|
+
}
|
|
4666
4676
|
function readClientCommand() {
|
|
4667
4677
|
try {
|
|
4668
4678
|
const cmd = findLastCmd((c) => typeof c.cookiesEnabled === 'boolean');
|
|
@@ -4702,6 +4712,37 @@ function readCookiebot() {
|
|
|
4702
4712
|
return undefined;
|
|
4703
4713
|
}
|
|
4704
4714
|
}
|
|
4715
|
+
function readTrueVault() {
|
|
4716
|
+
try {
|
|
4717
|
+
const cookie = readCookie('polaris_consent_settings');
|
|
4718
|
+
if (cookie === undefined)
|
|
4719
|
+
return undefined;
|
|
4720
|
+
const parsed = JSON.parse(cookie);
|
|
4721
|
+
if (parsed.analyticsPermitted === false || parsed.notOptedOut === false) {
|
|
4722
|
+
return 'denied';
|
|
4723
|
+
}
|
|
4724
|
+
if (parsed.implicit === false && parsed.analyticsPermitted === true)
|
|
4725
|
+
return 'granted';
|
|
4726
|
+
return 'pending';
|
|
4727
|
+
}
|
|
4728
|
+
catch (_a) {
|
|
4729
|
+
return undefined;
|
|
4730
|
+
}
|
|
4731
|
+
}
|
|
4732
|
+
function readUsPrivacy() {
|
|
4733
|
+
try {
|
|
4734
|
+
const cookie = readCookie('us_privacy');
|
|
4735
|
+
if (cookie !== undefined &&
|
|
4736
|
+
/^1[YN-]{3}$/i.test(cookie) &&
|
|
4737
|
+
(cookie[2] === 'Y' || cookie[2] === 'y')) {
|
|
4738
|
+
return 'denied';
|
|
4739
|
+
}
|
|
4740
|
+
return undefined;
|
|
4741
|
+
}
|
|
4742
|
+
catch (_a) {
|
|
4743
|
+
return undefined;
|
|
4744
|
+
}
|
|
4745
|
+
}
|
|
4705
4746
|
function readConsentMode() {
|
|
4706
4747
|
var _a;
|
|
4707
4748
|
try {
|
|
@@ -4750,6 +4791,9 @@ const EXPLICIT_CONSENT_WAIT_MS = 60000;
|
|
|
4750
4791
|
function configureReplayScriptUrl(url) {
|
|
4751
4792
|
replayScriptUrl = (url === null || url === void 0 ? void 0 : url.trim()) || undefined;
|
|
4752
4793
|
}
|
|
4794
|
+
function isOptOut(settings) {
|
|
4795
|
+
return settings.consent_model === 'opt_out';
|
|
4796
|
+
}
|
|
4753
4797
|
function readReplayConsent(settings) {
|
|
4754
4798
|
try {
|
|
4755
4799
|
if (navigator
|
|
@@ -4758,10 +4802,13 @@ function readReplayConsent(settings) {
|
|
|
4758
4802
|
}
|
|
4759
4803
|
const shopify = window.Shopify;
|
|
4760
4804
|
if (shopify === undefined) {
|
|
4805
|
+
if (readUsPrivacy() === 'denied')
|
|
4806
|
+
return { state: 'denied', reason: 'consent_denied' };
|
|
4761
4807
|
const readers = [
|
|
4762
4808
|
[readClientCommand, 'client'],
|
|
4763
4809
|
[readOneTrust, 'onetrust'],
|
|
4764
4810
|
[readCookiebot, 'cookiebot'],
|
|
4811
|
+
[readTrueVault, 'truevault'],
|
|
4765
4812
|
[readConsentMode, 'consent_mode'],
|
|
4766
4813
|
];
|
|
4767
4814
|
for (let i = 0; i < readers.length; i++) {
|
|
@@ -4772,13 +4819,13 @@ function readReplayConsent(settings) {
|
|
|
4772
4819
|
if (signal === 'denied')
|
|
4773
4820
|
return { state: 'denied', reason: 'consent_denied' };
|
|
4774
4821
|
if (signal === 'pending') {
|
|
4775
|
-
if (settings
|
|
4822
|
+
if (isOptOut(settings))
|
|
4776
4823
|
continue;
|
|
4777
4824
|
return { state: 'pending', detected: true };
|
|
4778
4825
|
}
|
|
4779
4826
|
}
|
|
4780
|
-
if (settings
|
|
4781
|
-
return { state: 'allowed', source: '
|
|
4827
|
+
if (isOptOut(settings))
|
|
4828
|
+
return { state: 'allowed', source: 'opt_out' };
|
|
4782
4829
|
return { state: 'pending', detected: isWaitingForCookies() };
|
|
4783
4830
|
}
|
|
4784
4831
|
const customerPrivacy = shopify.customerPrivacy;
|
|
@@ -81,7 +81,7 @@ interface SessionReplaySettings {
|
|
|
81
81
|
block_selector: string;
|
|
82
82
|
url_deny_patterns: string[];
|
|
83
83
|
url_allow_patterns?: string[];
|
|
84
|
-
|
|
84
|
+
consent_model?: 'opt_in' | 'opt_out';
|
|
85
85
|
max_session_minutes: number;
|
|
86
86
|
max_session_bytes: number;
|
|
87
87
|
}
|
|
@@ -101,7 +101,7 @@ interface SessionReplaySettings {
|
|
|
101
101
|
block_selector: string;
|
|
102
102
|
url_deny_patterns: string[];
|
|
103
103
|
url_allow_patterns?: string[];
|
|
104
|
-
|
|
104
|
+
consent_model?: 'opt_in' | 'opt_out';
|
|
105
105
|
max_session_minutes: number;
|
|
106
106
|
max_session_bytes: number;
|
|
107
107
|
}
|
|
@@ -81,7 +81,7 @@ interface SessionReplaySettings {
|
|
|
81
81
|
block_selector: string;
|
|
82
82
|
url_deny_patterns: string[];
|
|
83
83
|
url_allow_patterns?: string[];
|
|
84
|
-
|
|
84
|
+
consent_model?: 'opt_in' | 'opt_out';
|
|
85
85
|
max_session_minutes: number;
|
|
86
86
|
max_session_bytes: number;
|
|
87
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coframe/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.51",
|
|
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",
|