@uniformdev/next-app-router 20.72.1 → 20.72.2
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 +12 -0
- package/dist/cache.mjs +12 -0
- package/dist/component.js +15 -15
- package/dist/component.mjs +2 -2
- package/dist/handler.js +32 -0
- package/dist/handler.mjs +32 -0
- package/dist/index.esm.js +44 -0
- package/dist/index.js +44 -0
- package/dist/index.mjs +44 -0
- package/dist/middleware.js +1 -0
- package/dist/middleware.mjs +1 -0
- package/package.json +8 -8
package/dist/cache.js
CHANGED
|
@@ -1498,6 +1498,17 @@ var RouteClient = class extends ApiClient {
|
|
|
1498
1498
|
);
|
|
1499
1499
|
}
|
|
1500
1500
|
};
|
|
1501
|
+
var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
1502
|
+
var _a, _b;
|
|
1503
|
+
const dataSourceVariant = (
|
|
1504
|
+
// support explicit 'undefined' as a way to opt out of data resources variant
|
|
1505
|
+
"dataSourceVariant" in params ? params.dataSourceVariant : (
|
|
1506
|
+
// in case of DRAFT state we still want to fetch unpublished data
|
|
1507
|
+
((_b = (_a = params == null ? void 0 : params.state) != null ? _a : defaultPreviewState) != null ? _b : CANVAS_PUBLISHED_STATE) !== CANVAS_PUBLISHED_STATE ? "unpublished" : void 0
|
|
1508
|
+
)
|
|
1509
|
+
);
|
|
1510
|
+
return dataSourceVariant;
|
|
1511
|
+
};
|
|
1501
1512
|
|
|
1502
1513
|
// src/data/client.ts
|
|
1503
1514
|
var import_functions = require("@vercel/functions");
|
|
@@ -2010,6 +2021,7 @@ var DefaultDataClient = class {
|
|
|
2010
2021
|
const originalRoute = {
|
|
2011
2022
|
path: options.pageState.routePath,
|
|
2012
2023
|
state: options.pageState.compositionState,
|
|
2024
|
+
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, options.pageState.compositionState),
|
|
2013
2025
|
withComponentIDs: true,
|
|
2014
2026
|
releaseId: options.pageState.releaseId,
|
|
2015
2027
|
locale: options.pageState.locale,
|
package/dist/cache.mjs
CHANGED
|
@@ -1485,6 +1485,17 @@ var RouteClient = class extends ApiClient {
|
|
|
1485
1485
|
);
|
|
1486
1486
|
}
|
|
1487
1487
|
};
|
|
1488
|
+
var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
1489
|
+
var _a, _b;
|
|
1490
|
+
const dataSourceVariant = (
|
|
1491
|
+
// support explicit 'undefined' as a way to opt out of data resources variant
|
|
1492
|
+
"dataSourceVariant" in params ? params.dataSourceVariant : (
|
|
1493
|
+
// in case of DRAFT state we still want to fetch unpublished data
|
|
1494
|
+
((_b = (_a = params == null ? void 0 : params.state) != null ? _a : defaultPreviewState) != null ? _b : CANVAS_PUBLISHED_STATE) !== CANVAS_PUBLISHED_STATE ? "unpublished" : void 0
|
|
1495
|
+
)
|
|
1496
|
+
);
|
|
1497
|
+
return dataSourceVariant;
|
|
1498
|
+
};
|
|
1488
1499
|
|
|
1489
1500
|
// src/data/client.ts
|
|
1490
1501
|
import { getCache, waitUntil } from "@vercel/functions";
|
|
@@ -1997,6 +2008,7 @@ var DefaultDataClient = class {
|
|
|
1997
2008
|
const originalRoute = {
|
|
1998
2009
|
path: options.pageState.routePath,
|
|
1999
2010
|
state: options.pageState.compositionState,
|
|
2011
|
+
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, options.pageState.compositionState),
|
|
2000
2012
|
withComponentIDs: true,
|
|
2001
2013
|
releaseId: options.pageState.releaseId,
|
|
2002
2014
|
locale: options.pageState.locale,
|
package/dist/component.js
CHANGED
|
@@ -899,11 +899,11 @@ var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
|
|
899
899
|
var ATTRIBUTE_PARAMETER_TYPE = "data-uniform-parameter-type";
|
|
900
900
|
|
|
901
901
|
// src/components/UniformRichText.tsx
|
|
902
|
-
var
|
|
902
|
+
var import_richtext5 = require("@uniformdev/richtext");
|
|
903
903
|
var import_react12 = __toESM(require("react"));
|
|
904
904
|
|
|
905
905
|
// src/components/UniformRichTextNode.tsx
|
|
906
|
-
var
|
|
906
|
+
var import_richtext4 = require("@uniformdev/richtext");
|
|
907
907
|
var import_react11 = __toESM(require("react"));
|
|
908
908
|
|
|
909
909
|
// src/components/nodes/AssetRichTextNode.tsx
|
|
@@ -941,11 +941,11 @@ var LinebreakRichTextNode = () => {
|
|
|
941
941
|
};
|
|
942
942
|
|
|
943
943
|
// src/components/nodes/LinkRichTextNode.tsx
|
|
944
|
-
var
|
|
944
|
+
var import_canvas_react = require("@uniformdev/canvas-react");
|
|
945
945
|
var import_react4 = __toESM(require("react"));
|
|
946
946
|
var LinkRichTextNode = ({ children, node }) => {
|
|
947
947
|
const { link } = node;
|
|
948
|
-
return /* @__PURE__ */ import_react4.default.createElement("a", {
|
|
948
|
+
return /* @__PURE__ */ import_react4.default.createElement("a", { ...(0, import_canvas_react.linkParamValueToAnchorProps)(link) }, children);
|
|
949
949
|
};
|
|
950
950
|
|
|
951
951
|
// src/components/nodes/ListItemRichTextNode.tsx
|
|
@@ -964,26 +964,26 @@ var ListRichTextNode = ({ children, node }) => {
|
|
|
964
964
|
};
|
|
965
965
|
|
|
966
966
|
// src/components/nodes/ParagraphRichTextNode.tsx
|
|
967
|
-
var
|
|
967
|
+
var import_richtext = require("@uniformdev/richtext");
|
|
968
968
|
var import_react7 = __toESM(require("react"));
|
|
969
969
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
970
970
|
const { format, direction } = node;
|
|
971
971
|
return /* @__PURE__ */ import_react7.default.createElement(
|
|
972
972
|
"p",
|
|
973
973
|
{
|
|
974
|
-
dir: (0,
|
|
975
|
-
style: (0,
|
|
974
|
+
dir: (0, import_richtext.isPureDirection)(direction) ? direction : void 0,
|
|
975
|
+
style: (0, import_richtext.isPureTextAlign)(format) ? { textAlign: format } : void 0
|
|
976
976
|
},
|
|
977
977
|
children
|
|
978
978
|
);
|
|
979
979
|
};
|
|
980
980
|
|
|
981
981
|
// src/components/nodes/TableCellRichTextNode.tsx
|
|
982
|
-
var
|
|
982
|
+
var import_richtext2 = require("@uniformdev/richtext");
|
|
983
983
|
var import_react8 = __toESM(require("react"));
|
|
984
984
|
var TableCellRichTextNode = ({ children, node }) => {
|
|
985
985
|
const { headerState } = node;
|
|
986
|
-
const TableCellTag = (0,
|
|
986
|
+
const TableCellTag = (0, import_richtext2.getRichTextTagFromTableCellHeaderState)(headerState);
|
|
987
987
|
return /* @__PURE__ */ import_react8.default.createElement(TableCellTag, null, children);
|
|
988
988
|
};
|
|
989
989
|
|
|
@@ -994,18 +994,18 @@ var TabRichTextNode = () => {
|
|
|
994
994
|
};
|
|
995
995
|
|
|
996
996
|
// src/components/nodes/TextRichTextNode.tsx
|
|
997
|
-
var
|
|
997
|
+
var import_richtext3 = require("@uniformdev/richtext");
|
|
998
998
|
var import_react10 = __toESM(require("react"));
|
|
999
999
|
var TextRichTextNode = ({ node }) => {
|
|
1000
1000
|
const { text, format } = node;
|
|
1001
|
-
const tags = (0,
|
|
1001
|
+
const tags = (0, import_richtext3.getRichTextTagsFromTextFormat)(format);
|
|
1002
1002
|
return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ import_react10.default.createElement(Tag, null, children), text) : text);
|
|
1003
1003
|
};
|
|
1004
1004
|
|
|
1005
1005
|
// src/components/UniformRichTextNode.tsx
|
|
1006
1006
|
function UniformRichTextNode({ node, ...props }) {
|
|
1007
1007
|
var _a;
|
|
1008
|
-
if (!(0,
|
|
1008
|
+
if (!(0, import_richtext4.isRichTextNode)(node)) return null;
|
|
1009
1009
|
let NodeRenderer = (_a = props.resolveRichTextRenderer) == null ? void 0 : _a.call(props, node);
|
|
1010
1010
|
if (typeof NodeRenderer === "undefined") {
|
|
1011
1011
|
NodeRenderer = resolveRichTextDefaultRenderer(node);
|
|
@@ -1059,8 +1059,8 @@ var UniformRichText = import_react12.default.forwardRef(function UniformRichText
|
|
|
1059
1059
|
}
|
|
1060
1060
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameter.parameterId }) : placeholder;
|
|
1061
1061
|
const value = parameter.value;
|
|
1062
|
-
if (!value || !(0,
|
|
1063
|
-
if (!isContextualEditing && (0,
|
|
1062
|
+
if (!value || !(0, import_richtext5.isRichTextValue)(value)) return null;
|
|
1063
|
+
if (!isContextualEditing && (0, import_richtext5.isRichTextValueConsideredEmpty)(value)) return null;
|
|
1064
1064
|
return Tag === null ? /* @__PURE__ */ import_react12.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ import_react12.default.createElement(
|
|
1065
1065
|
Tag,
|
|
1066
1066
|
{
|
|
@@ -1072,7 +1072,7 @@ var UniformRichText = import_react12.default.forwardRef(function UniformRichText
|
|
|
1072
1072
|
[ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
1073
1073
|
} : {}
|
|
1074
1074
|
},
|
|
1075
|
-
(0,
|
|
1075
|
+
(0, import_richtext5.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */ import_react12.default.createElement("p", null, /* @__PURE__ */ import_react12.default.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ import_react12.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
1076
1076
|
);
|
|
1077
1077
|
});
|
|
1078
1078
|
|
package/dist/component.mjs
CHANGED
|
@@ -929,11 +929,11 @@ var LinebreakRichTextNode = () => {
|
|
|
929
929
|
};
|
|
930
930
|
|
|
931
931
|
// src/components/nodes/LinkRichTextNode.tsx
|
|
932
|
-
import {
|
|
932
|
+
import { linkParamValueToAnchorProps } from "@uniformdev/canvas-react";
|
|
933
933
|
import React4 from "react";
|
|
934
934
|
var LinkRichTextNode = ({ children, node }) => {
|
|
935
935
|
const { link } = node;
|
|
936
|
-
return /* @__PURE__ */ React4.createElement("a", {
|
|
936
|
+
return /* @__PURE__ */ React4.createElement("a", { ...linkParamValueToAnchorProps(link) }, children);
|
|
937
937
|
};
|
|
938
938
|
|
|
939
939
|
// src/components/nodes/ListItemRichTextNode.tsx
|
package/dist/handler.js
CHANGED
|
@@ -2419,6 +2419,38 @@ var _Route = class _Route2 {
|
|
|
2419
2419
|
}
|
|
2420
2420
|
return segment.slice(_Route2.dynamicSegmentPrefix.length);
|
|
2421
2421
|
}
|
|
2422
|
+
/**
|
|
2423
|
+
* Splits a path into the path portion and an optional `#fragment`
|
|
2424
|
+
* (everything after the first `#`).
|
|
2425
|
+
*
|
|
2426
|
+
* Variable expressions (`${...}`) may legitimately contain `#` characters
|
|
2427
|
+
* (e.g. JSON-pointer tokens like `${#jptr:/foo/_slug}`), so the fragment
|
|
2428
|
+
* delimiter is the first `#` that falls outside of a variable expression.
|
|
2429
|
+
*/
|
|
2430
|
+
static splitFragment(path) {
|
|
2431
|
+
let fragmentIndex = -1;
|
|
2432
|
+
let length = 0;
|
|
2433
|
+
parseVariableExpression(path, (token, type) => {
|
|
2434
|
+
if (type === "variable") {
|
|
2435
|
+
length += createVariableReference(token).length;
|
|
2436
|
+
return;
|
|
2437
|
+
}
|
|
2438
|
+
const hashOffset = token.indexOf("#");
|
|
2439
|
+
if (hashOffset === -1) {
|
|
2440
|
+
length += token.length;
|
|
2441
|
+
return;
|
|
2442
|
+
}
|
|
2443
|
+
fragmentIndex = length + hashOffset;
|
|
2444
|
+
return false;
|
|
2445
|
+
});
|
|
2446
|
+
if (fragmentIndex === -1) {
|
|
2447
|
+
return { path, fragment: void 0 };
|
|
2448
|
+
}
|
|
2449
|
+
return {
|
|
2450
|
+
path: path.slice(0, fragmentIndex),
|
|
2451
|
+
fragment: path.slice(fragmentIndex + 1)
|
|
2452
|
+
};
|
|
2453
|
+
}
|
|
2422
2454
|
};
|
|
2423
2455
|
_routeInfo = /* @__PURE__ */ new WeakMap();
|
|
2424
2456
|
_Route_static = /* @__PURE__ */ new WeakSet();
|
package/dist/handler.mjs
CHANGED
|
@@ -2404,6 +2404,38 @@ var _Route = class _Route2 {
|
|
|
2404
2404
|
}
|
|
2405
2405
|
return segment.slice(_Route2.dynamicSegmentPrefix.length);
|
|
2406
2406
|
}
|
|
2407
|
+
/**
|
|
2408
|
+
* Splits a path into the path portion and an optional `#fragment`
|
|
2409
|
+
* (everything after the first `#`).
|
|
2410
|
+
*
|
|
2411
|
+
* Variable expressions (`${...}`) may legitimately contain `#` characters
|
|
2412
|
+
* (e.g. JSON-pointer tokens like `${#jptr:/foo/_slug}`), so the fragment
|
|
2413
|
+
* delimiter is the first `#` that falls outside of a variable expression.
|
|
2414
|
+
*/
|
|
2415
|
+
static splitFragment(path) {
|
|
2416
|
+
let fragmentIndex = -1;
|
|
2417
|
+
let length = 0;
|
|
2418
|
+
parseVariableExpression(path, (token, type) => {
|
|
2419
|
+
if (type === "variable") {
|
|
2420
|
+
length += createVariableReference(token).length;
|
|
2421
|
+
return;
|
|
2422
|
+
}
|
|
2423
|
+
const hashOffset = token.indexOf("#");
|
|
2424
|
+
if (hashOffset === -1) {
|
|
2425
|
+
length += token.length;
|
|
2426
|
+
return;
|
|
2427
|
+
}
|
|
2428
|
+
fragmentIndex = length + hashOffset;
|
|
2429
|
+
return false;
|
|
2430
|
+
});
|
|
2431
|
+
if (fragmentIndex === -1) {
|
|
2432
|
+
return { path, fragment: void 0 };
|
|
2433
|
+
}
|
|
2434
|
+
return {
|
|
2435
|
+
path: path.slice(0, fragmentIndex),
|
|
2436
|
+
fragment: path.slice(fragmentIndex + 1)
|
|
2437
|
+
};
|
|
2438
|
+
}
|
|
2407
2439
|
};
|
|
2408
2440
|
_routeInfo = /* @__PURE__ */ new WeakMap();
|
|
2409
2441
|
_Route_static = /* @__PURE__ */ new WeakSet();
|
package/dist/index.esm.js
CHANGED
|
@@ -2048,6 +2048,17 @@ var RouteClient = class extends ApiClient {
|
|
|
2048
2048
|
);
|
|
2049
2049
|
}
|
|
2050
2050
|
};
|
|
2051
|
+
var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
2052
|
+
var _a, _b;
|
|
2053
|
+
const dataSourceVariant = (
|
|
2054
|
+
// support explicit 'undefined' as a way to opt out of data resources variant
|
|
2055
|
+
"dataSourceVariant" in params ? params.dataSourceVariant : (
|
|
2056
|
+
// in case of DRAFT state we still want to fetch unpublished data
|
|
2057
|
+
((_b = (_a = params == null ? void 0 : params.state) != null ? _a : defaultPreviewState) != null ? _b : CANVAS_PUBLISHED_STATE) !== CANVAS_PUBLISHED_STATE ? "unpublished" : void 0
|
|
2058
|
+
)
|
|
2059
|
+
);
|
|
2060
|
+
return dataSourceVariant;
|
|
2061
|
+
};
|
|
2051
2062
|
function mapSlotToPersonalizedVariations(slot) {
|
|
2052
2063
|
if (!slot) return [];
|
|
2053
2064
|
return slot.map((v, i) => {
|
|
@@ -2691,6 +2702,38 @@ var _Route = class _Route2 {
|
|
|
2691
2702
|
}
|
|
2692
2703
|
return segment.slice(_Route2.dynamicSegmentPrefix.length);
|
|
2693
2704
|
}
|
|
2705
|
+
/**
|
|
2706
|
+
* Splits a path into the path portion and an optional `#fragment`
|
|
2707
|
+
* (everything after the first `#`).
|
|
2708
|
+
*
|
|
2709
|
+
* Variable expressions (`${...}`) may legitimately contain `#` characters
|
|
2710
|
+
* (e.g. JSON-pointer tokens like `${#jptr:/foo/_slug}`), so the fragment
|
|
2711
|
+
* delimiter is the first `#` that falls outside of a variable expression.
|
|
2712
|
+
*/
|
|
2713
|
+
static splitFragment(path) {
|
|
2714
|
+
let fragmentIndex = -1;
|
|
2715
|
+
let length = 0;
|
|
2716
|
+
parseVariableExpression(path, (token, type) => {
|
|
2717
|
+
if (type === "variable") {
|
|
2718
|
+
length += createVariableReference(token).length;
|
|
2719
|
+
return;
|
|
2720
|
+
}
|
|
2721
|
+
const hashOffset = token.indexOf("#");
|
|
2722
|
+
if (hashOffset === -1) {
|
|
2723
|
+
length += token.length;
|
|
2724
|
+
return;
|
|
2725
|
+
}
|
|
2726
|
+
fragmentIndex = length + hashOffset;
|
|
2727
|
+
return false;
|
|
2728
|
+
});
|
|
2729
|
+
if (fragmentIndex === -1) {
|
|
2730
|
+
return { path, fragment: void 0 };
|
|
2731
|
+
}
|
|
2732
|
+
return {
|
|
2733
|
+
path: path.slice(0, fragmentIndex),
|
|
2734
|
+
fragment: path.slice(fragmentIndex + 1)
|
|
2735
|
+
};
|
|
2736
|
+
}
|
|
2694
2737
|
};
|
|
2695
2738
|
_routeInfo = /* @__PURE__ */ new WeakMap();
|
|
2696
2739
|
_Route_static = /* @__PURE__ */ new WeakSet();
|
|
@@ -3926,6 +3969,7 @@ var DefaultDataClient = class {
|
|
|
3926
3969
|
const originalRoute = {
|
|
3927
3970
|
path: options.pageState.routePath,
|
|
3928
3971
|
state: options.pageState.compositionState,
|
|
3972
|
+
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, options.pageState.compositionState),
|
|
3929
3973
|
withComponentIDs: true,
|
|
3930
3974
|
releaseId: options.pageState.releaseId,
|
|
3931
3975
|
locale: options.pageState.locale,
|
package/dist/index.js
CHANGED
|
@@ -2075,6 +2075,17 @@ var RouteClient = class extends ApiClient {
|
|
|
2075
2075
|
);
|
|
2076
2076
|
}
|
|
2077
2077
|
};
|
|
2078
|
+
var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
2079
|
+
var _a, _b;
|
|
2080
|
+
const dataSourceVariant = (
|
|
2081
|
+
// support explicit 'undefined' as a way to opt out of data resources variant
|
|
2082
|
+
"dataSourceVariant" in params ? params.dataSourceVariant : (
|
|
2083
|
+
// in case of DRAFT state we still want to fetch unpublished data
|
|
2084
|
+
((_b = (_a = params == null ? void 0 : params.state) != null ? _a : defaultPreviewState) != null ? _b : CANVAS_PUBLISHED_STATE) !== CANVAS_PUBLISHED_STATE ? "unpublished" : void 0
|
|
2085
|
+
)
|
|
2086
|
+
);
|
|
2087
|
+
return dataSourceVariant;
|
|
2088
|
+
};
|
|
2078
2089
|
function mapSlotToPersonalizedVariations(slot) {
|
|
2079
2090
|
if (!slot) return [];
|
|
2080
2091
|
return slot.map((v, i) => {
|
|
@@ -2718,6 +2729,38 @@ var _Route = class _Route2 {
|
|
|
2718
2729
|
}
|
|
2719
2730
|
return segment.slice(_Route2.dynamicSegmentPrefix.length);
|
|
2720
2731
|
}
|
|
2732
|
+
/**
|
|
2733
|
+
* Splits a path into the path portion and an optional `#fragment`
|
|
2734
|
+
* (everything after the first `#`).
|
|
2735
|
+
*
|
|
2736
|
+
* Variable expressions (`${...}`) may legitimately contain `#` characters
|
|
2737
|
+
* (e.g. JSON-pointer tokens like `${#jptr:/foo/_slug}`), so the fragment
|
|
2738
|
+
* delimiter is the first `#` that falls outside of a variable expression.
|
|
2739
|
+
*/
|
|
2740
|
+
static splitFragment(path) {
|
|
2741
|
+
let fragmentIndex = -1;
|
|
2742
|
+
let length = 0;
|
|
2743
|
+
parseVariableExpression(path, (token, type) => {
|
|
2744
|
+
if (type === "variable") {
|
|
2745
|
+
length += createVariableReference(token).length;
|
|
2746
|
+
return;
|
|
2747
|
+
}
|
|
2748
|
+
const hashOffset = token.indexOf("#");
|
|
2749
|
+
if (hashOffset === -1) {
|
|
2750
|
+
length += token.length;
|
|
2751
|
+
return;
|
|
2752
|
+
}
|
|
2753
|
+
fragmentIndex = length + hashOffset;
|
|
2754
|
+
return false;
|
|
2755
|
+
});
|
|
2756
|
+
if (fragmentIndex === -1) {
|
|
2757
|
+
return { path, fragment: void 0 };
|
|
2758
|
+
}
|
|
2759
|
+
return {
|
|
2760
|
+
path: path.slice(0, fragmentIndex),
|
|
2761
|
+
fragment: path.slice(fragmentIndex + 1)
|
|
2762
|
+
};
|
|
2763
|
+
}
|
|
2721
2764
|
};
|
|
2722
2765
|
_routeInfo = /* @__PURE__ */ new WeakMap();
|
|
2723
2766
|
_Route_static = /* @__PURE__ */ new WeakSet();
|
|
@@ -3947,6 +3990,7 @@ var DefaultDataClient = class {
|
|
|
3947
3990
|
const originalRoute = {
|
|
3948
3991
|
path: options.pageState.routePath,
|
|
3949
3992
|
state: options.pageState.compositionState,
|
|
3993
|
+
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, options.pageState.compositionState),
|
|
3950
3994
|
withComponentIDs: true,
|
|
3951
3995
|
releaseId: options.pageState.releaseId,
|
|
3952
3996
|
locale: options.pageState.locale,
|
package/dist/index.mjs
CHANGED
|
@@ -2048,6 +2048,17 @@ var RouteClient = class extends ApiClient {
|
|
|
2048
2048
|
);
|
|
2049
2049
|
}
|
|
2050
2050
|
};
|
|
2051
|
+
var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
2052
|
+
var _a, _b;
|
|
2053
|
+
const dataSourceVariant = (
|
|
2054
|
+
// support explicit 'undefined' as a way to opt out of data resources variant
|
|
2055
|
+
"dataSourceVariant" in params ? params.dataSourceVariant : (
|
|
2056
|
+
// in case of DRAFT state we still want to fetch unpublished data
|
|
2057
|
+
((_b = (_a = params == null ? void 0 : params.state) != null ? _a : defaultPreviewState) != null ? _b : CANVAS_PUBLISHED_STATE) !== CANVAS_PUBLISHED_STATE ? "unpublished" : void 0
|
|
2058
|
+
)
|
|
2059
|
+
);
|
|
2060
|
+
return dataSourceVariant;
|
|
2061
|
+
};
|
|
2051
2062
|
function mapSlotToPersonalizedVariations(slot) {
|
|
2052
2063
|
if (!slot) return [];
|
|
2053
2064
|
return slot.map((v, i) => {
|
|
@@ -2691,6 +2702,38 @@ var _Route = class _Route2 {
|
|
|
2691
2702
|
}
|
|
2692
2703
|
return segment.slice(_Route2.dynamicSegmentPrefix.length);
|
|
2693
2704
|
}
|
|
2705
|
+
/**
|
|
2706
|
+
* Splits a path into the path portion and an optional `#fragment`
|
|
2707
|
+
* (everything after the first `#`).
|
|
2708
|
+
*
|
|
2709
|
+
* Variable expressions (`${...}`) may legitimately contain `#` characters
|
|
2710
|
+
* (e.g. JSON-pointer tokens like `${#jptr:/foo/_slug}`), so the fragment
|
|
2711
|
+
* delimiter is the first `#` that falls outside of a variable expression.
|
|
2712
|
+
*/
|
|
2713
|
+
static splitFragment(path) {
|
|
2714
|
+
let fragmentIndex = -1;
|
|
2715
|
+
let length = 0;
|
|
2716
|
+
parseVariableExpression(path, (token, type) => {
|
|
2717
|
+
if (type === "variable") {
|
|
2718
|
+
length += createVariableReference(token).length;
|
|
2719
|
+
return;
|
|
2720
|
+
}
|
|
2721
|
+
const hashOffset = token.indexOf("#");
|
|
2722
|
+
if (hashOffset === -1) {
|
|
2723
|
+
length += token.length;
|
|
2724
|
+
return;
|
|
2725
|
+
}
|
|
2726
|
+
fragmentIndex = length + hashOffset;
|
|
2727
|
+
return false;
|
|
2728
|
+
});
|
|
2729
|
+
if (fragmentIndex === -1) {
|
|
2730
|
+
return { path, fragment: void 0 };
|
|
2731
|
+
}
|
|
2732
|
+
return {
|
|
2733
|
+
path: path.slice(0, fragmentIndex),
|
|
2734
|
+
fragment: path.slice(fragmentIndex + 1)
|
|
2735
|
+
};
|
|
2736
|
+
}
|
|
2694
2737
|
};
|
|
2695
2738
|
_routeInfo = /* @__PURE__ */ new WeakMap();
|
|
2696
2739
|
_Route_static = /* @__PURE__ */ new WeakSet();
|
|
@@ -3926,6 +3969,7 @@ var DefaultDataClient = class {
|
|
|
3926
3969
|
const originalRoute = {
|
|
3927
3970
|
path: options.pageState.routePath,
|
|
3928
3971
|
state: options.pageState.compositionState,
|
|
3972
|
+
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, options.pageState.compositionState),
|
|
3929
3973
|
withComponentIDs: true,
|
|
3930
3974
|
releaseId: options.pageState.releaseId,
|
|
3931
3975
|
locale: options.pageState.locale,
|
package/dist/middleware.js
CHANGED
|
@@ -3027,6 +3027,7 @@ var DefaultDataClient = class {
|
|
|
3027
3027
|
const originalRoute = {
|
|
3028
3028
|
path: options.pageState.routePath,
|
|
3029
3029
|
state: options.pageState.compositionState,
|
|
3030
|
+
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, options.pageState.compositionState),
|
|
3030
3031
|
withComponentIDs: true,
|
|
3031
3032
|
releaseId: options.pageState.releaseId,
|
|
3032
3033
|
locale: options.pageState.locale,
|
package/dist/middleware.mjs
CHANGED
|
@@ -3014,6 +3014,7 @@ var DefaultDataClient = class {
|
|
|
3014
3014
|
const originalRoute = {
|
|
3015
3015
|
path: options.pageState.routePath,
|
|
3016
3016
|
state: options.pageState.compositionState,
|
|
3017
|
+
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, options.pageState.compositionState),
|
|
3017
3018
|
withComponentIDs: true,
|
|
3018
3019
|
releaseId: options.pageState.releaseId,
|
|
3019
3020
|
locale: options.pageState.locale,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/next-app-router",
|
|
3
|
-
"version": "20.72.
|
|
3
|
+
"version": "20.72.2",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -98,12 +98,12 @@
|
|
|
98
98
|
"vitest": "4.1.9"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
|
-
"@uniformdev/canvas-react": "20.72.
|
|
102
|
-
"@uniformdev/next-app-router-client": "20.72.
|
|
103
|
-
"@uniformdev/next-app-router-shared": "20.72.
|
|
104
|
-
"@uniformdev/redirect": "20.72.
|
|
105
|
-
"@uniformdev/richtext": "20.72.
|
|
106
|
-
"@uniformdev/webhooks": "20.72.
|
|
101
|
+
"@uniformdev/canvas-react": "20.72.2",
|
|
102
|
+
"@uniformdev/next-app-router-client": "20.72.2",
|
|
103
|
+
"@uniformdev/next-app-router-shared": "20.72.2",
|
|
104
|
+
"@uniformdev/redirect": "20.72.2",
|
|
105
|
+
"@uniformdev/richtext": "20.72.2",
|
|
106
|
+
"@uniformdev/webhooks": "20.72.2",
|
|
107
107
|
"@vercel/functions": "^3.7.2",
|
|
108
108
|
"encoding": "^0.1.13",
|
|
109
109
|
"server-only": "^0.0.1",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"publishConfig": {
|
|
121
121
|
"access": "public"
|
|
122
122
|
},
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "8b65535fb3ec81e23f9eb8e0ed0b0be478f6e0e8"
|
|
124
124
|
}
|