@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260319054248 → 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 +715 -260
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +710 -255
- package/dist/index.mjs.map +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2101,7 +2101,7 @@ var DataList = (props) => {
|
|
|
2101
2101
|
}
|
|
2102
2102
|
}
|
|
2103
2103
|
}, [props.dataset]);
|
|
2104
|
-
function
|
|
2104
|
+
function getNestedProperty2(obj, path) {
|
|
2105
2105
|
if (path.includes(".")) {
|
|
2106
2106
|
return path.split(".").reduce((prev, curr) => prev ? prev[curr] : null, obj);
|
|
2107
2107
|
} else if (Array.isArray(obj[path])) {
|
|
@@ -2385,7 +2385,7 @@ var DataList = (props) => {
|
|
|
2385
2385
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tbody", { className: "divide-y divide-gray-200 ", children: props.dataset?.result?.map((dataitem, index) => {
|
|
2386
2386
|
let validityClass = "";
|
|
2387
2387
|
console.log("dataitem", dataitem);
|
|
2388
|
-
if (props.recordValidityColumnName &&
|
|
2388
|
+
if (props.recordValidityColumnName && getNestedProperty2(dataitem, props.recordValidityColumnName) == false) {
|
|
2389
2389
|
validityClass = "bg-alert-200";
|
|
2390
2390
|
}
|
|
2391
2391
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tr", { className: validityClass, children: props?.columns?.map((column, colindex) => {
|
|
@@ -2403,7 +2403,7 @@ var DataList = (props) => {
|
|
|
2403
2403
|
ViewControl_default,
|
|
2404
2404
|
{
|
|
2405
2405
|
controlType: column.controlType,
|
|
2406
|
-
value:
|
|
2406
|
+
value: getNestedProperty2(
|
|
2407
2407
|
dataitem,
|
|
2408
2408
|
column.name
|
|
2409
2409
|
),
|
|
@@ -2420,7 +2420,7 @@ var DataList = (props) => {
|
|
|
2420
2420
|
ViewControl_default,
|
|
2421
2421
|
{
|
|
2422
2422
|
controlType: column.controlType,
|
|
2423
|
-
value:
|
|
2423
|
+
value: getNestedProperty2(dataitem, column.name) || column.emptyValueLabel,
|
|
2424
2424
|
format: column.format,
|
|
2425
2425
|
customProps: column.customProps
|
|
2426
2426
|
}
|
|
@@ -2430,7 +2430,7 @@ var DataList = (props) => {
|
|
|
2430
2430
|
ViewControl_default,
|
|
2431
2431
|
{
|
|
2432
2432
|
controlType: column.controlType,
|
|
2433
|
-
value:
|
|
2433
|
+
value: getNestedProperty2(dataitem, column.name),
|
|
2434
2434
|
format: column.format,
|
|
2435
2435
|
customProps: column.customProps
|
|
2436
2436
|
}
|
|
@@ -2535,7 +2535,7 @@ var DataList = (props) => {
|
|
|
2535
2535
|
var DataList_default = DataList;
|
|
2536
2536
|
|
|
2537
2537
|
// src/components/pageRenderingEngine/PageBodyRenderer.tsx
|
|
2538
|
-
var
|
|
2538
|
+
var import_react52 = __toESM(require("react"));
|
|
2539
2539
|
|
|
2540
2540
|
// src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
|
|
2541
2541
|
var import_react37 = __toESM(require("react"));
|
|
@@ -2548,19 +2548,57 @@ var TextNode = (props) => {
|
|
|
2548
2548
|
};
|
|
2549
2549
|
function cssStringToJson(cssString) {
|
|
2550
2550
|
const styleObject = {};
|
|
2551
|
-
const matches = cssString
|
|
2552
|
-
if (matches
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2551
|
+
const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
|
|
2552
|
+
if (matches) {
|
|
2553
|
+
matches.forEach((match) => {
|
|
2554
|
+
const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
|
|
2555
|
+
if (parts && parts.length === 3) {
|
|
2556
|
+
const property = parts[1].trim();
|
|
2557
|
+
const value = parts[2].trim();
|
|
2558
|
+
styleObject[property] = value;
|
|
2559
|
+
}
|
|
2560
|
+
});
|
|
2558
2561
|
}
|
|
2559
2562
|
return styleObject;
|
|
2560
2563
|
}
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
+
function toCamelCase(str) {
|
|
2565
|
+
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
2566
|
+
}
|
|
2567
|
+
function convertKeysToCamelCase(obj) {
|
|
2568
|
+
if (Array.isArray(obj)) {
|
|
2569
|
+
return obj.map(convertKeysToCamelCase);
|
|
2570
|
+
} else if (obj !== null && typeof obj === "object") {
|
|
2571
|
+
return Object.fromEntries(
|
|
2572
|
+
Object.entries(obj).filter(([_, value]) => value !== "").map(([key, value]) => [
|
|
2573
|
+
toCamelCase(key),
|
|
2574
|
+
convertKeysToCamelCase(value)
|
|
2575
|
+
])
|
|
2576
|
+
);
|
|
2577
|
+
}
|
|
2578
|
+
return obj;
|
|
2579
|
+
}
|
|
2580
|
+
function getFormatClass(format) {
|
|
2581
|
+
const classes = [];
|
|
2582
|
+
if (format === 1) classes.push("font-medium");
|
|
2583
|
+
if (format === 2) classes.push("italic");
|
|
2584
|
+
if (format === 3) classes.push("font-medium italic");
|
|
2585
|
+
if (format === 8) classes.push("underline");
|
|
2586
|
+
if (format === 9) classes.push("font-medium underline");
|
|
2587
|
+
if (format === 10) classes.push("italic underline");
|
|
2588
|
+
if (format === 11) classes.push("font-medium italic underline");
|
|
2589
|
+
if (format === 256) classes.push("lowercase");
|
|
2590
|
+
if (format === 512) classes.push("uppercase");
|
|
2591
|
+
if (format === 1024) classes.push("capitalize");
|
|
2592
|
+
return classes.join(" ");
|
|
2593
|
+
}
|
|
2594
|
+
const styles = convertKeysToCamelCase(cssStringToJson(props.node.style));
|
|
2595
|
+
function replacePlaceholders(template, dataItem) {
|
|
2596
|
+
return template.replace(/{(\w+)}/g, (_, key) => {
|
|
2597
|
+
return key in dataItem ? dataItem[key] : `{${key}}`;
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
const displayText = props.linkText ? props.linkText : props.node.text;
|
|
2601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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 });
|
|
2564
2602
|
};
|
|
2565
2603
|
var TextNode_default = TextNode;
|
|
2566
2604
|
|
|
@@ -2592,39 +2630,225 @@ var LinkNode = (props) => {
|
|
|
2592
2630
|
};
|
|
2593
2631
|
var LinkNode_default = LinkNode;
|
|
2594
2632
|
|
|
2595
|
-
// src/components/pageRenderingEngine/nodes/
|
|
2633
|
+
// src/components/pageRenderingEngine/nodes/SVGIconNode.tsx
|
|
2596
2634
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2635
|
+
var SVGIconNode = ({ node }) => {
|
|
2636
|
+
if (!node?.svgCode) return null;
|
|
2637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2638
|
+
"span",
|
|
2639
|
+
{
|
|
2640
|
+
style: {
|
|
2641
|
+
display: "flex",
|
|
2642
|
+
width: node.width,
|
|
2643
|
+
height: node.height,
|
|
2644
|
+
color: node.color
|
|
2645
|
+
},
|
|
2646
|
+
dangerouslySetInnerHTML: { __html: node.svgCode }
|
|
2647
|
+
}
|
|
2648
|
+
);
|
|
2649
|
+
};
|
|
2650
|
+
var SVGIconNode_default = SVGIconNode;
|
|
2651
|
+
|
|
2652
|
+
// src/components/pageRenderingEngine/nodes/EquationNode.tsx
|
|
2653
|
+
var import_katex = __toESM(require("katex"));
|
|
2654
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2655
|
+
var EquationNode = ({ node }) => {
|
|
2656
|
+
const { equation, inline } = node;
|
|
2657
|
+
let html = "";
|
|
2658
|
+
try {
|
|
2659
|
+
html = import_katex.default.renderToString(equation, {
|
|
2660
|
+
displayMode: !inline,
|
|
2661
|
+
throwOnError: false
|
|
2662
|
+
});
|
|
2663
|
+
} catch (error) {
|
|
2664
|
+
html = import_katex.default.renderToString(`\\text{Invalid equation}`, {
|
|
2665
|
+
throwOnError: false
|
|
2666
|
+
});
|
|
2667
|
+
}
|
|
2668
|
+
if (inline) {
|
|
2669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2670
|
+
"span",
|
|
2671
|
+
{
|
|
2672
|
+
className: "katex-inline",
|
|
2673
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
2674
|
+
}
|
|
2675
|
+
);
|
|
2676
|
+
}
|
|
2677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2678
|
+
"div",
|
|
2679
|
+
{
|
|
2680
|
+
className: "katex-block my-3 text-center",
|
|
2681
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
2682
|
+
}
|
|
2683
|
+
);
|
|
2684
|
+
};
|
|
2685
|
+
var EquationNode_default = EquationNode;
|
|
2686
|
+
|
|
2687
|
+
// src/components/pageRenderingEngine/nodes/DatafieldNode.tsx
|
|
2688
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2689
|
+
function getNestedProperty(obj, path) {
|
|
2690
|
+
if (!obj || !path) return null;
|
|
2691
|
+
if (path.includes(".")) {
|
|
2692
|
+
return path.split(".").reduce((prev, curr) => prev ? prev[curr] : null, obj);
|
|
2693
|
+
} else if (Array.isArray(obj[path])) {
|
|
2694
|
+
return obj[path].map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: item }, index));
|
|
2695
|
+
} else {
|
|
2696
|
+
return obj[path];
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
var DatafieldNode = (props) => {
|
|
2700
|
+
function cssStringToJson(cssString) {
|
|
2701
|
+
const styleObject = {};
|
|
2702
|
+
const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
|
|
2703
|
+
if (matches) {
|
|
2704
|
+
matches.forEach((match) => {
|
|
2705
|
+
const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
|
|
2706
|
+
if (parts && parts.length === 3) {
|
|
2707
|
+
const property = parts[1].trim();
|
|
2708
|
+
const value2 = parts[2].trim();
|
|
2709
|
+
styleObject[property] = value2;
|
|
2710
|
+
}
|
|
2711
|
+
});
|
|
2712
|
+
}
|
|
2713
|
+
return styleObject;
|
|
2714
|
+
}
|
|
2715
|
+
function toCamelCase(str) {
|
|
2716
|
+
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
2717
|
+
}
|
|
2718
|
+
function convertKeysToCamelCase(obj) {
|
|
2719
|
+
if (!obj || typeof obj !== "object") return obj;
|
|
2720
|
+
return Object.fromEntries(
|
|
2721
|
+
Object.entries(obj).map(([key, value2]) => [toCamelCase(key), value2])
|
|
2722
|
+
);
|
|
2723
|
+
}
|
|
2724
|
+
const Formats = [
|
|
2725
|
+
"",
|
|
2726
|
+
"font-medium",
|
|
2727
|
+
"italic",
|
|
2728
|
+
"font-medium italic",
|
|
2729
|
+
"",
|
|
2730
|
+
"",
|
|
2731
|
+
"",
|
|
2732
|
+
"",
|
|
2733
|
+
"underline",
|
|
2734
|
+
"font-medium underline",
|
|
2735
|
+
"italic underline",
|
|
2736
|
+
"italic underline font-medium"
|
|
2737
|
+
];
|
|
2738
|
+
const styles = convertKeysToCamelCase(cssStringToJson(props.node.style));
|
|
2739
|
+
const fieldName = props.node.fieldName;
|
|
2740
|
+
const value = props.dataitem ? getNestedProperty(props.dataitem, fieldName) : null;
|
|
2741
|
+
console.log(fieldName, value, "haha");
|
|
2742
|
+
const isEmptyValue = value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0 || typeof value === "object" && Object.keys(value).length === 0;
|
|
2743
|
+
const maxLines = props.node.maxLines;
|
|
2744
|
+
if (maxLines && Number(maxLines) > 0) {
|
|
2745
|
+
Object.assign(styles, {
|
|
2746
|
+
display: "-webkit-box",
|
|
2747
|
+
overflow: "hidden",
|
|
2748
|
+
WebkitBoxOrient: "vertical",
|
|
2749
|
+
WebkitLineClamp: String(maxLines)
|
|
2750
|
+
});
|
|
2751
|
+
}
|
|
2752
|
+
const dataType = props.node.dataType;
|
|
2753
|
+
if (isEmptyValue) {
|
|
2754
|
+
return null;
|
|
2755
|
+
}
|
|
2756
|
+
if (dataType == "rawContent") {
|
|
2757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2758
|
+
PageBodyRenderer_default,
|
|
2759
|
+
{
|
|
2760
|
+
rawBody: value ?? `@databound[${fieldName}]`,
|
|
2761
|
+
routeParameters: props.routeParameters,
|
|
2762
|
+
query: props.query,
|
|
2763
|
+
session: props.session,
|
|
2764
|
+
host: props.host,
|
|
2765
|
+
path: props.path,
|
|
2766
|
+
apiBaseUrl: props.apiBaseUrl,
|
|
2767
|
+
breadcrumb: props.breadcrumb,
|
|
2768
|
+
donotApplyContainerClass: true
|
|
2769
|
+
}
|
|
2770
|
+
);
|
|
2771
|
+
}
|
|
2772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2773
|
+
"span",
|
|
2774
|
+
{
|
|
2775
|
+
className: `datafield-node ${props.node.format < Formats.length ? Formats[props.node.format] : ""}`,
|
|
2776
|
+
style: styles,
|
|
2777
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2778
|
+
ViewControl_default,
|
|
2779
|
+
{
|
|
2780
|
+
controlType: dataType,
|
|
2781
|
+
value: value ?? `@databound[${fieldName}]`
|
|
2782
|
+
}
|
|
2783
|
+
)
|
|
2784
|
+
}
|
|
2785
|
+
);
|
|
2786
|
+
};
|
|
2787
|
+
var DatafieldNode_default = DatafieldNode;
|
|
2788
|
+
|
|
2789
|
+
// src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
|
|
2790
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
2597
2791
|
var ParagraphNode = (props) => {
|
|
2598
2792
|
const NodeTypes2 = {
|
|
2599
2793
|
["text"]: TextNode_default,
|
|
2600
2794
|
["linebreak"]: LineBreakNode_default,
|
|
2601
|
-
["link"]: LinkNode_default
|
|
2602
|
-
|
|
2603
|
-
|
|
2795
|
+
["link"]: LinkNode_default,
|
|
2796
|
+
["datafield"]: DatafieldNode_default,
|
|
2797
|
+
["equation"]: EquationNode_default,
|
|
2798
|
+
["svg-icon"]: SVGIconNode_default
|
|
2604
2799
|
};
|
|
2605
2800
|
const FormatClass = {
|
|
2606
|
-
"center": "text-center"
|
|
2801
|
+
"center": "text-center",
|
|
2802
|
+
"right": "text-right"
|
|
2607
2803
|
};
|
|
2608
2804
|
{
|
|
2609
2805
|
}
|
|
2610
2806
|
let formatClasses = FormatClass[props.node.format] || "";
|
|
2611
|
-
|
|
2612
|
-
|
|
2807
|
+
const isInlineOnlyParent = props.parentTag === "summary";
|
|
2808
|
+
const hasChildren = props.node.children && props.node.children.length > 0;
|
|
2809
|
+
if (isInlineOnlyParent) {
|
|
2810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: hasChildren && props.node.children.map((node, index) => {
|
|
2811
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
2812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react37.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
2813
|
+
SelectedNode,
|
|
2814
|
+
{
|
|
2815
|
+
node,
|
|
2816
|
+
dataitem: props.dataitem,
|
|
2817
|
+
session: props.session,
|
|
2818
|
+
apiBaseUrl: props.apiBaseUrl,
|
|
2819
|
+
routeParameters: props.routeParameters
|
|
2820
|
+
}
|
|
2821
|
+
) }, index);
|
|
2822
|
+
}) });
|
|
2823
|
+
}
|
|
2824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: " " + formatClasses, children: [
|
|
2825
|
+
hasChildren && props.node.children.map((node, index) => {
|
|
2613
2826
|
const SelectedNode = NodeTypes2[node.type];
|
|
2614
|
-
return /* @__PURE__ */ (0,
|
|
2827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react37.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
2828
|
+
SelectedNode,
|
|
2829
|
+
{
|
|
2830
|
+
node,
|
|
2831
|
+
dataitem: props.dataitem,
|
|
2832
|
+
session: props.session,
|
|
2833
|
+
apiBaseUrl: props.apiBaseUrl,
|
|
2834
|
+
routeParameters: props.routeParameters
|
|
2835
|
+
}
|
|
2836
|
+
) }, index);
|
|
2615
2837
|
}),
|
|
2616
|
-
|
|
2838
|
+
!hasChildren && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "py-1.5 lg:py-2" })
|
|
2617
2839
|
] });
|
|
2618
2840
|
};
|
|
2619
2841
|
var ParagraphNode_default = ParagraphNode;
|
|
2620
2842
|
|
|
2621
2843
|
// src/components/pageRenderingEngine/nodes/HeadingNode.tsx
|
|
2622
2844
|
var import_react38 = __toESM(require("react"));
|
|
2623
|
-
var
|
|
2845
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
2624
2846
|
var HeadingNode = (props) => {
|
|
2625
2847
|
const NodeTypes2 = {
|
|
2626
2848
|
["text"]: TextNode_default,
|
|
2627
|
-
["link"]: LinkNode_default
|
|
2849
|
+
["link"]: LinkNode_default,
|
|
2850
|
+
// ["linebreak"]: LineBreakNodeNew,
|
|
2851
|
+
["datafield"]: DatafieldNode_default
|
|
2628
2852
|
};
|
|
2629
2853
|
const HeadingTag = `${props.node.tag}`;
|
|
2630
2854
|
const FormatClass = {
|
|
@@ -2633,12 +2857,12 @@ var HeadingNode = (props) => {
|
|
|
2633
2857
|
{
|
|
2634
2858
|
}
|
|
2635
2859
|
let formatClasses = FormatClass[props.node.format] || "";
|
|
2636
|
-
return /* @__PURE__ */ (0,
|
|
2860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, { children: import_react38.default.createElement(
|
|
2637
2861
|
HeadingTag,
|
|
2638
2862
|
{ className: formatClasses },
|
|
2639
2863
|
props.node.children && props.node.children.map((childNode, index) => {
|
|
2640
2864
|
const SelectedNode = NodeTypes2[childNode.type];
|
|
2641
|
-
return /* @__PURE__ */ (0,
|
|
2865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react38.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectedNode, { node: childNode, dataitem: props.dataitem, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
|
|
2642
2866
|
})
|
|
2643
2867
|
) });
|
|
2644
2868
|
};
|
|
@@ -2649,34 +2873,54 @@ var import_react40 = __toESM(require("react"));
|
|
|
2649
2873
|
|
|
2650
2874
|
// src/components/pageRenderingEngine/nodes/ListItemNode.tsx
|
|
2651
2875
|
var import_react39 = __toESM(require("react"));
|
|
2652
|
-
var
|
|
2876
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
2653
2877
|
var ListItemNode = (props) => {
|
|
2654
2878
|
const NodeTypes2 = {
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2879
|
+
text: TextNode_default,
|
|
2880
|
+
linebreak: LineBreakNode_default,
|
|
2881
|
+
link: LinkNode_default,
|
|
2882
|
+
list: ListNode_default
|
|
2658
2883
|
};
|
|
2659
|
-
|
|
2884
|
+
let foundFirstBreak = false;
|
|
2885
|
+
const firstTextChild = props.node.children?.find((c) => c.type === "text");
|
|
2886
|
+
let liStyle = {};
|
|
2887
|
+
if (firstTextChild?.style) {
|
|
2888
|
+
const match = firstTextChild.style.match(/font-size\s*:\s*([^;]+);?/);
|
|
2889
|
+
if (match) {
|
|
2890
|
+
liStyle.fontSize = match[1].trim();
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("li", { style: liStyle, children: props.node.children && props.node.children.map((node, index) => {
|
|
2660
2894
|
const SelectedNode = NodeTypes2[node.type];
|
|
2661
|
-
|
|
2895
|
+
if (node.type === "linebreak") {
|
|
2896
|
+
if (!foundFirstBreak) {
|
|
2897
|
+
foundFirstBreak = true;
|
|
2898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", {}, index);
|
|
2899
|
+
} else {
|
|
2900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "py-1 lg:py-2" }, index);
|
|
2901
|
+
}
|
|
2902
|
+
} else {
|
|
2903
|
+
foundFirstBreak = false;
|
|
2904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react39.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
|
|
2905
|
+
}
|
|
2662
2906
|
}) });
|
|
2663
2907
|
};
|
|
2664
2908
|
var ListItemNode_default = ListItemNode;
|
|
2665
2909
|
|
|
2666
2910
|
// src/components/pageRenderingEngine/nodes/ListNode.tsx
|
|
2667
|
-
var
|
|
2911
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2668
2912
|
var ListNode = (props) => {
|
|
2669
2913
|
const NodeTypes2 = {
|
|
2670
2914
|
listitem: ListItemNode_default
|
|
2671
2915
|
};
|
|
2672
|
-
return /* @__PURE__ */ (0,
|
|
2673
|
-
props.node.listType == "bullet" && /* @__PURE__ */ (0,
|
|
2916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react40.default.Fragment, { children: [
|
|
2917
|
+
props.node.listType == "bullet" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ul", { children: props.node.children && props.node.children.map((node, index) => {
|
|
2674
2918
|
const SelectedNode = NodeTypes2[node.type];
|
|
2675
|
-
return /* @__PURE__ */ (0,
|
|
2919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react40.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
|
|
2676
2920
|
}) }),
|
|
2677
|
-
props.node.listType == "number" && /* @__PURE__ */ (0,
|
|
2921
|
+
props.node.listType == "number" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ol", { children: props.node.children && props.node.children.map((node, index) => {
|
|
2678
2922
|
const SelectedNode = NodeTypes2[node.type];
|
|
2679
|
-
return /* @__PURE__ */ (0,
|
|
2923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react40.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
|
|
2680
2924
|
}) })
|
|
2681
2925
|
] });
|
|
2682
2926
|
};
|
|
@@ -2684,56 +2928,118 @@ var ListNode_default = ListNode;
|
|
|
2684
2928
|
|
|
2685
2929
|
// src/components/pageRenderingEngine/nodes/QuoteNode.tsx
|
|
2686
2930
|
var import_react41 = __toESM(require("react"));
|
|
2687
|
-
var
|
|
2931
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2688
2932
|
var QuoteNode = (props) => {
|
|
2689
2933
|
const NodeTypes2 = {
|
|
2690
2934
|
["text"]: TextNode_default,
|
|
2691
2935
|
["linebreak"]: LineBreakNode_default,
|
|
2692
2936
|
["link"]: LinkNode_default
|
|
2693
2937
|
};
|
|
2694
|
-
return /* @__PURE__ */ (0,
|
|
2938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("blockquote", { children: props.node.children && props.node.children.map((node, index) => {
|
|
2695
2939
|
const SelectedNode = NodeTypes2[node.type];
|
|
2696
|
-
return /* @__PURE__ */ (0,
|
|
2940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react41.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(SelectedNode, { node, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
|
|
2697
2941
|
}) });
|
|
2698
2942
|
};
|
|
2699
2943
|
var QuoteNode_default = QuoteNode;
|
|
2700
2944
|
|
|
2701
2945
|
// src/components/pageRenderingEngine/nodes/CodeNode.tsx
|
|
2702
|
-
var
|
|
2703
|
-
|
|
2946
|
+
var import_react43 = __toESM(require("react"));
|
|
2947
|
+
|
|
2948
|
+
// src/components/CopyButton.tsx
|
|
2949
|
+
var import_react42 = require("react");
|
|
2950
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2951
|
+
function CopyButton({ text }) {
|
|
2952
|
+
const [copied, setCopied] = (0, import_react42.useState)(false);
|
|
2953
|
+
const timeoutRef = (0, import_react42.useRef)(null);
|
|
2954
|
+
(0, import_react42.useEffect)(() => {
|
|
2955
|
+
return () => {
|
|
2956
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2957
|
+
};
|
|
2958
|
+
}, []);
|
|
2959
|
+
const handleCopy = async () => {
|
|
2960
|
+
try {
|
|
2961
|
+
await navigator.clipboard.writeText(text);
|
|
2962
|
+
setCopied(true);
|
|
2963
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2964
|
+
timeoutRef.current = setTimeout(() => setCopied(false), 2e3);
|
|
2965
|
+
} catch (err) {
|
|
2966
|
+
console.error("Failed to copy: ", err);
|
|
2967
|
+
}
|
|
2968
|
+
};
|
|
2969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
2970
|
+
"button",
|
|
2971
|
+
{
|
|
2972
|
+
onClick: handleCopy,
|
|
2973
|
+
className: "flex gap-1 items-center hover:text-white transition",
|
|
2974
|
+
children: [
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2976
|
+
"svg",
|
|
2977
|
+
{
|
|
2978
|
+
width: "16",
|
|
2979
|
+
height: "16",
|
|
2980
|
+
viewBox: "0 0 24 24",
|
|
2981
|
+
className: "w-4 h-4",
|
|
2982
|
+
fill: "currentColor",
|
|
2983
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2984
|
+
"path",
|
|
2985
|
+
{
|
|
2986
|
+
fillRule: "evenodd",
|
|
2987
|
+
clipRule: "evenodd",
|
|
2988
|
+
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"
|
|
2989
|
+
}
|
|
2990
|
+
)
|
|
2991
|
+
}
|
|
2992
|
+
),
|
|
2993
|
+
copied ? "Copied!" : "Copy code"
|
|
2994
|
+
]
|
|
2995
|
+
}
|
|
2996
|
+
);
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
// src/components/pageRenderingEngine/nodes/CodeNode.tsx
|
|
3000
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2704
3001
|
var CodeNode = (props) => {
|
|
2705
3002
|
const NodeTypes2 = {
|
|
2706
3003
|
["text"]: TextNode_default,
|
|
2707
3004
|
["linebreak"]: LineBreakNode_default,
|
|
2708
3005
|
["link"]: LinkNode_default
|
|
2709
3006
|
};
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
3007
|
+
const textContent = props.node?.children?.map((node) => {
|
|
3008
|
+
if (node.type === "text") return node.text || "";
|
|
3009
|
+
if (node.type === "linebreak") return "\n";
|
|
3010
|
+
if (node.type === "link") return node.text || node.url || "";
|
|
3011
|
+
return "";
|
|
3012
|
+
}).join("") ?? "";
|
|
3013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "code-block", children: [
|
|
3014
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("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: [
|
|
3015
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Code Snippet" }),
|
|
3016
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(CopyButton, { text: textContent })
|
|
3017
|
+
] }),
|
|
3018
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("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) => {
|
|
3019
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
3020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react43.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SelectedNode, { node, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
|
|
3021
|
+
}) })
|
|
3022
|
+
] });
|
|
2714
3023
|
};
|
|
2715
3024
|
var CodeNode_default = CodeNode;
|
|
2716
3025
|
|
|
2717
3026
|
// src/components/pageRenderingEngine/nodes/HorizontalRuleNode.tsx
|
|
2718
|
-
var
|
|
3027
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2719
3028
|
var HorizontalRuleNode = (props) => {
|
|
2720
|
-
return /* @__PURE__ */ (0,
|
|
3029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("hr", {});
|
|
2721
3030
|
};
|
|
2722
3031
|
var HorizontalRuleNode_default = HorizontalRuleNode;
|
|
2723
3032
|
|
|
2724
|
-
// src/components/pageRenderingEngine/nodes/LayoutContainerNode.tsx
|
|
2725
|
-
var import_react45 = __toESM(require("react"));
|
|
2726
|
-
|
|
2727
3033
|
// src/components/pageRenderingEngine/nodes/LayoutItemNode.tsx
|
|
2728
|
-
var
|
|
3034
|
+
var import_react49 = __toESM(require("react"));
|
|
2729
3035
|
|
|
2730
3036
|
// src/components/pageRenderingEngine/nodes/ImageNode.tsx
|
|
2731
|
-
var
|
|
2732
|
-
var
|
|
3037
|
+
var import_react44 = __toESM(require("react"));
|
|
3038
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2733
3039
|
var ImageNode = (props) => {
|
|
2734
3040
|
const { node, apiBaseUrl = "" } = props;
|
|
2735
3041
|
let imageUrl = node.imageUrl.startsWith("http") ? node.imageUrl : `${apiBaseUrl}/digitalassets/storefront/${node.imageUrl}`;
|
|
2736
|
-
return /* @__PURE__ */ (0,
|
|
3042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react44.default.Fragment, { children: node.width ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { style: { width: node.width }, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2737
3043
|
"img",
|
|
2738
3044
|
{
|
|
2739
3045
|
loading: "lazy",
|
|
@@ -2743,7 +3049,7 @@ var ImageNode = (props) => {
|
|
|
2743
3049
|
height: node.intrinsicHeight,
|
|
2744
3050
|
alt: node.title
|
|
2745
3051
|
}
|
|
2746
|
-
) }) : /* @__PURE__ */ (0,
|
|
3052
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2747
3053
|
"img",
|
|
2748
3054
|
{
|
|
2749
3055
|
loading: "lazy",
|
|
@@ -2757,8 +3063,204 @@ var ImageNode = (props) => {
|
|
|
2757
3063
|
};
|
|
2758
3064
|
var ImageNode_default = ImageNode;
|
|
2759
3065
|
|
|
3066
|
+
// src/components/pageRenderingEngine/nodes/WidgetNode.tsx
|
|
3067
|
+
var import_react45 = require("react");
|
|
3068
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3069
|
+
var WidgetNode = (props) => {
|
|
3070
|
+
const getWidgetParameters = () => {
|
|
3071
|
+
const widgetInputParameters = { ...props.routeParameters ?? {} };
|
|
3072
|
+
const rawWidgetParams = props.node?.widgetParameters ?? props.node?.widgetParams;
|
|
3073
|
+
let widgetParameters = {};
|
|
3074
|
+
const isJSON = (str) => {
|
|
3075
|
+
if (typeof str !== "string") return false;
|
|
3076
|
+
str = str.trim();
|
|
3077
|
+
return str.startsWith("{") && str.endsWith("}") || str.startsWith("[") && str.endsWith("]");
|
|
3078
|
+
};
|
|
3079
|
+
if (rawWidgetParams) {
|
|
3080
|
+
if (typeof rawWidgetParams === "string" && isJSON(rawWidgetParams)) {
|
|
3081
|
+
widgetParameters = JSON.parse(rawWidgetParams);
|
|
3082
|
+
} else if (typeof rawWidgetParams === "object") {
|
|
3083
|
+
widgetParameters = rawWidgetParams;
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
const resolveValue = (val) => {
|
|
3087
|
+
if (typeof val === "string") {
|
|
3088
|
+
const m = /^\{(.+)\}$/.exec(val);
|
|
3089
|
+
if (m) {
|
|
3090
|
+
const actualKey = m[1];
|
|
3091
|
+
return props.routeParameters?.[actualKey] ?? val;
|
|
3092
|
+
}
|
|
3093
|
+
return val;
|
|
3094
|
+
} else if (Array.isArray(val)) {
|
|
3095
|
+
return val.map(resolveValue);
|
|
3096
|
+
} else if (val && typeof val === "object") {
|
|
3097
|
+
const out = {};
|
|
3098
|
+
for (const k of Object.keys(val)) {
|
|
3099
|
+
out[k] = resolveValue(val[k]);
|
|
3100
|
+
}
|
|
3101
|
+
return out;
|
|
3102
|
+
}
|
|
3103
|
+
return val;
|
|
3104
|
+
};
|
|
3105
|
+
Object.keys(widgetParameters).forEach((key) => {
|
|
3106
|
+
const rawVal = widgetParameters[key];
|
|
3107
|
+
if (rawVal === "route") {
|
|
3108
|
+
if (key === "itemPath") {
|
|
3109
|
+
widgetInputParameters[key] = props.path;
|
|
3110
|
+
} else {
|
|
3111
|
+
widgetInputParameters[key] = widgetInputParameters[key] ?? null;
|
|
3112
|
+
}
|
|
3113
|
+
} else {
|
|
3114
|
+
widgetInputParameters[key] = resolveValue(rawVal);
|
|
3115
|
+
}
|
|
3116
|
+
});
|
|
3117
|
+
widgetInputParameters["widgetTitle"] = props.node?.widgetTitle;
|
|
3118
|
+
return widgetInputParameters;
|
|
3119
|
+
};
|
|
3120
|
+
const SelectedWidget = props.widgetRegistry?.[props.node.widgetCode];
|
|
3121
|
+
if (!SelectedWidget) {
|
|
3122
|
+
console.warn("Widget not found:", props.node.widgetCode);
|
|
3123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
3124
|
+
"Widget not found: ",
|
|
3125
|
+
props.node.widgetCode
|
|
3126
|
+
] });
|
|
3127
|
+
}
|
|
3128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react45.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "container mt-2", children: "..." }), children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3129
|
+
SelectedWidget,
|
|
3130
|
+
{
|
|
3131
|
+
params: getWidgetParameters(),
|
|
3132
|
+
query: props.query,
|
|
3133
|
+
session: props.session,
|
|
3134
|
+
host: props.host,
|
|
3135
|
+
path: props.path,
|
|
3136
|
+
apiBaseUrl: props.apiBaseUrl
|
|
3137
|
+
}
|
|
3138
|
+
) });
|
|
3139
|
+
};
|
|
3140
|
+
var WidgetNode_default = WidgetNode;
|
|
3141
|
+
|
|
3142
|
+
// src/components/pageRenderingEngine/nodes/IframeClient.tsx
|
|
3143
|
+
var import_react47 = __toESM(require("react"));
|
|
3144
|
+
|
|
3145
|
+
// src/components/IFrameLoaderView.tsx
|
|
3146
|
+
var import_react46 = __toESM(require("react"));
|
|
3147
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3148
|
+
var IFrameLoaderView = (props) => {
|
|
3149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_react46.default.Fragment, { children: [
|
|
3150
|
+
props.isDataFound == null && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "mt-4 bg-gray-200 rounded-md p-4 animate-pulse", children: [
|
|
3151
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-center mb-4", children: [
|
|
3152
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 h-8 w-8 rounded-full animate-pulse" }),
|
|
3153
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ml-2", children: [
|
|
3154
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 h-3 w-16 animate-pulse" }),
|
|
3155
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 h-2 w-12 animate-pulse" })
|
|
3156
|
+
] })
|
|
3157
|
+
] }),
|
|
3158
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "grid grid-cols-3 gap-4 mt-6", children: [
|
|
3159
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "animate-pulse", children: [
|
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
3161
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
3162
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
3163
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
3164
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
3165
|
+
] }),
|
|
3166
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "animate-pulse", children: [
|
|
3167
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
3168
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
3169
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
3170
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
3171
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
3172
|
+
] }),
|
|
3173
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "animate-pulse", children: [
|
|
3174
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
3175
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
3176
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
3177
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
3178
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
3179
|
+
] })
|
|
3180
|
+
] })
|
|
3181
|
+
] }) }),
|
|
3182
|
+
props.children
|
|
3183
|
+
] });
|
|
3184
|
+
};
|
|
3185
|
+
var IFrameLoaderView_default = IFrameLoaderView;
|
|
3186
|
+
|
|
3187
|
+
// src/components/pageRenderingEngine/nodes/IframeClient.tsx
|
|
3188
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3189
|
+
var IframeClient = ({ src }) => {
|
|
3190
|
+
const iframeRef = (0, import_react47.useRef)(null);
|
|
3191
|
+
const [iframeHeight, setIframeHeight] = (0, import_react47.useState)("100%");
|
|
3192
|
+
const [isDataFound, setIsDataFound] = (0, import_react47.useState)(null);
|
|
3193
|
+
(0, import_react47.useEffect)(() => {
|
|
3194
|
+
const handleReceiveMessage = (event) => {
|
|
3195
|
+
const eventName = event?.data?.eventName;
|
|
3196
|
+
const payload = event?.data?.payload;
|
|
3197
|
+
if (eventName === "SET_HEIGHT" && payload?.height) {
|
|
3198
|
+
let height = 500;
|
|
3199
|
+
if (payload.height > 500) {
|
|
3200
|
+
height = payload.height + 50;
|
|
3201
|
+
}
|
|
3202
|
+
setIframeHeight(`${height}px`);
|
|
3203
|
+
}
|
|
3204
|
+
};
|
|
3205
|
+
window.addEventListener("message", handleReceiveMessage);
|
|
3206
|
+
return () => window.removeEventListener("message", handleReceiveMessage);
|
|
3207
|
+
}, []);
|
|
3208
|
+
(0, import_react47.useEffect)(() => {
|
|
3209
|
+
const handleResize = () => {
|
|
3210
|
+
if (iframeRef.current) {
|
|
3211
|
+
iframeRef.current.contentWindow?.postMessage({ eventName: "RESIZE" }, "*");
|
|
3212
|
+
}
|
|
3213
|
+
};
|
|
3214
|
+
window.addEventListener("resize", handleResize);
|
|
3215
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
3216
|
+
}, []);
|
|
3217
|
+
const handleIframeLoad = () => {
|
|
3218
|
+
setIsDataFound(true);
|
|
3219
|
+
};
|
|
3220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react47.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(IFrameLoaderView_default, { isDataFound, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3221
|
+
"iframe",
|
|
3222
|
+
{
|
|
3223
|
+
ref: iframeRef,
|
|
3224
|
+
src,
|
|
3225
|
+
className: "w-full h-full border-none",
|
|
3226
|
+
scrolling: "no",
|
|
3227
|
+
onLoad: handleIframeLoad
|
|
3228
|
+
}
|
|
3229
|
+
) }) });
|
|
3230
|
+
};
|
|
3231
|
+
var IframeClient_default = IframeClient;
|
|
3232
|
+
|
|
3233
|
+
// src/components/pageRenderingEngine/nodes/EmbedNode.tsx
|
|
3234
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
3235
|
+
var EmbedNode = (props) => {
|
|
3236
|
+
let src;
|
|
3237
|
+
if (props.node.provider == "youtube") {
|
|
3238
|
+
src = `https://www.youtube-nocookie.com/embed/${props.node.embedSrc}`;
|
|
3239
|
+
} else if (props.node.provider == "bunny") {
|
|
3240
|
+
src = `https://iframe.mediadelivery.net/embed/${props.node.embedSrc}?autoplay=false&loop=false&muted=false&preload=true&responsive=true`;
|
|
3241
|
+
} else {
|
|
3242
|
+
src = props.node.embedSrc;
|
|
3243
|
+
}
|
|
3244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "aspect-video", children: src && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(IframeClient_default, { src }) });
|
|
3245
|
+
};
|
|
3246
|
+
var EmbedNode_default = EmbedNode;
|
|
3247
|
+
|
|
3248
|
+
// src/components/pageRenderingEngine/nodes/VideoNode.tsx
|
|
3249
|
+
var import_react48 = __toESM(require("react"));
|
|
3250
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
3251
|
+
var VideoNode = (props) => {
|
|
3252
|
+
let src;
|
|
3253
|
+
if (props.node.provider == "youtube") {
|
|
3254
|
+
src = `https://www.youtube-nocookie.com/embed/${props.node.videoId}`;
|
|
3255
|
+
} else if (props.node.provider == "bunny") {
|
|
3256
|
+
src = `https://iframe.mediadelivery.net/embed/${props.node.videoId}?autoplay=false&loop=false&muted=false&preload=true&responsive=true`;
|
|
3257
|
+
}
|
|
3258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react48.default.Fragment, { children: src && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("iframe", { className: "w-full aspect-video rounded", src, loading: "lazy", allow: "accelerometer;gyroscope;autoplay;encrypted-media;picture-in-picture;", allowFullScreen: true }) });
|
|
3259
|
+
};
|
|
3260
|
+
var VideoNode_default = VideoNode;
|
|
3261
|
+
|
|
2760
3262
|
// src/components/pageRenderingEngine/nodes/LayoutItemNode.tsx
|
|
2761
|
-
var
|
|
3263
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
2762
3264
|
var LayoutItemNode = (props) => {
|
|
2763
3265
|
const NodeTypes2 = {
|
|
2764
3266
|
["paragraph"]: ParagraphNode_default,
|
|
@@ -2769,7 +3271,11 @@ var LayoutItemNode = (props) => {
|
|
|
2769
3271
|
["horizontalrule"]: HorizontalRuleNode_default,
|
|
2770
3272
|
["image"]: ImageNode_default,
|
|
2771
3273
|
["layout-container"]: LayoutContainerNode_default,
|
|
2772
|
-
["link"]: LinkNode_default
|
|
3274
|
+
["link"]: LinkNode_default,
|
|
3275
|
+
["widget"]: WidgetNode_default,
|
|
3276
|
+
["youtube"]: VideoNode_default,
|
|
3277
|
+
["video"]: VideoNode_default,
|
|
3278
|
+
["embed"]: EmbedNode_default
|
|
2773
3279
|
};
|
|
2774
3280
|
let cssClasses = "";
|
|
2775
3281
|
if (props.order) {
|
|
@@ -2787,6 +3293,7 @@ var LayoutItemNode = (props) => {
|
|
|
2787
3293
|
}
|
|
2788
3294
|
if (props.node.itemBorderRadius) {
|
|
2789
3295
|
styles.borderRadius = props.node.itemBorderRadius;
|
|
3296
|
+
styles.overflow = "hidden";
|
|
2790
3297
|
}
|
|
2791
3298
|
function removeParagraphsAtStartAndEnd(layoutItem) {
|
|
2792
3299
|
let startIndex = 0;
|
|
@@ -2803,6 +3310,8 @@ var LayoutItemNode = (props) => {
|
|
|
2803
3310
|
}
|
|
2804
3311
|
if (startIndex <= endIndex) {
|
|
2805
3312
|
layoutItem.children = layoutItem.children.slice(startIndex, endIndex + 1);
|
|
3313
|
+
} else {
|
|
3314
|
+
layoutItem.children = [];
|
|
2806
3315
|
}
|
|
2807
3316
|
return layoutItem;
|
|
2808
3317
|
}
|
|
@@ -2812,201 +3321,160 @@ var LayoutItemNode = (props) => {
|
|
|
2812
3321
|
} else {
|
|
2813
3322
|
updatedLayout = removeParagraphsAtStartAndEnd(props.node);
|
|
2814
3323
|
}
|
|
2815
|
-
return /* @__PURE__ */ (0,
|
|
3324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_react49.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "layout-item " + cssClasses, style: { ...styles }, children: updatedLayout.children.map((node, index) => {
|
|
2816
3325
|
{
|
|
2817
3326
|
}
|
|
2818
3327
|
const SelectedNode = NodeTypes2[node.type];
|
|
2819
|
-
return /* @__PURE__ */ (0,
|
|
2820
|
-
|
|
3328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_react49.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3329
|
+
SelectedNode,
|
|
3330
|
+
{
|
|
3331
|
+
node,
|
|
3332
|
+
routeParameters: props.routeParameters,
|
|
3333
|
+
query: props.query,
|
|
3334
|
+
session: props.session,
|
|
3335
|
+
host: props.host,
|
|
3336
|
+
path: props.path,
|
|
3337
|
+
apiBaseUrl: props.apiBaseUrl
|
|
3338
|
+
}
|
|
3339
|
+
) }, index);
|
|
3340
|
+
}) }) });
|
|
2821
3341
|
};
|
|
2822
3342
|
var LayoutItemNode_default = LayoutItemNode;
|
|
2823
3343
|
|
|
2824
|
-
// src/components/
|
|
2825
|
-
var
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
}
|
|
2833
|
-
|
|
2834
|
-
"1fr": "layout-grid-col-1",
|
|
2835
|
-
"1fr 1fr": "layout-grid-col-2-equal",
|
|
2836
|
-
"1fr 2fr": "layout-grid-col-2-widths-33-67",
|
|
2837
|
-
"2fr 1fr": "layout-grid-col-2-widths-67-33",
|
|
2838
|
-
"3fr 2fr": "layout-grid-col-2-widths-60-40",
|
|
2839
|
-
"3fr 1fr": "layout-grid-col-2-widths-75-25",
|
|
2840
|
-
"1fr 1fr 1fr": "layout-grid-col-3-equal",
|
|
2841
|
-
"1fr 2fr 1fr": "layout-grid-col-3-widths-25-50-25",
|
|
2842
|
-
"1fr 6fr 1fr": "layout-grid-col-3-widths-15-70-15",
|
|
2843
|
-
"1fr 1fr 1fr 1fr": "layout-grid-col-4-equal"
|
|
3344
|
+
// src/components/utilities/AssetUtility.tsx
|
|
3345
|
+
var AssetUtility = class {
|
|
3346
|
+
constructor() {
|
|
3347
|
+
}
|
|
3348
|
+
static resolveUrl(apiBaseUrl, url) {
|
|
3349
|
+
if (!url) return void 0;
|
|
3350
|
+
if (url.startsWith("http")) return url;
|
|
3351
|
+
if (!apiBaseUrl) return url;
|
|
3352
|
+
return `${apiBaseUrl}/digitalassets-management/${url}`;
|
|
3353
|
+
}
|
|
2844
3354
|
};
|
|
3355
|
+
var AssetUtility_default = AssetUtility;
|
|
3356
|
+
|
|
3357
|
+
// src/components/pageRenderingEngine/nodes/LayoutContainerNode.tsx
|
|
3358
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
2845
3359
|
var LayoutContainerNode = (props) => {
|
|
2846
|
-
const
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
}
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
3360
|
+
const VERTICAL_ALIGNMENT_CLASSES = {
|
|
3361
|
+
start: "items-start",
|
|
3362
|
+
center: "items-center place-content-center",
|
|
3363
|
+
end: "items-end",
|
|
3364
|
+
stretch: "items-stretch",
|
|
3365
|
+
baseline: "items-baseline"
|
|
3366
|
+
};
|
|
3367
|
+
const LAYOUTGRID_COLS_CLASSES = {
|
|
3368
|
+
"1fr": "layout-grid-col-1",
|
|
3369
|
+
"1fr 1fr": "layout-grid-col-2-equal",
|
|
3370
|
+
"1fr 2fr": "layout-grid-col-2-widths-33-67",
|
|
3371
|
+
"2fr 1fr": "layout-grid-col-2-widths-67-33",
|
|
3372
|
+
"3fr 2fr": "layout-grid-col-2-widths-60-40",
|
|
3373
|
+
"3fr 1fr": "layout-grid-col-2-widths-75-25",
|
|
3374
|
+
"1fr 1fr 1fr": "layout-grid-col-3-equal",
|
|
3375
|
+
"1fr 2fr 1fr": "layout-grid-col-3-widths-25-50-25",
|
|
3376
|
+
"1fr 6fr 1fr": "layout-grid-col-3-widths-15-70-15",
|
|
3377
|
+
"1fr 1fr 1fr 1fr": "layout-grid-col-4-equal"
|
|
3378
|
+
};
|
|
3379
|
+
const sectionWidth = props.node.sectionWidth || "fixed";
|
|
3380
|
+
let gridCssClasses = LAYOUTGRID_COLS_CLASSES[props.node.templateColumns] || "";
|
|
3381
|
+
if (props.node.contentVerticalAlignment) {
|
|
3382
|
+
gridCssClasses += " " + (VERTICAL_ALIGNMENT_CLASSES[props.node.contentVerticalAlignment] || "");
|
|
2856
3383
|
}
|
|
3384
|
+
const columnGap = props.node.columnGap || "0.5rem";
|
|
2857
3385
|
const styles = {};
|
|
2858
|
-
|
|
2859
|
-
styles.backgroundColor = node.backgroundColor;
|
|
2860
|
-
}
|
|
2861
|
-
let cssClasses = "layout_grid ";
|
|
3386
|
+
let cssClasses = "layout_grid";
|
|
2862
3387
|
let addPadding = false;
|
|
2863
|
-
if (node.
|
|
2864
|
-
|
|
2865
|
-
}
|
|
2866
|
-
cssClasses = cssClasses + " " + (node.boxShadow || "");
|
|
2867
|
-
addPadding = true;
|
|
3388
|
+
if (props.node.backgroundColor) {
|
|
3389
|
+
styles.backgroundColor = props.node.backgroundColor;
|
|
2868
3390
|
}
|
|
2869
|
-
if (node.borderWidth) {
|
|
2870
|
-
styles.borderWidth = node.borderWidth;
|
|
3391
|
+
if (props.node.borderWidth) {
|
|
3392
|
+
styles.borderWidth = props.node.borderWidth;
|
|
2871
3393
|
addPadding = true;
|
|
2872
3394
|
}
|
|
2873
|
-
if (node.borderRadius) {
|
|
2874
|
-
styles.borderRadius = node.borderRadius;
|
|
2875
|
-
}
|
|
2876
|
-
let backgroundStyle = "";
|
|
2877
|
-
if (node.backgroundImage) {
|
|
2878
|
-
let resolvedPath = node.backgroundImage;
|
|
2879
|
-
if (!resolvedPath.startsWith("http")) {
|
|
2880
|
-
resolvedPath = `${apiBaseUrl}/digitalassets/storefront/${resolvedPath}`;
|
|
2881
|
-
}
|
|
2882
|
-
backgroundStyle = `url('${resolvedPath}'),`;
|
|
3395
|
+
if (props.node.borderRadius) {
|
|
3396
|
+
styles.borderRadius = props.node.borderRadius;
|
|
2883
3397
|
}
|
|
2884
|
-
if (node.
|
|
2885
|
-
|
|
3398
|
+
if (props.node.boxShadow && props.node.boxShadow !== "shadow-none") {
|
|
3399
|
+
cssClasses += " " + props.node.boxShadow;
|
|
3400
|
+
addPadding = true;
|
|
2886
3401
|
}
|
|
2887
|
-
|
|
2888
|
-
|
|
3402
|
+
const backgroundLayers = [];
|
|
3403
|
+
if (props.node.backgroundImage) {
|
|
3404
|
+
const resolved = AssetUtility_default.resolveUrl(
|
|
3405
|
+
props.apiBaseUrl,
|
|
3406
|
+
props.node.backgroundImage
|
|
3407
|
+
);
|
|
3408
|
+
if (resolved) {
|
|
3409
|
+
backgroundLayers.push(`url('${resolved}')`);
|
|
3410
|
+
addPadding = true;
|
|
3411
|
+
}
|
|
2889
3412
|
}
|
|
2890
|
-
if (
|
|
2891
|
-
|
|
2892
|
-
|
|
3413
|
+
if (props.node.gradientColor1 && props.node.gradientColor2) {
|
|
3414
|
+
backgroundLayers.push(
|
|
3415
|
+
`linear-gradient(to bottom, ${props.node.gradientColor1}, ${props.node.gradientColor2})`
|
|
3416
|
+
);
|
|
3417
|
+
addPadding = true;
|
|
3418
|
+
} else if (props.node.gradientColor1) {
|
|
3419
|
+
backgroundLayers.push(props.node.gradientColor1);
|
|
3420
|
+
addPadding = true;
|
|
3421
|
+
} else if (props.node.gradientColor2) {
|
|
3422
|
+
backgroundLayers.push(props.node.gradientColor2);
|
|
2893
3423
|
addPadding = true;
|
|
2894
3424
|
}
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
sectionWidth = node.sectionWidth;
|
|
3425
|
+
if (backgroundLayers.length) {
|
|
3426
|
+
styles.background = backgroundLayers.join(", ");
|
|
2898
3427
|
}
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
3428
|
+
const renderChildren = () => props.node.children?.map((node, index) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3429
|
+
LayoutItemNode_default,
|
|
3430
|
+
{
|
|
3431
|
+
node,
|
|
3432
|
+
order: props.node.smOrder === "reverse" ? props.node.children.length - index : index,
|
|
3433
|
+
routeParameters: props.routeParameters,
|
|
3434
|
+
query: props.query,
|
|
3435
|
+
session: props.session,
|
|
3436
|
+
host: props.host,
|
|
3437
|
+
path: props.path,
|
|
3438
|
+
apiBaseUrl: props.apiBaseUrl
|
|
3439
|
+
},
|
|
3440
|
+
index
|
|
3441
|
+
));
|
|
3442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
3443
|
+
sectionWidth === "mixed" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: cssClasses, style: styles, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "container", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
2904
3444
|
"div",
|
|
2905
3445
|
{
|
|
2906
|
-
className:
|
|
3446
|
+
className: `grid gap-y-4 lg:gap-y-0 ${gridCssClasses} ${addPadding ? "py-8 lg:py-6" : ""}`,
|
|
3447
|
+
style: { columnGap, minHeight: props.node.height },
|
|
3448
|
+
children: renderChildren()
|
|
3449
|
+
}
|
|
3450
|
+
) }) }),
|
|
3451
|
+
sectionWidth === "full" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3452
|
+
"div",
|
|
3453
|
+
{
|
|
3454
|
+
className: `grid gap-y-4 lg:gap-y-0 ${cssClasses} ${gridCssClasses} ${addPadding ? "p-8 lg:p-0" : ""}`,
|
|
2907
3455
|
style: { columnGap, ...styles },
|
|
2908
|
-
children:
|
|
2909
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react45.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(LayoutItemNode_default, { node: node2, order: props.node.smOrder == "reverse" ? node2.children.length - index : index }) }, index);
|
|
2910
|
-
})
|
|
3456
|
+
children: renderChildren()
|
|
2911
3457
|
}
|
|
2912
3458
|
),
|
|
2913
|
-
sectionWidth
|
|
3459
|
+
sectionWidth === "fixed" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "container", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
2914
3460
|
"div",
|
|
2915
3461
|
{
|
|
2916
|
-
className:
|
|
3462
|
+
className: `grid gap-y-4 lg:gap-y-0 ${cssClasses} ${gridCssClasses} ${addPadding ? "px-8 py-6 lg:px-6 lg:py-6" : ""}`,
|
|
2917
3463
|
style: { columnGap, ...styles },
|
|
2918
|
-
children:
|
|
2919
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react45.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(LayoutItemNode_default, { node: node2, order: props.node.smOrder == "reverse" ? node2.children.length - index : index }) }, index);
|
|
2920
|
-
})
|
|
3464
|
+
children: renderChildren()
|
|
2921
3465
|
}
|
|
2922
3466
|
) })
|
|
2923
3467
|
] });
|
|
2924
3468
|
};
|
|
2925
3469
|
var LayoutContainerNode_default = LayoutContainerNode;
|
|
2926
3470
|
|
|
2927
|
-
// src/components/pageRenderingEngine/nodes/WidgetNode.tsx
|
|
2928
|
-
var import_react46 = require("react");
|
|
2929
|
-
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2930
|
-
var WidgetNode = (props) => {
|
|
2931
|
-
const getWidgetParameters = () => {
|
|
2932
|
-
const widgetInputParameters = { ...props.routeParameters ?? {} };
|
|
2933
|
-
const rawWidgetParams = props.node?.widgetParameters ?? props.node?.widgetParams;
|
|
2934
|
-
let widgetParameters = {};
|
|
2935
|
-
const isJSON = (str) => {
|
|
2936
|
-
if (typeof str !== "string") return false;
|
|
2937
|
-
str = str.trim();
|
|
2938
|
-
return str.startsWith("{") && str.endsWith("}") || str.startsWith("[") && str.endsWith("]");
|
|
2939
|
-
};
|
|
2940
|
-
if (rawWidgetParams) {
|
|
2941
|
-
if (typeof rawWidgetParams === "string" && isJSON(rawWidgetParams)) {
|
|
2942
|
-
widgetParameters = JSON.parse(rawWidgetParams);
|
|
2943
|
-
} else if (typeof rawWidgetParams === "object") {
|
|
2944
|
-
widgetParameters = rawWidgetParams;
|
|
2945
|
-
}
|
|
2946
|
-
}
|
|
2947
|
-
const resolveValue = (val) => {
|
|
2948
|
-
if (typeof val === "string") {
|
|
2949
|
-
const m = /^\{(.+)\}$/.exec(val);
|
|
2950
|
-
if (m) {
|
|
2951
|
-
const actualKey = m[1];
|
|
2952
|
-
return props.routeParameters?.[actualKey] ?? val;
|
|
2953
|
-
}
|
|
2954
|
-
return val;
|
|
2955
|
-
} else if (Array.isArray(val)) {
|
|
2956
|
-
return val.map(resolveValue);
|
|
2957
|
-
} else if (val && typeof val === "object") {
|
|
2958
|
-
const out = {};
|
|
2959
|
-
for (const k of Object.keys(val)) {
|
|
2960
|
-
out[k] = resolveValue(val[k]);
|
|
2961
|
-
}
|
|
2962
|
-
return out;
|
|
2963
|
-
}
|
|
2964
|
-
return val;
|
|
2965
|
-
};
|
|
2966
|
-
Object.keys(widgetParameters).forEach((key) => {
|
|
2967
|
-
const rawVal = widgetParameters[key];
|
|
2968
|
-
if (rawVal === "route") {
|
|
2969
|
-
if (key === "itemPath") {
|
|
2970
|
-
widgetInputParameters[key] = props.path;
|
|
2971
|
-
} else {
|
|
2972
|
-
widgetInputParameters[key] = widgetInputParameters[key] ?? null;
|
|
2973
|
-
}
|
|
2974
|
-
} else {
|
|
2975
|
-
widgetInputParameters[key] = resolveValue(rawVal);
|
|
2976
|
-
}
|
|
2977
|
-
});
|
|
2978
|
-
widgetInputParameters["widgetTitle"] = props.node?.widgetTitle;
|
|
2979
|
-
return widgetInputParameters;
|
|
2980
|
-
};
|
|
2981
|
-
const SelectedWidget = props.widgetRegistry?.[props.node.widgetCode];
|
|
2982
|
-
if (!SelectedWidget) {
|
|
2983
|
-
console.warn("Widget not found:", props.node.widgetCode);
|
|
2984
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
2985
|
-
"Widget not found: ",
|
|
2986
|
-
props.node.widgetCode
|
|
2987
|
-
] });
|
|
2988
|
-
}
|
|
2989
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react46.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "container mt-2", children: "..." }), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2990
|
-
SelectedWidget,
|
|
2991
|
-
{
|
|
2992
|
-
params: getWidgetParameters(),
|
|
2993
|
-
query: props.query,
|
|
2994
|
-
session: props.session,
|
|
2995
|
-
host: props.host,
|
|
2996
|
-
path: props.path,
|
|
2997
|
-
apiBaseUrl: props.apiBaseUrl
|
|
2998
|
-
}
|
|
2999
|
-
) });
|
|
3000
|
-
};
|
|
3001
|
-
var WidgetNode_default = WidgetNode;
|
|
3002
|
-
|
|
3003
3471
|
// src/components/pageRenderingEngine/nodes/FormContainerNode.tsx
|
|
3004
|
-
var
|
|
3472
|
+
var import_react50 = __toESM(require("react"));
|
|
3005
3473
|
|
|
3006
3474
|
// src/components/pageRenderingEngine/nodes/InputControlNode.tsx
|
|
3007
|
-
var
|
|
3475
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
3008
3476
|
var InputControlNode = (props) => {
|
|
3009
|
-
return /* @__PURE__ */ (0,
|
|
3477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
3010
3478
|
InputControl_default,
|
|
3011
3479
|
{
|
|
3012
3480
|
name: props.node.name,
|
|
@@ -3035,19 +3503,19 @@ var InputControlNode = (props) => {
|
|
|
3035
3503
|
var InputControlNode_default = InputControlNode;
|
|
3036
3504
|
|
|
3037
3505
|
// src/components/pageRenderingEngine/nodes/FormContainerNode.tsx
|
|
3038
|
-
var
|
|
3506
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
3039
3507
|
var FormContainerNode = (props) => {
|
|
3040
3508
|
const NodeTypes2 = {
|
|
3041
3509
|
["input-control"]: InputControlNode_default
|
|
3042
3510
|
};
|
|
3043
3511
|
const { node } = props;
|
|
3044
|
-
const formRef = (0,
|
|
3512
|
+
const formRef = (0, import_react50.useRef)(null);
|
|
3045
3513
|
const initialState = {
|
|
3046
3514
|
inputValues: {},
|
|
3047
3515
|
lastPropertyChanged: ""
|
|
3048
3516
|
};
|
|
3049
|
-
const [formState, dispatch] = (0,
|
|
3050
|
-
const handleInputChange = (0,
|
|
3517
|
+
const [formState, dispatch] = (0, import_react50.useReducer)(FormReducer_default, initialState);
|
|
3518
|
+
const handleInputChange = (0, import_react50.useCallback)((updatedValues) => {
|
|
3051
3519
|
dispatch({ type: FORM_INPUT_UPDATE, name: updatedValues.name, value: updatedValues.value });
|
|
3052
3520
|
}, [dispatch]);
|
|
3053
3521
|
const onValidate = async () => {
|
|
@@ -3058,7 +3526,7 @@ var FormContainerNode = (props) => {
|
|
|
3058
3526
|
return true;
|
|
3059
3527
|
}
|
|
3060
3528
|
};
|
|
3061
|
-
(0,
|
|
3529
|
+
(0, import_react50.useEffect)(() => {
|
|
3062
3530
|
const fetchInitialData = async () => {
|
|
3063
3531
|
if (!props.fetchData || !node.dataFetchApi) return;
|
|
3064
3532
|
const response = await props.fetchData(
|
|
@@ -3075,12 +3543,12 @@ var FormContainerNode = (props) => {
|
|
|
3075
3543
|
};
|
|
3076
3544
|
fetchInitialData();
|
|
3077
3545
|
}, [props.fetchData, node.dataFetchApi, props.routeParameters]);
|
|
3078
|
-
return /* @__PURE__ */ (0,
|
|
3546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("form", { className: "group space-y-6 pb-6 overflow-y-auto", noValidate: true, ref: formRef, children: [
|
|
3079
3547
|
node.children && node.children.map((node2, index) => {
|
|
3080
3548
|
{
|
|
3081
3549
|
}
|
|
3082
3550
|
const SelectedNode = NodeTypes2[node2.type];
|
|
3083
|
-
return /* @__PURE__ */ (0,
|
|
3551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react50.default.Fragment, { children: SelectedNode && node2.type == "input-control" && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
3084
3552
|
InputControlNode_default,
|
|
3085
3553
|
{
|
|
3086
3554
|
value: formState.inputValues[node2.name],
|
|
@@ -3089,34 +3557,15 @@ var FormContainerNode = (props) => {
|
|
|
3089
3557
|
}
|
|
3090
3558
|
) }, index);
|
|
3091
3559
|
}),
|
|
3092
|
-
node.children.length == 0 && /* @__PURE__ */ (0,
|
|
3560
|
+
node.children.length == 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "py-0.5 lg:py-1.5" })
|
|
3093
3561
|
] });
|
|
3094
3562
|
};
|
|
3095
3563
|
var FormContainerNode_default = FormContainerNode;
|
|
3096
3564
|
|
|
3097
3565
|
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
3098
|
-
var
|
|
3566
|
+
var import_react51 = __toESM(require("react"));
|
|
3099
3567
|
var import_link3 = __toESM(require("next/link"));
|
|
3100
|
-
|
|
3101
|
-
// src/components/utilities/AssetUtility.tsx
|
|
3102
|
-
var AssetUtility = class {
|
|
3103
|
-
constructor() {
|
|
3104
|
-
}
|
|
3105
|
-
static resolveUrl(apiBaseUrl, url) {
|
|
3106
|
-
if (url) {
|
|
3107
|
-
if (url.startsWith("http")) {
|
|
3108
|
-
return url;
|
|
3109
|
-
} else {
|
|
3110
|
-
return `${apiBaseUrl}/digitalassets-management/${url}`;
|
|
3111
|
-
}
|
|
3112
|
-
}
|
|
3113
|
-
return void 0;
|
|
3114
|
-
}
|
|
3115
|
-
};
|
|
3116
|
-
var AssetUtility_default = AssetUtility;
|
|
3117
|
-
|
|
3118
|
-
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
3119
|
-
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3568
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
3120
3569
|
var DivContainer = (props) => {
|
|
3121
3570
|
const { cssProperties: styles, hoverCssProperties: hoverStyles, mobileCssProperties: mobileStyles } = props.node;
|
|
3122
3571
|
const updatedStyles = convertKeysToCamelCase(styles);
|
|
@@ -3130,8 +3579,11 @@ var DivContainer = (props) => {
|
|
|
3130
3579
|
["horizontalrule"]: HorizontalRuleNode_default,
|
|
3131
3580
|
["layout-container"]: LayoutContainerNode_default,
|
|
3132
3581
|
["widget"]: WidgetNode_default,
|
|
3582
|
+
["embed"]: EmbedNode_default,
|
|
3133
3583
|
["div-container"]: DivContainer,
|
|
3134
|
-
["text"]: TextNode_default
|
|
3584
|
+
["text"]: TextNode_default,
|
|
3585
|
+
["datafield"]: DatafieldNode_default,
|
|
3586
|
+
["svg-icon"]: SVGIconNode_default
|
|
3135
3587
|
};
|
|
3136
3588
|
function toCamelCase(str) {
|
|
3137
3589
|
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
@@ -3232,9 +3684,9 @@ ${mobileCssRules.join("\n")}
|
|
|
3232
3684
|
return css2;
|
|
3233
3685
|
};
|
|
3234
3686
|
const css = generateCssString(updatedStyle, hoverStyles, mobileStyles);
|
|
3235
|
-
return /* @__PURE__ */ (0,
|
|
3236
|
-
/* @__PURE__ */ (0,
|
|
3237
|
-
props.node.href && props.node.href !== "" ? /* @__PURE__ */ (0,
|
|
3687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_react51.default.Fragment, { children: [
|
|
3688
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("style", { dangerouslySetInnerHTML: { __html: css } }),
|
|
3689
|
+
props.node.href && props.node.href !== "" ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_link3.default, { href: props.node.href, className: "block", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3238
3690
|
"div",
|
|
3239
3691
|
{
|
|
3240
3692
|
id: guid,
|
|
@@ -3242,7 +3694,7 @@ ${mobileCssRules.join("\n")}
|
|
|
3242
3694
|
className: containerPaddingClass,
|
|
3243
3695
|
children: props.node.children?.map((node, index) => {
|
|
3244
3696
|
const SelectedNode = NodeTypes2[node.type];
|
|
3245
|
-
return /* @__PURE__ */ (0,
|
|
3697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_react51.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3246
3698
|
SelectedNode,
|
|
3247
3699
|
{
|
|
3248
3700
|
node,
|
|
@@ -3257,9 +3709,9 @@ ${mobileCssRules.join("\n")}
|
|
|
3257
3709
|
) }, index);
|
|
3258
3710
|
})
|
|
3259
3711
|
}
|
|
3260
|
-
) }) : /* @__PURE__ */ (0,
|
|
3712
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { id: guid, style: { ...backgroundStyle }, className: containerPaddingClass, children: props.node.children && props.node.children.map((node, index) => {
|
|
3261
3713
|
const SelectedNode = NodeTypes2[node.type];
|
|
3262
|
-
return /* @__PURE__ */ (0,
|
|
3714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_react51.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3263
3715
|
SelectedNode,
|
|
3264
3716
|
{
|
|
3265
3717
|
node,
|
|
@@ -3278,7 +3730,7 @@ ${mobileCssRules.join("\n")}
|
|
|
3278
3730
|
var DivContainer_default = DivContainer;
|
|
3279
3731
|
|
|
3280
3732
|
// src/components/pageRenderingEngine/PageBodyRenderer.tsx
|
|
3281
|
-
var
|
|
3733
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
3282
3734
|
var NodeTypes = {
|
|
3283
3735
|
["paragraph"]: ParagraphNode_default,
|
|
3284
3736
|
["heading"]: HeadingNode_default,
|
|
@@ -3290,7 +3742,9 @@ var NodeTypes = {
|
|
|
3290
3742
|
["layout-container"]: LayoutContainerNode_default,
|
|
3291
3743
|
["widget"]: WidgetNode_default,
|
|
3292
3744
|
["form-container"]: FormContainerNode_default,
|
|
3293
|
-
["div-container"]: DivContainer_default
|
|
3745
|
+
["div-container"]: DivContainer_default,
|
|
3746
|
+
["svg-icon"]: SVGIconNode_default,
|
|
3747
|
+
["embed"]: EmbedNode_default
|
|
3294
3748
|
};
|
|
3295
3749
|
var PageBodyRenderer = (props) => {
|
|
3296
3750
|
let pageBodyTree;
|
|
@@ -3304,11 +3758,11 @@ var PageBodyRenderer = (props) => {
|
|
|
3304
3758
|
if (pageBodyTree && pageBodyTree.root) {
|
|
3305
3759
|
rootNode = pageBodyTree.root;
|
|
3306
3760
|
}
|
|
3307
|
-
return /* @__PURE__ */ (0,
|
|
3761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react52.default.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
|
|
3308
3762
|
{
|
|
3309
3763
|
}
|
|
3310
3764
|
const SelectedNode = NodeTypes[node.type];
|
|
3311
|
-
return /* @__PURE__ */ (0,
|
|
3765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react52.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react52.default.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react52.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
3312
3766
|
SelectedNode,
|
|
3313
3767
|
{
|
|
3314
3768
|
node,
|
|
@@ -3321,7 +3775,7 @@ var PageBodyRenderer = (props) => {
|
|
|
3321
3775
|
apiBaseUrl: props.apiBaseUrl,
|
|
3322
3776
|
widgetRegistry: props.widgetRegistry
|
|
3323
3777
|
}
|
|
3324
|
-
) }) : /* @__PURE__ */ (0,
|
|
3778
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react52.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
3325
3779
|
SelectedNode,
|
|
3326
3780
|
{
|
|
3327
3781
|
node,
|
|
@@ -3346,3 +3800,4 @@ var PageBodyRenderer_default = PageBodyRenderer;
|
|
|
3346
3800
|
ViewControl,
|
|
3347
3801
|
ViewControlTypes
|
|
3348
3802
|
});
|
|
3803
|
+
//# sourceMappingURL=index.js.map
|