@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260623120639 → 0.8.1-dev.20260623122324

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.
Files changed (3) hide show
  1. package/dist/index.js +151 -153
  2. package/dist/index.mjs +151 -153
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5635,8 +5635,145 @@ var validateRoleVisibility = (roleCode, oAuthToken) => {
5635
5635
  return shouldRenderByRole(roleCode, userRoles);
5636
5636
  };
5637
5637
 
5638
- // src/components/pageRenderingEngine/nodes/DivContainer.tsx
5638
+ // src/components/pageRenderingEngine/nodes/DocumentNode.tsx
5639
5639
  var import_jsx_runtime70 = require("react/jsx-runtime");
5640
+ var getNestedValue4 = (obj, path) => {
5641
+ if (!obj || !path) return void 0;
5642
+ return path.split(".").reduce((current, key) => {
5643
+ return current && current[key] !== void 0 ? current[key] : void 0;
5644
+ }, obj);
5645
+ };
5646
+ var PdfIcon = () => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-red-500 w-8 h-8", children: [
5647
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
5648
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
5649
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M9 14H11C11.5304 14 12.0391 13.7893 12.4142 13.4142C12.7893 13.0391 13 12.5304 13 12C13 11.4696 12.7893 10.9609 12.4142 10.5858C12.0391 10.2107 11.5304 10 11 10H9V18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
5650
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M9 14H12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
5651
+ ] });
5652
+ var ExcelIcon = () => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-green-600 w-8 h-8", children: [
5653
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
5654
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
5655
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M9 11L15 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
5656
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M15 11L9 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
5657
+ ] });
5658
+ var WordIcon = () => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-blue-600 w-8 h-8", children: [
5659
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
5660
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
5661
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M8 12L10 17L12 14L14 17L16 12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
5662
+ ] });
5663
+ var ImageIcon = () => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-yellow-500 w-8 h-8", children: [
5664
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H19C19.5304 3 20.0391 3.21071 20.4142 3.58579C20.7893 3.96086 21 4.46957 21 5V15ZM21 15L16 10L9 17L6 14L3 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
5665
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M16 8C16 8.55228 15.5523 9 15 9C14.4477 9 14 8.55228 14 8C14 7.44772 14.4477 7 15 7C15.5523 7 16 7.44772 16 8Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
5666
+ ] });
5667
+ var StandardIcon = () => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-gray-500 w-8 h-8", children: [
5668
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
5669
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
5670
+ ] });
5671
+ var getFileDetails = (url) => {
5672
+ const extMatch = url.match(/\.([a-zA-Z0-9]+)(?:[\?#]|$)/);
5673
+ const ext = extMatch ? extMatch[1].toLowerCase() : "";
5674
+ let Icon2 = StandardIcon;
5675
+ let extLabel = "FILE";
5676
+ if (["pdf"].includes(ext)) {
5677
+ Icon2 = PdfIcon;
5678
+ extLabel = "PDF";
5679
+ } else if (["xls", "xlsx", "csv"].includes(ext)) {
5680
+ Icon2 = ExcelIcon;
5681
+ extLabel = "Excel";
5682
+ } else if (["doc", "docx"].includes(ext)) {
5683
+ Icon2 = WordIcon;
5684
+ extLabel = ext.toUpperCase();
5685
+ } else if (["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(ext)) {
5686
+ Icon2 = ImageIcon;
5687
+ extLabel = ext.toUpperCase();
5688
+ } else if (ext) {
5689
+ extLabel = ext.toUpperCase();
5690
+ }
5691
+ return { Icon: Icon2, extLabel };
5692
+ };
5693
+ var DocumentNode = (props) => {
5694
+ console.log("DocumentNode rendered");
5695
+ console.log("props", props);
5696
+ console.log("dataitem", props.dataitem);
5697
+ console.log("node", props.node);
5698
+ let documentUrl;
5699
+ let documentTitle;
5700
+ if (props.dataitem && props.node.documentKey) {
5701
+ const docData = getNestedValue4(props.dataitem, props.node.documentKey);
5702
+ if (typeof docData === "string") {
5703
+ const trimmed = docData.trim();
5704
+ if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
5705
+ try {
5706
+ const parsed = JSON.parse(trimmed);
5707
+ const asset = Array.isArray(parsed) ? parsed[0] : parsed;
5708
+ if (asset && asset.assetUrl) {
5709
+ documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
5710
+ if (asset.title) documentTitle = asset.title;
5711
+ }
5712
+ } catch (e) {
5713
+ }
5714
+ } else {
5715
+ documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, docData);
5716
+ }
5717
+ } else if (Array.isArray(docData) && docData.length > 0) {
5718
+ const asset = docData[0];
5719
+ if (asset && asset.assetUrl) {
5720
+ documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
5721
+ if (asset.title) documentTitle = asset.title;
5722
+ }
5723
+ } else if (docData && typeof docData === "object") {
5724
+ const asset = docData;
5725
+ if (asset && asset.assetUrl) {
5726
+ documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
5727
+ if (asset.title) documentTitle = asset.title;
5728
+ }
5729
+ }
5730
+ }
5731
+ if (!documentUrl) return null;
5732
+ const { Icon: Icon2, extLabel } = getFileDetails(documentUrl);
5733
+ if (!documentTitle) {
5734
+ try {
5735
+ const pathName = new URL(documentUrl).pathname;
5736
+ documentTitle = pathName.split("/").pop() || "Document";
5737
+ } catch {
5738
+ documentTitle = documentUrl.split("/").pop() || "Document";
5739
+ }
5740
+ documentTitle = documentTitle.replace(/\.[^/.]+$/, "");
5741
+ }
5742
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center justify-between py-4 bg-default", children: [
5743
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center space-x-4", children: [
5744
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex items-center justify-center p-2 rounded bg-secondary-soft border", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Icon2, {}) }),
5745
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-baseline space-x-2", children: [
5746
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h4", { className: "text-base font-semibold", children: documentTitle }),
5747
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "text-sm font-medium", children: [
5748
+ "(",
5749
+ extLabel,
5750
+ ")"
5751
+ ] })
5752
+ ] })
5753
+ ] }),
5754
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
5755
+ "a",
5756
+ {
5757
+ href: documentUrl,
5758
+ download: true,
5759
+ target: "_blank",
5760
+ rel: "noreferrer",
5761
+ className: "inline-flex items-center px-4 py-2 text-sm font-medium bg-default border rounded focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors",
5762
+ children: [
5763
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("svg", { className: "w-4 h-4 mr-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
5764
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" }),
5765
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 12v5m0 0l-3-3m3 3l3-3M12 8v4" })
5766
+ ] }),
5767
+ "Download"
5768
+ ]
5769
+ }
5770
+ )
5771
+ ] });
5772
+ };
5773
+ var DocumentNode_default = DocumentNode;
5774
+
5775
+ // src/components/pageRenderingEngine/nodes/DivContainer.tsx
5776
+ var import_jsx_runtime71 = require("react/jsx-runtime");
5640
5777
  function toCamelCase(str) {
5641
5778
  return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
5642
5779
  }
@@ -5650,7 +5787,7 @@ function convertKeysToCamelCase(obj) {
5650
5787
  ])
5651
5788
  );
5652
5789
  }
5653
- var getNestedValue4 = (obj, path) => {
5790
+ var getNestedValue5 = (obj, path) => {
5654
5791
  if (!obj || !path) return void 0;
5655
5792
  return path.split(".").reduce((current, key) => {
5656
5793
  {
@@ -5695,7 +5832,7 @@ function generateCompleteBackgroundString(layers, apiBaseUrl, dataItem) {
5695
5832
  const imageValue = layer.value;
5696
5833
  let assetUrl = imageValue.assetUrl || "";
5697
5834
  if (layer.datafield && dataItem) {
5698
- const fieldValue = getNestedValue4(
5835
+ const fieldValue = getNestedValue5(
5699
5836
  dataItem,
5700
5837
  layer.datafield
5701
5838
  );
@@ -5820,7 +5957,8 @@ var DivContainer = async (props) => {
5820
5957
  "div-container": DivContainer,
5821
5958
  text: TextNode_default,
5822
5959
  datafield: DatafieldNode_default,
5823
- "svg-icon": SVGIconNode_default
5960
+ "svg-icon": SVGIconNode_default,
5961
+ document: DocumentNode_default
5824
5962
  };
5825
5963
  const styles = props.node.cssProperties;
5826
5964
  const mobileStyles = props.node.mobileCssProperties;
@@ -5856,7 +5994,7 @@ var DivContainer = async (props) => {
5856
5994
  const condition = props.node.fieldVisibleOnTrue;
5857
5995
  const isNegated = condition.startsWith("!");
5858
5996
  const fieldName = isNegated ? condition.substring(1) : condition;
5859
- const fieldValue = getNestedValue4(props.dataitem, fieldName);
5997
+ const fieldValue = getNestedValue5(props.dataitem, fieldName);
5860
5998
  if (fieldValue === void 0) {
5861
5999
  return false;
5862
6000
  }
@@ -5895,10 +6033,10 @@ var DivContainer = async (props) => {
5895
6033
  response = await serviceClient.get(endpoint);
5896
6034
  result = response?.result;
5897
6035
  if (dataBindingProperties.showNoResultsMessage && (result === void 0 || result.length == 0)) {
5898
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(NoDataFound_default, {});
6036
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(NoDataFound_default, {});
5899
6037
  }
5900
6038
  if (dataBindingProperties.childCollectionName && props.dataitem) {
5901
- childCollectionData = getNestedValue4(props.dataitem, dataBindingProperties.childCollectionName);
6039
+ childCollectionData = getNestedValue5(props.dataitem, dataBindingProperties.childCollectionName);
5902
6040
  }
5903
6041
  }
5904
6042
  const cssResult = generateCssString(
@@ -5912,7 +6050,7 @@ var DivContainer = async (props) => {
5912
6050
  }
5913
6051
  const SelectedNode = NodeTypes2[node.type];
5914
6052
  if (!SelectedNode) return null;
5915
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react50.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
6053
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react50.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
5916
6054
  SelectedNode,
5917
6055
  {
5918
6056
  node,
@@ -6031,9 +6169,9 @@ var DivContainer = async (props) => {
6031
6169
  props.node.bgClass,
6032
6170
  noLinkColor && "no-link-color"
6033
6171
  ].filter(Boolean).join(" ");
6034
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_react50.default.Fragment, { children: [
6035
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("style", { dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS } }),
6036
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react50.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
6172
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_react50.default.Fragment, { children: [
6173
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("style", { dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS } }),
6174
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react50.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
6037
6175
  Wrapper,
6038
6176
  {
6039
6177
  id: guid,
@@ -6042,153 +6180,16 @@ var DivContainer = async (props) => {
6042
6180
  ...wrapperProps,
6043
6181
  children: dataToRender.map(
6044
6182
  (item, idx) => item?.links?.view && renderLink ? renderChildren(props.node.children, props, item, idx, props.href ? void 0 : item?.links?.view)?.map(
6045
- (child, i) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react50.default.Fragment, { children: child }, i)
6183
+ (child, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react50.default.Fragment, { children: child }, i)
6046
6184
  ) : renderChildren(props.node.children, props, item, idx)
6047
6185
  )
6048
6186
  }
6049
6187
  ) }),
6050
- dataBindingProperties && props.node.dataBinding.enablePagination && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Pagination_default, { path: props.path, query: props.query, dataset: response }) })
6188
+ dataBindingProperties && props.node.dataBinding.enablePagination && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Pagination_default, { path: props.path, query: props.query, dataset: response }) })
6051
6189
  ] });
6052
6190
  };
6053
6191
  var DivContainer_default = DivContainer;
6054
6192
 
6055
- // src/components/pageRenderingEngine/nodes/DocumentNode.tsx
6056
- var import_jsx_runtime71 = require("react/jsx-runtime");
6057
- var getNestedValue5 = (obj, path) => {
6058
- if (!obj || !path) return void 0;
6059
- return path.split(".").reduce((current, key) => {
6060
- return current && current[key] !== void 0 ? current[key] : void 0;
6061
- }, obj);
6062
- };
6063
- var PdfIcon = () => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-red-500 w-8 h-8", children: [
6064
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
6065
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
6066
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M9 14H11C11.5304 14 12.0391 13.7893 12.4142 13.4142C12.7893 13.0391 13 12.5304 13 12C13 11.4696 12.7893 10.9609 12.4142 10.5858C12.0391 10.2107 11.5304 10 11 10H9V18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
6067
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M9 14H12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
6068
- ] });
6069
- var ExcelIcon = () => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-green-600 w-8 h-8", children: [
6070
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
6071
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
6072
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M9 11L15 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
6073
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M15 11L9 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
6074
- ] });
6075
- var WordIcon = () => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-blue-600 w-8 h-8", children: [
6076
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
6077
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
6078
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M8 12L10 17L12 14L14 17L16 12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
6079
- ] });
6080
- var ImageIcon = () => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-yellow-500 w-8 h-8", children: [
6081
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H19C19.5304 3 20.0391 3.21071 20.4142 3.58579C20.7893 3.96086 21 4.46957 21 5V15ZM21 15L16 10L9 17L6 14L3 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
6082
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M16 8C16 8.55228 15.5523 9 15 9C14.4477 9 14 8.55228 14 8C14 7.44772 14.4477 7 15 7C15.5523 7 16 7.44772 16 8Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
6083
- ] });
6084
- var StandardIcon = () => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-gray-500 w-8 h-8", children: [
6085
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
6086
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
6087
- ] });
6088
- var getFileDetails = (url) => {
6089
- const extMatch = url.match(/\.([a-zA-Z0-9]+)(?:[\?#]|$)/);
6090
- const ext = extMatch ? extMatch[1].toLowerCase() : "";
6091
- let Icon2 = StandardIcon;
6092
- let extLabel = "FILE";
6093
- if (["pdf"].includes(ext)) {
6094
- Icon2 = PdfIcon;
6095
- extLabel = "PDF";
6096
- } else if (["xls", "xlsx", "csv"].includes(ext)) {
6097
- Icon2 = ExcelIcon;
6098
- extLabel = "Excel";
6099
- } else if (["doc", "docx"].includes(ext)) {
6100
- Icon2 = WordIcon;
6101
- extLabel = ext.toUpperCase();
6102
- } else if (["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(ext)) {
6103
- Icon2 = ImageIcon;
6104
- extLabel = ext.toUpperCase();
6105
- } else if (ext) {
6106
- extLabel = ext.toUpperCase();
6107
- }
6108
- return { Icon: Icon2, extLabel };
6109
- };
6110
- var DocumentNode = (props) => {
6111
- console.log("DocumentNode rendered");
6112
- console.log("props", props);
6113
- console.log("dataitem", props.dataitem);
6114
- console.log("node", props.node);
6115
- let documentUrl;
6116
- let documentTitle;
6117
- if (props.dataitem && props.node.documentKey) {
6118
- const docData = getNestedValue5(props.dataitem, props.node.documentKey);
6119
- if (typeof docData === "string") {
6120
- const trimmed = docData.trim();
6121
- if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
6122
- try {
6123
- const parsed = JSON.parse(trimmed);
6124
- const asset = Array.isArray(parsed) ? parsed[0] : parsed;
6125
- if (asset && asset.assetUrl) {
6126
- documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
6127
- if (asset.title) documentTitle = asset.title;
6128
- }
6129
- } catch (e) {
6130
- }
6131
- } else {
6132
- documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, docData);
6133
- }
6134
- } else if (Array.isArray(docData) && docData.length > 0) {
6135
- const asset = docData[0];
6136
- if (asset && asset.assetUrl) {
6137
- documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
6138
- if (asset.title) documentTitle = asset.title;
6139
- }
6140
- } else if (docData && typeof docData === "object") {
6141
- const asset = docData;
6142
- if (asset && asset.assetUrl) {
6143
- documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
6144
- if (asset.title) documentTitle = asset.title;
6145
- }
6146
- }
6147
- }
6148
- if (!documentUrl) return null;
6149
- const { Icon: Icon2, extLabel } = getFileDetails(documentUrl);
6150
- if (!documentTitle) {
6151
- try {
6152
- const pathName = new URL(documentUrl).pathname;
6153
- documentTitle = pathName.split("/").pop() || "Document";
6154
- } catch {
6155
- documentTitle = documentUrl.split("/").pop() || "Document";
6156
- }
6157
- documentTitle = documentTitle.replace(/\.[^/.]+$/, "");
6158
- }
6159
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center justify-between py-4 border-b bg-default", children: [
6160
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center space-x-4", children: [
6161
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex items-center justify-center p-2 rounded bg-secondary-soft border", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Icon2, {}) }),
6162
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-baseline space-x-2", children: [
6163
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("h4", { className: "text-base font-semibold", children: documentTitle }),
6164
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "text-sm font-medium", children: [
6165
- "(",
6166
- extLabel,
6167
- ")"
6168
- ] })
6169
- ] })
6170
- ] }),
6171
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
6172
- "a",
6173
- {
6174
- href: documentUrl,
6175
- download: true,
6176
- target: "_blank",
6177
- rel: "noreferrer",
6178
- className: "inline-flex items-center px-4 py-2 text-sm font-medium bg-default border rounded focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors",
6179
- children: [
6180
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("svg", { className: "w-4 h-4 mr-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
6181
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" }),
6182
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 12v5m0 0l-3-3m3 3l3-3M12 8v4" })
6183
- ] }),
6184
- "Download"
6185
- ]
6186
- }
6187
- )
6188
- ] });
6189
- };
6190
- var DocumentNode_default = DocumentNode;
6191
-
6192
6193
  // src/components/pageRenderingEngine/PageBodyRenderer.tsx
6193
6194
  var import_jsx_runtime72 = require("react/jsx-runtime");
6194
6195
  var NodeTypes = {
@@ -6228,9 +6229,6 @@ var PageBodyRenderer = (props) => {
6228
6229
  return true;
6229
6230
  };
6230
6231
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react51.default.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
6231
- {
6232
- }
6233
- console.log("Node type:", node.type);
6234
6232
  {
6235
6233
  }
6236
6234
  const SelectedNode = NodeTypes[node.type];
package/dist/index.mjs CHANGED
@@ -4029,8 +4029,145 @@ var validateRoleVisibility = (roleCode, oAuthToken) => {
4029
4029
  return shouldRenderByRole(roleCode, userRoles);
4030
4030
  };
4031
4031
 
4032
- // src/components/pageRenderingEngine/nodes/DivContainer.tsx
4032
+ // src/components/pageRenderingEngine/nodes/DocumentNode.tsx
4033
4033
  import { jsx as jsx59, jsxs as jsxs32 } from "react/jsx-runtime";
4034
+ var getNestedValue4 = (obj, path) => {
4035
+ if (!obj || !path) return void 0;
4036
+ return path.split(".").reduce((current, key) => {
4037
+ return current && current[key] !== void 0 ? current[key] : void 0;
4038
+ }, obj);
4039
+ };
4040
+ var PdfIcon = () => /* @__PURE__ */ jsxs32("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-red-500 w-8 h-8", children: [
4041
+ /* @__PURE__ */ jsx59("path", { d: "M7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4042
+ /* @__PURE__ */ jsx59("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4043
+ /* @__PURE__ */ jsx59("path", { d: "M9 14H11C11.5304 14 12.0391 13.7893 12.4142 13.4142C12.7893 13.0391 13 12.5304 13 12C13 11.4696 12.7893 10.9609 12.4142 10.5858C12.0391 10.2107 11.5304 10 11 10H9V18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4044
+ /* @__PURE__ */ jsx59("path", { d: "M9 14H12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
4045
+ ] });
4046
+ var ExcelIcon = () => /* @__PURE__ */ jsxs32("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-green-600 w-8 h-8", children: [
4047
+ /* @__PURE__ */ jsx59("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4048
+ /* @__PURE__ */ jsx59("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4049
+ /* @__PURE__ */ jsx59("path", { d: "M9 11L15 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4050
+ /* @__PURE__ */ jsx59("path", { d: "M15 11L9 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
4051
+ ] });
4052
+ var WordIcon = () => /* @__PURE__ */ jsxs32("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-blue-600 w-8 h-8", children: [
4053
+ /* @__PURE__ */ jsx59("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4054
+ /* @__PURE__ */ jsx59("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4055
+ /* @__PURE__ */ jsx59("path", { d: "M8 12L10 17L12 14L14 17L16 12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
4056
+ ] });
4057
+ var ImageIcon = () => /* @__PURE__ */ jsxs32("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-yellow-500 w-8 h-8", children: [
4058
+ /* @__PURE__ */ jsx59("path", { d: "M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H19C19.5304 3 20.0391 3.21071 20.4142 3.58579C20.7893 3.96086 21 4.46957 21 5V15ZM21 15L16 10L9 17L6 14L3 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4059
+ /* @__PURE__ */ jsx59("path", { d: "M16 8C16 8.55228 15.5523 9 15 9C14.4477 9 14 8.55228 14 8C14 7.44772 14.4477 7 15 7C15.5523 7 16 7.44772 16 8Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
4060
+ ] });
4061
+ var StandardIcon = () => /* @__PURE__ */ jsxs32("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-gray-500 w-8 h-8", children: [
4062
+ /* @__PURE__ */ jsx59("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4063
+ /* @__PURE__ */ jsx59("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
4064
+ ] });
4065
+ var getFileDetails = (url) => {
4066
+ const extMatch = url.match(/\.([a-zA-Z0-9]+)(?:[\?#]|$)/);
4067
+ const ext = extMatch ? extMatch[1].toLowerCase() : "";
4068
+ let Icon2 = StandardIcon;
4069
+ let extLabel = "FILE";
4070
+ if (["pdf"].includes(ext)) {
4071
+ Icon2 = PdfIcon;
4072
+ extLabel = "PDF";
4073
+ } else if (["xls", "xlsx", "csv"].includes(ext)) {
4074
+ Icon2 = ExcelIcon;
4075
+ extLabel = "Excel";
4076
+ } else if (["doc", "docx"].includes(ext)) {
4077
+ Icon2 = WordIcon;
4078
+ extLabel = ext.toUpperCase();
4079
+ } else if (["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(ext)) {
4080
+ Icon2 = ImageIcon;
4081
+ extLabel = ext.toUpperCase();
4082
+ } else if (ext) {
4083
+ extLabel = ext.toUpperCase();
4084
+ }
4085
+ return { Icon: Icon2, extLabel };
4086
+ };
4087
+ var DocumentNode = (props) => {
4088
+ console.log("DocumentNode rendered");
4089
+ console.log("props", props);
4090
+ console.log("dataitem", props.dataitem);
4091
+ console.log("node", props.node);
4092
+ let documentUrl;
4093
+ let documentTitle;
4094
+ if (props.dataitem && props.node.documentKey) {
4095
+ const docData = getNestedValue4(props.dataitem, props.node.documentKey);
4096
+ if (typeof docData === "string") {
4097
+ const trimmed = docData.trim();
4098
+ if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
4099
+ try {
4100
+ const parsed = JSON.parse(trimmed);
4101
+ const asset = Array.isArray(parsed) ? parsed[0] : parsed;
4102
+ if (asset && asset.assetUrl) {
4103
+ documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
4104
+ if (asset.title) documentTitle = asset.title;
4105
+ }
4106
+ } catch (e) {
4107
+ }
4108
+ } else {
4109
+ documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, docData);
4110
+ }
4111
+ } else if (Array.isArray(docData) && docData.length > 0) {
4112
+ const asset = docData[0];
4113
+ if (asset && asset.assetUrl) {
4114
+ documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
4115
+ if (asset.title) documentTitle = asset.title;
4116
+ }
4117
+ } else if (docData && typeof docData === "object") {
4118
+ const asset = docData;
4119
+ if (asset && asset.assetUrl) {
4120
+ documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
4121
+ if (asset.title) documentTitle = asset.title;
4122
+ }
4123
+ }
4124
+ }
4125
+ if (!documentUrl) return null;
4126
+ const { Icon: Icon2, extLabel } = getFileDetails(documentUrl);
4127
+ if (!documentTitle) {
4128
+ try {
4129
+ const pathName = new URL(documentUrl).pathname;
4130
+ documentTitle = pathName.split("/").pop() || "Document";
4131
+ } catch {
4132
+ documentTitle = documentUrl.split("/").pop() || "Document";
4133
+ }
4134
+ documentTitle = documentTitle.replace(/\.[^/.]+$/, "");
4135
+ }
4136
+ return /* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-between py-4 bg-default", children: [
4137
+ /* @__PURE__ */ jsxs32("div", { className: "flex items-center space-x-4", children: [
4138
+ /* @__PURE__ */ jsx59("div", { className: "flex items-center justify-center p-2 rounded bg-secondary-soft border", children: /* @__PURE__ */ jsx59(Icon2, {}) }),
4139
+ /* @__PURE__ */ jsxs32("div", { className: "flex items-baseline space-x-2", children: [
4140
+ /* @__PURE__ */ jsx59("h4", { className: "text-base font-semibold", children: documentTitle }),
4141
+ /* @__PURE__ */ jsxs32("span", { className: "text-sm font-medium", children: [
4142
+ "(",
4143
+ extLabel,
4144
+ ")"
4145
+ ] })
4146
+ ] })
4147
+ ] }),
4148
+ /* @__PURE__ */ jsxs32(
4149
+ "a",
4150
+ {
4151
+ href: documentUrl,
4152
+ download: true,
4153
+ target: "_blank",
4154
+ rel: "noreferrer",
4155
+ className: "inline-flex items-center px-4 py-2 text-sm font-medium bg-default border rounded focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors",
4156
+ children: [
4157
+ /* @__PURE__ */ jsxs32("svg", { className: "w-4 h-4 mr-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
4158
+ /* @__PURE__ */ jsx59("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" }),
4159
+ /* @__PURE__ */ jsx59("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 12v5m0 0l-3-3m3 3l3-3M12 8v4" })
4160
+ ] }),
4161
+ "Download"
4162
+ ]
4163
+ }
4164
+ )
4165
+ ] });
4166
+ };
4167
+ var DocumentNode_default = DocumentNode;
4168
+
4169
+ // src/components/pageRenderingEngine/nodes/DivContainer.tsx
4170
+ import { jsx as jsx60, jsxs as jsxs33 } from "react/jsx-runtime";
4034
4171
  function toCamelCase(str) {
4035
4172
  return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
4036
4173
  }
@@ -4044,7 +4181,7 @@ function convertKeysToCamelCase(obj) {
4044
4181
  ])
4045
4182
  );
4046
4183
  }
4047
- var getNestedValue4 = (obj, path) => {
4184
+ var getNestedValue5 = (obj, path) => {
4048
4185
  if (!obj || !path) return void 0;
4049
4186
  return path.split(".").reduce((current, key) => {
4050
4187
  {
@@ -4089,7 +4226,7 @@ function generateCompleteBackgroundString(layers, apiBaseUrl, dataItem) {
4089
4226
  const imageValue = layer.value;
4090
4227
  let assetUrl = imageValue.assetUrl || "";
4091
4228
  if (layer.datafield && dataItem) {
4092
- const fieldValue = getNestedValue4(
4229
+ const fieldValue = getNestedValue5(
4093
4230
  dataItem,
4094
4231
  layer.datafield
4095
4232
  );
@@ -4214,7 +4351,8 @@ var DivContainer = async (props) => {
4214
4351
  "div-container": DivContainer,
4215
4352
  text: TextNode_default,
4216
4353
  datafield: DatafieldNode_default,
4217
- "svg-icon": SVGIconNode_default
4354
+ "svg-icon": SVGIconNode_default,
4355
+ document: DocumentNode_default
4218
4356
  };
4219
4357
  const styles = props.node.cssProperties;
4220
4358
  const mobileStyles = props.node.mobileCssProperties;
@@ -4250,7 +4388,7 @@ var DivContainer = async (props) => {
4250
4388
  const condition = props.node.fieldVisibleOnTrue;
4251
4389
  const isNegated = condition.startsWith("!");
4252
4390
  const fieldName = isNegated ? condition.substring(1) : condition;
4253
- const fieldValue = getNestedValue4(props.dataitem, fieldName);
4391
+ const fieldValue = getNestedValue5(props.dataitem, fieldName);
4254
4392
  if (fieldValue === void 0) {
4255
4393
  return false;
4256
4394
  }
@@ -4289,10 +4427,10 @@ var DivContainer = async (props) => {
4289
4427
  response = await serviceClient.get(endpoint);
4290
4428
  result = response?.result;
4291
4429
  if (dataBindingProperties.showNoResultsMessage && (result === void 0 || result.length == 0)) {
4292
- return /* @__PURE__ */ jsx59(NoDataFound_default, {});
4430
+ return /* @__PURE__ */ jsx60(NoDataFound_default, {});
4293
4431
  }
4294
4432
  if (dataBindingProperties.childCollectionName && props.dataitem) {
4295
- childCollectionData = getNestedValue4(props.dataitem, dataBindingProperties.childCollectionName);
4433
+ childCollectionData = getNestedValue5(props.dataitem, dataBindingProperties.childCollectionName);
4296
4434
  }
4297
4435
  }
4298
4436
  const cssResult = generateCssString(
@@ -4306,7 +4444,7 @@ var DivContainer = async (props) => {
4306
4444
  }
4307
4445
  const SelectedNode = NodeTypes2[node.type];
4308
4446
  if (!SelectedNode) return null;
4309
- return /* @__PURE__ */ jsx59(React41.Fragment, { children: /* @__PURE__ */ jsx59(
4447
+ return /* @__PURE__ */ jsx60(React41.Fragment, { children: /* @__PURE__ */ jsx60(
4310
4448
  SelectedNode,
4311
4449
  {
4312
4450
  node,
@@ -4425,9 +4563,9 @@ var DivContainer = async (props) => {
4425
4563
  props.node.bgClass,
4426
4564
  noLinkColor && "no-link-color"
4427
4565
  ].filter(Boolean).join(" ");
4428
- return /* @__PURE__ */ jsxs32(React41.Fragment, { children: [
4429
- /* @__PURE__ */ jsx59("style", { dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS } }),
4430
- /* @__PURE__ */ jsx59(React41.Fragment, { children: /* @__PURE__ */ jsx59(
4566
+ return /* @__PURE__ */ jsxs33(React41.Fragment, { children: [
4567
+ /* @__PURE__ */ jsx60("style", { dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS } }),
4568
+ /* @__PURE__ */ jsx60(React41.Fragment, { children: /* @__PURE__ */ jsx60(
4431
4569
  Wrapper,
4432
4570
  {
4433
4571
  id: guid,
@@ -4436,153 +4574,16 @@ var DivContainer = async (props) => {
4436
4574
  ...wrapperProps,
4437
4575
  children: dataToRender.map(
4438
4576
  (item, idx) => item?.links?.view && renderLink ? renderChildren(props.node.children, props, item, idx, props.href ? void 0 : item?.links?.view)?.map(
4439
- (child, i) => /* @__PURE__ */ jsx59(React41.Fragment, { children: child }, i)
4577
+ (child, i) => /* @__PURE__ */ jsx60(React41.Fragment, { children: child }, i)
4440
4578
  ) : renderChildren(props.node.children, props, item, idx)
4441
4579
  )
4442
4580
  }
4443
4581
  ) }),
4444
- dataBindingProperties && props.node.dataBinding.enablePagination && /* @__PURE__ */ jsx59("div", { children: /* @__PURE__ */ jsx59(Pagination_default, { path: props.path, query: props.query, dataset: response }) })
4582
+ dataBindingProperties && props.node.dataBinding.enablePagination && /* @__PURE__ */ jsx60("div", { children: /* @__PURE__ */ jsx60(Pagination_default, { path: props.path, query: props.query, dataset: response }) })
4445
4583
  ] });
4446
4584
  };
4447
4585
  var DivContainer_default = DivContainer;
4448
4586
 
4449
- // src/components/pageRenderingEngine/nodes/DocumentNode.tsx
4450
- import { jsx as jsx60, jsxs as jsxs33 } from "react/jsx-runtime";
4451
- var getNestedValue5 = (obj, path) => {
4452
- if (!obj || !path) return void 0;
4453
- return path.split(".").reduce((current, key) => {
4454
- return current && current[key] !== void 0 ? current[key] : void 0;
4455
- }, obj);
4456
- };
4457
- var PdfIcon = () => /* @__PURE__ */ jsxs33("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-red-500 w-8 h-8", children: [
4458
- /* @__PURE__ */ jsx60("path", { d: "M7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4459
- /* @__PURE__ */ jsx60("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4460
- /* @__PURE__ */ jsx60("path", { d: "M9 14H11C11.5304 14 12.0391 13.7893 12.4142 13.4142C12.7893 13.0391 13 12.5304 13 12C13 11.4696 12.7893 10.9609 12.4142 10.5858C12.0391 10.2107 11.5304 10 11 10H9V18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4461
- /* @__PURE__ */ jsx60("path", { d: "M9 14H12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
4462
- ] });
4463
- var ExcelIcon = () => /* @__PURE__ */ jsxs33("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-green-600 w-8 h-8", children: [
4464
- /* @__PURE__ */ jsx60("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4465
- /* @__PURE__ */ jsx60("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4466
- /* @__PURE__ */ jsx60("path", { d: "M9 11L15 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4467
- /* @__PURE__ */ jsx60("path", { d: "M15 11L9 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
4468
- ] });
4469
- var WordIcon = () => /* @__PURE__ */ jsxs33("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-blue-600 w-8 h-8", children: [
4470
- /* @__PURE__ */ jsx60("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4471
- /* @__PURE__ */ jsx60("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4472
- /* @__PURE__ */ jsx60("path", { d: "M8 12L10 17L12 14L14 17L16 12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
4473
- ] });
4474
- var ImageIcon = () => /* @__PURE__ */ jsxs33("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-yellow-500 w-8 h-8", children: [
4475
- /* @__PURE__ */ jsx60("path", { d: "M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H19C19.5304 3 20.0391 3.21071 20.4142 3.58579C20.7893 3.96086 21 4.46957 21 5V15ZM21 15L16 10L9 17L6 14L3 17", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4476
- /* @__PURE__ */ jsx60("path", { d: "M16 8C16 8.55228 15.5523 9 15 9C14.4477 9 14 8.55228 14 8C14 7.44772 14.4477 7 15 7C15.5523 7 16 7.44772 16 8Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
4477
- ] });
4478
- var StandardIcon = () => /* @__PURE__ */ jsxs33("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-gray-500 w-8 h-8", children: [
4479
- /* @__PURE__ */ jsx60("path", { d: "M14 3V8H19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
4480
- /* @__PURE__ */ jsx60("path", { d: "M5 20V5C5 4.46957 5.21071 3.96086 5.58579 3.58579C5.96086 3.21071 6.46957 3 7 3H14L19 8V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
4481
- ] });
4482
- var getFileDetails = (url) => {
4483
- const extMatch = url.match(/\.([a-zA-Z0-9]+)(?:[\?#]|$)/);
4484
- const ext = extMatch ? extMatch[1].toLowerCase() : "";
4485
- let Icon2 = StandardIcon;
4486
- let extLabel = "FILE";
4487
- if (["pdf"].includes(ext)) {
4488
- Icon2 = PdfIcon;
4489
- extLabel = "PDF";
4490
- } else if (["xls", "xlsx", "csv"].includes(ext)) {
4491
- Icon2 = ExcelIcon;
4492
- extLabel = "Excel";
4493
- } else if (["doc", "docx"].includes(ext)) {
4494
- Icon2 = WordIcon;
4495
- extLabel = ext.toUpperCase();
4496
- } else if (["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(ext)) {
4497
- Icon2 = ImageIcon;
4498
- extLabel = ext.toUpperCase();
4499
- } else if (ext) {
4500
- extLabel = ext.toUpperCase();
4501
- }
4502
- return { Icon: Icon2, extLabel };
4503
- };
4504
- var DocumentNode = (props) => {
4505
- console.log("DocumentNode rendered");
4506
- console.log("props", props);
4507
- console.log("dataitem", props.dataitem);
4508
- console.log("node", props.node);
4509
- let documentUrl;
4510
- let documentTitle;
4511
- if (props.dataitem && props.node.documentKey) {
4512
- const docData = getNestedValue5(props.dataitem, props.node.documentKey);
4513
- if (typeof docData === "string") {
4514
- const trimmed = docData.trim();
4515
- if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
4516
- try {
4517
- const parsed = JSON.parse(trimmed);
4518
- const asset = Array.isArray(parsed) ? parsed[0] : parsed;
4519
- if (asset && asset.assetUrl) {
4520
- documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
4521
- if (asset.title) documentTitle = asset.title;
4522
- }
4523
- } catch (e) {
4524
- }
4525
- } else {
4526
- documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, docData);
4527
- }
4528
- } else if (Array.isArray(docData) && docData.length > 0) {
4529
- const asset = docData[0];
4530
- if (asset && asset.assetUrl) {
4531
- documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
4532
- if (asset.title) documentTitle = asset.title;
4533
- }
4534
- } else if (docData && typeof docData === "object") {
4535
- const asset = docData;
4536
- if (asset && asset.assetUrl) {
4537
- documentUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, asset.assetUrl);
4538
- if (asset.title) documentTitle = asset.title;
4539
- }
4540
- }
4541
- }
4542
- if (!documentUrl) return null;
4543
- const { Icon: Icon2, extLabel } = getFileDetails(documentUrl);
4544
- if (!documentTitle) {
4545
- try {
4546
- const pathName = new URL(documentUrl).pathname;
4547
- documentTitle = pathName.split("/").pop() || "Document";
4548
- } catch {
4549
- documentTitle = documentUrl.split("/").pop() || "Document";
4550
- }
4551
- documentTitle = documentTitle.replace(/\.[^/.]+$/, "");
4552
- }
4553
- return /* @__PURE__ */ jsxs33("div", { className: "flex items-center justify-between py-4 border-b bg-default", children: [
4554
- /* @__PURE__ */ jsxs33("div", { className: "flex items-center space-x-4", children: [
4555
- /* @__PURE__ */ jsx60("div", { className: "flex items-center justify-center p-2 rounded bg-secondary-soft border", children: /* @__PURE__ */ jsx60(Icon2, {}) }),
4556
- /* @__PURE__ */ jsxs33("div", { className: "flex items-baseline space-x-2", children: [
4557
- /* @__PURE__ */ jsx60("h4", { className: "text-base font-semibold", children: documentTitle }),
4558
- /* @__PURE__ */ jsxs33("span", { className: "text-sm font-medium", children: [
4559
- "(",
4560
- extLabel,
4561
- ")"
4562
- ] })
4563
- ] })
4564
- ] }),
4565
- /* @__PURE__ */ jsxs33(
4566
- "a",
4567
- {
4568
- href: documentUrl,
4569
- download: true,
4570
- target: "_blank",
4571
- rel: "noreferrer",
4572
- className: "inline-flex items-center px-4 py-2 text-sm font-medium bg-default border rounded focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors",
4573
- children: [
4574
- /* @__PURE__ */ jsxs33("svg", { className: "w-4 h-4 mr-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
4575
- /* @__PURE__ */ jsx60("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" }),
4576
- /* @__PURE__ */ jsx60("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 12v5m0 0l-3-3m3 3l3-3M12 8v4" })
4577
- ] }),
4578
- "Download"
4579
- ]
4580
- }
4581
- )
4582
- ] });
4583
- };
4584
- var DocumentNode_default = DocumentNode;
4585
-
4586
4587
  // src/components/pageRenderingEngine/PageBodyRenderer.tsx
4587
4588
  import { jsx as jsx61 } from "react/jsx-runtime";
4588
4589
  var NodeTypes = {
@@ -4622,9 +4623,6 @@ var PageBodyRenderer = (props) => {
4622
4623
  return true;
4623
4624
  };
4624
4625
  return /* @__PURE__ */ jsx61(React42.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
4625
- {
4626
- }
4627
- console.log("Node type:", node.type);
4628
4626
  {
4629
4627
  }
4630
4628
  const SelectedNode = NodeTypes[node.type];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acoustte-digital-services/digitalstore-controls-dev",
3
- "version": "0.8.1-dev.20260623120639",
3
+ "version": "0.8.1-dev.20260623122324",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",