@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260630051644 → 0.8.1-dev.20260702085048

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.js CHANGED
@@ -1266,7 +1266,7 @@ var init_LinkNodeButton = __esm({
1266
1266
  const fieldNames = extractFieldNames(template);
1267
1267
  if (responseData) {
1268
1268
  fieldNames.forEach((fieldName) => {
1269
- const value = getNestedValue6(responseData, fieldName);
1269
+ const value = getNestedValue7(responseData, fieldName);
1270
1270
  if (value !== void 0) {
1271
1271
  const regex1 = new RegExp(`\\{${fieldName}\\}`, "g");
1272
1272
  const regex2 = new RegExp(`\\{\\{${fieldName}\\}\\}`, "g");
@@ -1289,7 +1289,7 @@ var init_LinkNodeButton = __esm({
1289
1289
  }
1290
1290
  return result;
1291
1291
  }, [props.routeParameters, dataitem, extractFieldNames]);
1292
- const getNestedValue6 = (0, import_react35.useCallback)((obj, path) => {
1292
+ const getNestedValue7 = (0, import_react35.useCallback)((obj, path) => {
1293
1293
  if (!obj || !path) return void 0;
1294
1294
  if (obj[path] !== void 0) {
1295
1295
  return obj[path];
@@ -1339,15 +1339,15 @@ var init_LinkNodeButton = __esm({
1339
1339
  console.log("Field names in redirect URL:", fieldNames);
1340
1340
  const fieldValueMap = {};
1341
1341
  fieldNames.forEach((fieldName) => {
1342
- const value = getNestedValue6(response, fieldName);
1342
+ const value = getNestedValue7(response, fieldName);
1343
1343
  if (value !== void 0) {
1344
1344
  fieldValueMap[fieldName] = String(value);
1345
1345
  } else {
1346
- const resultValue = getNestedValue6(response, `result.${fieldName}`);
1346
+ const resultValue = getNestedValue7(response, `result.${fieldName}`);
1347
1347
  if (resultValue !== void 0) {
1348
1348
  fieldValueMap[fieldName] = String(resultValue);
1349
1349
  } else {
1350
- const dataValue = getNestedValue6(response, `data.${fieldName}`);
1350
+ const dataValue = getNestedValue7(response, `data.${fieldName}`);
1351
1351
  if (dataValue !== void 0) {
1352
1352
  fieldValueMap[fieldName] = String(dataValue);
1353
1353
  }
@@ -1385,7 +1385,7 @@ var init_LinkNodeButton = __esm({
1385
1385
  setIsLoading(false);
1386
1386
  return { isSuccessful: false, message: err.message };
1387
1387
  }
1388
- }, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue6, props.apiBaseUrl, props.session]);
1388
+ }, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue7, props.apiBaseUrl, props.session]);
1389
1389
  const renderButtonContent = () => {
1390
1390
  if (children) {
1391
1391
  return children;
@@ -2112,7 +2112,7 @@ var LineTextInput = (props) => {
2112
2112
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react15.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "block", children: [
2113
2113
  props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm inline-block pb-1 font-medium ", children: props?.attributes?.label }),
2114
2114
  " ",
2115
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "bg-error-weak", children: "*" }),
2115
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "bg-error-weak !bg-transparent", children: "*" }),
2116
2116
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2117
2117
  "input",
2118
2118
  {
@@ -2852,7 +2852,7 @@ var SelectWithSearchPanel = (props) => {
2852
2852
  const containerRef = (0, import_react29.useRef)(null);
2853
2853
  const [isCreateOpen, setIsCreateOpen] = (0, import_react29.useState)(false);
2854
2854
  const [formData, setFormData] = (0, import_react29.useState)({});
2855
- const getNestedValue6 = (obj, path) => {
2855
+ const getNestedValue7 = (obj, path) => {
2856
2856
  return path.split(".").reduce((acc, key) => acc?.[key], obj);
2857
2857
  };
2858
2858
  (0, import_react29.useEffect)(() => {
@@ -2890,7 +2890,7 @@ var SelectWithSearchPanel = (props) => {
2890
2890
  props.dataSourceDependsOn
2891
2891
  ]);
2892
2892
  const filteredItems = list?.filter((item) => {
2893
- const value = getNestedValue6(item, props.dataTextFieldName);
2893
+ const value = getNestedValue7(item, props.dataTextFieldName);
2894
2894
  return value?.toLowerCase().includes(searchTerm?.toLowerCase());
2895
2895
  });
2896
2896
  const playBeep = () => {
@@ -2921,7 +2921,7 @@ var SelectWithSearchPanel = (props) => {
2921
2921
  }, [searchTerm]);
2922
2922
  const handleSelect = (event, item) => {
2923
2923
  event.preventDefault();
2924
- setSearchTerm(getNestedValue6(item, props.dataTextFieldName));
2924
+ setSearchTerm(getNestedValue7(item, props.dataTextFieldName));
2925
2925
  if (props.callback) {
2926
2926
  const val = {};
2927
2927
  props.callback({
@@ -3076,7 +3076,7 @@ var SelectWithSearchPanel = (props) => {
3076
3076
  role: "option",
3077
3077
  tabIndex: -1,
3078
3078
  onMouseEnter: () => setHighlightedIndex(index),
3079
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: getNestedValue6(item, props.dataTextFieldName) })
3079
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: getNestedValue7(item, props.dataTextFieldName) })
3080
3080
  }
3081
3081
  ) }, item[props.dataKeyFieldName])) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
3082
3082
  }
@@ -5681,9 +5681,55 @@ var validateRoleVisibility = (roleCode, oAuthToken) => {
5681
5681
  return shouldRenderByRole(roleCode, userRoles);
5682
5682
  };
5683
5683
 
5684
+ // src/utilities/VisibilityUtility.tsx
5685
+ var getNestedValue4 = (obj, path) => {
5686
+ if (!obj || !path) return void 0;
5687
+ return path.split(".").reduce((current, key) => {
5688
+ return current && current[key] !== void 0 ? current[key] : void 0;
5689
+ }, obj);
5690
+ };
5691
+ var shouldRenderByFieldVisibility = (fieldVisibleOnTrue, dataItem) => {
5692
+ if (!fieldVisibleOnTrue) {
5693
+ return true;
5694
+ }
5695
+ const condition = fieldVisibleOnTrue.trim();
5696
+ const isNegated = condition.startsWith("!");
5697
+ const fieldName = isNegated ? condition.substring(1).trim() : condition;
5698
+ const fieldValue = getNestedValue4(dataItem, fieldName);
5699
+ if (fieldValue == null || fieldValue === 0) {
5700
+ return false;
5701
+ }
5702
+ return isNegated ? fieldValue !== true : fieldValue !== false;
5703
+ };
5704
+ var shouldRenderByRole2 = (roleCode, oAuthToken) => {
5705
+ if (!roleCode || roleCode.trim() === "") {
5706
+ return true;
5707
+ }
5708
+ return validateRoleVisibility(roleCode, oAuthToken ?? void 0);
5709
+ };
5710
+ var shouldRenderByVisibility = (visibility, session) => {
5711
+ const normalizedVisibility = visibility?.trim().toLowerCase();
5712
+ const hasAuthToken = Boolean(session?.oAuthToken?.trim());
5713
+ switch (normalizedVisibility) {
5714
+ case "authorized":
5715
+ return hasAuthToken;
5716
+ case "anonymous":
5717
+ return !hasAuthToken;
5718
+ case "all":
5719
+ case "":
5720
+ case null:
5721
+ case void 0:
5722
+ default:
5723
+ return true;
5724
+ }
5725
+ };
5726
+ var shouldRenderContainer = (node, dataItem, session) => {
5727
+ return shouldRenderByVisibility(node.visibility, session) && shouldRenderByRole2(node.roleCode, session?.oAuthToken) && shouldRenderByFieldVisibility(node.fieldVisibleOnTrue, dataItem);
5728
+ };
5729
+
5684
5730
  // src/components/pageRenderingEngine/nodes/DocumentNode.tsx
5685
5731
  var import_jsx_runtime70 = require("react/jsx-runtime");
5686
- var getNestedValue4 = (obj, path) => {
5732
+ var getNestedValue5 = (obj, path) => {
5687
5733
  if (!obj || !path) return void 0;
5688
5734
  return path.split(".").reduce((current, key) => {
5689
5735
  return current && current[key] !== void 0 ? current[key] : void 0;
@@ -6005,7 +6051,7 @@ var DocumentNode = (props) => {
6005
6051
  console.log("node", props.node);
6006
6052
  let documents = [];
6007
6053
  if (props.dataitem && props.node.documentKey) {
6008
- const docData = getNestedValue4(props.dataitem, props.node.documentKey);
6054
+ const docData = getNestedValue5(props.dataitem, props.node.documentKey);
6009
6055
  if (typeof docData === "string") {
6010
6056
  const trimmed = docData.trim();
6011
6057
  if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
@@ -6146,7 +6192,7 @@ function convertKeysToCamelCase(obj) {
6146
6192
  Object.entries(obj).filter(([_, value]) => value !== "" && value !== void 0).map(([key, value]) => [toCamelCase(key), convertKeysToCamelCase(value)])
6147
6193
  );
6148
6194
  }
6149
- var getNestedValue5 = (obj, path) => {
6195
+ var getNestedValue6 = (obj, path) => {
6150
6196
  if (!obj || !path) return void 0;
6151
6197
  return path.split(".").reduce((current, key) => {
6152
6198
  {
@@ -6191,7 +6237,7 @@ function generateCompleteBackgroundString(layers, apiBaseUrl, dataItem) {
6191
6237
  const imageValue = layer.value;
6192
6238
  let assetUrl = imageValue.assetUrl || "";
6193
6239
  if (layer.datafield && dataItem) {
6194
- const fieldValue = getNestedValue5(dataItem, layer.datafield);
6240
+ const fieldValue = getNestedValue6(dataItem, layer.datafield);
6195
6241
  const resolvedAssetUrl = resolveAssetUrl2(fieldValue, layer.tag);
6196
6242
  if (resolvedAssetUrl) {
6197
6243
  assetUrl = resolvedAssetUrl;
@@ -6347,27 +6393,15 @@ var DivContainer = async (props) => {
6347
6393
  `#${guid}`
6348
6394
  );
6349
6395
  }
6350
- const shouldHideContainer = () => {
6351
- if (!props.node.fieldVisibleOnTrue) return false;
6352
- const condition = props.node.fieldVisibleOnTrue.trim();
6353
- const isNegated = condition.startsWith("!");
6354
- const fieldName = isNegated ? condition.substring(1).trim() : condition;
6355
- const fieldValue = getNestedValue5(props.dataitem, fieldName);
6356
- if (fieldValue == null || fieldValue === 0) {
6357
- return true;
6358
- }
6359
- return isNegated ? fieldValue === true : fieldValue === false;
6360
- };
6361
- const shouldHideByRole = () => {
6362
- if (!props.node.roleCode) return false;
6363
- const roleCode = props.node.roleCode;
6364
- const oAuthToken = props.session?.oAuthToken;
6365
- if (!roleCode || roleCode.trim() === "") {
6366
- return false;
6367
- }
6368
- return !validateRoleVisibility(roleCode, oAuthToken);
6369
- };
6370
- const isHidden = shouldHideContainer() || shouldHideByRole();
6396
+ const isHidden = !shouldRenderContainer(
6397
+ {
6398
+ visibility: props.node.visibility,
6399
+ roleCode: props.node.roleCode,
6400
+ fieldVisibleOnTrue: props.node.fieldVisibleOnTrue
6401
+ },
6402
+ props.dataitem,
6403
+ props.session
6404
+ );
6371
6405
  let odataString = void 0;
6372
6406
  let endpoint = void 0;
6373
6407
  let result = null;
@@ -6394,7 +6428,7 @@ var DivContainer = async (props) => {
6394
6428
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(NoDataFound_default, {});
6395
6429
  }
6396
6430
  if (dataBindingProperties.childCollectionName && props.dataitem) {
6397
- childCollectionData = getNestedValue5(
6431
+ childCollectionData = getNestedValue6(
6398
6432
  props.dataitem,
6399
6433
  dataBindingProperties.childCollectionName
6400
6434
  );
package/dist/index.mjs CHANGED
@@ -508,7 +508,7 @@ var LineTextInput = (props) => {
508
508
  return /* @__PURE__ */ jsx14(React13.Fragment, { children: /* @__PURE__ */ jsxs6("label", { className: "block", children: [
509
509
  props?.attributes?.label && /* @__PURE__ */ jsx14("span", { className: "text-sm inline-block pb-1 font-medium ", children: props?.attributes?.label }),
510
510
  " ",
511
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx14("span", { className: "bg-error-weak", children: "*" }),
511
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx14("span", { className: "bg-error-weak !bg-transparent", children: "*" }),
512
512
  /* @__PURE__ */ jsx14(
513
513
  "input",
514
514
  {
@@ -1252,7 +1252,7 @@ var SelectWithSearchPanel = (props) => {
1252
1252
  const containerRef = useRef2(null);
1253
1253
  const [isCreateOpen, setIsCreateOpen] = useState4(false);
1254
1254
  const [formData, setFormData] = useState4({});
1255
- const getNestedValue6 = (obj, path) => {
1255
+ const getNestedValue7 = (obj, path) => {
1256
1256
  return path.split(".").reduce((acc, key) => acc?.[key], obj);
1257
1257
  };
1258
1258
  useEffect5(() => {
@@ -1290,7 +1290,7 @@ var SelectWithSearchPanel = (props) => {
1290
1290
  props.dataSourceDependsOn
1291
1291
  ]);
1292
1292
  const filteredItems = list?.filter((item) => {
1293
- const value = getNestedValue6(item, props.dataTextFieldName);
1293
+ const value = getNestedValue7(item, props.dataTextFieldName);
1294
1294
  return value?.toLowerCase().includes(searchTerm?.toLowerCase());
1295
1295
  });
1296
1296
  const playBeep = () => {
@@ -1321,7 +1321,7 @@ var SelectWithSearchPanel = (props) => {
1321
1321
  }, [searchTerm]);
1322
1322
  const handleSelect = (event, item) => {
1323
1323
  event.preventDefault();
1324
- setSearchTerm(getNestedValue6(item, props.dataTextFieldName));
1324
+ setSearchTerm(getNestedValue7(item, props.dataTextFieldName));
1325
1325
  if (props.callback) {
1326
1326
  const val = {};
1327
1327
  props.callback({
@@ -1476,7 +1476,7 @@ var SelectWithSearchPanel = (props) => {
1476
1476
  role: "option",
1477
1477
  tabIndex: -1,
1478
1478
  onMouseEnter: () => setHighlightedIndex(index),
1479
- children: /* @__PURE__ */ jsx25("span", { children: getNestedValue6(item, props.dataTextFieldName) })
1479
+ children: /* @__PURE__ */ jsx25("span", { children: getNestedValue7(item, props.dataTextFieldName) })
1480
1480
  }
1481
1481
  ) }, item[props.dataKeyFieldName])) : /* @__PURE__ */ jsx25("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
1482
1482
  }
@@ -4075,9 +4075,55 @@ var validateRoleVisibility = (roleCode, oAuthToken) => {
4075
4075
  return shouldRenderByRole(roleCode, userRoles);
4076
4076
  };
4077
4077
 
4078
+ // src/utilities/VisibilityUtility.tsx
4079
+ var getNestedValue4 = (obj, path) => {
4080
+ if (!obj || !path) return void 0;
4081
+ return path.split(".").reduce((current, key) => {
4082
+ return current && current[key] !== void 0 ? current[key] : void 0;
4083
+ }, obj);
4084
+ };
4085
+ var shouldRenderByFieldVisibility = (fieldVisibleOnTrue, dataItem) => {
4086
+ if (!fieldVisibleOnTrue) {
4087
+ return true;
4088
+ }
4089
+ const condition = fieldVisibleOnTrue.trim();
4090
+ const isNegated = condition.startsWith("!");
4091
+ const fieldName = isNegated ? condition.substring(1).trim() : condition;
4092
+ const fieldValue = getNestedValue4(dataItem, fieldName);
4093
+ if (fieldValue == null || fieldValue === 0) {
4094
+ return false;
4095
+ }
4096
+ return isNegated ? fieldValue !== true : fieldValue !== false;
4097
+ };
4098
+ var shouldRenderByRole2 = (roleCode, oAuthToken) => {
4099
+ if (!roleCode || roleCode.trim() === "") {
4100
+ return true;
4101
+ }
4102
+ return validateRoleVisibility(roleCode, oAuthToken ?? void 0);
4103
+ };
4104
+ var shouldRenderByVisibility = (visibility, session) => {
4105
+ const normalizedVisibility = visibility?.trim().toLowerCase();
4106
+ const hasAuthToken = Boolean(session?.oAuthToken?.trim());
4107
+ switch (normalizedVisibility) {
4108
+ case "authorized":
4109
+ return hasAuthToken;
4110
+ case "anonymous":
4111
+ return !hasAuthToken;
4112
+ case "all":
4113
+ case "":
4114
+ case null:
4115
+ case void 0:
4116
+ default:
4117
+ return true;
4118
+ }
4119
+ };
4120
+ var shouldRenderContainer = (node, dataItem, session) => {
4121
+ return shouldRenderByVisibility(node.visibility, session) && shouldRenderByRole2(node.roleCode, session?.oAuthToken) && shouldRenderByFieldVisibility(node.fieldVisibleOnTrue, dataItem);
4122
+ };
4123
+
4078
4124
  // src/components/pageRenderingEngine/nodes/DocumentNode.tsx
4079
4125
  import { Fragment as Fragment9, jsx as jsx59, jsxs as jsxs32 } from "react/jsx-runtime";
4080
- var getNestedValue4 = (obj, path) => {
4126
+ var getNestedValue5 = (obj, path) => {
4081
4127
  if (!obj || !path) return void 0;
4082
4128
  return path.split(".").reduce((current, key) => {
4083
4129
  return current && current[key] !== void 0 ? current[key] : void 0;
@@ -4399,7 +4445,7 @@ var DocumentNode = (props) => {
4399
4445
  console.log("node", props.node);
4400
4446
  let documents = [];
4401
4447
  if (props.dataitem && props.node.documentKey) {
4402
- const docData = getNestedValue4(props.dataitem, props.node.documentKey);
4448
+ const docData = getNestedValue5(props.dataitem, props.node.documentKey);
4403
4449
  if (typeof docData === "string") {
4404
4450
  const trimmed = docData.trim();
4405
4451
  if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
@@ -4540,7 +4586,7 @@ function convertKeysToCamelCase(obj) {
4540
4586
  Object.entries(obj).filter(([_, value]) => value !== "" && value !== void 0).map(([key, value]) => [toCamelCase(key), convertKeysToCamelCase(value)])
4541
4587
  );
4542
4588
  }
4543
- var getNestedValue5 = (obj, path) => {
4589
+ var getNestedValue6 = (obj, path) => {
4544
4590
  if (!obj || !path) return void 0;
4545
4591
  return path.split(".").reduce((current, key) => {
4546
4592
  {
@@ -4585,7 +4631,7 @@ function generateCompleteBackgroundString(layers, apiBaseUrl, dataItem) {
4585
4631
  const imageValue = layer.value;
4586
4632
  let assetUrl = imageValue.assetUrl || "";
4587
4633
  if (layer.datafield && dataItem) {
4588
- const fieldValue = getNestedValue5(dataItem, layer.datafield);
4634
+ const fieldValue = getNestedValue6(dataItem, layer.datafield);
4589
4635
  const resolvedAssetUrl = resolveAssetUrl2(fieldValue, layer.tag);
4590
4636
  if (resolvedAssetUrl) {
4591
4637
  assetUrl = resolvedAssetUrl;
@@ -4741,27 +4787,15 @@ var DivContainer = async (props) => {
4741
4787
  `#${guid}`
4742
4788
  );
4743
4789
  }
4744
- const shouldHideContainer = () => {
4745
- if (!props.node.fieldVisibleOnTrue) return false;
4746
- const condition = props.node.fieldVisibleOnTrue.trim();
4747
- const isNegated = condition.startsWith("!");
4748
- const fieldName = isNegated ? condition.substring(1).trim() : condition;
4749
- const fieldValue = getNestedValue5(props.dataitem, fieldName);
4750
- if (fieldValue == null || fieldValue === 0) {
4751
- return true;
4752
- }
4753
- return isNegated ? fieldValue === true : fieldValue === false;
4754
- };
4755
- const shouldHideByRole = () => {
4756
- if (!props.node.roleCode) return false;
4757
- const roleCode = props.node.roleCode;
4758
- const oAuthToken = props.session?.oAuthToken;
4759
- if (!roleCode || roleCode.trim() === "") {
4760
- return false;
4761
- }
4762
- return !validateRoleVisibility(roleCode, oAuthToken);
4763
- };
4764
- const isHidden = shouldHideContainer() || shouldHideByRole();
4790
+ const isHidden = !shouldRenderContainer(
4791
+ {
4792
+ visibility: props.node.visibility,
4793
+ roleCode: props.node.roleCode,
4794
+ fieldVisibleOnTrue: props.node.fieldVisibleOnTrue
4795
+ },
4796
+ props.dataitem,
4797
+ props.session
4798
+ );
4765
4799
  let odataString = void 0;
4766
4800
  let endpoint = void 0;
4767
4801
  let result = null;
@@ -4788,7 +4822,7 @@ var DivContainer = async (props) => {
4788
4822
  return /* @__PURE__ */ jsx60(NoDataFound_default, {});
4789
4823
  }
4790
4824
  if (dataBindingProperties.childCollectionName && props.dataitem) {
4791
- childCollectionData = getNestedValue5(
4825
+ childCollectionData = getNestedValue6(
4792
4826
  props.dataitem,
4793
4827
  dataBindingProperties.childCollectionName
4794
4828
  );
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.20260630051644",
3
+ "version": "0.8.1-dev.20260702085048",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  "devDependencies": {
25
- "@types/node": "^26.0.1",
25
+ "@types/node": "^26.1.0",
26
26
  "@types/react": "^19",
27
27
  "@types/react-dom": "^19",
28
28
  "tsup": "^8.5.1",
@@ -52,7 +52,7 @@
52
52
  "moment-timezone": "^0.6.2",
53
53
  "ms": "^2.1.3",
54
54
  "mz": "^2.7.0",
55
- "next": "^15.5.19",
55
+ "next": "^15.5.20",
56
56
  "object-assign": "^4.1.1",
57
57
  "pathe": "^2.0.3",
58
58
  "picocolors": "^1.1.1",