@uniformdev/canvas-next-rsc-shared 20.8.1 → 20.8.2-alpha.21
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 +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.esm.js +10 -25
- package/dist/index.js +10 -25
- package/dist/index.mjs +10 -25
- package/package.json +6 -5
package/dist/index.d.mts
CHANGED
|
@@ -216,16 +216,17 @@ declare class AppDirectoryContextInstance implements AppDirectoryContext {
|
|
|
216
216
|
type PersonalizeProps = {
|
|
217
217
|
trackingEventName: string;
|
|
218
218
|
count: number | string | undefined;
|
|
219
|
+
algorithm?: string;
|
|
219
220
|
};
|
|
220
221
|
type PersonalizeWithContextComponentProps = ComponentProps<PersonalizeProps> & {
|
|
221
222
|
contextInstance: AppDirectoryServerContext;
|
|
222
223
|
};
|
|
223
224
|
|
|
224
|
-
|
|
225
|
-
component: ComponentProps[
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}) => {
|
|
225
|
+
interface RunPersonalizationProps extends PersonalizeProps {
|
|
226
|
+
component: ComponentProps['component'];
|
|
227
|
+
contextInstance: Pick<ContextInstance, 'personalize'> | undefined;
|
|
228
|
+
}
|
|
229
|
+
declare const runPersonalization: ({ component, trackingEventName, count, algorithm, contextInstance, }: RunPersonalizationProps) => {
|
|
229
230
|
indexes: number[];
|
|
230
231
|
event: PersonalizationEvent;
|
|
231
232
|
};
|
|
@@ -249,4 +250,4 @@ declare const resolvePath: ({ params }: Pick<AwaitedPageParameters, "params">) =
|
|
|
249
250
|
|
|
250
251
|
declare function getBaseUrl(): string;
|
|
251
252
|
|
|
252
|
-
export { type AppDirectoryContext, AppDirectoryContextInstance, type AppDirectoryContextState, type AppDirectoryServerContext, type AwaitedPageParameters, type AwaitedPlaygroundParameters, type CacheMode, type ComponentProps, type CompositionContext, type CreateUniformContextOptions, type PageParameters, type PersonalizeProps, type PersonalizeWithContextComponentProps, type PlaygroundParameters, type ResolvePathResult, type SlotDefinition, type TestProps, type UniformServerConfig, createUniformContext, getBaseUrl, resolvePath, runPersonalization, runTest };
|
|
253
|
+
export { type AppDirectoryContext, AppDirectoryContextInstance, type AppDirectoryContextState, type AppDirectoryServerContext, type AwaitedPageParameters, type AwaitedPlaygroundParameters, type CacheMode, type ComponentProps, type CompositionContext, type CreateUniformContextOptions, type PageParameters, type PersonalizeProps, type PersonalizeWithContextComponentProps, type PlaygroundParameters, type ResolvePathResult, type RunPersonalizationProps, type SlotDefinition, type TestProps, type UniformServerConfig, createUniformContext, getBaseUrl, resolvePath, runPersonalization, runTest };
|
package/dist/index.d.ts
CHANGED
|
@@ -216,16 +216,17 @@ declare class AppDirectoryContextInstance implements AppDirectoryContext {
|
|
|
216
216
|
type PersonalizeProps = {
|
|
217
217
|
trackingEventName: string;
|
|
218
218
|
count: number | string | undefined;
|
|
219
|
+
algorithm?: string;
|
|
219
220
|
};
|
|
220
221
|
type PersonalizeWithContextComponentProps = ComponentProps<PersonalizeProps> & {
|
|
221
222
|
contextInstance: AppDirectoryServerContext;
|
|
222
223
|
};
|
|
223
224
|
|
|
224
|
-
|
|
225
|
-
component: ComponentProps[
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}) => {
|
|
225
|
+
interface RunPersonalizationProps extends PersonalizeProps {
|
|
226
|
+
component: ComponentProps['component'];
|
|
227
|
+
contextInstance: Pick<ContextInstance, 'personalize'> | undefined;
|
|
228
|
+
}
|
|
229
|
+
declare const runPersonalization: ({ component, trackingEventName, count, algorithm, contextInstance, }: RunPersonalizationProps) => {
|
|
229
230
|
indexes: number[];
|
|
230
231
|
event: PersonalizationEvent;
|
|
231
232
|
};
|
|
@@ -249,4 +250,4 @@ declare const resolvePath: ({ params }: Pick<AwaitedPageParameters, "params">) =
|
|
|
249
250
|
|
|
250
251
|
declare function getBaseUrl(): string;
|
|
251
252
|
|
|
252
|
-
export { type AppDirectoryContext, AppDirectoryContextInstance, type AppDirectoryContextState, type AppDirectoryServerContext, type AwaitedPageParameters, type AwaitedPlaygroundParameters, type CacheMode, type ComponentProps, type CompositionContext, type CreateUniformContextOptions, type PageParameters, type PersonalizeProps, type PersonalizeWithContextComponentProps, type PlaygroundParameters, type ResolvePathResult, type SlotDefinition, type TestProps, type UniformServerConfig, createUniformContext, getBaseUrl, resolvePath, runPersonalization, runTest };
|
|
253
|
+
export { type AppDirectoryContext, AppDirectoryContextInstance, type AppDirectoryContextState, type AppDirectoryServerContext, type AwaitedPageParameters, type AwaitedPlaygroundParameters, type CacheMode, type ComponentProps, type CompositionContext, type CreateUniformContextOptions, type PageParameters, type PersonalizeProps, type PersonalizeWithContextComponentProps, type PlaygroundParameters, type ResolvePathResult, type RunPersonalizationProps, type SlotDefinition, type TestProps, type UniformServerConfig, createUniformContext, getBaseUrl, resolvePath, runPersonalization, runTest };
|
package/dist/index.esm.js
CHANGED
|
@@ -176,13 +176,14 @@ var runPersonalization = ({
|
|
|
176
176
|
component,
|
|
177
177
|
trackingEventName,
|
|
178
178
|
count,
|
|
179
|
+
algorithm,
|
|
179
180
|
contextInstance
|
|
180
181
|
}) => {
|
|
181
|
-
var _a
|
|
182
|
+
var _a;
|
|
182
183
|
const slot = ((_a = component.slots) == null ? void 0 : _a[CANVAS_PERSONALIZE_SLOT]) || [];
|
|
183
184
|
const componentVariations = slot.map((v, i) => {
|
|
184
|
-
var _a2,
|
|
185
|
-
const contextTag = (
|
|
185
|
+
var _a2, _b;
|
|
186
|
+
const contextTag = (_b = (_a2 = v.parameters) == null ? void 0 : _a2[CANVAS_PERSONALIZATION_PARAM]) == null ? void 0 : _b.value;
|
|
186
187
|
const id = v._id || `pz-${i}-${v.type}`;
|
|
187
188
|
return {
|
|
188
189
|
id,
|
|
@@ -204,35 +205,19 @@ var runPersonalization = ({
|
|
|
204
205
|
const { variations } = contextInstance.personalize({
|
|
205
206
|
name: trackingEventName,
|
|
206
207
|
take: parsedCount,
|
|
207
|
-
variations: componentVariations
|
|
208
|
+
variations: componentVariations,
|
|
209
|
+
algorithm
|
|
208
210
|
});
|
|
209
211
|
if (variations) {
|
|
210
212
|
for (let i = 0; i < variations.length; i++) {
|
|
211
|
-
|
|
213
|
+
const currentVariation = variations[i];
|
|
214
|
+
indexes.push(currentVariation.index);
|
|
212
215
|
variantIds.push({
|
|
213
|
-
id:
|
|
214
|
-
control:
|
|
216
|
+
id: currentVariation.id,
|
|
217
|
+
control: currentVariation.control
|
|
215
218
|
});
|
|
216
219
|
}
|
|
217
220
|
}
|
|
218
|
-
} else {
|
|
219
|
-
const defaults = [];
|
|
220
|
-
for (let i = 0; i < componentVariations.length; i++) {
|
|
221
|
-
const v = componentVariations[i];
|
|
222
|
-
if (!((_b = v.pz) == null ? void 0 : _b.crit)) {
|
|
223
|
-
defaults.push(v.index);
|
|
224
|
-
if (defaults.length >= (parsedCount || 1)) {
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
indexes.push(...defaults);
|
|
230
|
-
variantIds.push(
|
|
231
|
-
...defaults.map((i) => ({
|
|
232
|
-
id: componentVariations[i].id,
|
|
233
|
-
control: false
|
|
234
|
-
}))
|
|
235
|
-
);
|
|
236
221
|
}
|
|
237
222
|
const event = {
|
|
238
223
|
name: trackingEventName,
|
package/dist/index.js
CHANGED
|
@@ -203,13 +203,14 @@ var runPersonalization = ({
|
|
|
203
203
|
component,
|
|
204
204
|
trackingEventName,
|
|
205
205
|
count,
|
|
206
|
+
algorithm,
|
|
206
207
|
contextInstance
|
|
207
208
|
}) => {
|
|
208
|
-
var _a
|
|
209
|
+
var _a;
|
|
209
210
|
const slot = ((_a = component.slots) == null ? void 0 : _a[import_canvas.CANVAS_PERSONALIZE_SLOT]) || [];
|
|
210
211
|
const componentVariations = slot.map((v, i) => {
|
|
211
|
-
var _a2,
|
|
212
|
-
const contextTag = (
|
|
212
|
+
var _a2, _b;
|
|
213
|
+
const contextTag = (_b = (_a2 = v.parameters) == null ? void 0 : _a2[import_canvas.CANVAS_PERSONALIZATION_PARAM]) == null ? void 0 : _b.value;
|
|
213
214
|
const id = v._id || `pz-${i}-${v.type}`;
|
|
214
215
|
return {
|
|
215
216
|
id,
|
|
@@ -231,35 +232,19 @@ var runPersonalization = ({
|
|
|
231
232
|
const { variations } = contextInstance.personalize({
|
|
232
233
|
name: trackingEventName,
|
|
233
234
|
take: parsedCount,
|
|
234
|
-
variations: componentVariations
|
|
235
|
+
variations: componentVariations,
|
|
236
|
+
algorithm
|
|
235
237
|
});
|
|
236
238
|
if (variations) {
|
|
237
239
|
for (let i = 0; i < variations.length; i++) {
|
|
238
|
-
|
|
240
|
+
const currentVariation = variations[i];
|
|
241
|
+
indexes.push(currentVariation.index);
|
|
239
242
|
variantIds.push({
|
|
240
|
-
id:
|
|
241
|
-
control:
|
|
243
|
+
id: currentVariation.id,
|
|
244
|
+
control: currentVariation.control
|
|
242
245
|
});
|
|
243
246
|
}
|
|
244
247
|
}
|
|
245
|
-
} else {
|
|
246
|
-
const defaults = [];
|
|
247
|
-
for (let i = 0; i < componentVariations.length; i++) {
|
|
248
|
-
const v = componentVariations[i];
|
|
249
|
-
if (!((_b = v.pz) == null ? void 0 : _b.crit)) {
|
|
250
|
-
defaults.push(v.index);
|
|
251
|
-
if (defaults.length >= (parsedCount || 1)) {
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
indexes.push(...defaults);
|
|
257
|
-
variantIds.push(
|
|
258
|
-
...defaults.map((i) => ({
|
|
259
|
-
id: componentVariations[i].id,
|
|
260
|
-
control: false
|
|
261
|
-
}))
|
|
262
|
-
);
|
|
263
248
|
}
|
|
264
249
|
const event = {
|
|
265
250
|
name: trackingEventName,
|
package/dist/index.mjs
CHANGED
|
@@ -176,13 +176,14 @@ var runPersonalization = ({
|
|
|
176
176
|
component,
|
|
177
177
|
trackingEventName,
|
|
178
178
|
count,
|
|
179
|
+
algorithm,
|
|
179
180
|
contextInstance
|
|
180
181
|
}) => {
|
|
181
|
-
var _a
|
|
182
|
+
var _a;
|
|
182
183
|
const slot = ((_a = component.slots) == null ? void 0 : _a[CANVAS_PERSONALIZE_SLOT]) || [];
|
|
183
184
|
const componentVariations = slot.map((v, i) => {
|
|
184
|
-
var _a2,
|
|
185
|
-
const contextTag = (
|
|
185
|
+
var _a2, _b;
|
|
186
|
+
const contextTag = (_b = (_a2 = v.parameters) == null ? void 0 : _a2[CANVAS_PERSONALIZATION_PARAM]) == null ? void 0 : _b.value;
|
|
186
187
|
const id = v._id || `pz-${i}-${v.type}`;
|
|
187
188
|
return {
|
|
188
189
|
id,
|
|
@@ -204,35 +205,19 @@ var runPersonalization = ({
|
|
|
204
205
|
const { variations } = contextInstance.personalize({
|
|
205
206
|
name: trackingEventName,
|
|
206
207
|
take: parsedCount,
|
|
207
|
-
variations: componentVariations
|
|
208
|
+
variations: componentVariations,
|
|
209
|
+
algorithm
|
|
208
210
|
});
|
|
209
211
|
if (variations) {
|
|
210
212
|
for (let i = 0; i < variations.length; i++) {
|
|
211
|
-
|
|
213
|
+
const currentVariation = variations[i];
|
|
214
|
+
indexes.push(currentVariation.index);
|
|
212
215
|
variantIds.push({
|
|
213
|
-
id:
|
|
214
|
-
control:
|
|
216
|
+
id: currentVariation.id,
|
|
217
|
+
control: currentVariation.control
|
|
215
218
|
});
|
|
216
219
|
}
|
|
217
220
|
}
|
|
218
|
-
} else {
|
|
219
|
-
const defaults = [];
|
|
220
|
-
for (let i = 0; i < componentVariations.length; i++) {
|
|
221
|
-
const v = componentVariations[i];
|
|
222
|
-
if (!((_b = v.pz) == null ? void 0 : _b.crit)) {
|
|
223
|
-
defaults.push(v.index);
|
|
224
|
-
if (defaults.length >= (parsedCount || 1)) {
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
indexes.push(...defaults);
|
|
230
|
-
variantIds.push(
|
|
231
|
-
...defaults.map((i) => ({
|
|
232
|
-
id: componentVariations[i].id,
|
|
233
|
-
control: false
|
|
234
|
-
}))
|
|
235
|
-
);
|
|
236
221
|
}
|
|
237
222
|
const event = {
|
|
238
223
|
name: trackingEventName,
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc-shared",
|
|
3
|
-
"version": "20.8.
|
|
3
|
+
"version": "20.8.2-alpha.21+42bfa4ce42",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
7
7
|
"dev": "tsup --watch",
|
|
8
8
|
"lint": "eslint \"src/**/*.{ts,tsx}\" --fix",
|
|
9
|
-
"test": "jest --maxWorkers=1 --passWithNoTests"
|
|
9
|
+
"test": "jest --maxWorkers=1 --passWithNoTests",
|
|
10
|
+
"document": "api-extractor run --local"
|
|
10
11
|
},
|
|
11
12
|
"sideEffects": false,
|
|
12
13
|
"main": "./dist/index.js",
|
|
@@ -32,8 +33,8 @@
|
|
|
32
33
|
"react-dom": "18.3.1"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@uniformdev/canvas": "20.8.
|
|
36
|
-
"@uniformdev/context": "20.8.
|
|
36
|
+
"@uniformdev/canvas": "20.8.2-alpha.21+42bfa4ce42",
|
|
37
|
+
"@uniformdev/context": "20.8.2-alpha.21+42bfa4ce42"
|
|
37
38
|
},
|
|
38
39
|
"engines": {
|
|
39
40
|
"node": "^18.18.0 || ^19.8.0 || >= 20.0.0"
|
|
@@ -46,5 +47,5 @@
|
|
|
46
47
|
"publishConfig": {
|
|
47
48
|
"access": "public"
|
|
48
49
|
},
|
|
49
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "42bfa4ce42d4efdd35192096f1d4c23577e6cf2b"
|
|
50
51
|
}
|