@uniformdev/canvas-next-rsc-shared 19.75.1 → 19.76.0

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
- Next.js RSC SDK for Uniform Canvas
1
+ Next.js RSC SDK for Uniform
2
2
 
3
- **Note:** This package is in public preview.
3
+ To get started, follow our [Getting Started](https://docs.uniform.app/docs/learn/tutorials/nextjs-app-router) guide.
4
4
 
5
5
  part of the [Uniform Platform](https://uniform.app). See our [documentation](https://docs.uniform.app) for more details.
package/dist/index.d.mts CHANGED
@@ -136,16 +136,14 @@ declare const createUniformContext: ({ serverCookieValue, ...rest }: Omit<Contex
136
136
 
137
137
  type PersonalizeProps = {
138
138
  trackingEventName: string;
139
- count: number | undefined;
139
+ count: number | string | undefined;
140
140
  };
141
141
  type PersonalizeWithContextComponentProps = ComponentProps<PersonalizeProps> & {
142
142
  contextInstance: AppDirectoryServerContext;
143
143
  };
144
144
 
145
145
  declare const runPersonalization: ({ component, trackingEventName, count, contextInstance, }: PersonalizeProps & {
146
- component: _uniformdev_canvas.ComponentInstance;
147
- context: CompositionContext;
148
- slots: Record<string, SlotDefinition>;
146
+ component: ComponentProps['component'];
149
147
  } & {
150
148
  contextInstance: Pick<ContextInstance, 'personalize'> | undefined;
151
149
  }) => {
package/dist/index.d.ts CHANGED
@@ -136,16 +136,14 @@ declare const createUniformContext: ({ serverCookieValue, ...rest }: Omit<Contex
136
136
 
137
137
  type PersonalizeProps = {
138
138
  trackingEventName: string;
139
- count: number | undefined;
139
+ count: number | string | undefined;
140
140
  };
141
141
  type PersonalizeWithContextComponentProps = ComponentProps<PersonalizeProps> & {
142
142
  contextInstance: AppDirectoryServerContext;
143
143
  };
144
144
 
145
145
  declare const runPersonalization: ({ component, trackingEventName, count, contextInstance, }: PersonalizeProps & {
146
- component: _uniformdev_canvas.ComponentInstance;
147
- context: CompositionContext;
148
- slots: Record<string, SlotDefinition>;
146
+ component: ComponentProps['component'];
149
147
  } & {
150
148
  contextInstance: Pick<ContextInstance, 'personalize'> | undefined;
151
149
  }) => {
package/dist/index.esm.js CHANGED
@@ -154,10 +154,18 @@ var runPersonalization = ({
154
154
  };
155
155
  });
156
156
  const indexes = [];
157
+ let parsedCount;
158
+ if (typeof count === "string") {
159
+ parsedCount = parseInt(count, 10);
160
+ } else if (typeof count !== "number") {
161
+ parsedCount = void 0;
162
+ } else {
163
+ parsedCount = count || 1;
164
+ }
157
165
  if (contextInstance) {
158
166
  const { variations } = contextInstance.personalize({
159
167
  name: trackingEventName,
160
- take: count || 1,
168
+ take: parsedCount,
161
169
  variations: componentVariations
162
170
  });
163
171
  if (variations) {
@@ -171,7 +179,7 @@ var runPersonalization = ({
171
179
  const v = componentVariations[i];
172
180
  if (!((_b = v.pz) == null ? void 0 : _b.crit)) {
173
181
  defaults.push(v.index);
174
- if (defaults.length >= (count || 1)) {
182
+ if (defaults.length >= (parsedCount || 1)) {
175
183
  break;
176
184
  }
177
185
  }
package/dist/index.js CHANGED
@@ -177,10 +177,18 @@ var runPersonalization = ({
177
177
  };
178
178
  });
179
179
  const indexes = [];
180
+ let parsedCount;
181
+ if (typeof count === "string") {
182
+ parsedCount = parseInt(count, 10);
183
+ } else if (typeof count !== "number") {
184
+ parsedCount = void 0;
185
+ } else {
186
+ parsedCount = count || 1;
187
+ }
180
188
  if (contextInstance) {
181
189
  const { variations } = contextInstance.personalize({
182
190
  name: trackingEventName,
183
- take: count || 1,
191
+ take: parsedCount,
184
192
  variations: componentVariations
185
193
  });
186
194
  if (variations) {
@@ -194,7 +202,7 @@ var runPersonalization = ({
194
202
  const v = componentVariations[i];
195
203
  if (!((_b = v.pz) == null ? void 0 : _b.crit)) {
196
204
  defaults.push(v.index);
197
- if (defaults.length >= (count || 1)) {
205
+ if (defaults.length >= (parsedCount || 1)) {
198
206
  break;
199
207
  }
200
208
  }
package/dist/index.mjs CHANGED
@@ -154,10 +154,18 @@ var runPersonalization = ({
154
154
  };
155
155
  });
156
156
  const indexes = [];
157
+ let parsedCount;
158
+ if (typeof count === "string") {
159
+ parsedCount = parseInt(count, 10);
160
+ } else if (typeof count !== "number") {
161
+ parsedCount = void 0;
162
+ } else {
163
+ parsedCount = count || 1;
164
+ }
157
165
  if (contextInstance) {
158
166
  const { variations } = contextInstance.personalize({
159
167
  name: trackingEventName,
160
- take: count || 1,
168
+ take: parsedCount,
161
169
  variations: componentVariations
162
170
  });
163
171
  if (variations) {
@@ -171,7 +179,7 @@ var runPersonalization = ({
171
179
  const v = componentVariations[i];
172
180
  if (!((_b = v.pz) == null ? void 0 : _b.crit)) {
173
181
  defaults.push(v.index);
174
- if (defaults.length >= (count || 1)) {
182
+ if (defaults.length >= (parsedCount || 1)) {
175
183
  break;
176
184
  }
177
185
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc-shared",
3
- "version": "19.75.1",
3
+ "version": "19.76.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -32,8 +32,8 @@
32
32
  "react-dom": "18.2.0"
33
33
  },
34
34
  "dependencies": {
35
- "@uniformdev/canvas": "19.75.1",
36
- "@uniformdev/context": "19.75.1"
35
+ "@uniformdev/canvas": "19.76.0",
36
+ "@uniformdev/context": "19.76.0"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=16.14.0"
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "396978c95670d4530a3b9baecbd55915d4ac6fe0"
49
+ "gitHead": "68c676df4588906359e10e58f9394f3de70098ba"
50
50
  }