From 8e254c0129a783856624d2d3a8a11d0e00a23b9f Mon Sep 17 00:00:00 2001 From: piano-analytics Date: Fri, 11 Oct 2024 18:42:44 +0200 Subject: [PATCH] 6.15.2 --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/business/privacy/privacy.js | 6 ++---- src/config.js | 2 +- src/core/steps/send.step.js | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d851290..4331b37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## 6.15.2 +### Fixes +- Fix the configuration `sendEventWhenOptout` (broken in versions 6.15.0 and 6.15.1) + ## 6.15.1 ### Fixes - [browser] Fix a specific case when consent is disabled diff --git a/package.json b/package.json index 923e255..c6c6f17 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "piano-analytics-js", "description": "JavaScript library for Piano Analytics", - "version": "6.15.1", + "version": "6.15.2", "main": "dist/browserless/piano-analytics.cjs.js", "module": "dist/browserless/piano-analytics.esm.js", "browser": "dist/browser/piano-analytics.umd.js", diff --git a/src/business/privacy/privacy.js b/src/business/privacy/privacy.js index e67a978..c4ab57f 100644 --- a/src/business/privacy/privacy.js +++ b/src/business/privacy/privacy.js @@ -4,10 +4,8 @@ import {dataLayer} from '../ext/data-layer/data-layer'; function Privacy(pa) { this.isLegacyPrivacy = true; - this.modeEnum = { - OPTOUT: (() => { - return this.isLegacyPrivacy ? 'optout' : 'opt-out'; - })() + this.getOptoutValue = function () { + return this.isLegacyPrivacy ? 'optout' : 'opt-out'; }; this.call = function (method, ...paramsArray) { const privacy = this.isLegacyPrivacy ? 'privacy' : 'consent'; diff --git a/src/config.js b/src/config.js index 999aa16..5235ef4 100644 --- a/src/config.js +++ b/src/config.js @@ -23,7 +23,7 @@ export default { ], 'storageVisitor': 'pa_vid', 'storageUser': 'pa_user', - 'version': '6.15.1', + 'version': '6.15.2', 'minHeartbeat': 5, 'minBufferingHeartbeat': 1, 'queueVarName': '_paq', diff --git a/src/core/steps/send.step.js b/src/core/steps/send.step.js index 55be257..a2b7680 100644 --- a/src/core/steps/send.step.js +++ b/src/core/steps/send.step.js @@ -2,8 +2,8 @@ import {nextStep} from './utils/index'; import {http} from '../../utils/index'; function sendStep(pa, model, nextSteps) { - if ((pa._privacy.call('getMode') !== pa._privacy.modeEnum.OPTOUT || - (pa._privacy.call('getMode') === pa._privacy.modeEnum.OPTOUT && model.getConfiguration('sendEventWhenOptout')) + if ((pa._privacy.call('getMode') !== pa._privacy.getOptoutValue() || + (pa._privacy.call('getMode') === pa._privacy.getOptoutValue() && model.getConfiguration('sendEventWhenOptout')) ) && model.build.data.events.length > 0) { http.post(model.build.url, JSON.stringify(model.build.data)); }