@uniformdev/next-app-router 20.70.0 → 20.70.1-alpha.6
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/cache.js +6 -6
- package/dist/cache.mjs +6 -6
- package/dist/component.js +6 -6
- package/dist/component.mjs +6 -6
- package/dist/handler.js +6 -6
- package/dist/handler.mjs +6 -6
- package/dist/index.esm.js +37 -30
- package/dist/index.js +50 -43
- package/dist/index.mjs +37 -30
- package/dist/middleware.js +28 -12
- package/dist/middleware.mjs +28 -12
- package/package.json +19 -19
package/dist/cache.js
CHANGED
|
@@ -176,12 +176,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
176
176
|
`${errorMessage}
|
|
177
177
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
178
178
|
);
|
|
179
|
-
this
|
|
180
|
-
this
|
|
181
|
-
this
|
|
182
|
-
this
|
|
183
|
-
this
|
|
184
|
-
this
|
|
179
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
180
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
181
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
182
|
+
__publicField(this, "statusCode", statusCode);
|
|
183
|
+
__publicField(this, "statusText", statusText);
|
|
184
|
+
__publicField(this, "requestId", requestId);
|
|
185
185
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
186
186
|
}
|
|
187
187
|
};
|
package/dist/cache.mjs
CHANGED
|
@@ -163,12 +163,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
163
163
|
`${errorMessage}
|
|
164
164
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
165
165
|
);
|
|
166
|
-
this
|
|
167
|
-
this
|
|
168
|
-
this
|
|
169
|
-
this
|
|
170
|
-
this
|
|
171
|
-
this
|
|
166
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
167
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
168
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
169
|
+
__publicField(this, "statusCode", statusCode);
|
|
170
|
+
__publicField(this, "statusText", statusText);
|
|
171
|
+
__publicField(this, "requestId", requestId);
|
|
172
172
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
173
173
|
}
|
|
174
174
|
};
|
package/dist/component.js
CHANGED
|
@@ -231,12 +231,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
231
231
|
`${errorMessage}
|
|
232
232
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
233
233
|
);
|
|
234
|
-
this
|
|
235
|
-
this
|
|
236
|
-
this
|
|
237
|
-
this
|
|
238
|
-
this
|
|
239
|
-
this
|
|
234
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
235
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
236
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
237
|
+
__publicField(this, "statusCode", statusCode);
|
|
238
|
+
__publicField(this, "statusText", statusText);
|
|
239
|
+
__publicField(this, "requestId", requestId);
|
|
240
240
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
241
241
|
}
|
|
242
242
|
};
|
package/dist/component.mjs
CHANGED
|
@@ -216,12 +216,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
216
216
|
`${errorMessage}
|
|
217
217
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
218
218
|
);
|
|
219
|
-
this
|
|
220
|
-
this
|
|
221
|
-
this
|
|
222
|
-
this
|
|
223
|
-
this
|
|
224
|
-
this
|
|
219
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
220
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
221
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
222
|
+
__publicField(this, "statusCode", statusCode);
|
|
223
|
+
__publicField(this, "statusText", statusText);
|
|
224
|
+
__publicField(this, "requestId", requestId);
|
|
225
225
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
226
226
|
}
|
|
227
227
|
};
|
package/dist/handler.js
CHANGED
|
@@ -175,12 +175,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
175
175
|
`${errorMessage}
|
|
176
176
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
177
177
|
);
|
|
178
|
-
this
|
|
179
|
-
this
|
|
180
|
-
this
|
|
181
|
-
this
|
|
182
|
-
this
|
|
183
|
-
this
|
|
178
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
179
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
180
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
181
|
+
__publicField(this, "statusCode", statusCode);
|
|
182
|
+
__publicField(this, "statusText", statusText);
|
|
183
|
+
__publicField(this, "requestId", requestId);
|
|
184
184
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
185
185
|
}
|
|
186
186
|
};
|
package/dist/handler.mjs
CHANGED
|
@@ -160,12 +160,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
160
160
|
`${errorMessage}
|
|
161
161
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
162
162
|
);
|
|
163
|
-
this
|
|
164
|
-
this
|
|
165
|
-
this
|
|
166
|
-
this
|
|
167
|
-
this
|
|
168
|
-
this
|
|
163
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
164
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
165
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
166
|
+
__publicField(this, "statusCode", statusCode);
|
|
167
|
+
__publicField(this, "statusText", statusText);
|
|
168
|
+
__publicField(this, "requestId", requestId);
|
|
169
169
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
170
170
|
}
|
|
171
171
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -166,12 +166,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
166
166
|
`${errorMessage}
|
|
167
167
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
168
168
|
);
|
|
169
|
-
this
|
|
170
|
-
this
|
|
171
|
-
this
|
|
172
|
-
this
|
|
173
|
-
this
|
|
174
|
-
this
|
|
169
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
170
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
171
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
172
|
+
__publicField(this, "statusCode", statusCode);
|
|
173
|
+
__publicField(this, "statusText", statusText);
|
|
174
|
+
__publicField(this, "requestId", requestId);
|
|
175
175
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
176
176
|
}
|
|
177
177
|
};
|
|
@@ -1194,15 +1194,15 @@ var CanvasClient = class extends ApiClient {
|
|
|
1194
1194
|
/** Updates or creates a Canvas component definition */
|
|
1195
1195
|
async updateComposition(body, options) {
|
|
1196
1196
|
const fetchUri = this.createUrl(CANVAS_URL);
|
|
1197
|
-
const
|
|
1197
|
+
const headers2 = {};
|
|
1198
1198
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1199
|
-
|
|
1199
|
+
headers2["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
1200
1200
|
}
|
|
1201
1201
|
const { response } = await this.apiClientWithResponse(fetchUri, {
|
|
1202
1202
|
method: "PUT",
|
|
1203
1203
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1204
1204
|
expectNoContent: true,
|
|
1205
|
-
headers
|
|
1205
|
+
headers: headers2
|
|
1206
1206
|
});
|
|
1207
1207
|
return { modified: response.headers.get("x-modified-at") };
|
|
1208
1208
|
}
|
|
@@ -1294,15 +1294,15 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1294
1294
|
}
|
|
1295
1295
|
async upsertEntry(body, options) {
|
|
1296
1296
|
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1297
|
-
const
|
|
1297
|
+
const headers2 = {};
|
|
1298
1298
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1299
|
-
|
|
1299
|
+
headers2["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
1300
1300
|
}
|
|
1301
1301
|
const { response } = await this.apiClientWithResponse(fetchUri, {
|
|
1302
1302
|
method: "PUT",
|
|
1303
1303
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1304
1304
|
expectNoContent: true,
|
|
1305
|
-
headers
|
|
1305
|
+
headers: headers2
|
|
1306
1306
|
});
|
|
1307
1307
|
return { modified: response.headers.get("x-modified-at") };
|
|
1308
1308
|
}
|
|
@@ -2679,8 +2679,13 @@ import { ContextUpdateTransfer, Personalize, UniformScript } from "@uniformdev/n
|
|
|
2679
2679
|
import {
|
|
2680
2680
|
resolveRuleFromPageState
|
|
2681
2681
|
} from "@uniformdev/next-app-router-shared";
|
|
2682
|
+
import { headers } from "next/headers";
|
|
2682
2683
|
import { notFound } from "next/navigation";
|
|
2683
|
-
import React5, { createElement as createElement2, Fragment as Fragment3, Suspense
|
|
2684
|
+
import React5, { createElement as createElement2, Fragment as Fragment3, Suspense } from "react";
|
|
2685
|
+
|
|
2686
|
+
// src/config/routeCode.ts
|
|
2687
|
+
var UNIFORM_DRAFT_SEGMENT = "__uniform_draft";
|
|
2688
|
+
var UNIFORM_DRAFT_CODE_HEADER = "x-uniform-code";
|
|
2684
2689
|
|
|
2685
2690
|
// src/data/extract/extractTest.ts
|
|
2686
2691
|
import { extractTestName } from "@uniformdev/next-app-router-shared";
|
|
@@ -2858,15 +2863,9 @@ var Test = ({ index, slots, test, component, context: compositionContext }) => {
|
|
|
2858
2863
|
};
|
|
2859
2864
|
|
|
2860
2865
|
// src/components/UniformCompositionWrapper.tsx
|
|
2861
|
-
import {
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
code,
|
|
2865
|
-
children
|
|
2866
|
-
}) => {
|
|
2867
|
-
const data = deserializeEvaluationResult({ input: code });
|
|
2868
|
-
const WrapperComponent = data.compositionState === CANVAS_EDITOR_STATE || data.compositionState === CANVAS_DRAFT_STATE ? Suspense : Fragment2;
|
|
2869
|
-
return /* @__PURE__ */ React2.createElement(WrapperComponent, null, children);
|
|
2866
|
+
import React2, { Fragment as Fragment2 } from "react";
|
|
2867
|
+
var UniformCompositionWrapper = ({ children }) => {
|
|
2868
|
+
return /* @__PURE__ */ React2.createElement(Fragment2, null, children);
|
|
2870
2869
|
};
|
|
2871
2870
|
|
|
2872
2871
|
// src/components/UniformContext.tsx
|
|
@@ -2964,8 +2963,16 @@ async function UniformCompositionInner({
|
|
|
2964
2963
|
dataClient
|
|
2965
2964
|
}) {
|
|
2966
2965
|
var _a, _b;
|
|
2966
|
+
let effectiveCode = code;
|
|
2967
|
+
if (code === UNIFORM_DRAFT_SEGMENT) {
|
|
2968
|
+
const draftCode = (await headers()).get(UNIFORM_DRAFT_CODE_HEADER);
|
|
2969
|
+
if (!draftCode) {
|
|
2970
|
+
notFound();
|
|
2971
|
+
}
|
|
2972
|
+
effectiveCode = draftCode;
|
|
2973
|
+
}
|
|
2967
2974
|
const result = await resolveRoute({
|
|
2968
|
-
code,
|
|
2975
|
+
code: effectiveCode,
|
|
2969
2976
|
dataClient
|
|
2970
2977
|
});
|
|
2971
2978
|
if (!(result == null ? void 0 : result.route) || ((_a = result == null ? void 0 : result.route) == null ? void 0 : _a.type) !== "composition") {
|
|
@@ -3000,12 +3007,12 @@ async function UniformCompositionInner({
|
|
|
3000
3007
|
composition,
|
|
3001
3008
|
compositionContext
|
|
3002
3009
|
});
|
|
3003
|
-
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, resolved, /* @__PURE__ */ React5.createElement(
|
|
3010
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, resolved, /* @__PURE__ */ React5.createElement(Suspense, null, /* @__PURE__ */ React5.createElement(
|
|
3004
3011
|
UniformContext,
|
|
3005
3012
|
{
|
|
3006
3013
|
clientContextComponent,
|
|
3007
3014
|
result: {
|
|
3008
|
-
code,
|
|
3015
|
+
code: effectiveCode,
|
|
3009
3016
|
pageState,
|
|
3010
3017
|
route
|
|
3011
3018
|
}
|
|
@@ -3088,7 +3095,7 @@ var resolveComponents = ({
|
|
|
3088
3095
|
let element = null;
|
|
3089
3096
|
if (wrapInSuspense) {
|
|
3090
3097
|
element = createElement2(
|
|
3091
|
-
|
|
3098
|
+
Suspense,
|
|
3092
3099
|
{
|
|
3093
3100
|
key,
|
|
3094
3101
|
fallback: typeof wrapInSuspense === "boolean" || typeof (wrapInSuspense == null ? void 0 : wrapInSuspense.fallback) === "undefined" ? void 0 : createElement2(wrapInSuspense.fallback)
|
|
@@ -3263,9 +3270,9 @@ import { draftMode } from "next/headers";
|
|
|
3263
3270
|
import React6 from "react";
|
|
3264
3271
|
|
|
3265
3272
|
// src/data/resolvePlaygroundRoute.ts
|
|
3266
|
-
import { deserializeEvaluationResult
|
|
3273
|
+
import { deserializeEvaluationResult } from "@uniformdev/next-app-router-shared";
|
|
3267
3274
|
var resolvePlaygroundRoute = async ({ code }) => {
|
|
3268
|
-
const pageState =
|
|
3275
|
+
const pageState = deserializeEvaluationResult({ input: code });
|
|
3269
3276
|
const canvasClient = getCanvasClient({
|
|
3270
3277
|
cache: {
|
|
3271
3278
|
type: "no-cache"
|
|
@@ -3899,12 +3906,12 @@ var precomputeComposition = ({
|
|
|
3899
3906
|
};
|
|
3900
3907
|
|
|
3901
3908
|
// src/data/resolveRouteFromCode.ts
|
|
3902
|
-
import { deserializeEvaluationResult as
|
|
3909
|
+
import { deserializeEvaluationResult as deserializeEvaluationResult2 } from "@uniformdev/next-app-router-shared";
|
|
3903
3910
|
var resolveRouteFromCode = async ({
|
|
3904
3911
|
code,
|
|
3905
3912
|
dataClient: providedDataClient
|
|
3906
3913
|
}) => {
|
|
3907
|
-
const pageState =
|
|
3914
|
+
const pageState = deserializeEvaluationResult2({ input: code });
|
|
3908
3915
|
const dataClient = providedDataClient != null ? providedDataClient : new DefaultDataClient();
|
|
3909
3916
|
const { route } = await dataClient.getRoute({
|
|
3910
3917
|
source: "pageState",
|
package/dist/index.js
CHANGED
|
@@ -149,8 +149,8 @@ var require_p_limit = __commonJS({
|
|
|
149
149
|
});
|
|
150
150
|
|
|
151
151
|
// src/index.ts
|
|
152
|
-
var
|
|
153
|
-
__export(
|
|
152
|
+
var index_exports = {};
|
|
153
|
+
__export(index_exports, {
|
|
154
154
|
DefaultDataClient: () => DefaultDataClient,
|
|
155
155
|
UniformComposition: () => UniformComposition,
|
|
156
156
|
UniformPlayground: () => UniformPlayground,
|
|
@@ -169,7 +169,7 @@ __export(src_exports, {
|
|
|
169
169
|
resolveRouteFromCode: () => resolveRouteFromCode,
|
|
170
170
|
serverContext: () => serverContext
|
|
171
171
|
});
|
|
172
|
-
module.exports = __toCommonJS(
|
|
172
|
+
module.exports = __toCommonJS(index_exports);
|
|
173
173
|
var import_server_only5 = require("server-only");
|
|
174
174
|
|
|
175
175
|
// src/clients/canvas.ts
|
|
@@ -193,12 +193,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
193
193
|
`${errorMessage}
|
|
194
194
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
195
195
|
);
|
|
196
|
-
this
|
|
197
|
-
this
|
|
198
|
-
this
|
|
199
|
-
this
|
|
200
|
-
this
|
|
201
|
-
this
|
|
196
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
197
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
198
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
199
|
+
__publicField(this, "statusCode", statusCode);
|
|
200
|
+
__publicField(this, "statusText", statusText);
|
|
201
|
+
__publicField(this, "requestId", requestId);
|
|
202
202
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
203
203
|
}
|
|
204
204
|
};
|
|
@@ -1221,15 +1221,15 @@ var CanvasClient = class extends ApiClient {
|
|
|
1221
1221
|
/** Updates or creates a Canvas component definition */
|
|
1222
1222
|
async updateComposition(body, options) {
|
|
1223
1223
|
const fetchUri = this.createUrl(CANVAS_URL);
|
|
1224
|
-
const
|
|
1224
|
+
const headers2 = {};
|
|
1225
1225
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1226
|
-
|
|
1226
|
+
headers2["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
1227
1227
|
}
|
|
1228
1228
|
const { response } = await this.apiClientWithResponse(fetchUri, {
|
|
1229
1229
|
method: "PUT",
|
|
1230
1230
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1231
1231
|
expectNoContent: true,
|
|
1232
|
-
headers
|
|
1232
|
+
headers: headers2
|
|
1233
1233
|
});
|
|
1234
1234
|
return { modified: response.headers.get("x-modified-at") };
|
|
1235
1235
|
}
|
|
@@ -1321,15 +1321,15 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
async upsertEntry(body, options) {
|
|
1323
1323
|
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1324
|
-
const
|
|
1324
|
+
const headers2 = {};
|
|
1325
1325
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1326
|
-
|
|
1326
|
+
headers2["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
1327
1327
|
}
|
|
1328
1328
|
const { response } = await this.apiClientWithResponse(fetchUri, {
|
|
1329
1329
|
method: "PUT",
|
|
1330
1330
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1331
1331
|
expectNoContent: true,
|
|
1332
|
-
headers
|
|
1332
|
+
headers: headers2
|
|
1333
1333
|
});
|
|
1334
1334
|
return { modified: response.headers.get("x-modified-at") };
|
|
1335
1335
|
}
|
|
@@ -2703,10 +2703,15 @@ var getRouteClient = (options) => {
|
|
|
2703
2703
|
// src/components/UniformComposition.tsx
|
|
2704
2704
|
var import_core = require("@uniformdev/canvas-react/core");
|
|
2705
2705
|
var import_next_app_router_client5 = require("@uniformdev/next-app-router-client");
|
|
2706
|
-
var
|
|
2706
|
+
var import_next_app_router_shared3 = require("@uniformdev/next-app-router-shared");
|
|
2707
|
+
var import_headers = require("next/headers");
|
|
2707
2708
|
var import_navigation = require("next/navigation");
|
|
2708
2709
|
var import_react6 = __toESM(require("react"));
|
|
2709
2710
|
|
|
2711
|
+
// src/config/routeCode.ts
|
|
2712
|
+
var UNIFORM_DRAFT_SEGMENT = "__uniform_draft";
|
|
2713
|
+
var UNIFORM_DRAFT_CODE_HEADER = "x-uniform-code";
|
|
2714
|
+
|
|
2710
2715
|
// src/data/extract/extractTest.ts
|
|
2711
2716
|
var import_next_app_router_shared = require("@uniformdev/next-app-router-shared");
|
|
2712
2717
|
var extractTest = ({ component }) => {
|
|
@@ -2881,15 +2886,9 @@ var Test = ({ index, slots, test, component, context: compositionContext }) => {
|
|
|
2881
2886
|
};
|
|
2882
2887
|
|
|
2883
2888
|
// src/components/UniformCompositionWrapper.tsx
|
|
2884
|
-
var import_next_app_router_shared3 = require("@uniformdev/next-app-router-shared");
|
|
2885
2889
|
var import_react3 = __toESM(require("react"));
|
|
2886
|
-
var UniformCompositionWrapper = ({
|
|
2887
|
-
|
|
2888
|
-
children
|
|
2889
|
-
}) => {
|
|
2890
|
-
const data = (0, import_next_app_router_shared3.deserializeEvaluationResult)({ input: code });
|
|
2891
|
-
const WrapperComponent = data.compositionState === CANVAS_EDITOR_STATE || data.compositionState === CANVAS_DRAFT_STATE ? import_react3.Suspense : import_react3.Fragment;
|
|
2892
|
-
return /* @__PURE__ */ import_react3.default.createElement(WrapperComponent, null, children);
|
|
2890
|
+
var UniformCompositionWrapper = ({ children }) => {
|
|
2891
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react3.Fragment, null, children);
|
|
2893
2892
|
};
|
|
2894
2893
|
|
|
2895
2894
|
// src/components/UniformContext.tsx
|
|
@@ -2987,8 +2986,16 @@ async function UniformCompositionInner({
|
|
|
2987
2986
|
dataClient
|
|
2988
2987
|
}) {
|
|
2989
2988
|
var _a, _b;
|
|
2989
|
+
let effectiveCode = code;
|
|
2990
|
+
if (code === UNIFORM_DRAFT_SEGMENT) {
|
|
2991
|
+
const draftCode = (await (0, import_headers.headers)()).get(UNIFORM_DRAFT_CODE_HEADER);
|
|
2992
|
+
if (!draftCode) {
|
|
2993
|
+
(0, import_navigation.notFound)();
|
|
2994
|
+
}
|
|
2995
|
+
effectiveCode = draftCode;
|
|
2996
|
+
}
|
|
2990
2997
|
const result = await resolveRoute({
|
|
2991
|
-
code,
|
|
2998
|
+
code: effectiveCode,
|
|
2992
2999
|
dataClient
|
|
2993
3000
|
});
|
|
2994
3001
|
if (!(result == null ? void 0 : result.route) || ((_a = result == null ? void 0 : result.route) == null ? void 0 : _a.type) !== "composition") {
|
|
@@ -3028,7 +3035,7 @@ async function UniformCompositionInner({
|
|
|
3028
3035
|
{
|
|
3029
3036
|
clientContextComponent,
|
|
3030
3037
|
result: {
|
|
3031
|
-
code,
|
|
3038
|
+
code: effectiveCode,
|
|
3032
3039
|
pageState,
|
|
3033
3040
|
route
|
|
3034
3041
|
}
|
|
@@ -3167,7 +3174,7 @@ var resolveComponents = ({
|
|
|
3167
3174
|
childNode = elements;
|
|
3168
3175
|
}
|
|
3169
3176
|
if (visibilityRules) {
|
|
3170
|
-
const isVisible = (0,
|
|
3177
|
+
const isVisible = (0, import_next_app_router_shared3.resolveRuleFromPageState)({
|
|
3171
3178
|
pageState,
|
|
3172
3179
|
rule: visibilityRules
|
|
3173
3180
|
});
|
|
@@ -3282,13 +3289,13 @@ var resolveSlots = ({
|
|
|
3282
3289
|
};
|
|
3283
3290
|
|
|
3284
3291
|
// src/components/UniformPlayground.tsx
|
|
3285
|
-
var
|
|
3292
|
+
var import_headers2 = require("next/headers");
|
|
3286
3293
|
var import_react7 = __toESM(require("react"));
|
|
3287
3294
|
|
|
3288
3295
|
// src/data/resolvePlaygroundRoute.ts
|
|
3289
|
-
var
|
|
3296
|
+
var import_next_app_router_shared4 = require("@uniformdev/next-app-router-shared");
|
|
3290
3297
|
var resolvePlaygroundRoute = async ({ code }) => {
|
|
3291
|
-
const pageState = (0,
|
|
3298
|
+
const pageState = (0, import_next_app_router_shared4.deserializeEvaluationResult)({ input: code });
|
|
3292
3299
|
const canvasClient = getCanvasClient({
|
|
3293
3300
|
cache: {
|
|
3294
3301
|
type: "no-cache"
|
|
@@ -3327,7 +3334,7 @@ var resolvePlaygroundRoute = async ({ code }) => {
|
|
|
3327
3334
|
|
|
3328
3335
|
// src/components/UniformPlayground.tsx
|
|
3329
3336
|
var UniformPlayground = async ({ resolveRoute, ...rest }) => {
|
|
3330
|
-
const isDraftMode = (await (0,
|
|
3337
|
+
const isDraftMode = (await (0, import_headers2.draftMode)()).isEnabled;
|
|
3331
3338
|
if (!isDraftMode) {
|
|
3332
3339
|
return /* @__PURE__ */ import_react7.default.createElement("div", null, /* @__PURE__ */ import_react7.default.createElement("h1", null, "Playground is only available in draft mode"));
|
|
3333
3340
|
}
|
|
@@ -3335,18 +3342,18 @@ var UniformPlayground = async ({ resolveRoute, ...rest }) => {
|
|
|
3335
3342
|
};
|
|
3336
3343
|
|
|
3337
3344
|
// src/components/generateStaticParams.ts
|
|
3338
|
-
var
|
|
3345
|
+
var import_next_app_router_shared7 = require("@uniformdev/next-app-router-shared");
|
|
3339
3346
|
|
|
3340
3347
|
// src/data/extract/extractRunnables.ts
|
|
3341
|
-
var
|
|
3348
|
+
var import_next_app_router_shared6 = require("@uniformdev/next-app-router-shared");
|
|
3342
3349
|
|
|
3343
3350
|
// src/data/extract/extractPersonalization.ts
|
|
3344
|
-
var
|
|
3351
|
+
var import_next_app_router_shared5 = require("@uniformdev/next-app-router-shared");
|
|
3345
3352
|
var extractPersonalization = ({
|
|
3346
3353
|
component
|
|
3347
3354
|
}) => {
|
|
3348
3355
|
var _a, _b, _c;
|
|
3349
|
-
const trackingEventName = (0,
|
|
3356
|
+
const trackingEventName = (0, import_next_app_router_shared5.extractPersonalizationName)({ component });
|
|
3350
3357
|
const countParameter = (_a = component.parameters) == null ? void 0 : _a.count;
|
|
3351
3358
|
const algorithmParameter = (_b = component.parameters) == null ? void 0 : _b.algorithm;
|
|
3352
3359
|
const count = countParameter == null ? void 0 : countParameter.value;
|
|
@@ -3418,7 +3425,7 @@ var extractRunnables = (composition) => {
|
|
|
3418
3425
|
if (visibilityRules) {
|
|
3419
3426
|
runnable.push({
|
|
3420
3427
|
type: "visibility",
|
|
3421
|
-
_id: (0,
|
|
3428
|
+
_id: (0, import_next_app_router_shared6.getRuleId)(visibilityRules),
|
|
3422
3429
|
variantId: findAncestorVariant(node.ancestorsAndSelf),
|
|
3423
3430
|
rules: visibilityRules
|
|
3424
3431
|
});
|
|
@@ -3645,7 +3652,7 @@ var generatePossiblePageStates = ({
|
|
|
3645
3652
|
};
|
|
3646
3653
|
const allComponentIds = runnables.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
|
|
3647
3654
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3648
|
-
return allStates.map((payload) => (0,
|
|
3655
|
+
return allStates.map((payload) => (0, import_next_app_router_shared7.serializeEvaluationResult)({ payload, allComponentIds }));
|
|
3649
3656
|
};
|
|
3650
3657
|
function permutationsWithoutRepetition(options, k) {
|
|
3651
3658
|
if (k === 0) return [[]];
|
|
@@ -3848,16 +3855,16 @@ var expireMiddlewareCacheTag = async (tag) => {
|
|
|
3848
3855
|
};
|
|
3849
3856
|
|
|
3850
3857
|
// src/data/precomputeComposition.ts
|
|
3851
|
-
var
|
|
3858
|
+
var import_next_app_router_shared8 = require("@uniformdev/next-app-router-shared");
|
|
3852
3859
|
var shouldEvaluateTest = (test, evaluateTests) => {
|
|
3853
3860
|
return typeof evaluateTests === "function" ? evaluateTests({
|
|
3854
|
-
name: (0,
|
|
3861
|
+
name: (0, import_next_app_router_shared8.extractTestName)({ component: test }),
|
|
3855
3862
|
component: test
|
|
3856
3863
|
}) : evaluateTests;
|
|
3857
3864
|
};
|
|
3858
3865
|
var shouldEvaluatePersonalization = (personalization, evaluatePersonalizations) => {
|
|
3859
3866
|
const result = typeof evaluatePersonalizations === "function" ? evaluatePersonalizations({
|
|
3860
|
-
name: (0,
|
|
3867
|
+
name: (0, import_next_app_router_shared8.extractPersonalizationName)({ component: personalization }),
|
|
3861
3868
|
component: personalization
|
|
3862
3869
|
}) : evaluatePersonalizations;
|
|
3863
3870
|
return result;
|
|
@@ -3875,7 +3882,7 @@ var precomputeComposition = ({
|
|
|
3875
3882
|
var _a, _b;
|
|
3876
3883
|
if (node.type === "component") {
|
|
3877
3884
|
const component = node.node;
|
|
3878
|
-
const pageStateComponent = (0,
|
|
3885
|
+
const pageStateComponent = (0, import_next_app_router_shared8.resolveComponentFromPageState)({
|
|
3879
3886
|
pageState,
|
|
3880
3887
|
componentId: component._id
|
|
3881
3888
|
});
|
|
@@ -3916,12 +3923,12 @@ var precomputeComposition = ({
|
|
|
3916
3923
|
};
|
|
3917
3924
|
|
|
3918
3925
|
// src/data/resolveRouteFromCode.ts
|
|
3919
|
-
var
|
|
3926
|
+
var import_next_app_router_shared9 = require("@uniformdev/next-app-router-shared");
|
|
3920
3927
|
var resolveRouteFromCode = async ({
|
|
3921
3928
|
code,
|
|
3922
3929
|
dataClient: providedDataClient
|
|
3923
3930
|
}) => {
|
|
3924
|
-
const pageState = (0,
|
|
3931
|
+
const pageState = (0, import_next_app_router_shared9.deserializeEvaluationResult)({ input: code });
|
|
3925
3932
|
const dataClient = providedDataClient != null ? providedDataClient : new DefaultDataClient();
|
|
3926
3933
|
const { route } = await dataClient.getRoute({
|
|
3927
3934
|
source: "pageState",
|
package/dist/index.mjs
CHANGED
|
@@ -166,12 +166,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
166
166
|
`${errorMessage}
|
|
167
167
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
168
168
|
);
|
|
169
|
-
this
|
|
170
|
-
this
|
|
171
|
-
this
|
|
172
|
-
this
|
|
173
|
-
this
|
|
174
|
-
this
|
|
169
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
170
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
171
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
172
|
+
__publicField(this, "statusCode", statusCode);
|
|
173
|
+
__publicField(this, "statusText", statusText);
|
|
174
|
+
__publicField(this, "requestId", requestId);
|
|
175
175
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
176
176
|
}
|
|
177
177
|
};
|
|
@@ -1194,15 +1194,15 @@ var CanvasClient = class extends ApiClient {
|
|
|
1194
1194
|
/** Updates or creates a Canvas component definition */
|
|
1195
1195
|
async updateComposition(body, options) {
|
|
1196
1196
|
const fetchUri = this.createUrl(CANVAS_URL);
|
|
1197
|
-
const
|
|
1197
|
+
const headers2 = {};
|
|
1198
1198
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1199
|
-
|
|
1199
|
+
headers2["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
1200
1200
|
}
|
|
1201
1201
|
const { response } = await this.apiClientWithResponse(fetchUri, {
|
|
1202
1202
|
method: "PUT",
|
|
1203
1203
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1204
1204
|
expectNoContent: true,
|
|
1205
|
-
headers
|
|
1205
|
+
headers: headers2
|
|
1206
1206
|
});
|
|
1207
1207
|
return { modified: response.headers.get("x-modified-at") };
|
|
1208
1208
|
}
|
|
@@ -1294,15 +1294,15 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1294
1294
|
}
|
|
1295
1295
|
async upsertEntry(body, options) {
|
|
1296
1296
|
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1297
|
-
const
|
|
1297
|
+
const headers2 = {};
|
|
1298
1298
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1299
|
-
|
|
1299
|
+
headers2["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
1300
1300
|
}
|
|
1301
1301
|
const { response } = await this.apiClientWithResponse(fetchUri, {
|
|
1302
1302
|
method: "PUT",
|
|
1303
1303
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1304
1304
|
expectNoContent: true,
|
|
1305
|
-
headers
|
|
1305
|
+
headers: headers2
|
|
1306
1306
|
});
|
|
1307
1307
|
return { modified: response.headers.get("x-modified-at") };
|
|
1308
1308
|
}
|
|
@@ -2679,8 +2679,13 @@ import { ContextUpdateTransfer, Personalize, UniformScript } from "@uniformdev/n
|
|
|
2679
2679
|
import {
|
|
2680
2680
|
resolveRuleFromPageState
|
|
2681
2681
|
} from "@uniformdev/next-app-router-shared";
|
|
2682
|
+
import { headers } from "next/headers";
|
|
2682
2683
|
import { notFound } from "next/navigation";
|
|
2683
|
-
import React5, { createElement as createElement2, Fragment as Fragment3, Suspense
|
|
2684
|
+
import React5, { createElement as createElement2, Fragment as Fragment3, Suspense } from "react";
|
|
2685
|
+
|
|
2686
|
+
// src/config/routeCode.ts
|
|
2687
|
+
var UNIFORM_DRAFT_SEGMENT = "__uniform_draft";
|
|
2688
|
+
var UNIFORM_DRAFT_CODE_HEADER = "x-uniform-code";
|
|
2684
2689
|
|
|
2685
2690
|
// src/data/extract/extractTest.ts
|
|
2686
2691
|
import { extractTestName } from "@uniformdev/next-app-router-shared";
|
|
@@ -2858,15 +2863,9 @@ var Test = ({ index, slots, test, component, context: compositionContext }) => {
|
|
|
2858
2863
|
};
|
|
2859
2864
|
|
|
2860
2865
|
// src/components/UniformCompositionWrapper.tsx
|
|
2861
|
-
import {
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
code,
|
|
2865
|
-
children
|
|
2866
|
-
}) => {
|
|
2867
|
-
const data = deserializeEvaluationResult({ input: code });
|
|
2868
|
-
const WrapperComponent = data.compositionState === CANVAS_EDITOR_STATE || data.compositionState === CANVAS_DRAFT_STATE ? Suspense : Fragment2;
|
|
2869
|
-
return /* @__PURE__ */ React2.createElement(WrapperComponent, null, children);
|
|
2866
|
+
import React2, { Fragment as Fragment2 } from "react";
|
|
2867
|
+
var UniformCompositionWrapper = ({ children }) => {
|
|
2868
|
+
return /* @__PURE__ */ React2.createElement(Fragment2, null, children);
|
|
2870
2869
|
};
|
|
2871
2870
|
|
|
2872
2871
|
// src/components/UniformContext.tsx
|
|
@@ -2964,8 +2963,16 @@ async function UniformCompositionInner({
|
|
|
2964
2963
|
dataClient
|
|
2965
2964
|
}) {
|
|
2966
2965
|
var _a, _b;
|
|
2966
|
+
let effectiveCode = code;
|
|
2967
|
+
if (code === UNIFORM_DRAFT_SEGMENT) {
|
|
2968
|
+
const draftCode = (await headers()).get(UNIFORM_DRAFT_CODE_HEADER);
|
|
2969
|
+
if (!draftCode) {
|
|
2970
|
+
notFound();
|
|
2971
|
+
}
|
|
2972
|
+
effectiveCode = draftCode;
|
|
2973
|
+
}
|
|
2967
2974
|
const result = await resolveRoute({
|
|
2968
|
-
code,
|
|
2975
|
+
code: effectiveCode,
|
|
2969
2976
|
dataClient
|
|
2970
2977
|
});
|
|
2971
2978
|
if (!(result == null ? void 0 : result.route) || ((_a = result == null ? void 0 : result.route) == null ? void 0 : _a.type) !== "composition") {
|
|
@@ -3000,12 +3007,12 @@ async function UniformCompositionInner({
|
|
|
3000
3007
|
composition,
|
|
3001
3008
|
compositionContext
|
|
3002
3009
|
});
|
|
3003
|
-
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, resolved, /* @__PURE__ */ React5.createElement(
|
|
3010
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, resolved, /* @__PURE__ */ React5.createElement(Suspense, null, /* @__PURE__ */ React5.createElement(
|
|
3004
3011
|
UniformContext,
|
|
3005
3012
|
{
|
|
3006
3013
|
clientContextComponent,
|
|
3007
3014
|
result: {
|
|
3008
|
-
code,
|
|
3015
|
+
code: effectiveCode,
|
|
3009
3016
|
pageState,
|
|
3010
3017
|
route
|
|
3011
3018
|
}
|
|
@@ -3088,7 +3095,7 @@ var resolveComponents = ({
|
|
|
3088
3095
|
let element = null;
|
|
3089
3096
|
if (wrapInSuspense) {
|
|
3090
3097
|
element = createElement2(
|
|
3091
|
-
|
|
3098
|
+
Suspense,
|
|
3092
3099
|
{
|
|
3093
3100
|
key,
|
|
3094
3101
|
fallback: typeof wrapInSuspense === "boolean" || typeof (wrapInSuspense == null ? void 0 : wrapInSuspense.fallback) === "undefined" ? void 0 : createElement2(wrapInSuspense.fallback)
|
|
@@ -3263,9 +3270,9 @@ import { draftMode } from "next/headers";
|
|
|
3263
3270
|
import React6 from "react";
|
|
3264
3271
|
|
|
3265
3272
|
// src/data/resolvePlaygroundRoute.ts
|
|
3266
|
-
import { deserializeEvaluationResult
|
|
3273
|
+
import { deserializeEvaluationResult } from "@uniformdev/next-app-router-shared";
|
|
3267
3274
|
var resolvePlaygroundRoute = async ({ code }) => {
|
|
3268
|
-
const pageState =
|
|
3275
|
+
const pageState = deserializeEvaluationResult({ input: code });
|
|
3269
3276
|
const canvasClient = getCanvasClient({
|
|
3270
3277
|
cache: {
|
|
3271
3278
|
type: "no-cache"
|
|
@@ -3899,12 +3906,12 @@ var precomputeComposition = ({
|
|
|
3899
3906
|
};
|
|
3900
3907
|
|
|
3901
3908
|
// src/data/resolveRouteFromCode.ts
|
|
3902
|
-
import { deserializeEvaluationResult as
|
|
3909
|
+
import { deserializeEvaluationResult as deserializeEvaluationResult2 } from "@uniformdev/next-app-router-shared";
|
|
3903
3910
|
var resolveRouteFromCode = async ({
|
|
3904
3911
|
code,
|
|
3905
3912
|
dataClient: providedDataClient
|
|
3906
3913
|
}) => {
|
|
3907
|
-
const pageState =
|
|
3914
|
+
const pageState = deserializeEvaluationResult2({ input: code });
|
|
3908
3915
|
const dataClient = providedDataClient != null ? providedDataClient : new DefaultDataClient();
|
|
3909
3916
|
const { route } = await dataClient.getRoute({
|
|
3910
3917
|
source: "pageState",
|
package/dist/middleware.js
CHANGED
|
@@ -371,12 +371,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
371
371
|
`${errorMessage}
|
|
372
372
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
373
373
|
);
|
|
374
|
-
this
|
|
375
|
-
this
|
|
376
|
-
this
|
|
377
|
-
this
|
|
378
|
-
this
|
|
379
|
-
this
|
|
374
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
375
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
376
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
377
|
+
__publicField(this, "statusCode", statusCode);
|
|
378
|
+
__publicField(this, "statusText", statusText);
|
|
379
|
+
__publicField(this, "requestId", requestId);
|
|
380
380
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
381
381
|
}
|
|
382
382
|
};
|
|
@@ -2655,6 +2655,10 @@ var getDisableSwrMiddlewareCache = () => {
|
|
|
2655
2655
|
return false;
|
|
2656
2656
|
};
|
|
2657
2657
|
|
|
2658
|
+
// src/config/routeCode.ts
|
|
2659
|
+
var UNIFORM_DRAFT_SEGMENT = "__uniform_draft";
|
|
2660
|
+
var UNIFORM_DRAFT_CODE_HEADER = "x-uniform-code";
|
|
2661
|
+
|
|
2658
2662
|
// src/data/client.ts
|
|
2659
2663
|
var import_functions = require("@vercel/functions");
|
|
2660
2664
|
|
|
@@ -3163,7 +3167,7 @@ function dequal(foo, bar) {
|
|
|
3163
3167
|
return foo !== foo && bar !== bar;
|
|
3164
3168
|
}
|
|
3165
3169
|
|
|
3166
|
-
// ../../node_modules/.pnpm/js-cookie@3.0.
|
|
3170
|
+
// ../../node_modules/.pnpm/js-cookie@3.0.8/node_modules/js-cookie/dist/js.cookie.mjs
|
|
3167
3171
|
function assign(target) {
|
|
3168
3172
|
for (var i = 1; i < arguments.length; i++) {
|
|
3169
3173
|
var source = arguments[i];
|
|
@@ -3229,7 +3233,7 @@ function init(converter, defaultAttributes) {
|
|
|
3229
3233
|
if (name === found) {
|
|
3230
3234
|
break;
|
|
3231
3235
|
}
|
|
3232
|
-
} catch (
|
|
3236
|
+
} catch (_e) {
|
|
3233
3237
|
}
|
|
3234
3238
|
}
|
|
3235
3239
|
return name ? jar[name] : jar;
|
|
@@ -4574,7 +4578,7 @@ var _LocalStorage_instances;
|
|
|
4574
4578
|
var key_fn;
|
|
4575
4579
|
var LocalStorage = class {
|
|
4576
4580
|
constructor(partitionKey) {
|
|
4577
|
-
this
|
|
4581
|
+
__publicField2(this, "partitionKey", partitionKey);
|
|
4578
4582
|
__privateAdd4(this, _LocalStorage_instances);
|
|
4579
4583
|
__publicField2(this, "inMemoryFallback", {});
|
|
4580
4584
|
__publicField2(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
|
|
@@ -5743,8 +5747,14 @@ var handleRouteRequest = async ({
|
|
|
5743
5747
|
allComponentIds
|
|
5744
5748
|
});
|
|
5745
5749
|
let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "route" }) : void 0);
|
|
5750
|
+
let usedDraftStableSegment = false;
|
|
5746
5751
|
if (!pathToRewriteTo) {
|
|
5747
|
-
|
|
5752
|
+
if (draftModeEnabled) {
|
|
5753
|
+
pathToRewriteTo = `/uniform/${UNIFORM_DRAFT_SEGMENT}`;
|
|
5754
|
+
usedDraftStableSegment = true;
|
|
5755
|
+
} else {
|
|
5756
|
+
pathToRewriteTo = `/uniform/${code}`;
|
|
5757
|
+
}
|
|
5748
5758
|
}
|
|
5749
5759
|
const headers = new Headers();
|
|
5750
5760
|
if (serializedQuirkCookie) {
|
|
@@ -5753,8 +5763,14 @@ var handleRouteRequest = async ({
|
|
|
5753
5763
|
`${import_next_app_router_shared6.UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME}=${serializedQuirkCookie}; Path=/; SameSite=Lax; Max-Age=10`
|
|
5754
5764
|
);
|
|
5755
5765
|
}
|
|
5766
|
+
let requestHeaders;
|
|
5767
|
+
if (usedDraftStableSegment) {
|
|
5768
|
+
requestHeaders = new Headers(request.headers);
|
|
5769
|
+
requestHeaders.set(UNIFORM_DRAFT_CODE_HEADER, code);
|
|
5770
|
+
}
|
|
5756
5771
|
return import_server.NextResponse.rewrite(new URL(pathToRewriteTo, request.nextUrl.origin), {
|
|
5757
|
-
headers
|
|
5772
|
+
headers,
|
|
5773
|
+
...requestHeaders ? { request: { headers: requestHeaders } } : {}
|
|
5758
5774
|
});
|
|
5759
5775
|
};
|
|
5760
5776
|
var isPrefetchRequest = (request) => {
|
|
@@ -5900,5 +5916,5 @@ var determinePreviewMode = ({
|
|
|
5900
5916
|
/*! Bundled license information:
|
|
5901
5917
|
|
|
5902
5918
|
js-cookie/dist/js.cookie.mjs:
|
|
5903
|
-
(*! js-cookie v3.0.
|
|
5919
|
+
(*! js-cookie v3.0.8 | MIT *)
|
|
5904
5920
|
*/
|
package/dist/middleware.mjs
CHANGED
|
@@ -356,12 +356,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
356
356
|
`${errorMessage}
|
|
357
357
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
358
358
|
);
|
|
359
|
-
this
|
|
360
|
-
this
|
|
361
|
-
this
|
|
362
|
-
this
|
|
363
|
-
this
|
|
364
|
-
this
|
|
359
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
360
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
361
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
362
|
+
__publicField(this, "statusCode", statusCode);
|
|
363
|
+
__publicField(this, "statusText", statusText);
|
|
364
|
+
__publicField(this, "requestId", requestId);
|
|
365
365
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
366
366
|
}
|
|
367
367
|
};
|
|
@@ -2642,6 +2642,10 @@ var getDisableSwrMiddlewareCache = () => {
|
|
|
2642
2642
|
return false;
|
|
2643
2643
|
};
|
|
2644
2644
|
|
|
2645
|
+
// src/config/routeCode.ts
|
|
2646
|
+
var UNIFORM_DRAFT_SEGMENT = "__uniform_draft";
|
|
2647
|
+
var UNIFORM_DRAFT_CODE_HEADER = "x-uniform-code";
|
|
2648
|
+
|
|
2645
2649
|
// src/data/client.ts
|
|
2646
2650
|
import { getCache, waitUntil } from "@vercel/functions";
|
|
2647
2651
|
|
|
@@ -3155,7 +3159,7 @@ function dequal(foo, bar) {
|
|
|
3155
3159
|
return foo !== foo && bar !== bar;
|
|
3156
3160
|
}
|
|
3157
3161
|
|
|
3158
|
-
// ../../node_modules/.pnpm/js-cookie@3.0.
|
|
3162
|
+
// ../../node_modules/.pnpm/js-cookie@3.0.8/node_modules/js-cookie/dist/js.cookie.mjs
|
|
3159
3163
|
function assign(target) {
|
|
3160
3164
|
for (var i = 1; i < arguments.length; i++) {
|
|
3161
3165
|
var source = arguments[i];
|
|
@@ -3221,7 +3225,7 @@ function init(converter, defaultAttributes) {
|
|
|
3221
3225
|
if (name === found) {
|
|
3222
3226
|
break;
|
|
3223
3227
|
}
|
|
3224
|
-
} catch (
|
|
3228
|
+
} catch (_e) {
|
|
3225
3229
|
}
|
|
3226
3230
|
}
|
|
3227
3231
|
return name ? jar[name] : jar;
|
|
@@ -4566,7 +4570,7 @@ var _LocalStorage_instances;
|
|
|
4566
4570
|
var key_fn;
|
|
4567
4571
|
var LocalStorage = class {
|
|
4568
4572
|
constructor(partitionKey) {
|
|
4569
|
-
this
|
|
4573
|
+
__publicField2(this, "partitionKey", partitionKey);
|
|
4570
4574
|
__privateAdd4(this, _LocalStorage_instances);
|
|
4571
4575
|
__publicField2(this, "inMemoryFallback", {});
|
|
4572
4576
|
__publicField2(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
|
|
@@ -5735,8 +5739,14 @@ var handleRouteRequest = async ({
|
|
|
5735
5739
|
allComponentIds
|
|
5736
5740
|
});
|
|
5737
5741
|
let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "route" }) : void 0);
|
|
5742
|
+
let usedDraftStableSegment = false;
|
|
5738
5743
|
if (!pathToRewriteTo) {
|
|
5739
|
-
|
|
5744
|
+
if (draftModeEnabled) {
|
|
5745
|
+
pathToRewriteTo = `/uniform/${UNIFORM_DRAFT_SEGMENT}`;
|
|
5746
|
+
usedDraftStableSegment = true;
|
|
5747
|
+
} else {
|
|
5748
|
+
pathToRewriteTo = `/uniform/${code}`;
|
|
5749
|
+
}
|
|
5740
5750
|
}
|
|
5741
5751
|
const headers = new Headers();
|
|
5742
5752
|
if (serializedQuirkCookie) {
|
|
@@ -5745,8 +5755,14 @@ var handleRouteRequest = async ({
|
|
|
5745
5755
|
`${UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME}=${serializedQuirkCookie}; Path=/; SameSite=Lax; Max-Age=10`
|
|
5746
5756
|
);
|
|
5747
5757
|
}
|
|
5758
|
+
let requestHeaders;
|
|
5759
|
+
if (usedDraftStableSegment) {
|
|
5760
|
+
requestHeaders = new Headers(request.headers);
|
|
5761
|
+
requestHeaders.set(UNIFORM_DRAFT_CODE_HEADER, code);
|
|
5762
|
+
}
|
|
5748
5763
|
return NextResponse.rewrite(new URL(pathToRewriteTo, request.nextUrl.origin), {
|
|
5749
|
-
headers
|
|
5764
|
+
headers,
|
|
5765
|
+
...requestHeaders ? { request: { headers: requestHeaders } } : {}
|
|
5750
5766
|
});
|
|
5751
5767
|
};
|
|
5752
5768
|
var isPrefetchRequest = (request) => {
|
|
@@ -5891,5 +5907,5 @@ export {
|
|
|
5891
5907
|
/*! Bundled license information:
|
|
5892
5908
|
|
|
5893
5909
|
js-cookie/dist/js.cookie.mjs:
|
|
5894
|
-
(*! js-cookie v3.0.
|
|
5910
|
+
(*! js-cookie v3.0.8 | MIT *)
|
|
5895
5911
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/next-app-router",
|
|
3
|
-
"version": "20.70.
|
|
3
|
+
"version": "20.70.1-alpha.6+9aeb4f32ae",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -87,27 +87,27 @@
|
|
|
87
87
|
"/dist"
|
|
88
88
|
],
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@types/node": "
|
|
91
|
-
"@types/react": "19.
|
|
92
|
-
"@types/react-dom": "19.
|
|
93
|
-
"next": "16.2.
|
|
94
|
-
"react": "19.2.
|
|
95
|
-
"react-dom": "19.2.
|
|
96
|
-
"typescript": "
|
|
97
|
-
"vite-tsconfig-paths": "^
|
|
98
|
-
"vitest": "
|
|
90
|
+
"@types/node": "26.0.0",
|
|
91
|
+
"@types/react": "19.2.17",
|
|
92
|
+
"@types/react-dom": "19.2.3",
|
|
93
|
+
"next": "16.2.9",
|
|
94
|
+
"react": "19.2.1",
|
|
95
|
+
"react-dom": "19.2.1",
|
|
96
|
+
"typescript": "6.0.3",
|
|
97
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
98
|
+
"vitest": "4.1.9"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
|
-
"@uniformdev/canvas-react": "20.70.
|
|
102
|
-
"@uniformdev/next-app-router-client": "20.70.
|
|
103
|
-
"@uniformdev/next-app-router-shared": "20.70.
|
|
104
|
-
"@uniformdev/redirect": "20.70.
|
|
105
|
-
"@uniformdev/richtext": "20.70.
|
|
106
|
-
"@uniformdev/webhooks": "20.70.
|
|
107
|
-
"@vercel/functions": "^
|
|
101
|
+
"@uniformdev/canvas-react": "20.70.1-alpha.6+9aeb4f32ae",
|
|
102
|
+
"@uniformdev/next-app-router-client": "20.70.1-alpha.6+9aeb4f32ae",
|
|
103
|
+
"@uniformdev/next-app-router-shared": "20.70.1-alpha.6+9aeb4f32ae",
|
|
104
|
+
"@uniformdev/redirect": "20.70.1-alpha.6+9aeb4f32ae",
|
|
105
|
+
"@uniformdev/richtext": "20.70.1-alpha.6+9aeb4f32ae",
|
|
106
|
+
"@uniformdev/webhooks": "20.70.1-alpha.6+9aeb4f32ae",
|
|
107
|
+
"@vercel/functions": "^3.7.2",
|
|
108
108
|
"encoding": "^0.1.13",
|
|
109
109
|
"server-only": "^0.0.1",
|
|
110
|
-
"svix": "^1.
|
|
110
|
+
"svix": "^1.96.0"
|
|
111
111
|
},
|
|
112
112
|
"engines": {
|
|
113
113
|
"node": ">=20.9.0"
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"publishConfig": {
|
|
121
121
|
"access": "public"
|
|
122
122
|
},
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "9aeb4f32aeef86de9ce119eeb1516f5f8c6b6063"
|
|
124
124
|
}
|