@phantomstudios/ft-lib 0.5.2-rc10 → 0.5.2-rc11
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/lib/cmp/vendorConsent.js
CHANGED
|
@@ -49,12 +49,8 @@ function evaluateUSNatConsent(onConsentUpdate) {
|
|
|
49
49
|
// Option A: Preferred Sourcepoint SDK method
|
|
50
50
|
if (typeof ((_b = (_a = window._sp_) === null || _a === void 0 ? void 0 : _a.usnat) === null || _b === void 0 ? void 0 : _b.getUserConsents) === "function") {
|
|
51
51
|
window._sp_.usnat.getUserConsents(function (consents) {
|
|
52
|
-
// US Privacy is OPT-OUT by default
|
|
53
|
-
|
|
54
|
-
var isOptedOut = (consents === null || consents === void 0 ? void 0 : consents.optedOut) === true ||
|
|
55
|
-
(Array.isArray(consents === null || consents === void 0 ? void 0 : consents.rejectedCategories) &&
|
|
56
|
-
consents.rejectedCategories.length > 0);
|
|
57
|
-
var isConsented = !isOptedOut;
|
|
52
|
+
// US Privacy is OPT-OUT by default, categories[1] = cookies
|
|
53
|
+
var isConsented = consents === null || consents === void 0 ? void 0 : consents.categories[1].consented;
|
|
58
54
|
onConsentUpdate({
|
|
59
55
|
brandmetrics: isConsented,
|
|
60
56
|
linkedIn: isConsented,
|
|
@@ -65,26 +61,5 @@ function evaluateUSNatConsent(onConsentUpdate) {
|
|
|
65
61
|
});
|
|
66
62
|
return;
|
|
67
63
|
}
|
|
68
|
-
// Option B: Fallback to GPP standard API
|
|
69
|
-
if (typeof window.__gpp === "function") {
|
|
70
|
-
window.__gpp("getGPPData", function (gppData, success) {
|
|
71
|
-
var _a;
|
|
72
|
-
if (!success || !gppData)
|
|
73
|
-
return;
|
|
74
|
-
var usnat = (_a = gppData.parsedSections) === null || _a === void 0 ? void 0 : _a.usnat;
|
|
75
|
-
// GPP USNat spec: 1 = Opted Out / Yes
|
|
76
|
-
var isOptedOut = (usnat === null || usnat === void 0 ? void 0 : usnat.SharingOptOut) === 1 ||
|
|
77
|
-
(usnat === null || usnat === void 0 ? void 0 : usnat.TargetedAdvertisingOptOut) === 1 ||
|
|
78
|
-
(usnat === null || usnat === void 0 ? void 0 : usnat.SaleOptOut) === 1;
|
|
79
|
-
var isConsented = !isOptedOut;
|
|
80
|
-
onConsentUpdate({
|
|
81
|
-
brandmetrics: isConsented,
|
|
82
|
-
linkedIn: isConsented,
|
|
83
|
-
purpose1: isConsented,
|
|
84
|
-
gdprApplies: false,
|
|
85
|
-
usnatApplies: true,
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
64
|
}
|
|
90
65
|
//# sourceMappingURL=vendorConsent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vendorConsent.js","sourceRoot":"","sources":["../../src/cmp/vendorConsent.ts"],"names":[],"mappings":";;AAQA,8DAuDC;AAvDD,SAAgB,yBAAyB,CACvC,eAAwD;IAExD,sCAAsC;IACtC,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC1C,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,EAAE,UAAC,MAAM,EAAE,OAAO;;YACrD,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM;gBAAE,OAAO;YAEhC,IAAM,cAAc,GAClB,MAAM,CAAC,WAAW,KAAK,UAAU;gBACjC,MAAM,CAAC,WAAW,KAAK,oBAAoB,CAAC;YAE9C,IAAI,cAAc,EAAE,CAAC;gBACnB,gEAAgE;gBAChE,IAAI,MAAM,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;oBACjC,IAAM,OAAO,GAAyB;wBACpC,YAAY,EAAE,CAAA,MAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,QAAQ,0CAAG,GAAG,CAAC,MAAK,IAAI;wBACrD,QAAQ,EAAE,CAAA,MAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,QAAQ,0CAAG,GAAG,CAAC,MAAK,IAAI;wBACjD,Q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ACrB,CAAC,EACD,cAAO,CAAC,EACR,MAAM,CAAC,UAAU,CAClB,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,kEAAkE;QAClE,oBAAoB,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,oBAAoB,CAC3B,eAAwD;;IAExD,6CAA6C;IAC7C,IAAI,OAAO,CAAA,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,KAAK,0CAAE,eAAe,CAAA,KAAK,UAAU,EAAE,CAAC;QAC9D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,UAAC,QAAQ;YACzC,4DAA4D;YAC5D,IAAM,WAAW,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,UAAU,CAAC,CAAC,EAAE,SAAS,CAAC;YAEtD,eAAe,CAAC;gBACd,YAAY,EAAE,WAAW;gBACzB,QAAQ,EAAE,WAAW;gBACrB,QAAQ,EAAE,WAAW;gBACrB,WAAW,EAAE,KAAK;gBAClB,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO;IACT,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phantomstudios/ft-lib",
|
|
3
3
|
"description": "A collection of Javascript UI & tracking utils for FT sites",
|
|
4
|
-
"version": "0.5.2-
|
|
4
|
+
"version": "0.5.2-rc11",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"homepage": "https://github.com/phantomstudios/ft-lib#readme",
|
package/src/cmp/vendorConsent.ts
CHANGED
|
@@ -72,14 +72,8 @@ function evaluateUSNatConsent(
|
|
|
72
72
|
// Option A: Preferred Sourcepoint SDK method
|
|
73
73
|
if (typeof window._sp_?.usnat?.getUserConsents === "function") {
|
|
74
74
|
window._sp_.usnat.getUserConsents((consents) => {
|
|
75
|
-
// US Privacy is OPT-OUT by default
|
|
76
|
-
|
|
77
|
-
const isOptedOut =
|
|
78
|
-
consents?.optedOut === true ||
|
|
79
|
-
(Array.isArray(consents?.rejectedCategories) &&
|
|
80
|
-
consents.rejectedCategories.length > 0);
|
|
81
|
-
|
|
82
|
-
const isConsented = !isOptedOut;
|
|
75
|
+
// US Privacy is OPT-OUT by default, categories[1] = cookies
|
|
76
|
+
const isConsented = consents?.categories[1].consented;
|
|
83
77
|
|
|
84
78
|
onConsentUpdate({
|
|
85
79
|
brandmetrics: isConsented,
|
|
@@ -91,29 +85,4 @@ function evaluateUSNatConsent(
|
|
|
91
85
|
});
|
|
92
86
|
return;
|
|
93
87
|
}
|
|
94
|
-
|
|
95
|
-
// Option B: Fallback to GPP standard API
|
|
96
|
-
if (typeof window.__gpp === "function") {
|
|
97
|
-
window.__gpp("getGPPData", (gppData: any, success: boolean) => {
|
|
98
|
-
if (!success || !gppData) return;
|
|
99
|
-
|
|
100
|
-
const usnat = gppData.parsedSections?.usnat;
|
|
101
|
-
|
|
102
|
-
// GPP USNat spec: 1 = Opted Out / Yes
|
|
103
|
-
const isOptedOut =
|
|
104
|
-
usnat?.SharingOptOut === 1 ||
|
|
105
|
-
usnat?.TargetedAdvertisingOptOut === 1 ||
|
|
106
|
-
usnat?.SaleOptOut === 1;
|
|
107
|
-
|
|
108
|
-
const isConsented = !isOptedOut;
|
|
109
|
-
|
|
110
|
-
onConsentUpdate({
|
|
111
|
-
brandmetrics: isConsented,
|
|
112
|
-
linkedIn: isConsented,
|
|
113
|
-
purpose1: isConsented,
|
|
114
|
-
gdprApplies: false,
|
|
115
|
-
usnatApplies: true,
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
88
|
}
|