@uniformdev/canvas-next-rsc-client 20.80.0 → 20.80.1-alpha.10.sha-e0cfb4ce44
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.d.mts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.esm.js +60 -2
- package/dist/index.js +60 -2
- package/dist/index.mjs +60 -2
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ManifestV2, PersonalizationEvent, TestEvent, CompositionMetadata, Quirks, ScoreVector } from '@uniformdev/context';
|
|
1
|
+
import { ManifestV2, CookieTransitionDataStoreOptions, VisitorDataStoreOptions, PersonalizationEvent, TestEvent, CompositionMetadata, Quirks, ScoreVector } from '@uniformdev/context';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, PropsWithChildren } from 'react';
|
|
4
4
|
import { PureContextualEditingComponentWrapperProps } from '@uniformdev/canvas-react/core';
|
|
@@ -24,6 +24,23 @@ type ClientContextComponentProps = {
|
|
|
24
24
|
* Whether or not to enable the experimental quirk serialization
|
|
25
25
|
*/
|
|
26
26
|
experimentalQuirkSerialization: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Ceiling on the size in bytes of the visitor data cookie. Unbounded when unset.
|
|
29
|
+
*/
|
|
30
|
+
cookieMaxBytes?: CookieTransitionDataStoreOptions['maxBytes'];
|
|
31
|
+
/**
|
|
32
|
+
* Whether to remove stored A/B test assignments for tests that are no longer in the manifest
|
|
33
|
+
*/
|
|
34
|
+
pruneUnknownTests?: VisitorDataStoreOptions['pruneUnknownTests'];
|
|
35
|
+
/**
|
|
36
|
+
* Whether to remove stored dimensions that are no longer in the manifest
|
|
37
|
+
*/
|
|
38
|
+
pruneUnknownDimensions?: VisitorDataStoreOptions['pruneUnknownDimensions'];
|
|
39
|
+
/**
|
|
40
|
+
* Whether to remove stored dimensions whose score is zero.
|
|
41
|
+
* `'round'` also removes any score whose magnitude is below 1.
|
|
42
|
+
*/
|
|
43
|
+
pruneZeroScores?: VisitorDataStoreOptions['pruneZeroScores'];
|
|
27
44
|
};
|
|
28
45
|
type ClientContextComponent = (props: ClientContextComponentProps) => ReactNode;
|
|
29
46
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ManifestV2, PersonalizationEvent, TestEvent, CompositionMetadata, Quirks, ScoreVector } from '@uniformdev/context';
|
|
1
|
+
import { ManifestV2, CookieTransitionDataStoreOptions, VisitorDataStoreOptions, PersonalizationEvent, TestEvent, CompositionMetadata, Quirks, ScoreVector } from '@uniformdev/context';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, PropsWithChildren } from 'react';
|
|
4
4
|
import { PureContextualEditingComponentWrapperProps } from '@uniformdev/canvas-react/core';
|
|
@@ -24,6 +24,23 @@ type ClientContextComponentProps = {
|
|
|
24
24
|
* Whether or not to enable the experimental quirk serialization
|
|
25
25
|
*/
|
|
26
26
|
experimentalQuirkSerialization: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Ceiling on the size in bytes of the visitor data cookie. Unbounded when unset.
|
|
29
|
+
*/
|
|
30
|
+
cookieMaxBytes?: CookieTransitionDataStoreOptions['maxBytes'];
|
|
31
|
+
/**
|
|
32
|
+
* Whether to remove stored A/B test assignments for tests that are no longer in the manifest
|
|
33
|
+
*/
|
|
34
|
+
pruneUnknownTests?: VisitorDataStoreOptions['pruneUnknownTests'];
|
|
35
|
+
/**
|
|
36
|
+
* Whether to remove stored dimensions that are no longer in the manifest
|
|
37
|
+
*/
|
|
38
|
+
pruneUnknownDimensions?: VisitorDataStoreOptions['pruneUnknownDimensions'];
|
|
39
|
+
/**
|
|
40
|
+
* Whether to remove stored dimensions whose score is zero.
|
|
41
|
+
* `'round'` also removes any score whose magnitude is below 1.
|
|
42
|
+
*/
|
|
43
|
+
pruneZeroScores?: VisitorDataStoreOptions['pruneZeroScores'];
|
|
27
44
|
};
|
|
28
45
|
type ClientContextComponent = (props: ClientContextComponentProps) => ReactNode;
|
|
29
46
|
|
package/dist/index.esm.js
CHANGED
|
@@ -482,14 +482,17 @@ var s2b = new Array(123);
|
|
|
482
482
|
for (let i = 0; i < alphabet.length; i++) {
|
|
483
483
|
s2b[alphabet.charCodeAt(i)] = i;
|
|
484
484
|
}
|
|
485
|
+
var isZeroCookieScore = (score) => Math.abs(score) < 1;
|
|
485
486
|
var _cookieName;
|
|
486
487
|
var _quirkCookieName;
|
|
487
488
|
var _cookieAttributes;
|
|
488
489
|
var _quirksEnabled;
|
|
490
|
+
var _maxBytes;
|
|
489
491
|
_cookieName = /* @__PURE__ */ new WeakMap();
|
|
490
492
|
_quirkCookieName = /* @__PURE__ */ new WeakMap();
|
|
491
493
|
_cookieAttributes = /* @__PURE__ */ new WeakMap();
|
|
492
494
|
_quirksEnabled = /* @__PURE__ */ new WeakMap();
|
|
495
|
+
_maxBytes = /* @__PURE__ */ new WeakMap();
|
|
493
496
|
var _EdgeTransitionDataStore_instances;
|
|
494
497
|
var fetchData_fn;
|
|
495
498
|
_EdgeTransitionDataStore_instances = /* @__PURE__ */ new WeakSet();
|
|
@@ -503,6 +506,7 @@ fetchData_fn = async function() {
|
|
|
503
506
|
this.signalAsyncDataUpdate(serviceData);
|
|
504
507
|
}
|
|
505
508
|
};
|
|
509
|
+
var isSystemDimension = (dimension) => dimension.startsWith("$");
|
|
506
510
|
var emptyVisitorData = () => ({
|
|
507
511
|
quirks: {},
|
|
508
512
|
scores: {},
|
|
@@ -531,6 +535,9 @@ var replaceData_fn;
|
|
|
531
535
|
var setVisitTimeout_fn;
|
|
532
536
|
var isExpired_fn;
|
|
533
537
|
var handleCaps_fn;
|
|
538
|
+
var pruningManifest_get;
|
|
539
|
+
var handlePruning_fn;
|
|
540
|
+
var pruneScores_fn;
|
|
534
541
|
var defaultData_fn;
|
|
535
542
|
_mitt2 = /* @__PURE__ */ new WeakMap();
|
|
536
543
|
_persist = /* @__PURE__ */ new WeakMap();
|
|
@@ -553,6 +560,7 @@ replaceData_fn = function(data, quiet = false) {
|
|
|
553
560
|
sessionScores: data.sessionScores,
|
|
554
561
|
onLogMessage: __privateGet(this, _options).onLogMessage
|
|
555
562
|
});
|
|
563
|
+
__privateMethod(this, _VisitorDataStore_instances, handlePruning_fn).call(this, data);
|
|
556
564
|
const haveScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.scores, data.scores);
|
|
557
565
|
const haveSessionScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.sessionScores, data.sessionScores);
|
|
558
566
|
const haveQuirksChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.quirks, data.quirks);
|
|
@@ -625,6 +633,48 @@ handleCaps_fn = function(scores) {
|
|
|
625
633
|
}
|
|
626
634
|
}
|
|
627
635
|
};
|
|
636
|
+
pruningManifest_get = function() {
|
|
637
|
+
var _a, _b, _c, _d, _e;
|
|
638
|
+
const project = (_b = (_a = __privateGet(this, _options).manifest) == null ? void 0 : _a.data) == null ? void 0 : _b.project;
|
|
639
|
+
const populated = [(_c = project == null ? void 0 : project.pz) == null ? void 0 : _c.sig, (_d = project == null ? void 0 : project.pz) == null ? void 0 : _d.enr, (_e = project == null ? void 0 : project.pz) == null ? void 0 : _e.agg, project == null ? void 0 : project.test].some(
|
|
640
|
+
(definitions) => definitions && Object.keys(definitions).length > 0
|
|
641
|
+
);
|
|
642
|
+
return populated ? __privateGet(this, _options).manifest : void 0;
|
|
643
|
+
};
|
|
644
|
+
handlePruning_fn = function(data) {
|
|
645
|
+
var _a, _b;
|
|
646
|
+
const { pruneUnknownTests, pruneUnknownDimensions } = __privateGet(this, _options);
|
|
647
|
+
const manifest = pruneUnknownTests || pruneUnknownDimensions ? __privateGet(this, _VisitorDataStore_instances, pruningManifest_get) : void 0;
|
|
648
|
+
const pruned = [];
|
|
649
|
+
if (pruneUnknownTests && manifest) {
|
|
650
|
+
for (const test in data.tests) {
|
|
651
|
+
if (!manifest.getTest(test)) {
|
|
652
|
+
delete data.tests[test];
|
|
653
|
+
pruned.push(`tests.${test}`);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
__privateMethod(this, _VisitorDataStore_instances, pruneScores_fn).call(this, data.scores, "scores", pruned, manifest);
|
|
658
|
+
__privateMethod(this, _VisitorDataStore_instances, pruneScores_fn).call(this, data.sessionScores, "sessionScores", pruned, manifest);
|
|
659
|
+
if (pruned.length) {
|
|
660
|
+
(_b = (_a = __privateGet(this, _options)).onLogMessage) == null ? void 0 : _b.call(_a, ["info", 150, pruned]);
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
pruneScores_fn = function(scores, bucket, pruned, manifest) {
|
|
664
|
+
const { pruneUnknownDimensions, pruneZeroScores } = __privateGet(this, _options);
|
|
665
|
+
if (!pruneUnknownDimensions && !pruneZeroScores) {
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
const pruneUnknown = pruneUnknownDimensions && manifest;
|
|
669
|
+
for (const dim in scores) {
|
|
670
|
+
const isUnknown = pruneUnknown && !isSystemDimension(dim) && !manifest.getDimensionByKey(dim);
|
|
671
|
+
const isZero = pruneZeroScores && (pruneZeroScores === "round" ? isZeroCookieScore(scores[dim]) : scores[dim] === 0);
|
|
672
|
+
if (isUnknown || isZero) {
|
|
673
|
+
delete scores[dim];
|
|
674
|
+
pruned.push(`${bucket}.${dim}`);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
};
|
|
628
678
|
defaultData_fn = function() {
|
|
629
679
|
var _a, _b, _c;
|
|
630
680
|
return {
|
|
@@ -844,7 +894,11 @@ var DefaultUniformClientContext = ({
|
|
|
844
894
|
manifest,
|
|
845
895
|
disableDevTools,
|
|
846
896
|
defaultConsent,
|
|
847
|
-
experimentalQuirkSerialization
|
|
897
|
+
experimentalQuirkSerialization,
|
|
898
|
+
cookieMaxBytes,
|
|
899
|
+
pruneUnknownTests,
|
|
900
|
+
pruneUnknownDimensions,
|
|
901
|
+
pruneZeroScores
|
|
848
902
|
}) => {
|
|
849
903
|
const router = useRouter();
|
|
850
904
|
useInitUniformContext(() => {
|
|
@@ -862,7 +916,11 @@ var DefaultUniformClientContext = ({
|
|
|
862
916
|
manifest,
|
|
863
917
|
plugins,
|
|
864
918
|
defaultConsent,
|
|
865
|
-
experimental_quirksEnabled: experimentalQuirkSerialization
|
|
919
|
+
experimental_quirksEnabled: experimentalQuirkSerialization,
|
|
920
|
+
cookieMaxBytes,
|
|
921
|
+
pruneUnknownTests,
|
|
922
|
+
pruneUnknownDimensions,
|
|
923
|
+
pruneZeroScores
|
|
866
924
|
});
|
|
867
925
|
});
|
|
868
926
|
return null;
|
package/dist/index.js
CHANGED
|
@@ -508,14 +508,17 @@ var s2b = new Array(123);
|
|
|
508
508
|
for (let i = 0; i < alphabet.length; i++) {
|
|
509
509
|
s2b[alphabet.charCodeAt(i)] = i;
|
|
510
510
|
}
|
|
511
|
+
var isZeroCookieScore = (score) => Math.abs(score) < 1;
|
|
511
512
|
var _cookieName;
|
|
512
513
|
var _quirkCookieName;
|
|
513
514
|
var _cookieAttributes;
|
|
514
515
|
var _quirksEnabled;
|
|
516
|
+
var _maxBytes;
|
|
515
517
|
_cookieName = /* @__PURE__ */ new WeakMap();
|
|
516
518
|
_quirkCookieName = /* @__PURE__ */ new WeakMap();
|
|
517
519
|
_cookieAttributes = /* @__PURE__ */ new WeakMap();
|
|
518
520
|
_quirksEnabled = /* @__PURE__ */ new WeakMap();
|
|
521
|
+
_maxBytes = /* @__PURE__ */ new WeakMap();
|
|
519
522
|
var _EdgeTransitionDataStore_instances;
|
|
520
523
|
var fetchData_fn;
|
|
521
524
|
_EdgeTransitionDataStore_instances = /* @__PURE__ */ new WeakSet();
|
|
@@ -529,6 +532,7 @@ fetchData_fn = async function() {
|
|
|
529
532
|
this.signalAsyncDataUpdate(serviceData);
|
|
530
533
|
}
|
|
531
534
|
};
|
|
535
|
+
var isSystemDimension = (dimension) => dimension.startsWith("$");
|
|
532
536
|
var emptyVisitorData = () => ({
|
|
533
537
|
quirks: {},
|
|
534
538
|
scores: {},
|
|
@@ -557,6 +561,9 @@ var replaceData_fn;
|
|
|
557
561
|
var setVisitTimeout_fn;
|
|
558
562
|
var isExpired_fn;
|
|
559
563
|
var handleCaps_fn;
|
|
564
|
+
var pruningManifest_get;
|
|
565
|
+
var handlePruning_fn;
|
|
566
|
+
var pruneScores_fn;
|
|
560
567
|
var defaultData_fn;
|
|
561
568
|
_mitt2 = /* @__PURE__ */ new WeakMap();
|
|
562
569
|
_persist = /* @__PURE__ */ new WeakMap();
|
|
@@ -579,6 +586,7 @@ replaceData_fn = function(data, quiet = false) {
|
|
|
579
586
|
sessionScores: data.sessionScores,
|
|
580
587
|
onLogMessage: __privateGet(this, _options).onLogMessage
|
|
581
588
|
});
|
|
589
|
+
__privateMethod(this, _VisitorDataStore_instances, handlePruning_fn).call(this, data);
|
|
582
590
|
const haveScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.scores, data.scores);
|
|
583
591
|
const haveSessionScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.sessionScores, data.sessionScores);
|
|
584
592
|
const haveQuirksChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.quirks, data.quirks);
|
|
@@ -651,6 +659,48 @@ handleCaps_fn = function(scores) {
|
|
|
651
659
|
}
|
|
652
660
|
}
|
|
653
661
|
};
|
|
662
|
+
pruningManifest_get = function() {
|
|
663
|
+
var _a, _b, _c, _d, _e;
|
|
664
|
+
const project = (_b = (_a = __privateGet(this, _options).manifest) == null ? void 0 : _a.data) == null ? void 0 : _b.project;
|
|
665
|
+
const populated = [(_c = project == null ? void 0 : project.pz) == null ? void 0 : _c.sig, (_d = project == null ? void 0 : project.pz) == null ? void 0 : _d.enr, (_e = project == null ? void 0 : project.pz) == null ? void 0 : _e.agg, project == null ? void 0 : project.test].some(
|
|
666
|
+
(definitions) => definitions && Object.keys(definitions).length > 0
|
|
667
|
+
);
|
|
668
|
+
return populated ? __privateGet(this, _options).manifest : void 0;
|
|
669
|
+
};
|
|
670
|
+
handlePruning_fn = function(data) {
|
|
671
|
+
var _a, _b;
|
|
672
|
+
const { pruneUnknownTests, pruneUnknownDimensions } = __privateGet(this, _options);
|
|
673
|
+
const manifest = pruneUnknownTests || pruneUnknownDimensions ? __privateGet(this, _VisitorDataStore_instances, pruningManifest_get) : void 0;
|
|
674
|
+
const pruned = [];
|
|
675
|
+
if (pruneUnknownTests && manifest) {
|
|
676
|
+
for (const test in data.tests) {
|
|
677
|
+
if (!manifest.getTest(test)) {
|
|
678
|
+
delete data.tests[test];
|
|
679
|
+
pruned.push(`tests.${test}`);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
__privateMethod(this, _VisitorDataStore_instances, pruneScores_fn).call(this, data.scores, "scores", pruned, manifest);
|
|
684
|
+
__privateMethod(this, _VisitorDataStore_instances, pruneScores_fn).call(this, data.sessionScores, "sessionScores", pruned, manifest);
|
|
685
|
+
if (pruned.length) {
|
|
686
|
+
(_b = (_a = __privateGet(this, _options)).onLogMessage) == null ? void 0 : _b.call(_a, ["info", 150, pruned]);
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
pruneScores_fn = function(scores, bucket, pruned, manifest) {
|
|
690
|
+
const { pruneUnknownDimensions, pruneZeroScores } = __privateGet(this, _options);
|
|
691
|
+
if (!pruneUnknownDimensions && !pruneZeroScores) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
const pruneUnknown = pruneUnknownDimensions && manifest;
|
|
695
|
+
for (const dim in scores) {
|
|
696
|
+
const isUnknown = pruneUnknown && !isSystemDimension(dim) && !manifest.getDimensionByKey(dim);
|
|
697
|
+
const isZero = pruneZeroScores && (pruneZeroScores === "round" ? isZeroCookieScore(scores[dim]) : scores[dim] === 0);
|
|
698
|
+
if (isUnknown || isZero) {
|
|
699
|
+
delete scores[dim];
|
|
700
|
+
pruned.push(`${bucket}.${dim}`);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
};
|
|
654
704
|
defaultData_fn = function() {
|
|
655
705
|
var _a, _b, _c;
|
|
656
706
|
return {
|
|
@@ -870,7 +920,11 @@ var DefaultUniformClientContext = ({
|
|
|
870
920
|
manifest,
|
|
871
921
|
disableDevTools,
|
|
872
922
|
defaultConsent,
|
|
873
|
-
experimentalQuirkSerialization
|
|
923
|
+
experimentalQuirkSerialization,
|
|
924
|
+
cookieMaxBytes,
|
|
925
|
+
pruneUnknownTests,
|
|
926
|
+
pruneUnknownDimensions,
|
|
927
|
+
pruneZeroScores
|
|
874
928
|
}) => {
|
|
875
929
|
const router = (0, import_navigation3.useRouter)();
|
|
876
930
|
useInitUniformContext(() => {
|
|
@@ -888,7 +942,11 @@ var DefaultUniformClientContext = ({
|
|
|
888
942
|
manifest,
|
|
889
943
|
plugins,
|
|
890
944
|
defaultConsent,
|
|
891
|
-
experimental_quirksEnabled: experimentalQuirkSerialization
|
|
945
|
+
experimental_quirksEnabled: experimentalQuirkSerialization,
|
|
946
|
+
cookieMaxBytes,
|
|
947
|
+
pruneUnknownTests,
|
|
948
|
+
pruneUnknownDimensions,
|
|
949
|
+
pruneZeroScores
|
|
892
950
|
});
|
|
893
951
|
});
|
|
894
952
|
return null;
|
package/dist/index.mjs
CHANGED
|
@@ -482,14 +482,17 @@ var s2b = new Array(123);
|
|
|
482
482
|
for (let i = 0; i < alphabet.length; i++) {
|
|
483
483
|
s2b[alphabet.charCodeAt(i)] = i;
|
|
484
484
|
}
|
|
485
|
+
var isZeroCookieScore = (score) => Math.abs(score) < 1;
|
|
485
486
|
var _cookieName;
|
|
486
487
|
var _quirkCookieName;
|
|
487
488
|
var _cookieAttributes;
|
|
488
489
|
var _quirksEnabled;
|
|
490
|
+
var _maxBytes;
|
|
489
491
|
_cookieName = /* @__PURE__ */ new WeakMap();
|
|
490
492
|
_quirkCookieName = /* @__PURE__ */ new WeakMap();
|
|
491
493
|
_cookieAttributes = /* @__PURE__ */ new WeakMap();
|
|
492
494
|
_quirksEnabled = /* @__PURE__ */ new WeakMap();
|
|
495
|
+
_maxBytes = /* @__PURE__ */ new WeakMap();
|
|
493
496
|
var _EdgeTransitionDataStore_instances;
|
|
494
497
|
var fetchData_fn;
|
|
495
498
|
_EdgeTransitionDataStore_instances = /* @__PURE__ */ new WeakSet();
|
|
@@ -503,6 +506,7 @@ fetchData_fn = async function() {
|
|
|
503
506
|
this.signalAsyncDataUpdate(serviceData);
|
|
504
507
|
}
|
|
505
508
|
};
|
|
509
|
+
var isSystemDimension = (dimension) => dimension.startsWith("$");
|
|
506
510
|
var emptyVisitorData = () => ({
|
|
507
511
|
quirks: {},
|
|
508
512
|
scores: {},
|
|
@@ -531,6 +535,9 @@ var replaceData_fn;
|
|
|
531
535
|
var setVisitTimeout_fn;
|
|
532
536
|
var isExpired_fn;
|
|
533
537
|
var handleCaps_fn;
|
|
538
|
+
var pruningManifest_get;
|
|
539
|
+
var handlePruning_fn;
|
|
540
|
+
var pruneScores_fn;
|
|
534
541
|
var defaultData_fn;
|
|
535
542
|
_mitt2 = /* @__PURE__ */ new WeakMap();
|
|
536
543
|
_persist = /* @__PURE__ */ new WeakMap();
|
|
@@ -553,6 +560,7 @@ replaceData_fn = function(data, quiet = false) {
|
|
|
553
560
|
sessionScores: data.sessionScores,
|
|
554
561
|
onLogMessage: __privateGet(this, _options).onLogMessage
|
|
555
562
|
});
|
|
563
|
+
__privateMethod(this, _VisitorDataStore_instances, handlePruning_fn).call(this, data);
|
|
556
564
|
const haveScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.scores, data.scores);
|
|
557
565
|
const haveSessionScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.sessionScores, data.sessionScores);
|
|
558
566
|
const haveQuirksChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.quirks, data.quirks);
|
|
@@ -625,6 +633,48 @@ handleCaps_fn = function(scores) {
|
|
|
625
633
|
}
|
|
626
634
|
}
|
|
627
635
|
};
|
|
636
|
+
pruningManifest_get = function() {
|
|
637
|
+
var _a, _b, _c, _d, _e;
|
|
638
|
+
const project = (_b = (_a = __privateGet(this, _options).manifest) == null ? void 0 : _a.data) == null ? void 0 : _b.project;
|
|
639
|
+
const populated = [(_c = project == null ? void 0 : project.pz) == null ? void 0 : _c.sig, (_d = project == null ? void 0 : project.pz) == null ? void 0 : _d.enr, (_e = project == null ? void 0 : project.pz) == null ? void 0 : _e.agg, project == null ? void 0 : project.test].some(
|
|
640
|
+
(definitions) => definitions && Object.keys(definitions).length > 0
|
|
641
|
+
);
|
|
642
|
+
return populated ? __privateGet(this, _options).manifest : void 0;
|
|
643
|
+
};
|
|
644
|
+
handlePruning_fn = function(data) {
|
|
645
|
+
var _a, _b;
|
|
646
|
+
const { pruneUnknownTests, pruneUnknownDimensions } = __privateGet(this, _options);
|
|
647
|
+
const manifest = pruneUnknownTests || pruneUnknownDimensions ? __privateGet(this, _VisitorDataStore_instances, pruningManifest_get) : void 0;
|
|
648
|
+
const pruned = [];
|
|
649
|
+
if (pruneUnknownTests && manifest) {
|
|
650
|
+
for (const test in data.tests) {
|
|
651
|
+
if (!manifest.getTest(test)) {
|
|
652
|
+
delete data.tests[test];
|
|
653
|
+
pruned.push(`tests.${test}`);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
__privateMethod(this, _VisitorDataStore_instances, pruneScores_fn).call(this, data.scores, "scores", pruned, manifest);
|
|
658
|
+
__privateMethod(this, _VisitorDataStore_instances, pruneScores_fn).call(this, data.sessionScores, "sessionScores", pruned, manifest);
|
|
659
|
+
if (pruned.length) {
|
|
660
|
+
(_b = (_a = __privateGet(this, _options)).onLogMessage) == null ? void 0 : _b.call(_a, ["info", 150, pruned]);
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
pruneScores_fn = function(scores, bucket, pruned, manifest) {
|
|
664
|
+
const { pruneUnknownDimensions, pruneZeroScores } = __privateGet(this, _options);
|
|
665
|
+
if (!pruneUnknownDimensions && !pruneZeroScores) {
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
const pruneUnknown = pruneUnknownDimensions && manifest;
|
|
669
|
+
for (const dim in scores) {
|
|
670
|
+
const isUnknown = pruneUnknown && !isSystemDimension(dim) && !manifest.getDimensionByKey(dim);
|
|
671
|
+
const isZero = pruneZeroScores && (pruneZeroScores === "round" ? isZeroCookieScore(scores[dim]) : scores[dim] === 0);
|
|
672
|
+
if (isUnknown || isZero) {
|
|
673
|
+
delete scores[dim];
|
|
674
|
+
pruned.push(`${bucket}.${dim}`);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
};
|
|
628
678
|
defaultData_fn = function() {
|
|
629
679
|
var _a, _b, _c;
|
|
630
680
|
return {
|
|
@@ -844,7 +894,11 @@ var DefaultUniformClientContext = ({
|
|
|
844
894
|
manifest,
|
|
845
895
|
disableDevTools,
|
|
846
896
|
defaultConsent,
|
|
847
|
-
experimentalQuirkSerialization
|
|
897
|
+
experimentalQuirkSerialization,
|
|
898
|
+
cookieMaxBytes,
|
|
899
|
+
pruneUnknownTests,
|
|
900
|
+
pruneUnknownDimensions,
|
|
901
|
+
pruneZeroScores
|
|
848
902
|
}) => {
|
|
849
903
|
const router = useRouter();
|
|
850
904
|
useInitUniformContext(() => {
|
|
@@ -862,7 +916,11 @@ var DefaultUniformClientContext = ({
|
|
|
862
916
|
manifest,
|
|
863
917
|
plugins,
|
|
864
918
|
defaultConsent,
|
|
865
|
-
experimental_quirksEnabled: experimentalQuirkSerialization
|
|
919
|
+
experimental_quirksEnabled: experimentalQuirkSerialization,
|
|
920
|
+
cookieMaxBytes,
|
|
921
|
+
pruneUnknownTests,
|
|
922
|
+
pruneUnknownDimensions,
|
|
923
|
+
pruneZeroScores
|
|
866
924
|
});
|
|
867
925
|
});
|
|
868
926
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc-client",
|
|
3
|
-
"version": "20.80.
|
|
3
|
+
"version": "20.80.1-alpha.10.sha-e0cfb4ce44",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"typescript": "6.0.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@uniformdev/canvas": "20.80.
|
|
38
|
-
"@uniformdev/canvas-next-rsc-shared": "20.80.
|
|
39
|
-
"@uniformdev/canvas-react": "20.80.
|
|
37
|
+
"@uniformdev/canvas": "20.80.1-alpha.10.sha-e0cfb4ce44",
|
|
38
|
+
"@uniformdev/canvas-next-rsc-shared": "20.80.1-alpha.10.sha-e0cfb4ce44",
|
|
39
|
+
"@uniformdev/canvas-react": "20.80.1-alpha.10.sha-e0cfb4ce44",
|
|
40
40
|
"js-cookie": "3.0.8"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "e0cfb4ce4435ea507f36d3246fc886c24f8ebe16"
|
|
54
54
|
}
|