@replohq/canopy-sdk 0.1.1 → 0.1.2
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/_vendor/replo-utils/lib/json.mjs +2 -0
- package/_vendor/replo-utils/lib/misc.d.ts +2 -0
- package/_vendor/replo-utils/lib/misc.mjs +2 -1
- package/_vendor/schemas/errors.mjs +2 -1
- package/_vendor/schemas/generated/consent.d.ts +24 -0
- package/_vendor/schemas/selectMode.mjs +3 -10
- package/analytics/analytics-provider.js +28 -29
- package/analytics/analytics-provider.js.map +2 -2
- package/analytics/get-analytics-sinks.d.ts +25 -0
- package/analytics/get-analytics-sinks.js +46 -0
- package/analytics/get-analytics-sinks.js.map +7 -0
- package/chunk-GV5FY7ZZ.mjs +89 -0
- package/chunk-VKO7P3ED.mjs +41 -0
- package/{chunk-INHK6MYI.mjs → chunk-XK2K3263.mjs} +48 -128
- package/consent/consent-store.d.ts +52 -0
- package/consent/consent-store.js +160 -0
- package/consent/consent-store.js.map +7 -0
- package/consent/cookie.d.ts +38 -0
- package/consent/cookie.js +83 -0
- package/consent/cookie.js.map +7 -0
- package/consent/replo-scripts.d.ts +9 -0
- package/consent/replo-scripts.js +91 -0
- package/consent/replo-scripts.js.map +7 -0
- package/consent/script-registration-store.d.ts +25 -0
- package/consent/script-registration-store.js +61 -0
- package/consent/script-registration-store.js.map +7 -0
- package/consent/script-snippets.d.ts +19 -0
- package/consent/script-snippets.js +125 -0
- package/consent/script-snippets.js.map +7 -0
- package/consent/server.d.ts +12 -0
- package/consent/server.js +29 -0
- package/consent/server.js.map +7 -0
- package/consent/window-api.d.ts +41 -0
- package/consent/window-api.js +73 -0
- package/consent/window-api.js.map +7 -0
- package/loaders/prefetch-loaders.d.ts +1 -1
- package/loaders/prefetch-loaders.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { root_default, isObjectLike_default, freeGlobal_default, baseGetTag_default, Symbol_default, isObject_default, isArray_default } from './chunk-GV5FY7ZZ.mjs';
|
|
2
|
+
|
|
1
3
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.js
|
|
2
4
|
function listCacheClear() {
|
|
3
5
|
this.__data__ = [];
|
|
@@ -111,70 +113,6 @@ function stackHas(key) {
|
|
|
111
113
|
}
|
|
112
114
|
var stackHas_default = stackHas;
|
|
113
115
|
|
|
114
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js
|
|
115
|
-
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
116
|
-
var freeGlobal_default = freeGlobal;
|
|
117
|
-
|
|
118
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js
|
|
119
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
120
|
-
var root = freeGlobal_default || freeSelf || Function("return this")();
|
|
121
|
-
var root_default = root;
|
|
122
|
-
|
|
123
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js
|
|
124
|
-
var Symbol = root_default.Symbol;
|
|
125
|
-
var Symbol_default = Symbol;
|
|
126
|
-
|
|
127
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js
|
|
128
|
-
var objectProto = Object.prototype;
|
|
129
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
130
|
-
var nativeObjectToString = objectProto.toString;
|
|
131
|
-
var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
|
|
132
|
-
function getRawTag(value) {
|
|
133
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
|
134
|
-
try {
|
|
135
|
-
value[symToStringTag] = void 0;
|
|
136
|
-
var unmasked = true;
|
|
137
|
-
} catch (e) {
|
|
138
|
-
}
|
|
139
|
-
var result = nativeObjectToString.call(value);
|
|
140
|
-
if (unmasked) {
|
|
141
|
-
if (isOwn) {
|
|
142
|
-
value[symToStringTag] = tag;
|
|
143
|
-
} else {
|
|
144
|
-
delete value[symToStringTag];
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
var getRawTag_default = getRawTag;
|
|
150
|
-
|
|
151
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js
|
|
152
|
-
var objectProto2 = Object.prototype;
|
|
153
|
-
var nativeObjectToString2 = objectProto2.toString;
|
|
154
|
-
function objectToString(value) {
|
|
155
|
-
return nativeObjectToString2.call(value);
|
|
156
|
-
}
|
|
157
|
-
var objectToString_default = objectToString;
|
|
158
|
-
|
|
159
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js
|
|
160
|
-
var nullTag = "[object Null]";
|
|
161
|
-
var undefinedTag = "[object Undefined]";
|
|
162
|
-
var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
|
|
163
|
-
function baseGetTag(value) {
|
|
164
|
-
if (value == null) {
|
|
165
|
-
return value === void 0 ? undefinedTag : nullTag;
|
|
166
|
-
}
|
|
167
|
-
return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
|
|
168
|
-
}
|
|
169
|
-
var baseGetTag_default = baseGetTag;
|
|
170
|
-
|
|
171
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js
|
|
172
|
-
function isObject(value) {
|
|
173
|
-
var type = typeof value;
|
|
174
|
-
return value != null && (type == "object" || type == "function");
|
|
175
|
-
}
|
|
176
|
-
var isObject_default = isObject;
|
|
177
|
-
|
|
178
116
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js
|
|
179
117
|
var asyncTag = "[object AsyncFunction]";
|
|
180
118
|
var funcTag = "[object Function]";
|
|
@@ -225,11 +163,11 @@ var toSource_default = toSource;
|
|
|
225
163
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
226
164
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
227
165
|
var funcProto2 = Function.prototype;
|
|
228
|
-
var
|
|
166
|
+
var objectProto = Object.prototype;
|
|
229
167
|
var funcToString2 = funcProto2.toString;
|
|
230
|
-
var
|
|
168
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
231
169
|
var reIsNative = RegExp(
|
|
232
|
-
"^" + funcToString2.call(
|
|
170
|
+
"^" + funcToString2.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
233
171
|
);
|
|
234
172
|
function baseIsNative(value) {
|
|
235
173
|
if (!isObject_default(value) || isMasked_default(value)) {
|
|
@@ -278,24 +216,24 @@ var hashDelete_default = hashDelete;
|
|
|
278
216
|
|
|
279
217
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.js
|
|
280
218
|
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
281
|
-
var
|
|
282
|
-
var
|
|
219
|
+
var objectProto2 = Object.prototype;
|
|
220
|
+
var hasOwnProperty2 = objectProto2.hasOwnProperty;
|
|
283
221
|
function hashGet(key) {
|
|
284
222
|
var data = this.__data__;
|
|
285
223
|
if (nativeCreate_default) {
|
|
286
224
|
var result = data[key];
|
|
287
225
|
return result === HASH_UNDEFINED ? void 0 : result;
|
|
288
226
|
}
|
|
289
|
-
return
|
|
227
|
+
return hasOwnProperty2.call(data, key) ? data[key] : void 0;
|
|
290
228
|
}
|
|
291
229
|
var hashGet_default = hashGet;
|
|
292
230
|
|
|
293
231
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.js
|
|
294
|
-
var
|
|
295
|
-
var
|
|
232
|
+
var objectProto3 = Object.prototype;
|
|
233
|
+
var hasOwnProperty3 = objectProto3.hasOwnProperty;
|
|
296
234
|
function hashHas(key) {
|
|
297
235
|
var data = this.__data__;
|
|
298
|
-
return nativeCreate_default ? data[key] !== void 0 :
|
|
236
|
+
return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty3.call(data, key);
|
|
299
237
|
}
|
|
300
238
|
var hashHas_default = hashHas;
|
|
301
239
|
|
|
@@ -465,11 +403,11 @@ function baseAssignValue(object, key, value) {
|
|
|
465
403
|
var baseAssignValue_default = baseAssignValue;
|
|
466
404
|
|
|
467
405
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assignValue.js
|
|
468
|
-
var
|
|
469
|
-
var
|
|
406
|
+
var objectProto4 = Object.prototype;
|
|
407
|
+
var hasOwnProperty4 = objectProto4.hasOwnProperty;
|
|
470
408
|
function assignValue(object, key, value) {
|
|
471
409
|
var objValue = object[key];
|
|
472
|
-
if (!(
|
|
410
|
+
if (!(hasOwnProperty4.call(object, key) && eq_default(objValue, value)) || value === void 0 && !(key in object)) {
|
|
473
411
|
baseAssignValue_default(object, key, value);
|
|
474
412
|
}
|
|
475
413
|
}
|
|
@@ -506,12 +444,6 @@ function baseTimes(n, iteratee) {
|
|
|
506
444
|
}
|
|
507
445
|
var baseTimes_default = baseTimes;
|
|
508
446
|
|
|
509
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js
|
|
510
|
-
function isObjectLike(value) {
|
|
511
|
-
return value != null && typeof value == "object";
|
|
512
|
-
}
|
|
513
|
-
var isObjectLike_default = isObjectLike;
|
|
514
|
-
|
|
515
447
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js
|
|
516
448
|
var argsTag = "[object Arguments]";
|
|
517
449
|
function baseIsArguments(value) {
|
|
@@ -520,20 +452,16 @@ function baseIsArguments(value) {
|
|
|
520
452
|
var baseIsArguments_default = baseIsArguments;
|
|
521
453
|
|
|
522
454
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js
|
|
523
|
-
var
|
|
524
|
-
var
|
|
525
|
-
var propertyIsEnumerable =
|
|
455
|
+
var objectProto5 = Object.prototype;
|
|
456
|
+
var hasOwnProperty5 = objectProto5.hasOwnProperty;
|
|
457
|
+
var propertyIsEnumerable = objectProto5.propertyIsEnumerable;
|
|
526
458
|
var isArguments = baseIsArguments_default(/* @__PURE__ */ (function() {
|
|
527
459
|
return arguments;
|
|
528
460
|
})()) ? baseIsArguments_default : function(value) {
|
|
529
|
-
return isObjectLike_default(value) &&
|
|
461
|
+
return isObjectLike_default(value) && hasOwnProperty5.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
530
462
|
};
|
|
531
463
|
var isArguments_default = isArguments;
|
|
532
464
|
|
|
533
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js
|
|
534
|
-
var isArray = Array.isArray;
|
|
535
|
-
var isArray_default = isArray;
|
|
536
|
-
|
|
537
465
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js
|
|
538
466
|
function stubFalse() {
|
|
539
467
|
return false;
|
|
@@ -630,12 +558,12 @@ var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : base
|
|
|
630
558
|
var isTypedArray_default = isTypedArray;
|
|
631
559
|
|
|
632
560
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js
|
|
633
|
-
var
|
|
634
|
-
var
|
|
561
|
+
var objectProto6 = Object.prototype;
|
|
562
|
+
var hasOwnProperty6 = objectProto6.hasOwnProperty;
|
|
635
563
|
function arrayLikeKeys(value, inherited) {
|
|
636
564
|
var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length = result.length;
|
|
637
565
|
for (var key in value) {
|
|
638
|
-
if ((inherited ||
|
|
566
|
+
if ((inherited || hasOwnProperty6.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
639
567
|
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
640
568
|
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
641
569
|
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
@@ -648,9 +576,9 @@ function arrayLikeKeys(value, inherited) {
|
|
|
648
576
|
var arrayLikeKeys_default = arrayLikeKeys;
|
|
649
577
|
|
|
650
578
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js
|
|
651
|
-
var
|
|
579
|
+
var objectProto7 = Object.prototype;
|
|
652
580
|
function isPrototype(value) {
|
|
653
|
-
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype ||
|
|
581
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto7;
|
|
654
582
|
return value === proto;
|
|
655
583
|
}
|
|
656
584
|
var isPrototype_default = isPrototype;
|
|
@@ -668,15 +596,15 @@ var nativeKeys = overArg_default(Object.keys, Object);
|
|
|
668
596
|
var nativeKeys_default = nativeKeys;
|
|
669
597
|
|
|
670
598
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js
|
|
671
|
-
var
|
|
672
|
-
var
|
|
599
|
+
var objectProto8 = Object.prototype;
|
|
600
|
+
var hasOwnProperty7 = objectProto8.hasOwnProperty;
|
|
673
601
|
function baseKeys(object) {
|
|
674
602
|
if (!isPrototype_default(object)) {
|
|
675
603
|
return nativeKeys_default(object);
|
|
676
604
|
}
|
|
677
605
|
var result = [];
|
|
678
606
|
for (var key in Object(object)) {
|
|
679
|
-
if (
|
|
607
|
+
if (hasOwnProperty7.call(object, key) && key != "constructor") {
|
|
680
608
|
result.push(key);
|
|
681
609
|
}
|
|
682
610
|
}
|
|
@@ -715,15 +643,15 @@ function nativeKeysIn(object) {
|
|
|
715
643
|
var nativeKeysIn_default = nativeKeysIn;
|
|
716
644
|
|
|
717
645
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeysIn.js
|
|
718
|
-
var
|
|
719
|
-
var
|
|
646
|
+
var objectProto9 = Object.prototype;
|
|
647
|
+
var hasOwnProperty8 = objectProto9.hasOwnProperty;
|
|
720
648
|
function baseKeysIn(object) {
|
|
721
649
|
if (!isObject_default(object)) {
|
|
722
650
|
return nativeKeysIn_default(object);
|
|
723
651
|
}
|
|
724
652
|
var isProto = isPrototype_default(object), result = [];
|
|
725
653
|
for (var key in object) {
|
|
726
|
-
if (!(key == "constructor" && (isProto || !
|
|
654
|
+
if (!(key == "constructor" && (isProto || !hasOwnProperty8.call(object, key)))) {
|
|
727
655
|
result.push(key);
|
|
728
656
|
}
|
|
729
657
|
}
|
|
@@ -790,8 +718,8 @@ function stubArray() {
|
|
|
790
718
|
var stubArray_default = stubArray;
|
|
791
719
|
|
|
792
720
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getSymbols.js
|
|
793
|
-
var
|
|
794
|
-
var propertyIsEnumerable2 =
|
|
721
|
+
var objectProto10 = Object.prototype;
|
|
722
|
+
var propertyIsEnumerable2 = objectProto10.propertyIsEnumerable;
|
|
795
723
|
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
796
724
|
var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
|
|
797
725
|
if (object == null) {
|
|
@@ -913,11 +841,11 @@ if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != data
|
|
|
913
841
|
var getTag_default = getTag;
|
|
914
842
|
|
|
915
843
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_initCloneArray.js
|
|
916
|
-
var
|
|
917
|
-
var
|
|
844
|
+
var objectProto11 = Object.prototype;
|
|
845
|
+
var hasOwnProperty9 = objectProto11.hasOwnProperty;
|
|
918
846
|
function initCloneArray(array) {
|
|
919
847
|
var length = array.length, result = new array.constructor(length);
|
|
920
|
-
if (length && typeof array[0] == "string" &&
|
|
848
|
+
if (length && typeof array[0] == "string" && hasOwnProperty9.call(array, "index")) {
|
|
921
849
|
result.index = array.index;
|
|
922
850
|
result.input = array.input;
|
|
923
851
|
}
|
|
@@ -1179,8 +1107,8 @@ var cloneDeep_default = cloneDeep;
|
|
|
1179
1107
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEmpty.js
|
|
1180
1108
|
var mapTag6 = "[object Map]";
|
|
1181
1109
|
var setTag6 = "[object Set]";
|
|
1182
|
-
var
|
|
1183
|
-
var
|
|
1110
|
+
var objectProto12 = Object.prototype;
|
|
1111
|
+
var hasOwnProperty10 = objectProto12.hasOwnProperty;
|
|
1184
1112
|
function isEmpty(value) {
|
|
1185
1113
|
if (value == null) {
|
|
1186
1114
|
return true;
|
|
@@ -1196,7 +1124,7 @@ function isEmpty(value) {
|
|
|
1196
1124
|
return !baseKeys_default(value).length;
|
|
1197
1125
|
}
|
|
1198
1126
|
for (var key in value) {
|
|
1199
|
-
if (
|
|
1127
|
+
if (hasOwnProperty10.call(value, key)) {
|
|
1200
1128
|
return false;
|
|
1201
1129
|
}
|
|
1202
1130
|
}
|
|
@@ -1204,20 +1132,6 @@ function isEmpty(value) {
|
|
|
1204
1132
|
}
|
|
1205
1133
|
var isEmpty_default = isEmpty;
|
|
1206
1134
|
|
|
1207
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isNumber.js
|
|
1208
|
-
var numberTag4 = "[object Number]";
|
|
1209
|
-
function isNumber(value) {
|
|
1210
|
-
return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag4;
|
|
1211
|
-
}
|
|
1212
|
-
var isNumber_default = isNumber;
|
|
1213
|
-
|
|
1214
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isString.js
|
|
1215
|
-
var stringTag4 = "[object String]";
|
|
1216
|
-
function isString(value) {
|
|
1217
|
-
return typeof value == "string" || !isArray_default(value) && isObjectLike_default(value) && baseGetTag_default(value) == stringTag4;
|
|
1218
|
-
}
|
|
1219
|
-
var isString_default = isString;
|
|
1220
|
-
|
|
1221
1135
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assignMergeValue.js
|
|
1222
1136
|
function assignMergeValue(object, key, value) {
|
|
1223
1137
|
if (value !== void 0 && !eq_default(object[key], value) || value === void 0 && !(key in object)) {
|
|
@@ -1254,9 +1168,9 @@ var isArrayLikeObject_default = isArrayLikeObject;
|
|
|
1254
1168
|
// ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isPlainObject.js
|
|
1255
1169
|
var objectTag4 = "[object Object]";
|
|
1256
1170
|
var funcProto3 = Function.prototype;
|
|
1257
|
-
var
|
|
1171
|
+
var objectProto13 = Object.prototype;
|
|
1258
1172
|
var funcToString3 = funcProto3.toString;
|
|
1259
|
-
var
|
|
1173
|
+
var hasOwnProperty11 = objectProto13.hasOwnProperty;
|
|
1260
1174
|
var objectCtorString = funcToString3.call(Object);
|
|
1261
1175
|
function isPlainObject(value) {
|
|
1262
1176
|
if (!isObjectLike_default(value) || baseGetTag_default(value) != objectTag4) {
|
|
@@ -1266,7 +1180,7 @@ function isPlainObject(value) {
|
|
|
1266
1180
|
if (proto === null) {
|
|
1267
1181
|
return true;
|
|
1268
1182
|
}
|
|
1269
|
-
var Ctor =
|
|
1183
|
+
var Ctor = hasOwnProperty11.call(proto, "constructor") && proto.constructor;
|
|
1270
1184
|
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
|
|
1271
1185
|
}
|
|
1272
1186
|
var isPlainObject_default = isPlainObject;
|
|
@@ -1494,6 +1408,12 @@ function isNotNullish(value) {
|
|
|
1494
1408
|
function isNullish(value) {
|
|
1495
1409
|
return value == null;
|
|
1496
1410
|
}
|
|
1411
|
+
function isRecord(value) {
|
|
1412
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1413
|
+
}
|
|
1414
|
+
function stringValue(value) {
|
|
1415
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
1416
|
+
}
|
|
1497
1417
|
function getFromRecordOrNull(record, key) {
|
|
1498
1418
|
return key ? record?.[key] ?? null : null;
|
|
1499
1419
|
}
|
|
@@ -1560,7 +1480,7 @@ var deepCloneAndMergeReplacingArrays = (source, ...toMerge) => {
|
|
|
1560
1480
|
}
|
|
1561
1481
|
return copy;
|
|
1562
1482
|
};
|
|
1563
|
-
function
|
|
1483
|
+
function hasOwnProperty12(obj, prop) {
|
|
1564
1484
|
return obj?.hasOwnProperty(prop) || false;
|
|
1565
1485
|
}
|
|
1566
1486
|
function coerceNumberToString(value) {
|
|
@@ -1595,4 +1515,4 @@ function errorMessage(error) {
|
|
|
1595
1515
|
return String(error);
|
|
1596
1516
|
}
|
|
1597
1517
|
|
|
1598
|
-
export { MapCache_default, Stack_default,
|
|
1518
|
+
export { MapCache_default, Stack_default, Uint8Array_default, baseAssignValue_default, baseFor_default, coerceNumberToString, deepCloneAndMergeReplacingArrays, eq_default, errorMessage, exhaustiveSwitch, formatFileSize, getAllKeys_default, getFromRecordOrNull, getTag_default, hasOwnProperty12 as hasOwnProperty, identity_default, invariant, isArguments_default, isBuffer_default, isEmpty2 as isEmpty, isFunction_default, isIndex_default, isLength_default, isNotNullish, isNullish, isPrimitive, isRecord, isTypedArray_default, keys_default, mergeReplacingArrays, mergeReplacingObjects, noop, preventDefault, sleep, stringValue, warning };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ConsentCategory, ConsentMode } from "../_vendor/schemas/generated/consent";
|
|
2
|
+
import type { ConsentCategories, ConsentSeed } from "./cookie";
|
|
3
|
+
/**
|
|
4
|
+
* Framework-agnostic, cookie-backed consent store. Lives as a single module
|
|
5
|
+
* singleton so `ReploScripts`, the site's consent banner, and `AnalyticsProvider`
|
|
6
|
+
* all share the same state regardless of where they sit in the React tree — no
|
|
7
|
+
* provider-ancestor relationship is required.
|
|
8
|
+
*
|
|
9
|
+
* Consent-dependent work (script injection, banner visibility) happens on the
|
|
10
|
+
* client (effects / post-mount), so there is no SSR/hydration mismatch. The
|
|
11
|
+
* server-seeded `window.__REPLO_CONSENT__` (see ./server) only lets the first
|
|
12
|
+
* client snapshot reflect the cookie without a flash.
|
|
13
|
+
*/
|
|
14
|
+
export interface ConsentState {
|
|
15
|
+
mode: ConsentMode;
|
|
16
|
+
categories: ConsentCategories;
|
|
17
|
+
/** Epoch ms when the visitor last made a choice, or null if undecided. */
|
|
18
|
+
decidedAt: number | null;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface Window {
|
|
22
|
+
__REPLO_CONSENT__?: ConsentSeed;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export declare const consentStore: {
|
|
26
|
+
getSnapshot(): ConsentState;
|
|
27
|
+
getServerSnapshot(): ConsentState;
|
|
28
|
+
subscribe(listener: () => void): () => void;
|
|
29
|
+
/** Grant every consent category. */
|
|
30
|
+
accept(): void;
|
|
31
|
+
/** Deny every non-necessary category. */
|
|
32
|
+
reject(): void;
|
|
33
|
+
/** Set a subset of categories, leaving the rest at their current value. */
|
|
34
|
+
updateCategories(next: Partial<ConsentCategories>): void;
|
|
35
|
+
/** Test-only: reset cached state so the next read recomputes. */
|
|
36
|
+
reset(): void;
|
|
37
|
+
};
|
|
38
|
+
export interface UseConsentResult extends ConsentState {
|
|
39
|
+
accept(): void;
|
|
40
|
+
reject(): void;
|
|
41
|
+
updateCategories(next: Partial<ConsentCategories>): void;
|
|
42
|
+
}
|
|
43
|
+
export declare function useConsent(): UseConsentResult;
|
|
44
|
+
/**
|
|
45
|
+
* Whether a script requiring `requiredConsent` is allowed to load right now.
|
|
46
|
+
* `mode === "off"` always allows; otherwise every required category must be
|
|
47
|
+
* granted. An empty requirement list is always allowed.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isConsentAllowed({ state, requiredConsent, }: {
|
|
50
|
+
state: ConsentState;
|
|
51
|
+
requiredConsent: ConsentCategory[];
|
|
52
|
+
}): boolean;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
import {
|
|
4
|
+
CONSENT_COOKIE_MAX_AGE_SECONDS,
|
|
5
|
+
CONSENT_COOKIE_NAME,
|
|
6
|
+
DENIED_CATEGORIES,
|
|
7
|
+
GRANTED_CATEGORIES,
|
|
8
|
+
parseConsentCookie,
|
|
9
|
+
serializeConsentCookieValue
|
|
10
|
+
} from "./cookie";
|
|
11
|
+
const TOGGLEABLE_CATEGORIES = [
|
|
12
|
+
"analytics",
|
|
13
|
+
"marketing",
|
|
14
|
+
"preferences",
|
|
15
|
+
"sale_of_data"
|
|
16
|
+
];
|
|
17
|
+
const SERVER_SNAPSHOT = Object.freeze({
|
|
18
|
+
mode: "off",
|
|
19
|
+
categories: DENIED_CATEGORIES,
|
|
20
|
+
decidedAt: null
|
|
21
|
+
});
|
|
22
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
23
|
+
let snapshot = null;
|
|
24
|
+
function isConsentMode(value) {
|
|
25
|
+
return value === "off" || value === "simple" || value === "per-category";
|
|
26
|
+
}
|
|
27
|
+
function resolveMode() {
|
|
28
|
+
if (typeof window === "undefined") {
|
|
29
|
+
return "off";
|
|
30
|
+
}
|
|
31
|
+
const seedMode = window.__REPLO_CONSENT__?.mode;
|
|
32
|
+
if (isConsentMode(seedMode)) {
|
|
33
|
+
return seedMode;
|
|
34
|
+
}
|
|
35
|
+
const attribute = document.documentElement.dataset.reploConsentMode;
|
|
36
|
+
return isConsentMode(attribute) ? attribute : "off";
|
|
37
|
+
}
|
|
38
|
+
function computeSnapshot() {
|
|
39
|
+
if (typeof window === "undefined") {
|
|
40
|
+
return SERVER_SNAPSHOT;
|
|
41
|
+
}
|
|
42
|
+
const mode = resolveMode();
|
|
43
|
+
const fromCookie = parseConsentCookie(document.cookie);
|
|
44
|
+
if (fromCookie) {
|
|
45
|
+
return {
|
|
46
|
+
mode,
|
|
47
|
+
categories: {
|
|
48
|
+
necessary: true,
|
|
49
|
+
analytics: fromCookie.categories.analytics,
|
|
50
|
+
marketing: fromCookie.categories.marketing,
|
|
51
|
+
preferences: fromCookie.categories.preferences,
|
|
52
|
+
sale_of_data: fromCookie.categories.sale_of_data
|
|
53
|
+
},
|
|
54
|
+
decidedAt: fromCookie.decidedAt
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const seed = window.__REPLO_CONSENT__;
|
|
58
|
+
if (seed) {
|
|
59
|
+
return {
|
|
60
|
+
mode,
|
|
61
|
+
categories: { ...DENIED_CATEGORIES, ...seed.categories, necessary: true },
|
|
62
|
+
decidedAt: seed.decidedAt
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return { mode, categories: DENIED_CATEGORIES, decidedAt: null };
|
|
66
|
+
}
|
|
67
|
+
function writeCookie(categories, decidedAt) {
|
|
68
|
+
if (typeof document === "undefined") {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const value = serializeConsentCookieValue({ categories, decidedAt });
|
|
72
|
+
document.cookie = `${CONSENT_COOKIE_NAME}=${value}; path=/; max-age=${CONSENT_COOKIE_MAX_AGE_SECONDS}; SameSite=Lax`;
|
|
73
|
+
}
|
|
74
|
+
function notify() {
|
|
75
|
+
for (const listener of listeners) {
|
|
76
|
+
listener();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function commit(categories) {
|
|
80
|
+
const previous = consentStore.getSnapshot();
|
|
81
|
+
const decidedAt = Date.now();
|
|
82
|
+
writeCookie(categories, decidedAt);
|
|
83
|
+
snapshot = {
|
|
84
|
+
mode: previous.mode,
|
|
85
|
+
categories: { ...categories, necessary: true },
|
|
86
|
+
decidedAt
|
|
87
|
+
};
|
|
88
|
+
notify();
|
|
89
|
+
const wasDowngrade = previous.decidedAt !== null && TOGGLEABLE_CATEGORIES.some((category) => {
|
|
90
|
+
return previous.categories[category] && !categories[category];
|
|
91
|
+
});
|
|
92
|
+
if (wasDowngrade && typeof window !== "undefined") {
|
|
93
|
+
window.location.reload();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const consentStore = {
|
|
97
|
+
getSnapshot() {
|
|
98
|
+
if (!snapshot) {
|
|
99
|
+
snapshot = computeSnapshot();
|
|
100
|
+
}
|
|
101
|
+
return snapshot;
|
|
102
|
+
},
|
|
103
|
+
getServerSnapshot() {
|
|
104
|
+
return SERVER_SNAPSHOT;
|
|
105
|
+
},
|
|
106
|
+
subscribe(listener) {
|
|
107
|
+
listeners.add(listener);
|
|
108
|
+
return () => {
|
|
109
|
+
listeners.delete(listener);
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
/** Grant every consent category. */
|
|
113
|
+
accept() {
|
|
114
|
+
commit(GRANTED_CATEGORIES);
|
|
115
|
+
},
|
|
116
|
+
/** Deny every non-necessary category. */
|
|
117
|
+
reject() {
|
|
118
|
+
commit(DENIED_CATEGORIES);
|
|
119
|
+
},
|
|
120
|
+
/** Set a subset of categories, leaving the rest at their current value. */
|
|
121
|
+
updateCategories(next) {
|
|
122
|
+
const current = consentStore.getSnapshot().categories;
|
|
123
|
+
commit({ ...current, ...next, necessary: true });
|
|
124
|
+
},
|
|
125
|
+
/** Test-only: reset cached state so the next read recomputes. */
|
|
126
|
+
reset() {
|
|
127
|
+
snapshot = null;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
function useConsent() {
|
|
131
|
+
const state = useSyncExternalStore(
|
|
132
|
+
consentStore.subscribe,
|
|
133
|
+
consentStore.getSnapshot,
|
|
134
|
+
consentStore.getServerSnapshot
|
|
135
|
+
);
|
|
136
|
+
return {
|
|
137
|
+
...state,
|
|
138
|
+
accept: consentStore.accept,
|
|
139
|
+
reject: consentStore.reject,
|
|
140
|
+
updateCategories: consentStore.updateCategories
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function isConsentAllowed({
|
|
144
|
+
state,
|
|
145
|
+
requiredConsent
|
|
146
|
+
}) {
|
|
147
|
+
if (state.mode === "off") {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
if (requiredConsent.length === 0) {
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
return requiredConsent.every((category) => state.categories[category]);
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
consentStore,
|
|
157
|
+
isConsentAllowed,
|
|
158
|
+
useConsent
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=consent-store.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../consent/consent-store.ts"],
|
|
4
|
+
"sourcesContent": ["\"use client\";\n\nimport type { ConsentCategory, ConsentMode } from \"schemas/generated/consent\";\nimport type { ConsentCategories, ConsentSeed } from \"./cookie\";\n\nimport { useSyncExternalStore } from \"react\";\n\nimport {\n CONSENT_COOKIE_MAX_AGE_SECONDS,\n CONSENT_COOKIE_NAME,\n DENIED_CATEGORIES,\n GRANTED_CATEGORIES,\n parseConsentCookie,\n serializeConsentCookieValue,\n} from \"./cookie\";\n\n/**\n * Framework-agnostic, cookie-backed consent store. Lives as a single module\n * singleton so `ReploScripts`, the site's consent banner, and `AnalyticsProvider`\n * all share the same state regardless of where they sit in the React tree \u2014 no\n * provider-ancestor relationship is required.\n *\n * Consent-dependent work (script injection, banner visibility) happens on the\n * client (effects / post-mount), so there is no SSR/hydration mismatch. The\n * server-seeded `window.__REPLO_CONSENT__` (see ./server) only lets the first\n * client snapshot reflect the cookie without a flash.\n */\n\nexport interface ConsentState {\n mode: ConsentMode;\n categories: ConsentCategories;\n /** Epoch ms when the visitor last made a choice, or null if undecided. */\n decidedAt: number | null;\n}\n\n// The non-necessary categories a visitor can grant or revoke. `necessary` is\n// always granted and never toggled.\nconst TOGGLEABLE_CATEGORIES: Exclude<ConsentCategory, \"necessary\">[] = [\n \"analytics\",\n \"marketing\",\n \"preferences\",\n \"sale_of_data\",\n];\n\ndeclare global {\n interface Window {\n __REPLO_CONSENT__?: ConsentSeed;\n }\n}\n\n// A stable reference for SSR / first hydration render. Consent-dependent DOM is\n// only produced on the client, so this constant never causes a mismatch.\nconst SERVER_SNAPSHOT: ConsentState = Object.freeze({\n mode: \"off\",\n categories: DENIED_CATEGORIES,\n decidedAt: null,\n});\n\nconst listeners = new Set<() => void>();\nlet snapshot: ConsentState | null = null;\n\nfunction isConsentMode(value: string | null | undefined): value is ConsentMode {\n return value === \"off\" || value === \"simple\" || value === \"per-category\";\n}\n\nfunction resolveMode(): ConsentMode {\n if (typeof window === \"undefined\") {\n return \"off\";\n }\n const seedMode = window.__REPLO_CONSENT__?.mode;\n if (isConsentMode(seedMode)) {\n return seedMode;\n }\n const attribute = document.documentElement.dataset.reploConsentMode;\n return isConsentMode(attribute) ? attribute : \"off\";\n}\n\nfunction computeSnapshot(): ConsentState {\n if (typeof window === \"undefined\") {\n return SERVER_SNAPSHOT;\n }\n\n const mode = resolveMode();\n\n const fromCookie = parseConsentCookie(document.cookie);\n if (fromCookie) {\n return {\n mode,\n categories: {\n necessary: true,\n analytics: fromCookie.categories.analytics,\n marketing: fromCookie.categories.marketing,\n preferences: fromCookie.categories.preferences,\n sale_of_data: fromCookie.categories.sale_of_data,\n },\n decidedAt: fromCookie.decidedAt,\n };\n }\n\n const seed = window.__REPLO_CONSENT__;\n if (seed) {\n return {\n mode,\n categories: { ...DENIED_CATEGORIES, ...seed.categories, necessary: true },\n decidedAt: seed.decidedAt,\n };\n }\n\n return { mode, categories: DENIED_CATEGORIES, decidedAt: null };\n}\n\nfunction writeCookie(categories: ConsentCategories, decidedAt: number) {\n if (typeof document === \"undefined\") {\n return;\n }\n const value = serializeConsentCookieValue({ categories, decidedAt });\n document.cookie = `${CONSENT_COOKIE_NAME}=${value}; path=/; max-age=${CONSENT_COOKIE_MAX_AGE_SECONDS}; SameSite=Lax`;\n}\n\nfunction notify() {\n for (const listener of listeners) {\n listener();\n }\n}\n\nfunction commit(categories: ConsentCategories) {\n const previous = consentStore.getSnapshot();\n const decidedAt = Date.now();\n writeCookie(categories, decidedAt);\n snapshot = {\n mode: previous.mode,\n categories: { ...categories, necessary: true },\n decidedAt,\n };\n notify();\n\n // Revocation cannot unload an already-loaded vendor. If the visitor had\n // previously decided and is now turning a granted category off, reload so the\n // page renders without those scripts.\n const wasDowngrade =\n previous.decidedAt !== null &&\n TOGGLEABLE_CATEGORIES.some((category) => {\n return previous.categories[category] && !categories[category];\n });\n if (wasDowngrade && typeof window !== \"undefined\") {\n window.location.reload();\n }\n}\n\nexport const consentStore = {\n getSnapshot(): ConsentState {\n if (!snapshot) {\n snapshot = computeSnapshot();\n }\n return snapshot;\n },\n getServerSnapshot(): ConsentState {\n return SERVER_SNAPSHOT;\n },\n subscribe(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n /** Grant every consent category. */\n accept() {\n commit(GRANTED_CATEGORIES);\n },\n /** Deny every non-necessary category. */\n reject() {\n commit(DENIED_CATEGORIES);\n },\n /** Set a subset of categories, leaving the rest at their current value. */\n updateCategories(next: Partial<ConsentCategories>) {\n const current = consentStore.getSnapshot().categories;\n commit({ ...current, ...next, necessary: true });\n },\n /** Test-only: reset cached state so the next read recomputes. */\n reset() {\n snapshot = null;\n },\n};\n\nexport interface UseConsentResult extends ConsentState {\n accept(): void;\n reject(): void;\n updateCategories(next: Partial<ConsentCategories>): void;\n}\n\nexport function useConsent(): UseConsentResult {\n const state = useSyncExternalStore(\n consentStore.subscribe,\n consentStore.getSnapshot,\n consentStore.getServerSnapshot,\n );\n return {\n ...state,\n accept: consentStore.accept,\n reject: consentStore.reject,\n updateCategories: consentStore.updateCategories,\n };\n}\n\n/**\n * Whether a script requiring `requiredConsent` is allowed to load right now.\n * `mode === \"off\"` always allows; otherwise every required category must be\n * granted. An empty requirement list is always allowed.\n */\nexport function isConsentAllowed({\n state,\n requiredConsent,\n}: {\n state: ConsentState;\n requiredConsent: ConsentCategory[];\n}): boolean {\n if (state.mode === \"off\") {\n return true;\n }\n if (requiredConsent.length === 0) {\n return true;\n }\n return requiredConsent.every((category) => state.categories[category]);\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ConsentCategory, ConsentMode } from "../_vendor/schemas/generated/consent";
|
|
2
|
+
/**
|
|
3
|
+
* Pure (non-React, framework-agnostic) consent cookie helpers, shared by the
|
|
4
|
+
* client store (`consent-store.ts`) and the server seed reader (`server.ts`).
|
|
5
|
+
*/
|
|
6
|
+
export declare const CONSENT_COOKIE_NAME = "replo_consent";
|
|
7
|
+
export declare const CONSENT_COOKIE_VERSION = 1;
|
|
8
|
+
export declare const CONSENT_COOKIE_MAX_AGE_SECONDS: number;
|
|
9
|
+
export type ConsentCategories = Record<ConsentCategory, boolean>;
|
|
10
|
+
/** Persisted cookie payload. `necessary` is always granted and never stored. */
|
|
11
|
+
export interface ConsentCookiePayload {
|
|
12
|
+
version: number;
|
|
13
|
+
decidedAt: number;
|
|
14
|
+
categories: {
|
|
15
|
+
analytics: boolean;
|
|
16
|
+
marketing: boolean;
|
|
17
|
+
preferences: boolean;
|
|
18
|
+
sale_of_data: boolean;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface ConsentSeed {
|
|
22
|
+
mode: ConsentMode;
|
|
23
|
+
categories: ConsentCategories;
|
|
24
|
+
decidedAt: number | null;
|
|
25
|
+
}
|
|
26
|
+
export declare const DENIED_CATEGORIES: ConsentCategories;
|
|
27
|
+
export declare const GRANTED_CATEGORIES: ConsentCategories;
|
|
28
|
+
/**
|
|
29
|
+
* Parse a raw `document.cookie` (or a single cookie value) into a payload.
|
|
30
|
+
* Returns null for missing, malformed, or stale-version cookies so callers
|
|
31
|
+
* treat the visitor as undecided and re-prompt.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseConsentCookie(rawCookie: string | undefined): ConsentCookiePayload | null;
|
|
34
|
+
/** Serialize categories into the JSON-encoded cookie value (not the full Set-Cookie line). */
|
|
35
|
+
export declare function serializeConsentCookieValue({ categories, decidedAt, }: {
|
|
36
|
+
categories: ConsentCategories;
|
|
37
|
+
decidedAt: number;
|
|
38
|
+
}): string;
|