c15t 1.0.5 → 1.0.6
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/index.cjs +26 -18
- package/dist/index.js +26 -18
- package/dist/store.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1131,16 +1131,20 @@ const createConsentManagerStore = (manager, options = {})=>{
|
|
|
1131
1131
|
});
|
|
1132
1132
|
},
|
|
1133
1133
|
setShowPopup: (show, force = false)=>{
|
|
1134
|
+
if (!show) return void set({
|
|
1135
|
+
showPopup: false
|
|
1136
|
+
});
|
|
1134
1137
|
const state = get();
|
|
1135
1138
|
const storedConsent = getStoredConsent();
|
|
1136
|
-
if (force || !storedConsent && !state.consentInfo && !state.isLoadingConsentInfo
|
|
1137
|
-
showPopup:
|
|
1139
|
+
if (force || !storedConsent && !state.consentInfo && !state.isLoadingConsentInfo) set({
|
|
1140
|
+
showPopup: true
|
|
1138
1141
|
});
|
|
1139
1142
|
},
|
|
1140
1143
|
setIsPrivacyDialogOpen: (isOpen)=>{
|
|
1141
1144
|
set({
|
|
1142
1145
|
isPrivacyDialogOpen: isOpen
|
|
1143
1146
|
});
|
|
1147
|
+
if (!isOpen) queueMicrotask(()=>{});
|
|
1144
1148
|
},
|
|
1145
1149
|
saveConsents: async (type)=>{
|
|
1146
1150
|
const { callbacks, consents, consentTypes } = get();
|
|
@@ -1153,6 +1157,22 @@ const createConsentManagerStore = (manager, options = {})=>{
|
|
|
1153
1157
|
time: Date.now(),
|
|
1154
1158
|
type: type
|
|
1155
1159
|
};
|
|
1160
|
+
set({
|
|
1161
|
+
consents: newConsents,
|
|
1162
|
+
showPopup: false,
|
|
1163
|
+
consentInfo
|
|
1164
|
+
});
|
|
1165
|
+
trackingBlocker?.updateConsents(newConsents);
|
|
1166
|
+
try {
|
|
1167
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify({
|
|
1168
|
+
consents: newConsents,
|
|
1169
|
+
consentInfo
|
|
1170
|
+
}));
|
|
1171
|
+
} catch (e) {
|
|
1172
|
+
console.warn('Failed to persist consents to localStorage:', e);
|
|
1173
|
+
}
|
|
1174
|
+
callbacks.onConsentGiven?.();
|
|
1175
|
+
callbacks.onPreferenceExpressed?.();
|
|
1156
1176
|
const consent = await manager.setConsent({
|
|
1157
1177
|
body: {
|
|
1158
1178
|
type: 'cookie_banner',
|
|
@@ -1164,22 +1184,10 @@ const createConsentManagerStore = (manager, options = {})=>{
|
|
|
1164
1184
|
}
|
|
1165
1185
|
}
|
|
1166
1186
|
});
|
|
1167
|
-
if (consent.ok) {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
}));
|
|
1172
|
-
trackingBlocker?.updateConsents(newConsents);
|
|
1173
|
-
set({
|
|
1174
|
-
consents: newConsents,
|
|
1175
|
-
showPopup: false,
|
|
1176
|
-
consentInfo
|
|
1177
|
-
});
|
|
1178
|
-
callbacks.onConsentGiven?.();
|
|
1179
|
-
callbacks.onPreferenceExpressed?.();
|
|
1180
|
-
} else if (!callbacks.onError) {
|
|
1181
|
-
const error = consent.error?.message || 'Failed to save consents';
|
|
1182
|
-
console.error(error);
|
|
1187
|
+
if (!consent.ok) {
|
|
1188
|
+
const errorMsg = consent.error?.message ?? 'Failed to save consents';
|
|
1189
|
+
callbacks.onError?.(errorMsg);
|
|
1190
|
+
if (!callbacks.onError) console.error(errorMsg);
|
|
1183
1191
|
}
|
|
1184
1192
|
},
|
|
1185
1193
|
resetConsents: ()=>{
|
package/dist/index.js
CHANGED
|
@@ -1095,16 +1095,20 @@ const createConsentManagerStore = (manager, options = {})=>{
|
|
|
1095
1095
|
});
|
|
1096
1096
|
},
|
|
1097
1097
|
setShowPopup: (show, force = false)=>{
|
|
1098
|
+
if (!show) return void set({
|
|
1099
|
+
showPopup: false
|
|
1100
|
+
});
|
|
1098
1101
|
const state = get();
|
|
1099
1102
|
const storedConsent = getStoredConsent();
|
|
1100
|
-
if (force || !storedConsent && !state.consentInfo && !state.isLoadingConsentInfo
|
|
1101
|
-
showPopup:
|
|
1103
|
+
if (force || !storedConsent && !state.consentInfo && !state.isLoadingConsentInfo) set({
|
|
1104
|
+
showPopup: true
|
|
1102
1105
|
});
|
|
1103
1106
|
},
|
|
1104
1107
|
setIsPrivacyDialogOpen: (isOpen)=>{
|
|
1105
1108
|
set({
|
|
1106
1109
|
isPrivacyDialogOpen: isOpen
|
|
1107
1110
|
});
|
|
1111
|
+
if (!isOpen) queueMicrotask(()=>{});
|
|
1108
1112
|
},
|
|
1109
1113
|
saveConsents: async (type)=>{
|
|
1110
1114
|
const { callbacks, consents, consentTypes } = get();
|
|
@@ -1117,6 +1121,22 @@ const createConsentManagerStore = (manager, options = {})=>{
|
|
|
1117
1121
|
time: Date.now(),
|
|
1118
1122
|
type: type
|
|
1119
1123
|
};
|
|
1124
|
+
set({
|
|
1125
|
+
consents: newConsents,
|
|
1126
|
+
showPopup: false,
|
|
1127
|
+
consentInfo
|
|
1128
|
+
});
|
|
1129
|
+
trackingBlocker?.updateConsents(newConsents);
|
|
1130
|
+
try {
|
|
1131
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify({
|
|
1132
|
+
consents: newConsents,
|
|
1133
|
+
consentInfo
|
|
1134
|
+
}));
|
|
1135
|
+
} catch (e) {
|
|
1136
|
+
console.warn('Failed to persist consents to localStorage:', e);
|
|
1137
|
+
}
|
|
1138
|
+
callbacks.onConsentGiven?.();
|
|
1139
|
+
callbacks.onPreferenceExpressed?.();
|
|
1120
1140
|
const consent = await manager.setConsent({
|
|
1121
1141
|
body: {
|
|
1122
1142
|
type: 'cookie_banner',
|
|
@@ -1128,22 +1148,10 @@ const createConsentManagerStore = (manager, options = {})=>{
|
|
|
1128
1148
|
}
|
|
1129
1149
|
}
|
|
1130
1150
|
});
|
|
1131
|
-
if (consent.ok) {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
}));
|
|
1136
|
-
trackingBlocker?.updateConsents(newConsents);
|
|
1137
|
-
set({
|
|
1138
|
-
consents: newConsents,
|
|
1139
|
-
showPopup: false,
|
|
1140
|
-
consentInfo
|
|
1141
|
-
});
|
|
1142
|
-
callbacks.onConsentGiven?.();
|
|
1143
|
-
callbacks.onPreferenceExpressed?.();
|
|
1144
|
-
} else if (!callbacks.onError) {
|
|
1145
|
-
const error = consent.error?.message || 'Failed to save consents';
|
|
1146
|
-
console.error(error);
|
|
1151
|
+
if (!consent.ok) {
|
|
1152
|
+
const errorMsg = consent.error?.message ?? 'Failed to save consents';
|
|
1153
|
+
callbacks.onError?.(errorMsg);
|
|
1154
|
+
if (!callbacks.onError) console.error(errorMsg);
|
|
1147
1155
|
}
|
|
1148
1156
|
},
|
|
1149
1157
|
resetConsents: ()=>{
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAOvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EACX,kBAAkB,EAGlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,eAAe,EAAgB,MAAM,cAAc,CAAC;AAqDlE;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IAErC;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAExE;;OAEG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAE9C;;;OA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ED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c15t",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"license": "GPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"zustand": "^5.0.3",
|
|
23
|
-
"@c15t/backend": "1.0.
|
|
23
|
+
"@c15t/backend": "1.0.5"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"vitest-localstorage-mock": "^0.1.2",
|