@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260320043430 → 0.8.1-dev.20260320053940
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 +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +654 -256
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +649 -251
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2068,7 +2068,7 @@ var DataList = (props) => {
|
|
|
2068
2068
|
}
|
|
2069
2069
|
}
|
|
2070
2070
|
}, [props.dataset]);
|
|
2071
|
-
function
|
|
2071
|
+
function getNestedProperty2(obj, path) {
|
|
2072
2072
|
if (path.includes(".")) {
|
|
2073
2073
|
return path.split(".").reduce((prev, curr) => prev ? prev[curr] : null, obj);
|
|
2074
2074
|
} else if (Array.isArray(obj[path])) {
|
|
@@ -2352,7 +2352,7 @@ var DataList = (props) => {
|
|
|
2352
2352
|
/* @__PURE__ */ jsx40("tbody", { className: "divide-y divide-gray-200 ", children: props.dataset?.result?.map((dataitem, index) => {
|
|
2353
2353
|
let validityClass = "";
|
|
2354
2354
|
console.log("dataitem", dataitem);
|
|
2355
|
-
if (props.recordValidityColumnName &&
|
|
2355
|
+
if (props.recordValidityColumnName && getNestedProperty2(dataitem, props.recordValidityColumnName) == false) {
|
|
2356
2356
|
validityClass = "bg-alert-200";
|
|
2357
2357
|
}
|
|
2358
2358
|
return /* @__PURE__ */ jsx40("tr", { className: validityClass, children: props?.columns?.map((column, colindex) => {
|
|
@@ -2370,7 +2370,7 @@ var DataList = (props) => {
|
|
|
2370
2370
|
ViewControl_default,
|
|
2371
2371
|
{
|
|
2372
2372
|
controlType: column.controlType,
|
|
2373
|
-
value:
|
|
2373
|
+
value: getNestedProperty2(
|
|
2374
2374
|
dataitem,
|
|
2375
2375
|
column.name
|
|
2376
2376
|
),
|
|
@@ -2387,7 +2387,7 @@ var DataList = (props) => {
|
|
|
2387
2387
|
ViewControl_default,
|
|
2388
2388
|
{
|
|
2389
2389
|
controlType: column.controlType,
|
|
2390
|
-
value:
|
|
2390
|
+
value: getNestedProperty2(dataitem, column.name) || column.emptyValueLabel,
|
|
2391
2391
|
format: column.format,
|
|
2392
2392
|
customProps: column.customProps
|
|
2393
2393
|
}
|
|
@@ -2397,7 +2397,7 @@ var DataList = (props) => {
|
|
|
2397
2397
|
ViewControl_default,
|
|
2398
2398
|
{
|
|
2399
2399
|
controlType: column.controlType,
|
|
2400
|
-
value:
|
|
2400
|
+
value: getNestedProperty2(dataitem, column.name),
|
|
2401
2401
|
format: column.format,
|
|
2402
2402
|
customProps: column.customProps
|
|
2403
2403
|
}
|
|
@@ -2502,7 +2502,7 @@ var DataList = (props) => {
|
|
|
2502
2502
|
var DataList_default = DataList;
|
|
2503
2503
|
|
|
2504
2504
|
// src/components/pageRenderingEngine/PageBodyRenderer.tsx
|
|
2505
|
-
import
|
|
2505
|
+
import React51 from "react";
|
|
2506
2506
|
|
|
2507
2507
|
// src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
|
|
2508
2508
|
import React37 from "react";
|
|
@@ -2515,19 +2515,57 @@ var TextNode = (props) => {
|
|
|
2515
2515
|
};
|
|
2516
2516
|
function cssStringToJson(cssString) {
|
|
2517
2517
|
const styleObject = {};
|
|
2518
|
-
const matches = cssString
|
|
2519
|
-
if (matches
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2518
|
+
const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
|
|
2519
|
+
if (matches) {
|
|
2520
|
+
matches.forEach((match) => {
|
|
2521
|
+
const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
|
|
2522
|
+
if (parts && parts.length === 3) {
|
|
2523
|
+
const property = parts[1].trim();
|
|
2524
|
+
const value = parts[2].trim();
|
|
2525
|
+
styleObject[property] = value;
|
|
2526
|
+
}
|
|
2527
|
+
});
|
|
2525
2528
|
}
|
|
2526
2529
|
return styleObject;
|
|
2527
2530
|
}
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
+
function toCamelCase(str) {
|
|
2532
|
+
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
2533
|
+
}
|
|
2534
|
+
function convertKeysToCamelCase(obj) {
|
|
2535
|
+
if (Array.isArray(obj)) {
|
|
2536
|
+
return obj.map(convertKeysToCamelCase);
|
|
2537
|
+
} else if (obj !== null && typeof obj === "object") {
|
|
2538
|
+
return Object.fromEntries(
|
|
2539
|
+
Object.entries(obj).filter(([_, value]) => value !== "").map(([key, value]) => [
|
|
2540
|
+
toCamelCase(key),
|
|
2541
|
+
convertKeysToCamelCase(value)
|
|
2542
|
+
])
|
|
2543
|
+
);
|
|
2544
|
+
}
|
|
2545
|
+
return obj;
|
|
2546
|
+
}
|
|
2547
|
+
function getFormatClass(format) {
|
|
2548
|
+
const classes = [];
|
|
2549
|
+
if (format === 1) classes.push("font-medium");
|
|
2550
|
+
if (format === 2) classes.push("italic");
|
|
2551
|
+
if (format === 3) classes.push("font-medium italic");
|
|
2552
|
+
if (format === 8) classes.push("underline");
|
|
2553
|
+
if (format === 9) classes.push("font-medium underline");
|
|
2554
|
+
if (format === 10) classes.push("italic underline");
|
|
2555
|
+
if (format === 11) classes.push("font-medium italic underline");
|
|
2556
|
+
if (format === 256) classes.push("lowercase");
|
|
2557
|
+
if (format === 512) classes.push("uppercase");
|
|
2558
|
+
if (format === 1024) classes.push("capitalize");
|
|
2559
|
+
return classes.join(" ");
|
|
2560
|
+
}
|
|
2561
|
+
const styles = convertKeysToCamelCase(cssStringToJson(props.node.style));
|
|
2562
|
+
function replacePlaceholders(template, dataItem) {
|
|
2563
|
+
return template.replace(/{(\w+)}/g, (_, key) => {
|
|
2564
|
+
return key in dataItem ? dataItem[key] : `{${key}}`;
|
|
2565
|
+
});
|
|
2566
|
+
}
|
|
2567
|
+
const displayText = props.linkText ? props.linkText : props.node.text;
|
|
2568
|
+
return /* @__PURE__ */ jsx41("span", { style: { ...styles }, className: getFormatClass(props.node.format), children: props.dataitem && props.linkText ? displayText : props.dataitem ? replacePlaceholders(props.node.text, props.dataitem) : props.node.text });
|
|
2531
2569
|
};
|
|
2532
2570
|
var TextNode_default = TextNode;
|
|
2533
2571
|
|
|
@@ -2613,39 +2651,171 @@ var EquationNode = ({ node }) => {
|
|
|
2613
2651
|
};
|
|
2614
2652
|
var EquationNode_default = EquationNode;
|
|
2615
2653
|
|
|
2654
|
+
// src/components/pageRenderingEngine/nodes/DatafieldNode.tsx
|
|
2655
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
2656
|
+
function getNestedProperty(obj, path) {
|
|
2657
|
+
if (!obj || !path) return null;
|
|
2658
|
+
if (path.includes(".")) {
|
|
2659
|
+
return path.split(".").reduce((prev, curr) => prev ? prev[curr] : null, obj);
|
|
2660
|
+
} else if (Array.isArray(obj[path])) {
|
|
2661
|
+
return obj[path].map((item, index) => /* @__PURE__ */ jsx46("div", { children: item }, index));
|
|
2662
|
+
} else {
|
|
2663
|
+
return obj[path];
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
var DatafieldNode = (props) => {
|
|
2667
|
+
function cssStringToJson(cssString) {
|
|
2668
|
+
const styleObject = {};
|
|
2669
|
+
const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
|
|
2670
|
+
if (matches) {
|
|
2671
|
+
matches.forEach((match) => {
|
|
2672
|
+
const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
|
|
2673
|
+
if (parts && parts.length === 3) {
|
|
2674
|
+
const property = parts[1].trim();
|
|
2675
|
+
const value2 = parts[2].trim();
|
|
2676
|
+
styleObject[property] = value2;
|
|
2677
|
+
}
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2680
|
+
return styleObject;
|
|
2681
|
+
}
|
|
2682
|
+
function toCamelCase(str) {
|
|
2683
|
+
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
2684
|
+
}
|
|
2685
|
+
function convertKeysToCamelCase(obj) {
|
|
2686
|
+
if (!obj || typeof obj !== "object") return obj;
|
|
2687
|
+
return Object.fromEntries(
|
|
2688
|
+
Object.entries(obj).map(([key, value2]) => [toCamelCase(key), value2])
|
|
2689
|
+
);
|
|
2690
|
+
}
|
|
2691
|
+
const Formats = [
|
|
2692
|
+
"",
|
|
2693
|
+
"font-medium",
|
|
2694
|
+
"italic",
|
|
2695
|
+
"font-medium italic",
|
|
2696
|
+
"",
|
|
2697
|
+
"",
|
|
2698
|
+
"",
|
|
2699
|
+
"",
|
|
2700
|
+
"underline",
|
|
2701
|
+
"font-medium underline",
|
|
2702
|
+
"italic underline",
|
|
2703
|
+
"italic underline font-medium"
|
|
2704
|
+
];
|
|
2705
|
+
const styles = convertKeysToCamelCase(cssStringToJson(props.node.style));
|
|
2706
|
+
const fieldName = props.node.fieldName;
|
|
2707
|
+
const value = props.dataitem ? getNestedProperty(props.dataitem, fieldName) : null;
|
|
2708
|
+
console.log(fieldName, value, "haha");
|
|
2709
|
+
const isEmptyValue = value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0 || typeof value === "object" && Object.keys(value).length === 0;
|
|
2710
|
+
const maxLines = props.node.maxLines;
|
|
2711
|
+
if (maxLines && Number(maxLines) > 0) {
|
|
2712
|
+
Object.assign(styles, {
|
|
2713
|
+
display: "-webkit-box",
|
|
2714
|
+
overflow: "hidden",
|
|
2715
|
+
WebkitBoxOrient: "vertical",
|
|
2716
|
+
WebkitLineClamp: String(maxLines)
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2719
|
+
const dataType = props.node.dataType;
|
|
2720
|
+
if (isEmptyValue) {
|
|
2721
|
+
return null;
|
|
2722
|
+
}
|
|
2723
|
+
if (dataType == "rawContent") {
|
|
2724
|
+
return /* @__PURE__ */ jsx46(
|
|
2725
|
+
PageBodyRenderer_default,
|
|
2726
|
+
{
|
|
2727
|
+
rawBody: value ?? `@databound[${fieldName}]`,
|
|
2728
|
+
routeParameters: props.routeParameters,
|
|
2729
|
+
query: props.query,
|
|
2730
|
+
session: props.session,
|
|
2731
|
+
host: props.host,
|
|
2732
|
+
path: props.path,
|
|
2733
|
+
apiBaseUrl: props.apiBaseUrl,
|
|
2734
|
+
breadcrumb: props.breadcrumb,
|
|
2735
|
+
donotApplyContainerClass: true
|
|
2736
|
+
}
|
|
2737
|
+
);
|
|
2738
|
+
}
|
|
2739
|
+
return /* @__PURE__ */ jsx46(
|
|
2740
|
+
"span",
|
|
2741
|
+
{
|
|
2742
|
+
className: `datafield-node ${props.node.format < Formats.length ? Formats[props.node.format] : ""}`,
|
|
2743
|
+
style: styles,
|
|
2744
|
+
children: /* @__PURE__ */ jsx46(
|
|
2745
|
+
ViewControl_default,
|
|
2746
|
+
{
|
|
2747
|
+
controlType: dataType,
|
|
2748
|
+
value: value ?? `@databound[${fieldName}]`
|
|
2749
|
+
}
|
|
2750
|
+
)
|
|
2751
|
+
}
|
|
2752
|
+
);
|
|
2753
|
+
};
|
|
2754
|
+
var DatafieldNode_default = DatafieldNode;
|
|
2755
|
+
|
|
2616
2756
|
// src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
|
|
2617
|
-
import { jsx as
|
|
2757
|
+
import { Fragment as Fragment3, jsx as jsx47, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2618
2758
|
var ParagraphNode = (props) => {
|
|
2619
2759
|
const NodeTypes2 = {
|
|
2620
2760
|
["text"]: TextNode_default,
|
|
2621
2761
|
["linebreak"]: LineBreakNode_default,
|
|
2622
2762
|
["link"]: LinkNode_default,
|
|
2763
|
+
["datafield"]: DatafieldNode_default,
|
|
2623
2764
|
["equation"]: EquationNode_default,
|
|
2624
2765
|
["svg-icon"]: SVGIconNode_default
|
|
2625
2766
|
};
|
|
2626
2767
|
const FormatClass = {
|
|
2627
|
-
"center": "text-center"
|
|
2768
|
+
"center": "text-center",
|
|
2769
|
+
"right": "text-right"
|
|
2628
2770
|
};
|
|
2629
2771
|
{
|
|
2630
2772
|
}
|
|
2631
2773
|
let formatClasses = FormatClass[props.node.format] || "";
|
|
2632
|
-
|
|
2633
|
-
|
|
2774
|
+
const isInlineOnlyParent = props.parentTag === "summary";
|
|
2775
|
+
const hasChildren = props.node.children && props.node.children.length > 0;
|
|
2776
|
+
if (isInlineOnlyParent) {
|
|
2777
|
+
return /* @__PURE__ */ jsx47(Fragment3, { children: hasChildren && props.node.children.map((node, index) => {
|
|
2634
2778
|
const SelectedNode = NodeTypes2[node.type];
|
|
2635
|
-
return /* @__PURE__ */
|
|
2779
|
+
return /* @__PURE__ */ jsx47(React37.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx47(
|
|
2780
|
+
SelectedNode,
|
|
2781
|
+
{
|
|
2782
|
+
node,
|
|
2783
|
+
dataitem: props.dataitem,
|
|
2784
|
+
session: props.session,
|
|
2785
|
+
apiBaseUrl: props.apiBaseUrl,
|
|
2786
|
+
routeParameters: props.routeParameters
|
|
2787
|
+
}
|
|
2788
|
+
) }, index);
|
|
2789
|
+
}) });
|
|
2790
|
+
}
|
|
2791
|
+
return /* @__PURE__ */ jsxs24("div", { className: " " + formatClasses, children: [
|
|
2792
|
+
hasChildren && props.node.children.map((node, index) => {
|
|
2793
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
2794
|
+
return /* @__PURE__ */ jsx47(React37.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx47(
|
|
2795
|
+
SelectedNode,
|
|
2796
|
+
{
|
|
2797
|
+
node,
|
|
2798
|
+
dataitem: props.dataitem,
|
|
2799
|
+
session: props.session,
|
|
2800
|
+
apiBaseUrl: props.apiBaseUrl,
|
|
2801
|
+
routeParameters: props.routeParameters
|
|
2802
|
+
}
|
|
2803
|
+
) }, index);
|
|
2636
2804
|
}),
|
|
2637
|
-
|
|
2805
|
+
!hasChildren && /* @__PURE__ */ jsx47("div", { className: "py-1.5 lg:py-2" })
|
|
2638
2806
|
] });
|
|
2639
2807
|
};
|
|
2640
2808
|
var ParagraphNode_default = ParagraphNode;
|
|
2641
2809
|
|
|
2642
2810
|
// src/components/pageRenderingEngine/nodes/HeadingNode.tsx
|
|
2643
2811
|
import React38 from "react";
|
|
2644
|
-
import { Fragment as
|
|
2812
|
+
import { Fragment as Fragment4, jsx as jsx48 } from "react/jsx-runtime";
|
|
2645
2813
|
var HeadingNode = (props) => {
|
|
2646
2814
|
const NodeTypes2 = {
|
|
2647
2815
|
["text"]: TextNode_default,
|
|
2648
|
-
["link"]: LinkNode_default
|
|
2816
|
+
["link"]: LinkNode_default,
|
|
2817
|
+
// ["linebreak"]: LineBreakNodeNew,
|
|
2818
|
+
["datafield"]: DatafieldNode_default
|
|
2649
2819
|
};
|
|
2650
2820
|
const HeadingTag = `${props.node.tag}`;
|
|
2651
2821
|
const FormatClass = {
|
|
@@ -2654,12 +2824,12 @@ var HeadingNode = (props) => {
|
|
|
2654
2824
|
{
|
|
2655
2825
|
}
|
|
2656
2826
|
let formatClasses = FormatClass[props.node.format] || "";
|
|
2657
|
-
return /* @__PURE__ */
|
|
2827
|
+
return /* @__PURE__ */ jsx48(Fragment4, { children: React38.createElement(
|
|
2658
2828
|
HeadingTag,
|
|
2659
2829
|
{ className: formatClasses },
|
|
2660
2830
|
props.node.children && props.node.children.map((childNode, index) => {
|
|
2661
2831
|
const SelectedNode = NodeTypes2[childNode.type];
|
|
2662
|
-
return /* @__PURE__ */
|
|
2832
|
+
return /* @__PURE__ */ jsx48(React38.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx48(SelectedNode, { node: childNode, dataitem: props.dataitem, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
|
|
2663
2833
|
})
|
|
2664
2834
|
) });
|
|
2665
2835
|
};
|
|
@@ -2670,34 +2840,54 @@ import React40 from "react";
|
|
|
2670
2840
|
|
|
2671
2841
|
// src/components/pageRenderingEngine/nodes/ListItemNode.tsx
|
|
2672
2842
|
import React39 from "react";
|
|
2673
|
-
import { jsx as
|
|
2843
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
2674
2844
|
var ListItemNode = (props) => {
|
|
2675
2845
|
const NodeTypes2 = {
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2846
|
+
text: TextNode_default,
|
|
2847
|
+
linebreak: LineBreakNode_default,
|
|
2848
|
+
link: LinkNode_default,
|
|
2849
|
+
list: ListNode_default
|
|
2679
2850
|
};
|
|
2680
|
-
|
|
2851
|
+
let foundFirstBreak = false;
|
|
2852
|
+
const firstTextChild = props.node.children?.find((c) => c.type === "text");
|
|
2853
|
+
let liStyle = {};
|
|
2854
|
+
if (firstTextChild?.style) {
|
|
2855
|
+
const match = firstTextChild.style.match(/font-size\s*:\s*([^;]+);?/);
|
|
2856
|
+
if (match) {
|
|
2857
|
+
liStyle.fontSize = match[1].trim();
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
return /* @__PURE__ */ jsx49("li", { style: liStyle, children: props.node.children && props.node.children.map((node, index) => {
|
|
2681
2861
|
const SelectedNode = NodeTypes2[node.type];
|
|
2682
|
-
|
|
2862
|
+
if (node.type === "linebreak") {
|
|
2863
|
+
if (!foundFirstBreak) {
|
|
2864
|
+
foundFirstBreak = true;
|
|
2865
|
+
return /* @__PURE__ */ jsx49("div", {}, index);
|
|
2866
|
+
} else {
|
|
2867
|
+
return /* @__PURE__ */ jsx49("div", { className: "py-1 lg:py-2" }, index);
|
|
2868
|
+
}
|
|
2869
|
+
} else {
|
|
2870
|
+
foundFirstBreak = false;
|
|
2871
|
+
return /* @__PURE__ */ jsx49(React39.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx49(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
|
|
2872
|
+
}
|
|
2683
2873
|
}) });
|
|
2684
2874
|
};
|
|
2685
2875
|
var ListItemNode_default = ListItemNode;
|
|
2686
2876
|
|
|
2687
2877
|
// src/components/pageRenderingEngine/nodes/ListNode.tsx
|
|
2688
|
-
import { jsx as
|
|
2878
|
+
import { jsx as jsx50, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2689
2879
|
var ListNode = (props) => {
|
|
2690
2880
|
const NodeTypes2 = {
|
|
2691
2881
|
listitem: ListItemNode_default
|
|
2692
2882
|
};
|
|
2693
2883
|
return /* @__PURE__ */ jsxs25(React40.Fragment, { children: [
|
|
2694
|
-
props.node.listType == "bullet" && /* @__PURE__ */
|
|
2884
|
+
props.node.listType == "bullet" && /* @__PURE__ */ jsx50("ul", { children: props.node.children && props.node.children.map((node, index) => {
|
|
2695
2885
|
const SelectedNode = NodeTypes2[node.type];
|
|
2696
|
-
return /* @__PURE__ */
|
|
2886
|
+
return /* @__PURE__ */ jsx50(React40.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx50(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
|
|
2697
2887
|
}) }),
|
|
2698
|
-
props.node.listType == "number" && /* @__PURE__ */
|
|
2888
|
+
props.node.listType == "number" && /* @__PURE__ */ jsx50("ol", { children: props.node.children && props.node.children.map((node, index) => {
|
|
2699
2889
|
const SelectedNode = NodeTypes2[node.type];
|
|
2700
|
-
return /* @__PURE__ */
|
|
2890
|
+
return /* @__PURE__ */ jsx50(React40.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx50(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
|
|
2701
2891
|
}) })
|
|
2702
2892
|
] });
|
|
2703
2893
|
};
|
|
@@ -2705,56 +2895,118 @@ var ListNode_default = ListNode;
|
|
|
2705
2895
|
|
|
2706
2896
|
// src/components/pageRenderingEngine/nodes/QuoteNode.tsx
|
|
2707
2897
|
import React41 from "react";
|
|
2708
|
-
import { jsx as
|
|
2898
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
2709
2899
|
var QuoteNode = (props) => {
|
|
2710
2900
|
const NodeTypes2 = {
|
|
2711
2901
|
["text"]: TextNode_default,
|
|
2712
2902
|
["linebreak"]: LineBreakNode_default,
|
|
2713
2903
|
["link"]: LinkNode_default
|
|
2714
2904
|
};
|
|
2715
|
-
return /* @__PURE__ */
|
|
2905
|
+
return /* @__PURE__ */ jsx51("blockquote", { children: props.node.children && props.node.children.map((node, index) => {
|
|
2716
2906
|
const SelectedNode = NodeTypes2[node.type];
|
|
2717
|
-
return /* @__PURE__ */
|
|
2907
|
+
return /* @__PURE__ */ jsx51(React41.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx51(SelectedNode, { node, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
|
|
2718
2908
|
}) });
|
|
2719
2909
|
};
|
|
2720
2910
|
var QuoteNode_default = QuoteNode;
|
|
2721
2911
|
|
|
2722
2912
|
// src/components/pageRenderingEngine/nodes/CodeNode.tsx
|
|
2723
2913
|
import React42 from "react";
|
|
2724
|
-
|
|
2914
|
+
|
|
2915
|
+
// src/components/CopyButton.tsx
|
|
2916
|
+
import { useState as useState8, useRef as useRef3, useEffect as useEffect7 } from "react";
|
|
2917
|
+
import { jsx as jsx52, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2918
|
+
function CopyButton({ text }) {
|
|
2919
|
+
const [copied, setCopied] = useState8(false);
|
|
2920
|
+
const timeoutRef = useRef3(null);
|
|
2921
|
+
useEffect7(() => {
|
|
2922
|
+
return () => {
|
|
2923
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2924
|
+
};
|
|
2925
|
+
}, []);
|
|
2926
|
+
const handleCopy = async () => {
|
|
2927
|
+
try {
|
|
2928
|
+
await navigator.clipboard.writeText(text);
|
|
2929
|
+
setCopied(true);
|
|
2930
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2931
|
+
timeoutRef.current = setTimeout(() => setCopied(false), 2e3);
|
|
2932
|
+
} catch (err) {
|
|
2933
|
+
console.error("Failed to copy: ", err);
|
|
2934
|
+
}
|
|
2935
|
+
};
|
|
2936
|
+
return /* @__PURE__ */ jsxs26(
|
|
2937
|
+
"button",
|
|
2938
|
+
{
|
|
2939
|
+
onClick: handleCopy,
|
|
2940
|
+
className: "flex gap-1 items-center hover:text-white transition",
|
|
2941
|
+
children: [
|
|
2942
|
+
/* @__PURE__ */ jsx52(
|
|
2943
|
+
"svg",
|
|
2944
|
+
{
|
|
2945
|
+
width: "16",
|
|
2946
|
+
height: "16",
|
|
2947
|
+
viewBox: "0 0 24 24",
|
|
2948
|
+
className: "w-4 h-4",
|
|
2949
|
+
fill: "currentColor",
|
|
2950
|
+
children: /* @__PURE__ */ jsx52(
|
|
2951
|
+
"path",
|
|
2952
|
+
{
|
|
2953
|
+
fillRule: "evenodd",
|
|
2954
|
+
clipRule: "evenodd",
|
|
2955
|
+
d: "M12 4C10.8954 4 10 4.89543 10 6H14C14 4.89543 13.1046 4 12 4ZM8.53513 4C9.22675 2.8044 10.5194 2 12 2C13.4806 2 14.7733 2.8044 15.4649 4H17C18.6569 4 20 5.34315 20 7V19C20 20.6569 18.6569 22 17 22H7C5.34315 22 4 20.6569 4 19V7C4 5.34315 5.34315 4 7 4H8.53513ZM8 6H7C6.44772 6 6 6.44772 6 7V19C6 19.5523 6.44772 20 7 20H17C17.5523 20 18 19.5523 18 19V7C18 6.44772 17.5523 6 17 6H16C16 7.10457 15.1046 8 14 8H10C8.89543 8 8 7.10457 8 6Z"
|
|
2956
|
+
}
|
|
2957
|
+
)
|
|
2958
|
+
}
|
|
2959
|
+
),
|
|
2960
|
+
copied ? "Copied!" : "Copy code"
|
|
2961
|
+
]
|
|
2962
|
+
}
|
|
2963
|
+
);
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
// src/components/pageRenderingEngine/nodes/CodeNode.tsx
|
|
2967
|
+
import { jsx as jsx53, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2725
2968
|
var CodeNode = (props) => {
|
|
2726
2969
|
const NodeTypes2 = {
|
|
2727
2970
|
["text"]: TextNode_default,
|
|
2728
2971
|
["linebreak"]: LineBreakNode_default,
|
|
2729
2972
|
["link"]: LinkNode_default
|
|
2730
2973
|
};
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2974
|
+
const textContent = props.node?.children?.map((node) => {
|
|
2975
|
+
if (node.type === "text") return node.text || "";
|
|
2976
|
+
if (node.type === "linebreak") return "\n";
|
|
2977
|
+
if (node.type === "link") return node.text || node.url || "";
|
|
2978
|
+
return "";
|
|
2979
|
+
}).join("") ?? "";
|
|
2980
|
+
return /* @__PURE__ */ jsxs27("div", { className: "code-block", children: [
|
|
2981
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center relative text-gray-200 bg-gray-800 px-4 py-2.5 text-xs font-sans justify-between rounded-t-md", children: [
|
|
2982
|
+
/* @__PURE__ */ jsx53("span", { children: "Code Snippet" }),
|
|
2983
|
+
/* @__PURE__ */ jsx53(CopyButton, { text: textContent })
|
|
2984
|
+
] }),
|
|
2985
|
+
/* @__PURE__ */ jsx53("code", { className: "block bg-gray-900 text-gray-100 p-4 rounded-b-md text-sm whitespace-pre-wrap", children: props.node.children && props.node.children.map((node, index) => {
|
|
2986
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
2987
|
+
return /* @__PURE__ */ jsx53(React42.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx53(SelectedNode, { node, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
|
|
2988
|
+
}) })
|
|
2989
|
+
] });
|
|
2735
2990
|
};
|
|
2736
2991
|
var CodeNode_default = CodeNode;
|
|
2737
2992
|
|
|
2738
2993
|
// src/components/pageRenderingEngine/nodes/HorizontalRuleNode.tsx
|
|
2739
|
-
import { jsx as
|
|
2994
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
2740
2995
|
var HorizontalRuleNode = (props) => {
|
|
2741
|
-
return /* @__PURE__ */
|
|
2996
|
+
return /* @__PURE__ */ jsx54("hr", {});
|
|
2742
2997
|
};
|
|
2743
2998
|
var HorizontalRuleNode_default = HorizontalRuleNode;
|
|
2744
2999
|
|
|
2745
|
-
// src/components/pageRenderingEngine/nodes/LayoutContainerNode.tsx
|
|
2746
|
-
import React45 from "react";
|
|
2747
|
-
|
|
2748
3000
|
// src/components/pageRenderingEngine/nodes/LayoutItemNode.tsx
|
|
2749
|
-
import
|
|
3001
|
+
import React48 from "react";
|
|
2750
3002
|
|
|
2751
3003
|
// src/components/pageRenderingEngine/nodes/ImageNode.tsx
|
|
2752
3004
|
import React43 from "react";
|
|
2753
|
-
import { jsx as
|
|
3005
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
2754
3006
|
var ImageNode = (props) => {
|
|
2755
3007
|
const { node, apiBaseUrl = "" } = props;
|
|
2756
3008
|
let imageUrl = node.imageUrl.startsWith("http") ? node.imageUrl : `${apiBaseUrl}/digitalassets/storefront/${node.imageUrl}`;
|
|
2757
|
-
return /* @__PURE__ */
|
|
3009
|
+
return /* @__PURE__ */ jsx55(React43.Fragment, { children: node.width ? /* @__PURE__ */ jsx55("div", { style: { width: node.width }, children: /* @__PURE__ */ jsx55(
|
|
2758
3010
|
"img",
|
|
2759
3011
|
{
|
|
2760
3012
|
loading: "lazy",
|
|
@@ -2764,7 +3016,7 @@ var ImageNode = (props) => {
|
|
|
2764
3016
|
height: node.intrinsicHeight,
|
|
2765
3017
|
alt: node.title
|
|
2766
3018
|
}
|
|
2767
|
-
) }) : /* @__PURE__ */
|
|
3019
|
+
) }) : /* @__PURE__ */ jsx55(
|
|
2768
3020
|
"img",
|
|
2769
3021
|
{
|
|
2770
3022
|
loading: "lazy",
|
|
@@ -2778,8 +3030,204 @@ var ImageNode = (props) => {
|
|
|
2778
3030
|
};
|
|
2779
3031
|
var ImageNode_default = ImageNode;
|
|
2780
3032
|
|
|
3033
|
+
// src/components/pageRenderingEngine/nodes/WidgetNode.tsx
|
|
3034
|
+
import { Suspense } from "react";
|
|
3035
|
+
import { Fragment as Fragment5, jsx as jsx56, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3036
|
+
var WidgetNode = (props) => {
|
|
3037
|
+
const getWidgetParameters = () => {
|
|
3038
|
+
const widgetInputParameters = { ...props.routeParameters ?? {} };
|
|
3039
|
+
const rawWidgetParams = props.node?.widgetParameters ?? props.node?.widgetParams;
|
|
3040
|
+
let widgetParameters = {};
|
|
3041
|
+
const isJSON = (str) => {
|
|
3042
|
+
if (typeof str !== "string") return false;
|
|
3043
|
+
str = str.trim();
|
|
3044
|
+
return str.startsWith("{") && str.endsWith("}") || str.startsWith("[") && str.endsWith("]");
|
|
3045
|
+
};
|
|
3046
|
+
if (rawWidgetParams) {
|
|
3047
|
+
if (typeof rawWidgetParams === "string" && isJSON(rawWidgetParams)) {
|
|
3048
|
+
widgetParameters = JSON.parse(rawWidgetParams);
|
|
3049
|
+
} else if (typeof rawWidgetParams === "object") {
|
|
3050
|
+
widgetParameters = rawWidgetParams;
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
const resolveValue = (val) => {
|
|
3054
|
+
if (typeof val === "string") {
|
|
3055
|
+
const m = /^\{(.+)\}$/.exec(val);
|
|
3056
|
+
if (m) {
|
|
3057
|
+
const actualKey = m[1];
|
|
3058
|
+
return props.routeParameters?.[actualKey] ?? val;
|
|
3059
|
+
}
|
|
3060
|
+
return val;
|
|
3061
|
+
} else if (Array.isArray(val)) {
|
|
3062
|
+
return val.map(resolveValue);
|
|
3063
|
+
} else if (val && typeof val === "object") {
|
|
3064
|
+
const out = {};
|
|
3065
|
+
for (const k of Object.keys(val)) {
|
|
3066
|
+
out[k] = resolveValue(val[k]);
|
|
3067
|
+
}
|
|
3068
|
+
return out;
|
|
3069
|
+
}
|
|
3070
|
+
return val;
|
|
3071
|
+
};
|
|
3072
|
+
Object.keys(widgetParameters).forEach((key) => {
|
|
3073
|
+
const rawVal = widgetParameters[key];
|
|
3074
|
+
if (rawVal === "route") {
|
|
3075
|
+
if (key === "itemPath") {
|
|
3076
|
+
widgetInputParameters[key] = props.path;
|
|
3077
|
+
} else {
|
|
3078
|
+
widgetInputParameters[key] = widgetInputParameters[key] ?? null;
|
|
3079
|
+
}
|
|
3080
|
+
} else {
|
|
3081
|
+
widgetInputParameters[key] = resolveValue(rawVal);
|
|
3082
|
+
}
|
|
3083
|
+
});
|
|
3084
|
+
widgetInputParameters["widgetTitle"] = props.node?.widgetTitle;
|
|
3085
|
+
return widgetInputParameters;
|
|
3086
|
+
};
|
|
3087
|
+
const SelectedWidget = props.widgetRegistry?.[props.node.widgetCode];
|
|
3088
|
+
if (!SelectedWidget) {
|
|
3089
|
+
console.warn("Widget not found:", props.node.widgetCode);
|
|
3090
|
+
return /* @__PURE__ */ jsxs28(Fragment5, { children: [
|
|
3091
|
+
"Widget not found: ",
|
|
3092
|
+
props.node.widgetCode
|
|
3093
|
+
] });
|
|
3094
|
+
}
|
|
3095
|
+
return /* @__PURE__ */ jsx56(Suspense, { fallback: /* @__PURE__ */ jsx56("div", { className: "container mt-2", children: "..." }), children: /* @__PURE__ */ jsx56(
|
|
3096
|
+
SelectedWidget,
|
|
3097
|
+
{
|
|
3098
|
+
params: getWidgetParameters(),
|
|
3099
|
+
query: props.query,
|
|
3100
|
+
session: props.session,
|
|
3101
|
+
host: props.host,
|
|
3102
|
+
path: props.path,
|
|
3103
|
+
apiBaseUrl: props.apiBaseUrl
|
|
3104
|
+
}
|
|
3105
|
+
) });
|
|
3106
|
+
};
|
|
3107
|
+
var WidgetNode_default = WidgetNode;
|
|
3108
|
+
|
|
3109
|
+
// src/components/pageRenderingEngine/nodes/IframeClient.tsx
|
|
3110
|
+
import React46, { useEffect as useEffect8, useRef as useRef4, useState as useState9 } from "react";
|
|
3111
|
+
|
|
3112
|
+
// src/components/IFrameLoaderView.tsx
|
|
3113
|
+
import React45 from "react";
|
|
3114
|
+
import { jsx as jsx57, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3115
|
+
var IFrameLoaderView = (props) => {
|
|
3116
|
+
return /* @__PURE__ */ jsxs29(React45.Fragment, { children: [
|
|
3117
|
+
props.isDataFound == null && /* @__PURE__ */ jsx57("div", { className: "", children: /* @__PURE__ */ jsxs29("div", { className: "mt-4 bg-gray-200 rounded-md p-4 animate-pulse", children: [
|
|
3118
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center mb-4", children: [
|
|
3119
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 h-8 w-8 rounded-full animate-pulse" }),
|
|
3120
|
+
/* @__PURE__ */ jsxs29("div", { className: "ml-2", children: [
|
|
3121
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 h-3 w-16 animate-pulse" }),
|
|
3122
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 h-2 w-12 animate-pulse" })
|
|
3123
|
+
] })
|
|
3124
|
+
] }),
|
|
3125
|
+
/* @__PURE__ */ jsxs29("div", { className: "grid grid-cols-3 gap-4 mt-6", children: [
|
|
3126
|
+
/* @__PURE__ */ jsxs29("div", { className: "animate-pulse", children: [
|
|
3127
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
3128
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
3129
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
3130
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
3131
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
3132
|
+
] }),
|
|
3133
|
+
/* @__PURE__ */ jsxs29("div", { className: "animate-pulse", children: [
|
|
3134
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
3135
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
3136
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
3137
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
3138
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
3139
|
+
] }),
|
|
3140
|
+
/* @__PURE__ */ jsxs29("div", { className: "animate-pulse", children: [
|
|
3141
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
3142
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
3143
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
3144
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
3145
|
+
/* @__PURE__ */ jsx57("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
3146
|
+
] })
|
|
3147
|
+
] })
|
|
3148
|
+
] }) }),
|
|
3149
|
+
props.children
|
|
3150
|
+
] });
|
|
3151
|
+
};
|
|
3152
|
+
var IFrameLoaderView_default = IFrameLoaderView;
|
|
3153
|
+
|
|
3154
|
+
// src/components/pageRenderingEngine/nodes/IframeClient.tsx
|
|
3155
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
3156
|
+
var IframeClient = ({ src }) => {
|
|
3157
|
+
const iframeRef = useRef4(null);
|
|
3158
|
+
const [iframeHeight, setIframeHeight] = useState9("100%");
|
|
3159
|
+
const [isDataFound, setIsDataFound] = useState9(null);
|
|
3160
|
+
useEffect8(() => {
|
|
3161
|
+
const handleReceiveMessage = (event) => {
|
|
3162
|
+
const eventName = event?.data?.eventName;
|
|
3163
|
+
const payload = event?.data?.payload;
|
|
3164
|
+
if (eventName === "SET_HEIGHT" && payload?.height) {
|
|
3165
|
+
let height = 500;
|
|
3166
|
+
if (payload.height > 500) {
|
|
3167
|
+
height = payload.height + 50;
|
|
3168
|
+
}
|
|
3169
|
+
setIframeHeight(`${height}px`);
|
|
3170
|
+
}
|
|
3171
|
+
};
|
|
3172
|
+
window.addEventListener("message", handleReceiveMessage);
|
|
3173
|
+
return () => window.removeEventListener("message", handleReceiveMessage);
|
|
3174
|
+
}, []);
|
|
3175
|
+
useEffect8(() => {
|
|
3176
|
+
const handleResize = () => {
|
|
3177
|
+
if (iframeRef.current) {
|
|
3178
|
+
iframeRef.current.contentWindow?.postMessage({ eventName: "RESIZE" }, "*");
|
|
3179
|
+
}
|
|
3180
|
+
};
|
|
3181
|
+
window.addEventListener("resize", handleResize);
|
|
3182
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
3183
|
+
}, []);
|
|
3184
|
+
const handleIframeLoad = () => {
|
|
3185
|
+
setIsDataFound(true);
|
|
3186
|
+
};
|
|
3187
|
+
return /* @__PURE__ */ jsx58(React46.Fragment, { children: /* @__PURE__ */ jsx58(IFrameLoaderView_default, { isDataFound, children: /* @__PURE__ */ jsx58(
|
|
3188
|
+
"iframe",
|
|
3189
|
+
{
|
|
3190
|
+
ref: iframeRef,
|
|
3191
|
+
src,
|
|
3192
|
+
className: "w-full h-full border-none",
|
|
3193
|
+
scrolling: "no",
|
|
3194
|
+
onLoad: handleIframeLoad
|
|
3195
|
+
}
|
|
3196
|
+
) }) });
|
|
3197
|
+
};
|
|
3198
|
+
var IframeClient_default = IframeClient;
|
|
3199
|
+
|
|
3200
|
+
// src/components/pageRenderingEngine/nodes/EmbedNode.tsx
|
|
3201
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
3202
|
+
var EmbedNode = (props) => {
|
|
3203
|
+
let src;
|
|
3204
|
+
if (props.node.provider == "youtube") {
|
|
3205
|
+
src = `https://www.youtube-nocookie.com/embed/${props.node.embedSrc}`;
|
|
3206
|
+
} else if (props.node.provider == "bunny") {
|
|
3207
|
+
src = `https://iframe.mediadelivery.net/embed/${props.node.embedSrc}?autoplay=false&loop=false&muted=false&preload=true&responsive=true`;
|
|
3208
|
+
} else {
|
|
3209
|
+
src = props.node.embedSrc;
|
|
3210
|
+
}
|
|
3211
|
+
return /* @__PURE__ */ jsx59("div", { className: "aspect-video", children: src && /* @__PURE__ */ jsx59(IframeClient_default, { src }) });
|
|
3212
|
+
};
|
|
3213
|
+
var EmbedNode_default = EmbedNode;
|
|
3214
|
+
|
|
3215
|
+
// src/components/pageRenderingEngine/nodes/VideoNode.tsx
|
|
3216
|
+
import React47 from "react";
|
|
3217
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
3218
|
+
var VideoNode = (props) => {
|
|
3219
|
+
let src;
|
|
3220
|
+
if (props.node.provider == "youtube") {
|
|
3221
|
+
src = `https://www.youtube-nocookie.com/embed/${props.node.videoId}`;
|
|
3222
|
+
} else if (props.node.provider == "bunny") {
|
|
3223
|
+
src = `https://iframe.mediadelivery.net/embed/${props.node.videoId}?autoplay=false&loop=false&muted=false&preload=true&responsive=true`;
|
|
3224
|
+
}
|
|
3225
|
+
return /* @__PURE__ */ jsx60(React47.Fragment, { children: src && /* @__PURE__ */ jsx60("iframe", { className: "w-full aspect-video rounded", src, loading: "lazy", allow: "accelerometer;gyroscope;autoplay;encrypted-media;picture-in-picture;", allowFullScreen: true }) });
|
|
3226
|
+
};
|
|
3227
|
+
var VideoNode_default = VideoNode;
|
|
3228
|
+
|
|
2781
3229
|
// src/components/pageRenderingEngine/nodes/LayoutItemNode.tsx
|
|
2782
|
-
import { jsx as
|
|
3230
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
2783
3231
|
var LayoutItemNode = (props) => {
|
|
2784
3232
|
const NodeTypes2 = {
|
|
2785
3233
|
["paragraph"]: ParagraphNode_default,
|
|
@@ -2790,7 +3238,11 @@ var LayoutItemNode = (props) => {
|
|
|
2790
3238
|
["horizontalrule"]: HorizontalRuleNode_default,
|
|
2791
3239
|
["image"]: ImageNode_default,
|
|
2792
3240
|
["layout-container"]: LayoutContainerNode_default,
|
|
2793
|
-
["link"]: LinkNode_default
|
|
3241
|
+
["link"]: LinkNode_default,
|
|
3242
|
+
["widget"]: WidgetNode_default,
|
|
3243
|
+
["youtube"]: VideoNode_default,
|
|
3244
|
+
["video"]: VideoNode_default,
|
|
3245
|
+
["embed"]: EmbedNode_default
|
|
2794
3246
|
};
|
|
2795
3247
|
let cssClasses = "";
|
|
2796
3248
|
if (props.order) {
|
|
@@ -2808,6 +3260,7 @@ var LayoutItemNode = (props) => {
|
|
|
2808
3260
|
}
|
|
2809
3261
|
if (props.node.itemBorderRadius) {
|
|
2810
3262
|
styles.borderRadius = props.node.itemBorderRadius;
|
|
3263
|
+
styles.overflow = "hidden";
|
|
2811
3264
|
}
|
|
2812
3265
|
function removeParagraphsAtStartAndEnd(layoutItem) {
|
|
2813
3266
|
let startIndex = 0;
|
|
@@ -2824,6 +3277,8 @@ var LayoutItemNode = (props) => {
|
|
|
2824
3277
|
}
|
|
2825
3278
|
if (startIndex <= endIndex) {
|
|
2826
3279
|
layoutItem.children = layoutItem.children.slice(startIndex, endIndex + 1);
|
|
3280
|
+
} else {
|
|
3281
|
+
layoutItem.children = [];
|
|
2827
3282
|
}
|
|
2828
3283
|
return layoutItem;
|
|
2829
3284
|
}
|
|
@@ -2833,201 +3288,160 @@ var LayoutItemNode = (props) => {
|
|
|
2833
3288
|
} else {
|
|
2834
3289
|
updatedLayout = removeParagraphsAtStartAndEnd(props.node);
|
|
2835
3290
|
}
|
|
2836
|
-
return /* @__PURE__ */
|
|
3291
|
+
return /* @__PURE__ */ jsx61(React48.Fragment, { children: /* @__PURE__ */ jsx61("div", { className: "layout-item " + cssClasses, style: { ...styles }, children: updatedLayout.children.map((node, index) => {
|
|
2837
3292
|
{
|
|
2838
3293
|
}
|
|
2839
3294
|
const SelectedNode = NodeTypes2[node.type];
|
|
2840
|
-
return /* @__PURE__ */
|
|
2841
|
-
|
|
3295
|
+
return /* @__PURE__ */ jsx61(React48.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx61(
|
|
3296
|
+
SelectedNode,
|
|
3297
|
+
{
|
|
3298
|
+
node,
|
|
3299
|
+
routeParameters: props.routeParameters,
|
|
3300
|
+
query: props.query,
|
|
3301
|
+
session: props.session,
|
|
3302
|
+
host: props.host,
|
|
3303
|
+
path: props.path,
|
|
3304
|
+
apiBaseUrl: props.apiBaseUrl
|
|
3305
|
+
}
|
|
3306
|
+
) }, index);
|
|
3307
|
+
}) }) });
|
|
2842
3308
|
};
|
|
2843
3309
|
var LayoutItemNode_default = LayoutItemNode;
|
|
2844
3310
|
|
|
2845
|
-
// src/components/
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
}
|
|
2854
|
-
|
|
2855
|
-
"1fr": "layout-grid-col-1",
|
|
2856
|
-
"1fr 1fr": "layout-grid-col-2-equal",
|
|
2857
|
-
"1fr 2fr": "layout-grid-col-2-widths-33-67",
|
|
2858
|
-
"2fr 1fr": "layout-grid-col-2-widths-67-33",
|
|
2859
|
-
"3fr 2fr": "layout-grid-col-2-widths-60-40",
|
|
2860
|
-
"3fr 1fr": "layout-grid-col-2-widths-75-25",
|
|
2861
|
-
"1fr 1fr 1fr": "layout-grid-col-3-equal",
|
|
2862
|
-
"1fr 2fr 1fr": "layout-grid-col-3-widths-25-50-25",
|
|
2863
|
-
"1fr 6fr 1fr": "layout-grid-col-3-widths-15-70-15",
|
|
2864
|
-
"1fr 1fr 1fr 1fr": "layout-grid-col-4-equal"
|
|
3311
|
+
// src/components/utilities/AssetUtility.tsx
|
|
3312
|
+
var AssetUtility = class {
|
|
3313
|
+
constructor() {
|
|
3314
|
+
}
|
|
3315
|
+
static resolveUrl(apiBaseUrl, url) {
|
|
3316
|
+
if (!url) return void 0;
|
|
3317
|
+
if (url.startsWith("http")) return url;
|
|
3318
|
+
if (!apiBaseUrl) return url;
|
|
3319
|
+
return `${apiBaseUrl}/digitalassets-management/${url}`;
|
|
3320
|
+
}
|
|
2865
3321
|
};
|
|
3322
|
+
var AssetUtility_default = AssetUtility;
|
|
3323
|
+
|
|
3324
|
+
// src/components/pageRenderingEngine/nodes/LayoutContainerNode.tsx
|
|
3325
|
+
import { Fragment as Fragment6, jsx as jsx62, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2866
3326
|
var LayoutContainerNode = (props) => {
|
|
2867
|
-
const
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
}
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
3327
|
+
const VERTICAL_ALIGNMENT_CLASSES = {
|
|
3328
|
+
start: "items-start",
|
|
3329
|
+
center: "items-center place-content-center",
|
|
3330
|
+
end: "items-end",
|
|
3331
|
+
stretch: "items-stretch",
|
|
3332
|
+
baseline: "items-baseline"
|
|
3333
|
+
};
|
|
3334
|
+
const LAYOUTGRID_COLS_CLASSES = {
|
|
3335
|
+
"1fr": "layout-grid-col-1",
|
|
3336
|
+
"1fr 1fr": "layout-grid-col-2-equal",
|
|
3337
|
+
"1fr 2fr": "layout-grid-col-2-widths-33-67",
|
|
3338
|
+
"2fr 1fr": "layout-grid-col-2-widths-67-33",
|
|
3339
|
+
"3fr 2fr": "layout-grid-col-2-widths-60-40",
|
|
3340
|
+
"3fr 1fr": "layout-grid-col-2-widths-75-25",
|
|
3341
|
+
"1fr 1fr 1fr": "layout-grid-col-3-equal",
|
|
3342
|
+
"1fr 2fr 1fr": "layout-grid-col-3-widths-25-50-25",
|
|
3343
|
+
"1fr 6fr 1fr": "layout-grid-col-3-widths-15-70-15",
|
|
3344
|
+
"1fr 1fr 1fr 1fr": "layout-grid-col-4-equal"
|
|
3345
|
+
};
|
|
3346
|
+
const sectionWidth = props.node.sectionWidth || "fixed";
|
|
3347
|
+
let gridCssClasses = LAYOUTGRID_COLS_CLASSES[props.node.templateColumns] || "";
|
|
3348
|
+
if (props.node.contentVerticalAlignment) {
|
|
3349
|
+
gridCssClasses += " " + (VERTICAL_ALIGNMENT_CLASSES[props.node.contentVerticalAlignment] || "");
|
|
2877
3350
|
}
|
|
3351
|
+
const columnGap = props.node.columnGap || "0.5rem";
|
|
2878
3352
|
const styles = {};
|
|
2879
|
-
|
|
2880
|
-
styles.backgroundColor = node.backgroundColor;
|
|
2881
|
-
}
|
|
2882
|
-
let cssClasses = "layout_grid ";
|
|
3353
|
+
let cssClasses = "layout_grid";
|
|
2883
3354
|
let addPadding = false;
|
|
2884
|
-
if (node.
|
|
2885
|
-
|
|
2886
|
-
}
|
|
2887
|
-
cssClasses = cssClasses + " " + (node.boxShadow || "");
|
|
2888
|
-
addPadding = true;
|
|
3355
|
+
if (props.node.backgroundColor) {
|
|
3356
|
+
styles.backgroundColor = props.node.backgroundColor;
|
|
2889
3357
|
}
|
|
2890
|
-
if (node.borderWidth) {
|
|
2891
|
-
styles.borderWidth = node.borderWidth;
|
|
3358
|
+
if (props.node.borderWidth) {
|
|
3359
|
+
styles.borderWidth = props.node.borderWidth;
|
|
2892
3360
|
addPadding = true;
|
|
2893
3361
|
}
|
|
2894
|
-
if (node.borderRadius) {
|
|
2895
|
-
styles.borderRadius = node.borderRadius;
|
|
2896
|
-
}
|
|
2897
|
-
let backgroundStyle = "";
|
|
2898
|
-
if (node.backgroundImage) {
|
|
2899
|
-
let resolvedPath = node.backgroundImage;
|
|
2900
|
-
if (!resolvedPath.startsWith("http")) {
|
|
2901
|
-
resolvedPath = `${apiBaseUrl}/digitalassets/storefront/${resolvedPath}`;
|
|
2902
|
-
}
|
|
2903
|
-
backgroundStyle = `url('${resolvedPath}'),`;
|
|
3362
|
+
if (props.node.borderRadius) {
|
|
3363
|
+
styles.borderRadius = props.node.borderRadius;
|
|
2904
3364
|
}
|
|
2905
|
-
if (node.
|
|
2906
|
-
|
|
3365
|
+
if (props.node.boxShadow && props.node.boxShadow !== "shadow-none") {
|
|
3366
|
+
cssClasses += " " + props.node.boxShadow;
|
|
3367
|
+
addPadding = true;
|
|
2907
3368
|
}
|
|
2908
|
-
|
|
2909
|
-
|
|
3369
|
+
const backgroundLayers = [];
|
|
3370
|
+
if (props.node.backgroundImage) {
|
|
3371
|
+
const resolved = AssetUtility_default.resolveUrl(
|
|
3372
|
+
props.apiBaseUrl,
|
|
3373
|
+
props.node.backgroundImage
|
|
3374
|
+
);
|
|
3375
|
+
if (resolved) {
|
|
3376
|
+
backgroundLayers.push(`url('${resolved}')`);
|
|
3377
|
+
addPadding = true;
|
|
3378
|
+
}
|
|
2910
3379
|
}
|
|
2911
|
-
if (
|
|
2912
|
-
|
|
2913
|
-
|
|
3380
|
+
if (props.node.gradientColor1 && props.node.gradientColor2) {
|
|
3381
|
+
backgroundLayers.push(
|
|
3382
|
+
`linear-gradient(to bottom, ${props.node.gradientColor1}, ${props.node.gradientColor2})`
|
|
3383
|
+
);
|
|
3384
|
+
addPadding = true;
|
|
3385
|
+
} else if (props.node.gradientColor1) {
|
|
3386
|
+
backgroundLayers.push(props.node.gradientColor1);
|
|
3387
|
+
addPadding = true;
|
|
3388
|
+
} else if (props.node.gradientColor2) {
|
|
3389
|
+
backgroundLayers.push(props.node.gradientColor2);
|
|
2914
3390
|
addPadding = true;
|
|
2915
3391
|
}
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
sectionWidth = node.sectionWidth;
|
|
3392
|
+
if (backgroundLayers.length) {
|
|
3393
|
+
styles.background = backgroundLayers.join(", ");
|
|
2919
3394
|
}
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
3395
|
+
const renderChildren = () => props.node.children?.map((node, index) => /* @__PURE__ */ jsx62(
|
|
3396
|
+
LayoutItemNode_default,
|
|
3397
|
+
{
|
|
3398
|
+
node,
|
|
3399
|
+
order: props.node.smOrder === "reverse" ? props.node.children.length - index : index,
|
|
3400
|
+
routeParameters: props.routeParameters,
|
|
3401
|
+
query: props.query,
|
|
3402
|
+
session: props.session,
|
|
3403
|
+
host: props.host,
|
|
3404
|
+
path: props.path,
|
|
3405
|
+
apiBaseUrl: props.apiBaseUrl
|
|
3406
|
+
},
|
|
3407
|
+
index
|
|
3408
|
+
));
|
|
3409
|
+
return /* @__PURE__ */ jsxs30(Fragment6, { children: [
|
|
3410
|
+
sectionWidth === "mixed" && /* @__PURE__ */ jsx62("div", { className: cssClasses, style: styles, children: /* @__PURE__ */ jsx62("div", { className: "container", children: /* @__PURE__ */ jsx62(
|
|
2925
3411
|
"div",
|
|
2926
3412
|
{
|
|
2927
|
-
className:
|
|
3413
|
+
className: `grid gap-y-4 lg:gap-y-0 ${gridCssClasses} ${addPadding ? "py-8 lg:py-6" : ""}`,
|
|
3414
|
+
style: { columnGap, minHeight: props.node.height },
|
|
3415
|
+
children: renderChildren()
|
|
3416
|
+
}
|
|
3417
|
+
) }) }),
|
|
3418
|
+
sectionWidth === "full" && /* @__PURE__ */ jsx62(
|
|
3419
|
+
"div",
|
|
3420
|
+
{
|
|
3421
|
+
className: `grid gap-y-4 lg:gap-y-0 ${cssClasses} ${gridCssClasses} ${addPadding ? "p-8 lg:p-0" : ""}`,
|
|
2928
3422
|
style: { columnGap, ...styles },
|
|
2929
|
-
children:
|
|
2930
|
-
return /* @__PURE__ */ jsx55(React45.Fragment, { children: /* @__PURE__ */ jsx55(LayoutItemNode_default, { node: node2, order: props.node.smOrder == "reverse" ? node2.children.length - index : index }) }, index);
|
|
2931
|
-
})
|
|
3423
|
+
children: renderChildren()
|
|
2932
3424
|
}
|
|
2933
3425
|
),
|
|
2934
|
-
sectionWidth
|
|
3426
|
+
sectionWidth === "fixed" && /* @__PURE__ */ jsx62("div", { className: "container", children: /* @__PURE__ */ jsx62(
|
|
2935
3427
|
"div",
|
|
2936
3428
|
{
|
|
2937
|
-
className:
|
|
3429
|
+
className: `grid gap-y-4 lg:gap-y-0 ${cssClasses} ${gridCssClasses} ${addPadding ? "px-8 py-6 lg:px-6 lg:py-6" : ""}`,
|
|
2938
3430
|
style: { columnGap, ...styles },
|
|
2939
|
-
children:
|
|
2940
|
-
return /* @__PURE__ */ jsx55(React45.Fragment, { children: /* @__PURE__ */ jsx55(LayoutItemNode_default, { node: node2, order: props.node.smOrder == "reverse" ? node2.children.length - index : index }) }, index);
|
|
2941
|
-
})
|
|
3431
|
+
children: renderChildren()
|
|
2942
3432
|
}
|
|
2943
3433
|
) })
|
|
2944
3434
|
] });
|
|
2945
3435
|
};
|
|
2946
3436
|
var LayoutContainerNode_default = LayoutContainerNode;
|
|
2947
3437
|
|
|
2948
|
-
// src/components/pageRenderingEngine/nodes/WidgetNode.tsx
|
|
2949
|
-
import { Suspense } from "react";
|
|
2950
|
-
import { Fragment as Fragment4, jsx as jsx56, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2951
|
-
var WidgetNode = (props) => {
|
|
2952
|
-
const getWidgetParameters = () => {
|
|
2953
|
-
const widgetInputParameters = { ...props.routeParameters ?? {} };
|
|
2954
|
-
const rawWidgetParams = props.node?.widgetParameters ?? props.node?.widgetParams;
|
|
2955
|
-
let widgetParameters = {};
|
|
2956
|
-
const isJSON = (str) => {
|
|
2957
|
-
if (typeof str !== "string") return false;
|
|
2958
|
-
str = str.trim();
|
|
2959
|
-
return str.startsWith("{") && str.endsWith("}") || str.startsWith("[") && str.endsWith("]");
|
|
2960
|
-
};
|
|
2961
|
-
if (rawWidgetParams) {
|
|
2962
|
-
if (typeof rawWidgetParams === "string" && isJSON(rawWidgetParams)) {
|
|
2963
|
-
widgetParameters = JSON.parse(rawWidgetParams);
|
|
2964
|
-
} else if (typeof rawWidgetParams === "object") {
|
|
2965
|
-
widgetParameters = rawWidgetParams;
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
const resolveValue = (val) => {
|
|
2969
|
-
if (typeof val === "string") {
|
|
2970
|
-
const m = /^\{(.+)\}$/.exec(val);
|
|
2971
|
-
if (m) {
|
|
2972
|
-
const actualKey = m[1];
|
|
2973
|
-
return props.routeParameters?.[actualKey] ?? val;
|
|
2974
|
-
}
|
|
2975
|
-
return val;
|
|
2976
|
-
} else if (Array.isArray(val)) {
|
|
2977
|
-
return val.map(resolveValue);
|
|
2978
|
-
} else if (val && typeof val === "object") {
|
|
2979
|
-
const out = {};
|
|
2980
|
-
for (const k of Object.keys(val)) {
|
|
2981
|
-
out[k] = resolveValue(val[k]);
|
|
2982
|
-
}
|
|
2983
|
-
return out;
|
|
2984
|
-
}
|
|
2985
|
-
return val;
|
|
2986
|
-
};
|
|
2987
|
-
Object.keys(widgetParameters).forEach((key) => {
|
|
2988
|
-
const rawVal = widgetParameters[key];
|
|
2989
|
-
if (rawVal === "route") {
|
|
2990
|
-
if (key === "itemPath") {
|
|
2991
|
-
widgetInputParameters[key] = props.path;
|
|
2992
|
-
} else {
|
|
2993
|
-
widgetInputParameters[key] = widgetInputParameters[key] ?? null;
|
|
2994
|
-
}
|
|
2995
|
-
} else {
|
|
2996
|
-
widgetInputParameters[key] = resolveValue(rawVal);
|
|
2997
|
-
}
|
|
2998
|
-
});
|
|
2999
|
-
widgetInputParameters["widgetTitle"] = props.node?.widgetTitle;
|
|
3000
|
-
return widgetInputParameters;
|
|
3001
|
-
};
|
|
3002
|
-
const SelectedWidget = props.widgetRegistry?.[props.node.widgetCode];
|
|
3003
|
-
if (!SelectedWidget) {
|
|
3004
|
-
console.warn("Widget not found:", props.node.widgetCode);
|
|
3005
|
-
return /* @__PURE__ */ jsxs27(Fragment4, { children: [
|
|
3006
|
-
"Widget not found: ",
|
|
3007
|
-
props.node.widgetCode
|
|
3008
|
-
] });
|
|
3009
|
-
}
|
|
3010
|
-
return /* @__PURE__ */ jsx56(Suspense, { fallback: /* @__PURE__ */ jsx56("div", { className: "container mt-2", children: "..." }), children: /* @__PURE__ */ jsx56(
|
|
3011
|
-
SelectedWidget,
|
|
3012
|
-
{
|
|
3013
|
-
params: getWidgetParameters(),
|
|
3014
|
-
query: props.query,
|
|
3015
|
-
session: props.session,
|
|
3016
|
-
host: props.host,
|
|
3017
|
-
path: props.path,
|
|
3018
|
-
apiBaseUrl: props.apiBaseUrl
|
|
3019
|
-
}
|
|
3020
|
-
) });
|
|
3021
|
-
};
|
|
3022
|
-
var WidgetNode_default = WidgetNode;
|
|
3023
|
-
|
|
3024
3438
|
// src/components/pageRenderingEngine/nodes/FormContainerNode.tsx
|
|
3025
|
-
import
|
|
3439
|
+
import React49, { useRef as useRef5, useReducer as useReducer2, useCallback as useCallback3, useEffect as useEffect9 } from "react";
|
|
3026
3440
|
|
|
3027
3441
|
// src/components/pageRenderingEngine/nodes/InputControlNode.tsx
|
|
3028
|
-
import { jsx as
|
|
3442
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
3029
3443
|
var InputControlNode = (props) => {
|
|
3030
|
-
return /* @__PURE__ */
|
|
3444
|
+
return /* @__PURE__ */ jsx63("div", { children: /* @__PURE__ */ jsx63(
|
|
3031
3445
|
InputControl_default,
|
|
3032
3446
|
{
|
|
3033
3447
|
name: props.node.name,
|
|
@@ -3056,13 +3470,13 @@ var InputControlNode = (props) => {
|
|
|
3056
3470
|
var InputControlNode_default = InputControlNode;
|
|
3057
3471
|
|
|
3058
3472
|
// src/components/pageRenderingEngine/nodes/FormContainerNode.tsx
|
|
3059
|
-
import { jsx as
|
|
3473
|
+
import { jsx as jsx64, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3060
3474
|
var FormContainerNode = (props) => {
|
|
3061
3475
|
const NodeTypes2 = {
|
|
3062
3476
|
["input-control"]: InputControlNode_default
|
|
3063
3477
|
};
|
|
3064
3478
|
const { node } = props;
|
|
3065
|
-
const formRef =
|
|
3479
|
+
const formRef = useRef5(null);
|
|
3066
3480
|
const initialState = {
|
|
3067
3481
|
inputValues: {},
|
|
3068
3482
|
lastPropertyChanged: ""
|
|
@@ -3079,7 +3493,7 @@ var FormContainerNode = (props) => {
|
|
|
3079
3493
|
return true;
|
|
3080
3494
|
}
|
|
3081
3495
|
};
|
|
3082
|
-
|
|
3496
|
+
useEffect9(() => {
|
|
3083
3497
|
const fetchInitialData = async () => {
|
|
3084
3498
|
if (!props.fetchData || !node.dataFetchApi) return;
|
|
3085
3499
|
const response = await props.fetchData(
|
|
@@ -3096,12 +3510,12 @@ var FormContainerNode = (props) => {
|
|
|
3096
3510
|
};
|
|
3097
3511
|
fetchInitialData();
|
|
3098
3512
|
}, [props.fetchData, node.dataFetchApi, props.routeParameters]);
|
|
3099
|
-
return /* @__PURE__ */
|
|
3513
|
+
return /* @__PURE__ */ jsxs31("form", { className: "group space-y-6 pb-6 overflow-y-auto", noValidate: true, ref: formRef, children: [
|
|
3100
3514
|
node.children && node.children.map((node2, index) => {
|
|
3101
3515
|
{
|
|
3102
3516
|
}
|
|
3103
3517
|
const SelectedNode = NodeTypes2[node2.type];
|
|
3104
|
-
return /* @__PURE__ */
|
|
3518
|
+
return /* @__PURE__ */ jsx64(React49.Fragment, { children: SelectedNode && node2.type == "input-control" && /* @__PURE__ */ jsx64(
|
|
3105
3519
|
InputControlNode_default,
|
|
3106
3520
|
{
|
|
3107
3521
|
value: formState.inputValues[node2.name],
|
|
@@ -3110,34 +3524,15 @@ var FormContainerNode = (props) => {
|
|
|
3110
3524
|
}
|
|
3111
3525
|
) }, index);
|
|
3112
3526
|
}),
|
|
3113
|
-
node.children.length == 0 && /* @__PURE__ */
|
|
3527
|
+
node.children.length == 0 && /* @__PURE__ */ jsx64("div", { className: "py-0.5 lg:py-1.5" })
|
|
3114
3528
|
] });
|
|
3115
3529
|
};
|
|
3116
3530
|
var FormContainerNode_default = FormContainerNode;
|
|
3117
3531
|
|
|
3118
3532
|
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
3119
|
-
import
|
|
3533
|
+
import React50 from "react";
|
|
3120
3534
|
import Link3 from "next/link";
|
|
3121
|
-
|
|
3122
|
-
// src/components/utilities/AssetUtility.tsx
|
|
3123
|
-
var AssetUtility = class {
|
|
3124
|
-
constructor() {
|
|
3125
|
-
}
|
|
3126
|
-
static resolveUrl(apiBaseUrl, url) {
|
|
3127
|
-
if (url) {
|
|
3128
|
-
if (url.startsWith("http")) {
|
|
3129
|
-
return url;
|
|
3130
|
-
} else {
|
|
3131
|
-
return `${apiBaseUrl}/digitalassets-management/${url}`;
|
|
3132
|
-
}
|
|
3133
|
-
}
|
|
3134
|
-
return void 0;
|
|
3135
|
-
}
|
|
3136
|
-
};
|
|
3137
|
-
var AssetUtility_default = AssetUtility;
|
|
3138
|
-
|
|
3139
|
-
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
3140
|
-
import { jsx as jsx59, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3535
|
+
import { jsx as jsx65, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3141
3536
|
var DivContainer = (props) => {
|
|
3142
3537
|
const { cssProperties: styles, hoverCssProperties: hoverStyles, mobileCssProperties: mobileStyles } = props.node;
|
|
3143
3538
|
const updatedStyles = convertKeysToCamelCase(styles);
|
|
@@ -3151,8 +3546,10 @@ var DivContainer = (props) => {
|
|
|
3151
3546
|
["horizontalrule"]: HorizontalRuleNode_default,
|
|
3152
3547
|
["layout-container"]: LayoutContainerNode_default,
|
|
3153
3548
|
["widget"]: WidgetNode_default,
|
|
3549
|
+
["embed"]: EmbedNode_default,
|
|
3154
3550
|
["div-container"]: DivContainer,
|
|
3155
3551
|
["text"]: TextNode_default,
|
|
3552
|
+
["datafield"]: DatafieldNode_default,
|
|
3156
3553
|
["svg-icon"]: SVGIconNode_default
|
|
3157
3554
|
};
|
|
3158
3555
|
function toCamelCase(str) {
|
|
@@ -3254,9 +3651,9 @@ ${mobileCssRules.join("\n")}
|
|
|
3254
3651
|
return css2;
|
|
3255
3652
|
};
|
|
3256
3653
|
const css = generateCssString(updatedStyle, hoverStyles, mobileStyles);
|
|
3257
|
-
return /* @__PURE__ */
|
|
3258
|
-
/* @__PURE__ */
|
|
3259
|
-
props.node.href && props.node.href !== "" ? /* @__PURE__ */
|
|
3654
|
+
return /* @__PURE__ */ jsxs32(React50.Fragment, { children: [
|
|
3655
|
+
/* @__PURE__ */ jsx65("style", { dangerouslySetInnerHTML: { __html: css } }),
|
|
3656
|
+
props.node.href && props.node.href !== "" ? /* @__PURE__ */ jsx65(Link3, { href: props.node.href, className: "block", children: /* @__PURE__ */ jsx65(
|
|
3260
3657
|
"div",
|
|
3261
3658
|
{
|
|
3262
3659
|
id: guid,
|
|
@@ -3264,7 +3661,7 @@ ${mobileCssRules.join("\n")}
|
|
|
3264
3661
|
className: containerPaddingClass,
|
|
3265
3662
|
children: props.node.children?.map((node, index) => {
|
|
3266
3663
|
const SelectedNode = NodeTypes2[node.type];
|
|
3267
|
-
return /* @__PURE__ */
|
|
3664
|
+
return /* @__PURE__ */ jsx65(React50.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx65(
|
|
3268
3665
|
SelectedNode,
|
|
3269
3666
|
{
|
|
3270
3667
|
node,
|
|
@@ -3279,9 +3676,9 @@ ${mobileCssRules.join("\n")}
|
|
|
3279
3676
|
) }, index);
|
|
3280
3677
|
})
|
|
3281
3678
|
}
|
|
3282
|
-
) }) : /* @__PURE__ */
|
|
3679
|
+
) }) : /* @__PURE__ */ jsx65("div", { id: guid, style: { ...backgroundStyle }, className: containerPaddingClass, children: props.node.children && props.node.children.map((node, index) => {
|
|
3283
3680
|
const SelectedNode = NodeTypes2[node.type];
|
|
3284
|
-
return /* @__PURE__ */
|
|
3681
|
+
return /* @__PURE__ */ jsx65(React50.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx65(
|
|
3285
3682
|
SelectedNode,
|
|
3286
3683
|
{
|
|
3287
3684
|
node,
|
|
@@ -3300,7 +3697,7 @@ ${mobileCssRules.join("\n")}
|
|
|
3300
3697
|
var DivContainer_default = DivContainer;
|
|
3301
3698
|
|
|
3302
3699
|
// src/components/pageRenderingEngine/PageBodyRenderer.tsx
|
|
3303
|
-
import { jsx as
|
|
3700
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
3304
3701
|
var NodeTypes = {
|
|
3305
3702
|
["paragraph"]: ParagraphNode_default,
|
|
3306
3703
|
["heading"]: HeadingNode_default,
|
|
@@ -3313,7 +3710,8 @@ var NodeTypes = {
|
|
|
3313
3710
|
["widget"]: WidgetNode_default,
|
|
3314
3711
|
["form-container"]: FormContainerNode_default,
|
|
3315
3712
|
["div-container"]: DivContainer_default,
|
|
3316
|
-
["svg-icon"]: SVGIconNode_default
|
|
3713
|
+
["svg-icon"]: SVGIconNode_default,
|
|
3714
|
+
["embed"]: EmbedNode_default
|
|
3317
3715
|
};
|
|
3318
3716
|
var PageBodyRenderer = (props) => {
|
|
3319
3717
|
let pageBodyTree;
|
|
@@ -3327,11 +3725,11 @@ var PageBodyRenderer = (props) => {
|
|
|
3327
3725
|
if (pageBodyTree && pageBodyTree.root) {
|
|
3328
3726
|
rootNode = pageBodyTree.root;
|
|
3329
3727
|
}
|
|
3330
|
-
return /* @__PURE__ */
|
|
3728
|
+
return /* @__PURE__ */ jsx66(React51.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
|
|
3331
3729
|
{
|
|
3332
3730
|
}
|
|
3333
3731
|
const SelectedNode = NodeTypes[node.type];
|
|
3334
|
-
return /* @__PURE__ */
|
|
3732
|
+
return /* @__PURE__ */ jsx66(React51.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx66(React51.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ jsx66(React51.Fragment, { children: /* @__PURE__ */ jsx66(
|
|
3335
3733
|
SelectedNode,
|
|
3336
3734
|
{
|
|
3337
3735
|
node,
|
|
@@ -3344,7 +3742,7 @@ var PageBodyRenderer = (props) => {
|
|
|
3344
3742
|
apiBaseUrl: props.apiBaseUrl,
|
|
3345
3743
|
widgetRegistry: props.widgetRegistry
|
|
3346
3744
|
}
|
|
3347
|
-
) }) : /* @__PURE__ */
|
|
3745
|
+
) }) : /* @__PURE__ */ jsx66(React51.Fragment, { children: /* @__PURE__ */ jsx66(
|
|
3348
3746
|
SelectedNode,
|
|
3349
3747
|
{
|
|
3350
3748
|
node,
|