@uniformdev/canvas-next-rsc-client 19.173.1-alpha.17 → 19.173.2-alpha.210
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 +23 -5
- package/dist/index.d.ts +23 -5
- package/dist/index.esm.js +166 -85
- package/dist/index.js +166 -85
- package/dist/index.mjs +166 -85
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ManifestV2, TestEvent, ContextOptions } from '@uniformdev/context';
|
|
1
|
+
import { ManifestV2, TestEvent, ContextOptions, Quirks, ScoreVector } from '@uniformdev/context';
|
|
2
2
|
import { PersonalizationEvent } from '@uniformdev/context/*';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { PureContextualEditingComponentWrapperProps } from '@uniformdev/canvas-react/core';
|
|
@@ -6,6 +6,7 @@ import * as react from 'react';
|
|
|
6
6
|
import { PropsWithChildren } from 'react';
|
|
7
7
|
import * as _uniformdev_canvas_next_rsc_shared from '@uniformdev/canvas-next-rsc-shared';
|
|
8
8
|
import { AppDirectoryContextState, PersonalizeProps, ComponentProps, TestProps, AppDirectoryContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
9
|
+
import { VisibilityParameterValue } from '@uniformdev/canvas';
|
|
9
10
|
|
|
10
11
|
type ClientContextComponentProps = {
|
|
11
12
|
/**
|
|
@@ -50,20 +51,37 @@ type PersonalizeClientProps = PersonalizeProps & {
|
|
|
50
51
|
indexes: number[];
|
|
51
52
|
};
|
|
52
53
|
declare const PersonalizeClient: (props: ComponentProps<PersonalizeClientProps>) => react.FunctionComponentElement<{
|
|
53
|
-
children?: react.ReactNode;
|
|
54
|
+
children?: react.ReactNode | undefined;
|
|
54
55
|
}>;
|
|
55
56
|
|
|
56
57
|
declare const TestClient: (props: ComponentProps<TestProps>) => react.FunctionComponentElement<{
|
|
57
|
-
children?: react.ReactNode;
|
|
58
|
+
children?: react.ReactNode | undefined;
|
|
58
59
|
}> | null;
|
|
59
60
|
|
|
60
61
|
declare const UniformScript: () => react_jsx_runtime.JSX.Element;
|
|
61
62
|
|
|
63
|
+
declare const VisibilityRulesWrapperClient: ({ parameter, initialIsVisible, children, }: PropsWithChildren<{
|
|
64
|
+
parameter: VisibilityParameterValue;
|
|
65
|
+
initialIsVisible: boolean | null;
|
|
66
|
+
}>) => react_jsx_runtime.JSX.Element | null;
|
|
67
|
+
|
|
62
68
|
type CreateClientUniformContextOptions = Omit<ContextOptions, 'transitionStore'>;
|
|
63
|
-
declare const createClientUniformContext: (options: CreateClientUniformContextOptions) => _uniformdev_canvas_next_rsc_shared.
|
|
69
|
+
declare const createClientUniformContext: (options: CreateClientUniformContextOptions) => _uniformdev_canvas_next_rsc_shared.AppDirectoryContextInstance;
|
|
64
70
|
|
|
65
71
|
declare const useInitUniformContext: (callback: () => AppDirectoryContext) => void;
|
|
66
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Provides reactive access to the Uniform Context's current visitor quirks values
|
|
75
|
+
* This can be used when you want to read current quirk values directly.
|
|
76
|
+
*/
|
|
77
|
+
declare function useQuirks(): Quirks;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Provides reactive access to the Uniform Context's current visitor scores values.
|
|
81
|
+
* This can be used when you want to read current score values directly.
|
|
82
|
+
*/
|
|
83
|
+
declare function useScores(): ScoreVector | undefined;
|
|
84
|
+
|
|
67
85
|
declare global {
|
|
68
86
|
interface Window {
|
|
69
87
|
__UNIFORM_CONTEXT__: AppDirectoryContext | undefined;
|
|
@@ -73,4 +91,4 @@ declare const useUniformContext: () => {
|
|
|
73
91
|
context: AppDirectoryContext | undefined;
|
|
74
92
|
};
|
|
75
93
|
|
|
76
|
-
export { type ClientContextComponent, type ClientContextComponentProps, ClientContextPersonalizationTransfer, ClientContextTestTransfer, ClientContextUpdate, ClientContextualEditingComponentWrapper, ContextUpdateTransferClient, type CreateClientUniformContextOptions, DefaultUniformClientContext, PersonalizeClient, type PersonalizeClientProps, TestClient, UniformScript, createClientUniformContext, useInitUniformContext, useUniformContext };
|
|
94
|
+
export { type ClientContextComponent, type ClientContextComponentProps, ClientContextPersonalizationTransfer, ClientContextTestTransfer, ClientContextUpdate, ClientContextualEditingComponentWrapper, ContextUpdateTransferClient, type CreateClientUniformContextOptions, DefaultUniformClientContext, PersonalizeClient, type PersonalizeClientProps, TestClient, UniformScript, VisibilityRulesWrapperClient, createClientUniformContext, useInitUniformContext, useQuirks, useScores, useUniformContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ManifestV2, TestEvent, ContextOptions } from '@uniformdev/context';
|
|
1
|
+
import { ManifestV2, TestEvent, ContextOptions, Quirks, ScoreVector } from '@uniformdev/context';
|
|
2
2
|
import { PersonalizationEvent } from '@uniformdev/context/*';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { PureContextualEditingComponentWrapperProps } from '@uniformdev/canvas-react/core';
|
|
@@ -6,6 +6,7 @@ import * as react from 'react';
|
|
|
6
6
|
import { PropsWithChildren } from 'react';
|
|
7
7
|
import * as _uniformdev_canvas_next_rsc_shared from '@uniformdev/canvas-next-rsc-shared';
|
|
8
8
|
import { AppDirectoryContextState, PersonalizeProps, ComponentProps, TestProps, AppDirectoryContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
9
|
+
import { VisibilityParameterValue } from '@uniformdev/canvas';
|
|
9
10
|
|
|
10
11
|
type ClientContextComponentProps = {
|
|
11
12
|
/**
|
|
@@ -50,20 +51,37 @@ type PersonalizeClientProps = PersonalizeProps & {
|
|
|
50
51
|
indexes: number[];
|
|
51
52
|
};
|
|
52
53
|
declare const PersonalizeClient: (props: ComponentProps<PersonalizeClientProps>) => react.FunctionComponentElement<{
|
|
53
|
-
children?: react.ReactNode;
|
|
54
|
+
children?: react.ReactNode | undefined;
|
|
54
55
|
}>;
|
|
55
56
|
|
|
56
57
|
declare const TestClient: (props: ComponentProps<TestProps>) => react.FunctionComponentElement<{
|
|
57
|
-
children?: react.ReactNode;
|
|
58
|
+
children?: react.ReactNode | undefined;
|
|
58
59
|
}> | null;
|
|
59
60
|
|
|
60
61
|
declare const UniformScript: () => react_jsx_runtime.JSX.Element;
|
|
61
62
|
|
|
63
|
+
declare const VisibilityRulesWrapperClient: ({ parameter, initialIsVisible, children, }: PropsWithChildren<{
|
|
64
|
+
parameter: VisibilityParameterValue;
|
|
65
|
+
initialIsVisible: boolean | null;
|
|
66
|
+
}>) => react_jsx_runtime.JSX.Element | null;
|
|
67
|
+
|
|
62
68
|
type CreateClientUniformContextOptions = Omit<ContextOptions, 'transitionStore'>;
|
|
63
|
-
declare const createClientUniformContext: (options: CreateClientUniformContextOptions) => _uniformdev_canvas_next_rsc_shared.
|
|
69
|
+
declare const createClientUniformContext: (options: CreateClientUniformContextOptions) => _uniformdev_canvas_next_rsc_shared.AppDirectoryContextInstance;
|
|
64
70
|
|
|
65
71
|
declare const useInitUniformContext: (callback: () => AppDirectoryContext) => void;
|
|
66
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Provides reactive access to the Uniform Context's current visitor quirks values
|
|
75
|
+
* This can be used when you want to read current quirk values directly.
|
|
76
|
+
*/
|
|
77
|
+
declare function useQuirks(): Quirks;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Provides reactive access to the Uniform Context's current visitor scores values.
|
|
81
|
+
* This can be used when you want to read current score values directly.
|
|
82
|
+
*/
|
|
83
|
+
declare function useScores(): ScoreVector | undefined;
|
|
84
|
+
|
|
67
85
|
declare global {
|
|
68
86
|
interface Window {
|
|
69
87
|
__UNIFORM_CONTEXT__: AppDirectoryContext | undefined;
|
|
@@ -73,4 +91,4 @@ declare const useUniformContext: () => {
|
|
|
73
91
|
context: AppDirectoryContext | undefined;
|
|
74
92
|
};
|
|
75
93
|
|
|
76
|
-
export { type ClientContextComponent, type ClientContextComponentProps, ClientContextPersonalizationTransfer, ClientContextTestTransfer, ClientContextUpdate, ClientContextualEditingComponentWrapper, ContextUpdateTransferClient, type CreateClientUniformContextOptions, DefaultUniformClientContext, PersonalizeClient, type PersonalizeClientProps, TestClient, UniformScript, createClientUniformContext, useInitUniformContext, useUniformContext };
|
|
94
|
+
export { type ClientContextComponent, type ClientContextComponentProps, ClientContextPersonalizationTransfer, ClientContextTestTransfer, ClientContextUpdate, ClientContextualEditingComponentWrapper, ContextUpdateTransferClient, type CreateClientUniformContextOptions, DefaultUniformClientContext, PersonalizeClient, type PersonalizeClientProps, TestClient, UniformScript, VisibilityRulesWrapperClient, createClientUniformContext, useInitUniformContext, useQuirks, useScores, useUniformContext };
|
package/dist/index.esm.js
CHANGED
|
@@ -25,9 +25,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
|
|
28
|
-
// ../../node_modules/.pnpm/rfdc@1.
|
|
28
|
+
// ../../node_modules/.pnpm/rfdc@1.4.1/node_modules/rfdc/index.js
|
|
29
29
|
var require_rfdc = __commonJS({
|
|
30
|
-
"../../node_modules/.pnpm/rfdc@1.
|
|
30
|
+
"../../node_modules/.pnpm/rfdc@1.4.1/node_modules/rfdc/index.js"(exports, module) {
|
|
31
31
|
"use strict";
|
|
32
32
|
module.exports = rfdc4;
|
|
33
33
|
function copyBuffer(cur) {
|
|
@@ -39,17 +39,27 @@ var require_rfdc = __commonJS({
|
|
|
39
39
|
function rfdc4(opts) {
|
|
40
40
|
opts = opts || {};
|
|
41
41
|
if (opts.circles) return rfdcCircles(opts);
|
|
42
|
+
const constructorHandlers = /* @__PURE__ */ new Map();
|
|
43
|
+
constructorHandlers.set(Date, (o) => new Date(o));
|
|
44
|
+
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
45
|
+
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
46
|
+
if (opts.constructorHandlers) {
|
|
47
|
+
for (const handler2 of opts.constructorHandlers) {
|
|
48
|
+
constructorHandlers.set(handler2[0], handler2[1]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
let handler = null;
|
|
42
52
|
return opts.proto ? cloneProto : clone2;
|
|
43
53
|
function cloneArray(a, fn) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
for (
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
const keys = Object.keys(a);
|
|
55
|
+
const a2 = new Array(keys.length);
|
|
56
|
+
for (let i = 0; i < keys.length; i++) {
|
|
57
|
+
const k = keys[i];
|
|
58
|
+
const cur = a[k];
|
|
49
59
|
if (typeof cur !== "object" || cur === null) {
|
|
50
60
|
a2[k] = cur;
|
|
51
|
-
} else if (cur
|
|
52
|
-
a2[k] =
|
|
61
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
62
|
+
a2[k] = handler(cur, fn);
|
|
53
63
|
} else if (ArrayBuffer.isView(cur)) {
|
|
54
64
|
a2[k] = copyBuffer(cur);
|
|
55
65
|
} else {
|
|
@@ -60,22 +70,18 @@ var require_rfdc = __commonJS({
|
|
|
60
70
|
}
|
|
61
71
|
function clone2(o) {
|
|
62
72
|
if (typeof o !== "object" || o === null) return o;
|
|
63
|
-
if (o instanceof Date) return new Date(o);
|
|
64
73
|
if (Array.isArray(o)) return cloneArray(o, clone2);
|
|
65
|
-
if (o
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
75
|
+
return handler(o, clone2);
|
|
76
|
+
}
|
|
77
|
+
const o2 = {};
|
|
78
|
+
for (const k in o) {
|
|
69
79
|
if (Object.hasOwnProperty.call(o, k) === false) continue;
|
|
70
|
-
|
|
80
|
+
const cur = o[k];
|
|
71
81
|
if (typeof cur !== "object" || cur === null) {
|
|
72
82
|
o2[k] = cur;
|
|
73
|
-
} else if (cur
|
|
74
|
-
o2[k] =
|
|
75
|
-
} else if (cur instanceof Map) {
|
|
76
|
-
o2[k] = new Map(cloneArray(Array.from(cur), clone2));
|
|
77
|
-
} else if (cur instanceof Set) {
|
|
78
|
-
o2[k] = new Set(cloneArray(Array.from(cur), clone2));
|
|
83
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
84
|
+
o2[k] = handler(cur, clone2);
|
|
79
85
|
} else if (ArrayBuffer.isView(cur)) {
|
|
80
86
|
o2[k] = copyBuffer(cur);
|
|
81
87
|
} else {
|
|
@@ -86,21 +92,17 @@ var require_rfdc = __commonJS({
|
|
|
86
92
|
}
|
|
87
93
|
function cloneProto(o) {
|
|
88
94
|
if (typeof o !== "object" || o === null) return o;
|
|
89
|
-
if (o instanceof Date) return new Date(o);
|
|
90
95
|
if (Array.isArray(o)) return cloneArray(o, cloneProto);
|
|
91
|
-
if (o
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
97
|
+
return handler(o, cloneProto);
|
|
98
|
+
}
|
|
99
|
+
const o2 = {};
|
|
100
|
+
for (const k in o) {
|
|
101
|
+
const cur = o[k];
|
|
96
102
|
if (typeof cur !== "object" || cur === null) {
|
|
97
103
|
o2[k] = cur;
|
|
98
|
-
} else if (cur
|
|
99
|
-
o2[k] =
|
|
100
|
-
} else if (cur instanceof Map) {
|
|
101
|
-
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
|
|
102
|
-
} else if (cur instanceof Set) {
|
|
103
|
-
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
|
|
104
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
105
|
+
o2[k] = handler(cur, cloneProto);
|
|
104
106
|
} else if (ArrayBuffer.isView(cur)) {
|
|
105
107
|
o2[k] = copyBuffer(cur);
|
|
106
108
|
} else {
|
|
@@ -111,23 +113,33 @@ var require_rfdc = __commonJS({
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
function rfdcCircles(opts) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
const refs = [];
|
|
117
|
+
const refsNew = [];
|
|
118
|
+
const constructorHandlers = /* @__PURE__ */ new Map();
|
|
119
|
+
constructorHandlers.set(Date, (o) => new Date(o));
|
|
120
|
+
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
121
|
+
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
122
|
+
if (opts.constructorHandlers) {
|
|
123
|
+
for (const handler2 of opts.constructorHandlers) {
|
|
124
|
+
constructorHandlers.set(handler2[0], handler2[1]);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
let handler = null;
|
|
116
128
|
return opts.proto ? cloneProto : clone2;
|
|
117
129
|
function cloneArray(a, fn) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
for (
|
|
121
|
-
|
|
122
|
-
|
|
130
|
+
const keys = Object.keys(a);
|
|
131
|
+
const a2 = new Array(keys.length);
|
|
132
|
+
for (let i = 0; i < keys.length; i++) {
|
|
133
|
+
const k = keys[i];
|
|
134
|
+
const cur = a[k];
|
|
123
135
|
if (typeof cur !== "object" || cur === null) {
|
|
124
136
|
a2[k] = cur;
|
|
125
|
-
} else if (cur
|
|
126
|
-
a2[k] =
|
|
137
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
138
|
+
a2[k] = handler(cur, fn);
|
|
127
139
|
} else if (ArrayBuffer.isView(cur)) {
|
|
128
140
|
a2[k] = copyBuffer(cur);
|
|
129
141
|
} else {
|
|
130
|
-
|
|
142
|
+
const index = refs.indexOf(cur);
|
|
131
143
|
if (index !== -1) {
|
|
132
144
|
a2[k] = refsNew[index];
|
|
133
145
|
} else {
|
|
@@ -139,28 +151,24 @@ var require_rfdc = __commonJS({
|
|
|
139
151
|
}
|
|
140
152
|
function clone2(o) {
|
|
141
153
|
if (typeof o !== "object" || o === null) return o;
|
|
142
|
-
if (o instanceof Date) return new Date(o);
|
|
143
154
|
if (Array.isArray(o)) return cloneArray(o, clone2);
|
|
144
|
-
if (o
|
|
145
|
-
|
|
146
|
-
|
|
155
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
156
|
+
return handler(o, clone2);
|
|
157
|
+
}
|
|
158
|
+
const o2 = {};
|
|
147
159
|
refs.push(o);
|
|
148
160
|
refsNew.push(o2);
|
|
149
|
-
for (
|
|
161
|
+
for (const k in o) {
|
|
150
162
|
if (Object.hasOwnProperty.call(o, k) === false) continue;
|
|
151
|
-
|
|
163
|
+
const cur = o[k];
|
|
152
164
|
if (typeof cur !== "object" || cur === null) {
|
|
153
165
|
o2[k] = cur;
|
|
154
|
-
} else if (cur
|
|
155
|
-
o2[k] =
|
|
156
|
-
} else if (cur instanceof Map) {
|
|
157
|
-
o2[k] = new Map(cloneArray(Array.from(cur), clone2));
|
|
158
|
-
} else if (cur instanceof Set) {
|
|
159
|
-
o2[k] = new Set(cloneArray(Array.from(cur), clone2));
|
|
166
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
167
|
+
o2[k] = handler(cur, clone2);
|
|
160
168
|
} else if (ArrayBuffer.isView(cur)) {
|
|
161
169
|
o2[k] = copyBuffer(cur);
|
|
162
170
|
} else {
|
|
163
|
-
|
|
171
|
+
const i = refs.indexOf(cur);
|
|
164
172
|
if (i !== -1) {
|
|
165
173
|
o2[k] = refsNew[i];
|
|
166
174
|
} else {
|
|
@@ -174,27 +182,23 @@ var require_rfdc = __commonJS({
|
|
|
174
182
|
}
|
|
175
183
|
function cloneProto(o) {
|
|
176
184
|
if (typeof o !== "object" || o === null) return o;
|
|
177
|
-
if (o instanceof Date) return new Date(o);
|
|
178
185
|
if (Array.isArray(o)) return cloneArray(o, cloneProto);
|
|
179
|
-
if (o
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
187
|
+
return handler(o, cloneProto);
|
|
188
|
+
}
|
|
189
|
+
const o2 = {};
|
|
182
190
|
refs.push(o);
|
|
183
191
|
refsNew.push(o2);
|
|
184
|
-
for (
|
|
185
|
-
|
|
192
|
+
for (const k in o) {
|
|
193
|
+
const cur = o[k];
|
|
186
194
|
if (typeof cur !== "object" || cur === null) {
|
|
187
195
|
o2[k] = cur;
|
|
188
|
-
} else if (cur
|
|
189
|
-
o2[k] =
|
|
190
|
-
} else if (cur instanceof Map) {
|
|
191
|
-
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
|
|
192
|
-
} else if (cur instanceof Set) {
|
|
193
|
-
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
|
|
196
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
197
|
+
o2[k] = handler(cur, cloneProto);
|
|
194
198
|
} else if (ArrayBuffer.isView(cur)) {
|
|
195
199
|
o2[k] = copyBuffer(cur);
|
|
196
200
|
} else {
|
|
197
|
-
|
|
201
|
+
const i = refs.indexOf(cur);
|
|
198
202
|
if (i !== -1) {
|
|
199
203
|
o2[k] = refsNew[i];
|
|
200
204
|
} else {
|
|
@@ -470,9 +474,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
470
474
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
471
475
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
472
476
|
var ENR_SEPARATOR = "_";
|
|
473
|
-
var _signal;
|
|
474
477
|
var _id;
|
|
475
|
-
_signal = /* @__PURE__ */ new WeakMap();
|
|
476
478
|
_id = /* @__PURE__ */ new WeakMap();
|
|
477
479
|
var _evaluator;
|
|
478
480
|
var _onLogMessage;
|
|
@@ -625,20 +627,15 @@ replaceData_fn = function(data, quiet = false) {
|
|
|
625
627
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
626
628
|
const oldData = __privateGet(this, _VisitorDataStore_instances, currentData_get);
|
|
627
629
|
const now = Date.now();
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
scores: data.scores,
|
|
638
|
-
sessionScores: data.sessionScores,
|
|
639
|
-
onLogMessage: __privateGet(this, _options).onLogMessage
|
|
640
|
-
});
|
|
641
|
-
}
|
|
630
|
+
__privateMethod(this, _VisitorDataStore_instances, handleCaps_fn).call(this, data.scores);
|
|
631
|
+
__privateMethod(this, _VisitorDataStore_instances, handleCaps_fn).call(this, data.sessionScores);
|
|
632
|
+
(_b = (_a = __privateGet(this, _options)).decay) == null ? void 0 : _b.call(_a, {
|
|
633
|
+
now,
|
|
634
|
+
lastUpd: oldData == null ? void 0 : oldData.updated,
|
|
635
|
+
scores: data.scores,
|
|
636
|
+
sessionScores: data.sessionScores,
|
|
637
|
+
onLogMessage: __privateGet(this, _options).onLogMessage
|
|
638
|
+
});
|
|
642
639
|
const haveScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.scores, data.scores);
|
|
643
640
|
const haveSessionScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.sessionScores, data.sessionScores);
|
|
644
641
|
const haveQuirksChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.quirks, data.quirks);
|
|
@@ -1057,6 +1054,87 @@ var UniformScript = () => {
|
|
|
1057
1054
|
}, [router]);
|
|
1058
1055
|
return /* @__PURE__ */ jsx3(Fragment5, {});
|
|
1059
1056
|
};
|
|
1057
|
+
|
|
1058
|
+
// src/components/VisibilityRulesWrapperClient.tsx
|
|
1059
|
+
import {
|
|
1060
|
+
createQuirksVisibilityRule,
|
|
1061
|
+
evaluateNodeVisibilityParameter
|
|
1062
|
+
} from "@uniformdev/canvas";
|
|
1063
|
+
import { useEffect as useEffect10, useMemo as useMemo3, useState as useState8 } from "react";
|
|
1064
|
+
|
|
1065
|
+
// src/hooks/useQuirks.ts
|
|
1066
|
+
import { useEffect as useEffect9, useState as useState7 } from "react";
|
|
1067
|
+
function useQuirks() {
|
|
1068
|
+
var _a;
|
|
1069
|
+
const { context } = useUniformContext();
|
|
1070
|
+
const [quirks, setQuirks] = useState7((_a = context == null ? void 0 : context.quirks) != null ? _a : {});
|
|
1071
|
+
useEffect9(() => {
|
|
1072
|
+
if (!context) {
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
const quirkChangeListener = (updatedQuirks) => {
|
|
1076
|
+
setQuirks(updatedQuirks);
|
|
1077
|
+
};
|
|
1078
|
+
setQuirks(context.quirks);
|
|
1079
|
+
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener);
|
|
1080
|
+
return () => {
|
|
1081
|
+
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener);
|
|
1082
|
+
};
|
|
1083
|
+
}, [context]);
|
|
1084
|
+
return quirks;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// src/components/VisibilityRulesWrapperClient.tsx
|
|
1088
|
+
import { Fragment as Fragment6, jsx as jsx4 } from "react/jsx-runtime";
|
|
1089
|
+
var VisibilityRulesWrapperClient = ({
|
|
1090
|
+
parameter,
|
|
1091
|
+
initialIsVisible,
|
|
1092
|
+
children
|
|
1093
|
+
}) => {
|
|
1094
|
+
const [isVisible, setIsVisible] = useState8(initialIsVisible);
|
|
1095
|
+
const [visibleSource, setVisibleSource] = useState8(
|
|
1096
|
+
initialIsVisible === null ? "unknown" : "server"
|
|
1097
|
+
);
|
|
1098
|
+
const quirks = useQuirks();
|
|
1099
|
+
const rules = useMemo3(() => {
|
|
1100
|
+
return {
|
|
1101
|
+
...createQuirksVisibilityRule(quirks)
|
|
1102
|
+
};
|
|
1103
|
+
}, [quirks]);
|
|
1104
|
+
useEffect10(() => {
|
|
1105
|
+
const result = evaluateNodeVisibilityParameter({
|
|
1106
|
+
rules,
|
|
1107
|
+
parameter
|
|
1108
|
+
});
|
|
1109
|
+
if (visibleSource === "server" && initialIsVisible && !result) {
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
setIsVisible(result);
|
|
1113
|
+
setVisibleSource("client");
|
|
1114
|
+
}, [initialIsVisible, visibleSource, parameter, rules]);
|
|
1115
|
+
return isVisible ? /* @__PURE__ */ jsx4(Fragment6, { children }) : null;
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
// src/hooks/useScores.ts
|
|
1119
|
+
import { useEffect as useEffect11, useState as useState9 } from "react";
|
|
1120
|
+
function useScores() {
|
|
1121
|
+
const { context } = useUniformContext();
|
|
1122
|
+
const [scores, setScores] = useState9(context == null ? void 0 : context.scores);
|
|
1123
|
+
useEffect11(() => {
|
|
1124
|
+
if (!context) {
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
const scoringChangeListener = (updatedScores) => {
|
|
1128
|
+
setScores(updatedScores);
|
|
1129
|
+
};
|
|
1130
|
+
setScores(context.scores);
|
|
1131
|
+
context.events.on("scoresUpdated", scoringChangeListener);
|
|
1132
|
+
return () => {
|
|
1133
|
+
context.events.off("scoresUpdated", scoringChangeListener);
|
|
1134
|
+
};
|
|
1135
|
+
}, [context]);
|
|
1136
|
+
return scores;
|
|
1137
|
+
}
|
|
1060
1138
|
export {
|
|
1061
1139
|
ClientContextPersonalizationTransfer,
|
|
1062
1140
|
ClientContextTestTransfer,
|
|
@@ -1067,8 +1145,11 @@ export {
|
|
|
1067
1145
|
PersonalizeClient,
|
|
1068
1146
|
TestClient,
|
|
1069
1147
|
UniformScript,
|
|
1148
|
+
VisibilityRulesWrapperClient,
|
|
1070
1149
|
createClientUniformContext,
|
|
1071
1150
|
useInitUniformContext,
|
|
1151
|
+
useQuirks,
|
|
1152
|
+
useScores,
|
|
1072
1153
|
useUniformContext
|
|
1073
1154
|
};
|
|
1074
1155
|
/*! Bundled license information:
|
package/dist/index.js
CHANGED
|
@@ -31,9 +31,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
));
|
|
32
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
33
|
|
|
34
|
-
// ../../node_modules/.pnpm/rfdc@1.
|
|
34
|
+
// ../../node_modules/.pnpm/rfdc@1.4.1/node_modules/rfdc/index.js
|
|
35
35
|
var require_rfdc = __commonJS({
|
|
36
|
-
"../../node_modules/.pnpm/rfdc@1.
|
|
36
|
+
"../../node_modules/.pnpm/rfdc@1.4.1/node_modules/rfdc/index.js"(exports2, module2) {
|
|
37
37
|
"use strict";
|
|
38
38
|
module2.exports = rfdc4;
|
|
39
39
|
function copyBuffer(cur) {
|
|
@@ -45,17 +45,27 @@ var require_rfdc = __commonJS({
|
|
|
45
45
|
function rfdc4(opts) {
|
|
46
46
|
opts = opts || {};
|
|
47
47
|
if (opts.circles) return rfdcCircles(opts);
|
|
48
|
+
const constructorHandlers = /* @__PURE__ */ new Map();
|
|
49
|
+
constructorHandlers.set(Date, (o) => new Date(o));
|
|
50
|
+
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
51
|
+
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
52
|
+
if (opts.constructorHandlers) {
|
|
53
|
+
for (const handler2 of opts.constructorHandlers) {
|
|
54
|
+
constructorHandlers.set(handler2[0], handler2[1]);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
let handler = null;
|
|
48
58
|
return opts.proto ? cloneProto : clone2;
|
|
49
59
|
function cloneArray(a, fn) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
for (
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
const keys = Object.keys(a);
|
|
61
|
+
const a2 = new Array(keys.length);
|
|
62
|
+
for (let i = 0; i < keys.length; i++) {
|
|
63
|
+
const k = keys[i];
|
|
64
|
+
const cur = a[k];
|
|
55
65
|
if (typeof cur !== "object" || cur === null) {
|
|
56
66
|
a2[k] = cur;
|
|
57
|
-
} else if (cur
|
|
58
|
-
a2[k] =
|
|
67
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
68
|
+
a2[k] = handler(cur, fn);
|
|
59
69
|
} else if (ArrayBuffer.isView(cur)) {
|
|
60
70
|
a2[k] = copyBuffer(cur);
|
|
61
71
|
} else {
|
|
@@ -66,22 +76,18 @@ var require_rfdc = __commonJS({
|
|
|
66
76
|
}
|
|
67
77
|
function clone2(o) {
|
|
68
78
|
if (typeof o !== "object" || o === null) return o;
|
|
69
|
-
if (o instanceof Date) return new Date(o);
|
|
70
79
|
if (Array.isArray(o)) return cloneArray(o, clone2);
|
|
71
|
-
if (o
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
81
|
+
return handler(o, clone2);
|
|
82
|
+
}
|
|
83
|
+
const o2 = {};
|
|
84
|
+
for (const k in o) {
|
|
75
85
|
if (Object.hasOwnProperty.call(o, k) === false) continue;
|
|
76
|
-
|
|
86
|
+
const cur = o[k];
|
|
77
87
|
if (typeof cur !== "object" || cur === null) {
|
|
78
88
|
o2[k] = cur;
|
|
79
|
-
} else if (cur
|
|
80
|
-
o2[k] =
|
|
81
|
-
} else if (cur instanceof Map) {
|
|
82
|
-
o2[k] = new Map(cloneArray(Array.from(cur), clone2));
|
|
83
|
-
} else if (cur instanceof Set) {
|
|
84
|
-
o2[k] = new Set(cloneArray(Array.from(cur), clone2));
|
|
89
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
90
|
+
o2[k] = handler(cur, clone2);
|
|
85
91
|
} else if (ArrayBuffer.isView(cur)) {
|
|
86
92
|
o2[k] = copyBuffer(cur);
|
|
87
93
|
} else {
|
|
@@ -92,21 +98,17 @@ var require_rfdc = __commonJS({
|
|
|
92
98
|
}
|
|
93
99
|
function cloneProto(o) {
|
|
94
100
|
if (typeof o !== "object" || o === null) return o;
|
|
95
|
-
if (o instanceof Date) return new Date(o);
|
|
96
101
|
if (Array.isArray(o)) return cloneArray(o, cloneProto);
|
|
97
|
-
if (o
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
103
|
+
return handler(o, cloneProto);
|
|
104
|
+
}
|
|
105
|
+
const o2 = {};
|
|
106
|
+
for (const k in o) {
|
|
107
|
+
const cur = o[k];
|
|
102
108
|
if (typeof cur !== "object" || cur === null) {
|
|
103
109
|
o2[k] = cur;
|
|
104
|
-
} else if (cur
|
|
105
|
-
o2[k] =
|
|
106
|
-
} else if (cur instanceof Map) {
|
|
107
|
-
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
|
|
108
|
-
} else if (cur instanceof Set) {
|
|
109
|
-
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
|
|
110
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
111
|
+
o2[k] = handler(cur, cloneProto);
|
|
110
112
|
} else if (ArrayBuffer.isView(cur)) {
|
|
111
113
|
o2[k] = copyBuffer(cur);
|
|
112
114
|
} else {
|
|
@@ -117,23 +119,33 @@ var require_rfdc = __commonJS({
|
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
121
|
function rfdcCircles(opts) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
const refs = [];
|
|
123
|
+
const refsNew = [];
|
|
124
|
+
const constructorHandlers = /* @__PURE__ */ new Map();
|
|
125
|
+
constructorHandlers.set(Date, (o) => new Date(o));
|
|
126
|
+
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
127
|
+
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
128
|
+
if (opts.constructorHandlers) {
|
|
129
|
+
for (const handler2 of opts.constructorHandlers) {
|
|
130
|
+
constructorHandlers.set(handler2[0], handler2[1]);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
let handler = null;
|
|
122
134
|
return opts.proto ? cloneProto : clone2;
|
|
123
135
|
function cloneArray(a, fn) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
for (
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
const keys = Object.keys(a);
|
|
137
|
+
const a2 = new Array(keys.length);
|
|
138
|
+
for (let i = 0; i < keys.length; i++) {
|
|
139
|
+
const k = keys[i];
|
|
140
|
+
const cur = a[k];
|
|
129
141
|
if (typeof cur !== "object" || cur === null) {
|
|
130
142
|
a2[k] = cur;
|
|
131
|
-
} else if (cur
|
|
132
|
-
a2[k] =
|
|
143
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
144
|
+
a2[k] = handler(cur, fn);
|
|
133
145
|
} else if (ArrayBuffer.isView(cur)) {
|
|
134
146
|
a2[k] = copyBuffer(cur);
|
|
135
147
|
} else {
|
|
136
|
-
|
|
148
|
+
const index = refs.indexOf(cur);
|
|
137
149
|
if (index !== -1) {
|
|
138
150
|
a2[k] = refsNew[index];
|
|
139
151
|
} else {
|
|
@@ -145,28 +157,24 @@ var require_rfdc = __commonJS({
|
|
|
145
157
|
}
|
|
146
158
|
function clone2(o) {
|
|
147
159
|
if (typeof o !== "object" || o === null) return o;
|
|
148
|
-
if (o instanceof Date) return new Date(o);
|
|
149
160
|
if (Array.isArray(o)) return cloneArray(o, clone2);
|
|
150
|
-
if (o
|
|
151
|
-
|
|
152
|
-
|
|
161
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
162
|
+
return handler(o, clone2);
|
|
163
|
+
}
|
|
164
|
+
const o2 = {};
|
|
153
165
|
refs.push(o);
|
|
154
166
|
refsNew.push(o2);
|
|
155
|
-
for (
|
|
167
|
+
for (const k in o) {
|
|
156
168
|
if (Object.hasOwnProperty.call(o, k) === false) continue;
|
|
157
|
-
|
|
169
|
+
const cur = o[k];
|
|
158
170
|
if (typeof cur !== "object" || cur === null) {
|
|
159
171
|
o2[k] = cur;
|
|
160
|
-
} else if (cur
|
|
161
|
-
o2[k] =
|
|
162
|
-
} else if (cur instanceof Map) {
|
|
163
|
-
o2[k] = new Map(cloneArray(Array.from(cur), clone2));
|
|
164
|
-
} else if (cur instanceof Set) {
|
|
165
|
-
o2[k] = new Set(cloneArray(Array.from(cur), clone2));
|
|
172
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
173
|
+
o2[k] = handler(cur, clone2);
|
|
166
174
|
} else if (ArrayBuffer.isView(cur)) {
|
|
167
175
|
o2[k] = copyBuffer(cur);
|
|
168
176
|
} else {
|
|
169
|
-
|
|
177
|
+
const i = refs.indexOf(cur);
|
|
170
178
|
if (i !== -1) {
|
|
171
179
|
o2[k] = refsNew[i];
|
|
172
180
|
} else {
|
|
@@ -180,27 +188,23 @@ var require_rfdc = __commonJS({
|
|
|
180
188
|
}
|
|
181
189
|
function cloneProto(o) {
|
|
182
190
|
if (typeof o !== "object" || o === null) return o;
|
|
183
|
-
if (o instanceof Date) return new Date(o);
|
|
184
191
|
if (Array.isArray(o)) return cloneArray(o, cloneProto);
|
|
185
|
-
if (o
|
|
186
|
-
|
|
187
|
-
|
|
192
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
193
|
+
return handler(o, cloneProto);
|
|
194
|
+
}
|
|
195
|
+
const o2 = {};
|
|
188
196
|
refs.push(o);
|
|
189
197
|
refsNew.push(o2);
|
|
190
|
-
for (
|
|
191
|
-
|
|
198
|
+
for (const k in o) {
|
|
199
|
+
const cur = o[k];
|
|
192
200
|
if (typeof cur !== "object" || cur === null) {
|
|
193
201
|
o2[k] = cur;
|
|
194
|
-
} else if (cur
|
|
195
|
-
o2[k] =
|
|
196
|
-
} else if (cur instanceof Map) {
|
|
197
|
-
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
|
|
198
|
-
} else if (cur instanceof Set) {
|
|
199
|
-
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
|
|
202
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
203
|
+
o2[k] = handler(cur, cloneProto);
|
|
200
204
|
} else if (ArrayBuffer.isView(cur)) {
|
|
201
205
|
o2[k] = copyBuffer(cur);
|
|
202
206
|
} else {
|
|
203
|
-
|
|
207
|
+
const i = refs.indexOf(cur);
|
|
204
208
|
if (i !== -1) {
|
|
205
209
|
o2[k] = refsNew[i];
|
|
206
210
|
} else {
|
|
@@ -228,8 +232,11 @@ __export(src_exports, {
|
|
|
228
232
|
PersonalizeClient: () => PersonalizeClient,
|
|
229
233
|
TestClient: () => TestClient,
|
|
230
234
|
UniformScript: () => UniformScript,
|
|
235
|
+
VisibilityRulesWrapperClient: () => VisibilityRulesWrapperClient,
|
|
231
236
|
createClientUniformContext: () => createClientUniformContext,
|
|
232
237
|
useInitUniformContext: () => useInitUniformContext,
|
|
238
|
+
useQuirks: () => useQuirks,
|
|
239
|
+
useScores: () => useScores,
|
|
233
240
|
useUniformContext: () => useUniformContext
|
|
234
241
|
});
|
|
235
242
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -492,9 +499,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
492
499
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
493
500
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
494
501
|
var ENR_SEPARATOR = "_";
|
|
495
|
-
var _signal;
|
|
496
502
|
var _id;
|
|
497
|
-
_signal = /* @__PURE__ */ new WeakMap();
|
|
498
503
|
_id = /* @__PURE__ */ new WeakMap();
|
|
499
504
|
var _evaluator;
|
|
500
505
|
var _onLogMessage;
|
|
@@ -647,20 +652,15 @@ replaceData_fn = function(data, quiet = false) {
|
|
|
647
652
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
648
653
|
const oldData = __privateGet(this, _VisitorDataStore_instances, currentData_get);
|
|
649
654
|
const now = Date.now();
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
scores: data.scores,
|
|
660
|
-
sessionScores: data.sessionScores,
|
|
661
|
-
onLogMessage: __privateGet(this, _options).onLogMessage
|
|
662
|
-
});
|
|
663
|
-
}
|
|
655
|
+
__privateMethod(this, _VisitorDataStore_instances, handleCaps_fn).call(this, data.scores);
|
|
656
|
+
__privateMethod(this, _VisitorDataStore_instances, handleCaps_fn).call(this, data.sessionScores);
|
|
657
|
+
(_b = (_a = __privateGet(this, _options)).decay) == null ? void 0 : _b.call(_a, {
|
|
658
|
+
now,
|
|
659
|
+
lastUpd: oldData == null ? void 0 : oldData.updated,
|
|
660
|
+
scores: data.scores,
|
|
661
|
+
sessionScores: data.sessionScores,
|
|
662
|
+
onLogMessage: __privateGet(this, _options).onLogMessage
|
|
663
|
+
});
|
|
664
664
|
const haveScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.scores, data.scores);
|
|
665
665
|
const haveSessionScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.sessionScores, data.sessionScores);
|
|
666
666
|
const haveQuirksChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.quirks, data.quirks);
|
|
@@ -1075,6 +1075,84 @@ var UniformScript = () => {
|
|
|
1075
1075
|
}, [router]);
|
|
1076
1076
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {});
|
|
1077
1077
|
};
|
|
1078
|
+
|
|
1079
|
+
// src/components/VisibilityRulesWrapperClient.tsx
|
|
1080
|
+
var import_canvas5 = require("@uniformdev/canvas");
|
|
1081
|
+
var import_react12 = require("react");
|
|
1082
|
+
|
|
1083
|
+
// src/hooks/useQuirks.ts
|
|
1084
|
+
var import_react11 = require("react");
|
|
1085
|
+
function useQuirks() {
|
|
1086
|
+
var _a;
|
|
1087
|
+
const { context } = useUniformContext();
|
|
1088
|
+
const [quirks, setQuirks] = (0, import_react11.useState)((_a = context == null ? void 0 : context.quirks) != null ? _a : {});
|
|
1089
|
+
(0, import_react11.useEffect)(() => {
|
|
1090
|
+
if (!context) {
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
const quirkChangeListener = (updatedQuirks) => {
|
|
1094
|
+
setQuirks(updatedQuirks);
|
|
1095
|
+
};
|
|
1096
|
+
setQuirks(context.quirks);
|
|
1097
|
+
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener);
|
|
1098
|
+
return () => {
|
|
1099
|
+
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener);
|
|
1100
|
+
};
|
|
1101
|
+
}, [context]);
|
|
1102
|
+
return quirks;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
// src/components/VisibilityRulesWrapperClient.tsx
|
|
1106
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1107
|
+
var VisibilityRulesWrapperClient = ({
|
|
1108
|
+
parameter,
|
|
1109
|
+
initialIsVisible,
|
|
1110
|
+
children
|
|
1111
|
+
}) => {
|
|
1112
|
+
const [isVisible, setIsVisible] = (0, import_react12.useState)(initialIsVisible);
|
|
1113
|
+
const [visibleSource, setVisibleSource] = (0, import_react12.useState)(
|
|
1114
|
+
initialIsVisible === null ? "unknown" : "server"
|
|
1115
|
+
);
|
|
1116
|
+
const quirks = useQuirks();
|
|
1117
|
+
const rules = (0, import_react12.useMemo)(() => {
|
|
1118
|
+
return {
|
|
1119
|
+
...(0, import_canvas5.createQuirksVisibilityRule)(quirks)
|
|
1120
|
+
};
|
|
1121
|
+
}, [quirks]);
|
|
1122
|
+
(0, import_react12.useEffect)(() => {
|
|
1123
|
+
const result = (0, import_canvas5.evaluateNodeVisibilityParameter)({
|
|
1124
|
+
rules,
|
|
1125
|
+
parameter
|
|
1126
|
+
});
|
|
1127
|
+
if (visibleSource === "server" && initialIsVisible && !result) {
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1130
|
+
setIsVisible(result);
|
|
1131
|
+
setVisibleSource("client");
|
|
1132
|
+
}, [initialIsVisible, visibleSource, parameter, rules]);
|
|
1133
|
+
return isVisible ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children }) : null;
|
|
1134
|
+
};
|
|
1135
|
+
|
|
1136
|
+
// src/hooks/useScores.ts
|
|
1137
|
+
var import_react13 = require("react");
|
|
1138
|
+
function useScores() {
|
|
1139
|
+
const { context } = useUniformContext();
|
|
1140
|
+
const [scores, setScores] = (0, import_react13.useState)(context == null ? void 0 : context.scores);
|
|
1141
|
+
(0, import_react13.useEffect)(() => {
|
|
1142
|
+
if (!context) {
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
const scoringChangeListener = (updatedScores) => {
|
|
1146
|
+
setScores(updatedScores);
|
|
1147
|
+
};
|
|
1148
|
+
setScores(context.scores);
|
|
1149
|
+
context.events.on("scoresUpdated", scoringChangeListener);
|
|
1150
|
+
return () => {
|
|
1151
|
+
context.events.off("scoresUpdated", scoringChangeListener);
|
|
1152
|
+
};
|
|
1153
|
+
}, [context]);
|
|
1154
|
+
return scores;
|
|
1155
|
+
}
|
|
1078
1156
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1079
1157
|
0 && (module.exports = {
|
|
1080
1158
|
ClientContextPersonalizationTransfer,
|
|
@@ -1086,8 +1164,11 @@ var UniformScript = () => {
|
|
|
1086
1164
|
PersonalizeClient,
|
|
1087
1165
|
TestClient,
|
|
1088
1166
|
UniformScript,
|
|
1167
|
+
VisibilityRulesWrapperClient,
|
|
1089
1168
|
createClientUniformContext,
|
|
1090
1169
|
useInitUniformContext,
|
|
1170
|
+
useQuirks,
|
|
1171
|
+
useScores,
|
|
1091
1172
|
useUniformContext
|
|
1092
1173
|
});
|
|
1093
1174
|
/*! Bundled license information:
|
package/dist/index.mjs
CHANGED
|
@@ -25,9 +25,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
|
|
28
|
-
// ../../node_modules/.pnpm/rfdc@1.
|
|
28
|
+
// ../../node_modules/.pnpm/rfdc@1.4.1/node_modules/rfdc/index.js
|
|
29
29
|
var require_rfdc = __commonJS({
|
|
30
|
-
"../../node_modules/.pnpm/rfdc@1.
|
|
30
|
+
"../../node_modules/.pnpm/rfdc@1.4.1/node_modules/rfdc/index.js"(exports, module) {
|
|
31
31
|
"use strict";
|
|
32
32
|
module.exports = rfdc4;
|
|
33
33
|
function copyBuffer(cur) {
|
|
@@ -39,17 +39,27 @@ var require_rfdc = __commonJS({
|
|
|
39
39
|
function rfdc4(opts) {
|
|
40
40
|
opts = opts || {};
|
|
41
41
|
if (opts.circles) return rfdcCircles(opts);
|
|
42
|
+
const constructorHandlers = /* @__PURE__ */ new Map();
|
|
43
|
+
constructorHandlers.set(Date, (o) => new Date(o));
|
|
44
|
+
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
45
|
+
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
46
|
+
if (opts.constructorHandlers) {
|
|
47
|
+
for (const handler2 of opts.constructorHandlers) {
|
|
48
|
+
constructorHandlers.set(handler2[0], handler2[1]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
let handler = null;
|
|
42
52
|
return opts.proto ? cloneProto : clone2;
|
|
43
53
|
function cloneArray(a, fn) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
for (
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
const keys = Object.keys(a);
|
|
55
|
+
const a2 = new Array(keys.length);
|
|
56
|
+
for (let i = 0; i < keys.length; i++) {
|
|
57
|
+
const k = keys[i];
|
|
58
|
+
const cur = a[k];
|
|
49
59
|
if (typeof cur !== "object" || cur === null) {
|
|
50
60
|
a2[k] = cur;
|
|
51
|
-
} else if (cur
|
|
52
|
-
a2[k] =
|
|
61
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
62
|
+
a2[k] = handler(cur, fn);
|
|
53
63
|
} else if (ArrayBuffer.isView(cur)) {
|
|
54
64
|
a2[k] = copyBuffer(cur);
|
|
55
65
|
} else {
|
|
@@ -60,22 +70,18 @@ var require_rfdc = __commonJS({
|
|
|
60
70
|
}
|
|
61
71
|
function clone2(o) {
|
|
62
72
|
if (typeof o !== "object" || o === null) return o;
|
|
63
|
-
if (o instanceof Date) return new Date(o);
|
|
64
73
|
if (Array.isArray(o)) return cloneArray(o, clone2);
|
|
65
|
-
if (o
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
75
|
+
return handler(o, clone2);
|
|
76
|
+
}
|
|
77
|
+
const o2 = {};
|
|
78
|
+
for (const k in o) {
|
|
69
79
|
if (Object.hasOwnProperty.call(o, k) === false) continue;
|
|
70
|
-
|
|
80
|
+
const cur = o[k];
|
|
71
81
|
if (typeof cur !== "object" || cur === null) {
|
|
72
82
|
o2[k] = cur;
|
|
73
|
-
} else if (cur
|
|
74
|
-
o2[k] =
|
|
75
|
-
} else if (cur instanceof Map) {
|
|
76
|
-
o2[k] = new Map(cloneArray(Array.from(cur), clone2));
|
|
77
|
-
} else if (cur instanceof Set) {
|
|
78
|
-
o2[k] = new Set(cloneArray(Array.from(cur), clone2));
|
|
83
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
84
|
+
o2[k] = handler(cur, clone2);
|
|
79
85
|
} else if (ArrayBuffer.isView(cur)) {
|
|
80
86
|
o2[k] = copyBuffer(cur);
|
|
81
87
|
} else {
|
|
@@ -86,21 +92,17 @@ var require_rfdc = __commonJS({
|
|
|
86
92
|
}
|
|
87
93
|
function cloneProto(o) {
|
|
88
94
|
if (typeof o !== "object" || o === null) return o;
|
|
89
|
-
if (o instanceof Date) return new Date(o);
|
|
90
95
|
if (Array.isArray(o)) return cloneArray(o, cloneProto);
|
|
91
|
-
if (o
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
97
|
+
return handler(o, cloneProto);
|
|
98
|
+
}
|
|
99
|
+
const o2 = {};
|
|
100
|
+
for (const k in o) {
|
|
101
|
+
const cur = o[k];
|
|
96
102
|
if (typeof cur !== "object" || cur === null) {
|
|
97
103
|
o2[k] = cur;
|
|
98
|
-
} else if (cur
|
|
99
|
-
o2[k] =
|
|
100
|
-
} else if (cur instanceof Map) {
|
|
101
|
-
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
|
|
102
|
-
} else if (cur instanceof Set) {
|
|
103
|
-
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
|
|
104
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
105
|
+
o2[k] = handler(cur, cloneProto);
|
|
104
106
|
} else if (ArrayBuffer.isView(cur)) {
|
|
105
107
|
o2[k] = copyBuffer(cur);
|
|
106
108
|
} else {
|
|
@@ -111,23 +113,33 @@ var require_rfdc = __commonJS({
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
function rfdcCircles(opts) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
const refs = [];
|
|
117
|
+
const refsNew = [];
|
|
118
|
+
const constructorHandlers = /* @__PURE__ */ new Map();
|
|
119
|
+
constructorHandlers.set(Date, (o) => new Date(o));
|
|
120
|
+
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
121
|
+
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
122
|
+
if (opts.constructorHandlers) {
|
|
123
|
+
for (const handler2 of opts.constructorHandlers) {
|
|
124
|
+
constructorHandlers.set(handler2[0], handler2[1]);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
let handler = null;
|
|
116
128
|
return opts.proto ? cloneProto : clone2;
|
|
117
129
|
function cloneArray(a, fn) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
for (
|
|
121
|
-
|
|
122
|
-
|
|
130
|
+
const keys = Object.keys(a);
|
|
131
|
+
const a2 = new Array(keys.length);
|
|
132
|
+
for (let i = 0; i < keys.length; i++) {
|
|
133
|
+
const k = keys[i];
|
|
134
|
+
const cur = a[k];
|
|
123
135
|
if (typeof cur !== "object" || cur === null) {
|
|
124
136
|
a2[k] = cur;
|
|
125
|
-
} else if (cur
|
|
126
|
-
a2[k] =
|
|
137
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
138
|
+
a2[k] = handler(cur, fn);
|
|
127
139
|
} else if (ArrayBuffer.isView(cur)) {
|
|
128
140
|
a2[k] = copyBuffer(cur);
|
|
129
141
|
} else {
|
|
130
|
-
|
|
142
|
+
const index = refs.indexOf(cur);
|
|
131
143
|
if (index !== -1) {
|
|
132
144
|
a2[k] = refsNew[index];
|
|
133
145
|
} else {
|
|
@@ -139,28 +151,24 @@ var require_rfdc = __commonJS({
|
|
|
139
151
|
}
|
|
140
152
|
function clone2(o) {
|
|
141
153
|
if (typeof o !== "object" || o === null) return o;
|
|
142
|
-
if (o instanceof Date) return new Date(o);
|
|
143
154
|
if (Array.isArray(o)) return cloneArray(o, clone2);
|
|
144
|
-
if (o
|
|
145
|
-
|
|
146
|
-
|
|
155
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
156
|
+
return handler(o, clone2);
|
|
157
|
+
}
|
|
158
|
+
const o2 = {};
|
|
147
159
|
refs.push(o);
|
|
148
160
|
refsNew.push(o2);
|
|
149
|
-
for (
|
|
161
|
+
for (const k in o) {
|
|
150
162
|
if (Object.hasOwnProperty.call(o, k) === false) continue;
|
|
151
|
-
|
|
163
|
+
const cur = o[k];
|
|
152
164
|
if (typeof cur !== "object" || cur === null) {
|
|
153
165
|
o2[k] = cur;
|
|
154
|
-
} else if (cur
|
|
155
|
-
o2[k] =
|
|
156
|
-
} else if (cur instanceof Map) {
|
|
157
|
-
o2[k] = new Map(cloneArray(Array.from(cur), clone2));
|
|
158
|
-
} else if (cur instanceof Set) {
|
|
159
|
-
o2[k] = new Set(cloneArray(Array.from(cur), clone2));
|
|
166
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
167
|
+
o2[k] = handler(cur, clone2);
|
|
160
168
|
} else if (ArrayBuffer.isView(cur)) {
|
|
161
169
|
o2[k] = copyBuffer(cur);
|
|
162
170
|
} else {
|
|
163
|
-
|
|
171
|
+
const i = refs.indexOf(cur);
|
|
164
172
|
if (i !== -1) {
|
|
165
173
|
o2[k] = refsNew[i];
|
|
166
174
|
} else {
|
|
@@ -174,27 +182,23 @@ var require_rfdc = __commonJS({
|
|
|
174
182
|
}
|
|
175
183
|
function cloneProto(o) {
|
|
176
184
|
if (typeof o !== "object" || o === null) return o;
|
|
177
|
-
if (o instanceof Date) return new Date(o);
|
|
178
185
|
if (Array.isArray(o)) return cloneArray(o, cloneProto);
|
|
179
|
-
if (o
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
187
|
+
return handler(o, cloneProto);
|
|
188
|
+
}
|
|
189
|
+
const o2 = {};
|
|
182
190
|
refs.push(o);
|
|
183
191
|
refsNew.push(o2);
|
|
184
|
-
for (
|
|
185
|
-
|
|
192
|
+
for (const k in o) {
|
|
193
|
+
const cur = o[k];
|
|
186
194
|
if (typeof cur !== "object" || cur === null) {
|
|
187
195
|
o2[k] = cur;
|
|
188
|
-
} else if (cur
|
|
189
|
-
o2[k] =
|
|
190
|
-
} else if (cur instanceof Map) {
|
|
191
|
-
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
|
|
192
|
-
} else if (cur instanceof Set) {
|
|
193
|
-
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
|
|
196
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
197
|
+
o2[k] = handler(cur, cloneProto);
|
|
194
198
|
} else if (ArrayBuffer.isView(cur)) {
|
|
195
199
|
o2[k] = copyBuffer(cur);
|
|
196
200
|
} else {
|
|
197
|
-
|
|
201
|
+
const i = refs.indexOf(cur);
|
|
198
202
|
if (i !== -1) {
|
|
199
203
|
o2[k] = refsNew[i];
|
|
200
204
|
} else {
|
|
@@ -470,9 +474,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
470
474
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
471
475
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
472
476
|
var ENR_SEPARATOR = "_";
|
|
473
|
-
var _signal;
|
|
474
477
|
var _id;
|
|
475
|
-
_signal = /* @__PURE__ */ new WeakMap();
|
|
476
478
|
_id = /* @__PURE__ */ new WeakMap();
|
|
477
479
|
var _evaluator;
|
|
478
480
|
var _onLogMessage;
|
|
@@ -625,20 +627,15 @@ replaceData_fn = function(data, quiet = false) {
|
|
|
625
627
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
626
628
|
const oldData = __privateGet(this, _VisitorDataStore_instances, currentData_get);
|
|
627
629
|
const now = Date.now();
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
scores: data.scores,
|
|
638
|
-
sessionScores: data.sessionScores,
|
|
639
|
-
onLogMessage: __privateGet(this, _options).onLogMessage
|
|
640
|
-
});
|
|
641
|
-
}
|
|
630
|
+
__privateMethod(this, _VisitorDataStore_instances, handleCaps_fn).call(this, data.scores);
|
|
631
|
+
__privateMethod(this, _VisitorDataStore_instances, handleCaps_fn).call(this, data.sessionScores);
|
|
632
|
+
(_b = (_a = __privateGet(this, _options)).decay) == null ? void 0 : _b.call(_a, {
|
|
633
|
+
now,
|
|
634
|
+
lastUpd: oldData == null ? void 0 : oldData.updated,
|
|
635
|
+
scores: data.scores,
|
|
636
|
+
sessionScores: data.sessionScores,
|
|
637
|
+
onLogMessage: __privateGet(this, _options).onLogMessage
|
|
638
|
+
});
|
|
642
639
|
const haveScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.scores, data.scores);
|
|
643
640
|
const haveSessionScoresChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.sessionScores, data.sessionScores);
|
|
644
641
|
const haveQuirksChanged = !dequal(oldData == null ? void 0 : oldData.visitorData.quirks, data.quirks);
|
|
@@ -1057,6 +1054,87 @@ var UniformScript = () => {
|
|
|
1057
1054
|
}, [router]);
|
|
1058
1055
|
return /* @__PURE__ */ jsx3(Fragment5, {});
|
|
1059
1056
|
};
|
|
1057
|
+
|
|
1058
|
+
// src/components/VisibilityRulesWrapperClient.tsx
|
|
1059
|
+
import {
|
|
1060
|
+
createQuirksVisibilityRule,
|
|
1061
|
+
evaluateNodeVisibilityParameter
|
|
1062
|
+
} from "@uniformdev/canvas";
|
|
1063
|
+
import { useEffect as useEffect10, useMemo as useMemo3, useState as useState8 } from "react";
|
|
1064
|
+
|
|
1065
|
+
// src/hooks/useQuirks.ts
|
|
1066
|
+
import { useEffect as useEffect9, useState as useState7 } from "react";
|
|
1067
|
+
function useQuirks() {
|
|
1068
|
+
var _a;
|
|
1069
|
+
const { context } = useUniformContext();
|
|
1070
|
+
const [quirks, setQuirks] = useState7((_a = context == null ? void 0 : context.quirks) != null ? _a : {});
|
|
1071
|
+
useEffect9(() => {
|
|
1072
|
+
if (!context) {
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
const quirkChangeListener = (updatedQuirks) => {
|
|
1076
|
+
setQuirks(updatedQuirks);
|
|
1077
|
+
};
|
|
1078
|
+
setQuirks(context.quirks);
|
|
1079
|
+
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener);
|
|
1080
|
+
return () => {
|
|
1081
|
+
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener);
|
|
1082
|
+
};
|
|
1083
|
+
}, [context]);
|
|
1084
|
+
return quirks;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// src/components/VisibilityRulesWrapperClient.tsx
|
|
1088
|
+
import { Fragment as Fragment6, jsx as jsx4 } from "react/jsx-runtime";
|
|
1089
|
+
var VisibilityRulesWrapperClient = ({
|
|
1090
|
+
parameter,
|
|
1091
|
+
initialIsVisible,
|
|
1092
|
+
children
|
|
1093
|
+
}) => {
|
|
1094
|
+
const [isVisible, setIsVisible] = useState8(initialIsVisible);
|
|
1095
|
+
const [visibleSource, setVisibleSource] = useState8(
|
|
1096
|
+
initialIsVisible === null ? "unknown" : "server"
|
|
1097
|
+
);
|
|
1098
|
+
const quirks = useQuirks();
|
|
1099
|
+
const rules = useMemo3(() => {
|
|
1100
|
+
return {
|
|
1101
|
+
...createQuirksVisibilityRule(quirks)
|
|
1102
|
+
};
|
|
1103
|
+
}, [quirks]);
|
|
1104
|
+
useEffect10(() => {
|
|
1105
|
+
const result = evaluateNodeVisibilityParameter({
|
|
1106
|
+
rules,
|
|
1107
|
+
parameter
|
|
1108
|
+
});
|
|
1109
|
+
if (visibleSource === "server" && initialIsVisible && !result) {
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
setIsVisible(result);
|
|
1113
|
+
setVisibleSource("client");
|
|
1114
|
+
}, [initialIsVisible, visibleSource, parameter, rules]);
|
|
1115
|
+
return isVisible ? /* @__PURE__ */ jsx4(Fragment6, { children }) : null;
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
// src/hooks/useScores.ts
|
|
1119
|
+
import { useEffect as useEffect11, useState as useState9 } from "react";
|
|
1120
|
+
function useScores() {
|
|
1121
|
+
const { context } = useUniformContext();
|
|
1122
|
+
const [scores, setScores] = useState9(context == null ? void 0 : context.scores);
|
|
1123
|
+
useEffect11(() => {
|
|
1124
|
+
if (!context) {
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
const scoringChangeListener = (updatedScores) => {
|
|
1128
|
+
setScores(updatedScores);
|
|
1129
|
+
};
|
|
1130
|
+
setScores(context.scores);
|
|
1131
|
+
context.events.on("scoresUpdated", scoringChangeListener);
|
|
1132
|
+
return () => {
|
|
1133
|
+
context.events.off("scoresUpdated", scoringChangeListener);
|
|
1134
|
+
};
|
|
1135
|
+
}, [context]);
|
|
1136
|
+
return scores;
|
|
1137
|
+
}
|
|
1060
1138
|
export {
|
|
1061
1139
|
ClientContextPersonalizationTransfer,
|
|
1062
1140
|
ClientContextTestTransfer,
|
|
@@ -1067,8 +1145,11 @@ export {
|
|
|
1067
1145
|
PersonalizeClient,
|
|
1068
1146
|
TestClient,
|
|
1069
1147
|
UniformScript,
|
|
1148
|
+
VisibilityRulesWrapperClient,
|
|
1070
1149
|
createClientUniformContext,
|
|
1071
1150
|
useInitUniformContext,
|
|
1151
|
+
useQuirks,
|
|
1152
|
+
useScores,
|
|
1072
1153
|
useUniformContext
|
|
1073
1154
|
};
|
|
1074
1155
|
/*! Bundled license information:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc-client",
|
|
3
|
-
"version": "19.173.
|
|
3
|
+
"version": "19.173.2-alpha.210+4f0f6ff104",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
"/dist"
|
|
25
25
|
],
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@types/node": "
|
|
28
|
-
"@types/react": "18.
|
|
29
|
-
"eslint": "
|
|
27
|
+
"@types/node": "20.10.6",
|
|
28
|
+
"@types/react": "18.3.3",
|
|
29
|
+
"eslint": "9.9.0",
|
|
30
30
|
"next": "^14.0.0",
|
|
31
|
-
"react": "18.
|
|
32
|
-
"react-dom": "18.
|
|
31
|
+
"react": "18.3.1",
|
|
32
|
+
"react-dom": "18.3.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@uniformdev/canvas": "19.173.
|
|
36
|
-
"@uniformdev/canvas-next-rsc-shared": "^19.173.
|
|
37
|
-
"@uniformdev/canvas-react": "^19.173.
|
|
35
|
+
"@uniformdev/canvas": "19.173.2-alpha.210+4f0f6ff104",
|
|
36
|
+
"@uniformdev/canvas-next-rsc-shared": "^19.173.2-alpha.210+4f0f6ff104",
|
|
37
|
+
"@uniformdev/canvas-react": "^19.173.2-alpha.210+4f0f6ff104"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">=16.14.0"
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "4f0f6ff104f46349c338fde461f063f22f04ce0e"
|
|
51
51
|
}
|