@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260323055150 → 0.8.1-dev.20260323091914

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 CHANGED
@@ -204,6 +204,8 @@ interface PageBodyRendererProps {
204
204
  donotApplyContainerClass?: boolean;
205
205
  donotApplyContainerLargeClass?: boolean;
206
206
  widgetRegistry?: Record<string, React.ComponentType<any>>;
207
+ serviceClient?: ServiceClientInterface;
208
+ resolveAssetUrl?: (assetUrl: string) => string | undefined;
207
209
  }
208
210
  declare const PageBodyRenderer: React.FC<PageBodyRendererProps>;
209
211
 
package/dist/index.d.ts CHANGED
@@ -204,6 +204,8 @@ interface PageBodyRendererProps {
204
204
  donotApplyContainerClass?: boolean;
205
205
  donotApplyContainerLargeClass?: boolean;
206
206
  widgetRegistry?: Record<string, React.ComponentType<any>>;
207
+ serviceClient?: ServiceClientInterface;
208
+ resolveAssetUrl?: (assetUrl: string) => string | undefined;
207
209
  }
208
210
  declare const PageBodyRenderer: React.FC<PageBodyRendererProps>;
209
211
 
package/dist/index.js CHANGED
@@ -4017,7 +4017,7 @@ function EnterAnimationClient({ hasEnterAnimation, children }) {
4017
4017
  }
4018
4018
 
4019
4019
  // src/components/Slider.tsx
4020
- var import_react53 = require("react");
4020
+ var import_react53 = __toESM(require("react"));
4021
4021
  var import_jsx_runtime67 = require("react/jsx-runtime");
4022
4022
  var Slider = ({
4023
4023
  children,
@@ -4112,13 +4112,16 @@ var Slider = ({
4112
4112
  };
4113
4113
  const translateX = -currentSlide * (100 / slidesToShowState);
4114
4114
  const slides = import_react53.Children.map(children, (child, index) => {
4115
+ if (!import_react53.default.isValidElement(child)) return null;
4116
+ const childProps = child.props;
4117
+ const mergedClassName = `${childProps.className ?? ""} w-full`.trim();
4115
4118
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
4116
4119
  "div",
4117
4120
  {
4118
4121
  className: `flex-none ${scaleOnHover ? "group hover:z-50" : ""} relative`,
4119
4122
  style: { width: `calc(${100 / slidesToShowState}%)`, paddingRight: gap },
4120
4123
  children: (0, import_react53.cloneElement)(child, {
4121
- className: `w-full`
4124
+ className: mergedClassName
4122
4125
  })
4123
4126
  },
4124
4127
  index
@@ -4379,16 +4382,15 @@ var getNestedValue = (obj, path) => {
4379
4382
  return current && current[key] !== void 0 ? current[key] : void 0;
4380
4383
  }, obj);
4381
4384
  };
4382
- function generateCompleteBackgroundString(layers) {
4385
+ function generateCompleteBackgroundString(layers, resolveAssetUrl, apiBaseUrl) {
4383
4386
  if (!layers || !Array.isArray(layers)) return "";
4384
4387
  return layers.filter((layer) => layer && layer.type && layer.value).map((layer) => {
4385
4388
  if (layer.type === "image" && typeof layer.value === "object") {
4386
4389
  const imageValue = layer.value;
4387
4390
  if (!imageValue.assetUrl) return "";
4388
- const url = `url('${AssetUtility_default.resolveUrl(
4389
- ApiPathServerUtility.getApiPath(),
4390
- imageValue.assetUrl
4391
- )}')`;
4391
+ const resolvedAssetUrl = resolveAssetUrl?.(imageValue.assetUrl) ?? AssetUtility_default.resolveUrl(apiBaseUrl, imageValue.assetUrl);
4392
+ if (!resolvedAssetUrl) return "";
4393
+ const url = `url('${resolvedAssetUrl}')`;
4392
4394
  const repeat = layer.repeat || "no-repeat";
4393
4395
  const position = layer.position || "center";
4394
4396
  const size = layer.size || "auto";
@@ -4472,7 +4474,11 @@ var DivContainer = async (props) => {
4472
4474
  const mobileStyles = props.node.mobileCssProperties;
4473
4475
  const dataBindingProperties = props.node.dataBinding;
4474
4476
  const updatedStyles = convertKeysToCamelCase(styles);
4475
- var background = generateCompleteBackgroundString(props.node.backgroundLayers);
4477
+ var background = generateCompleteBackgroundString(
4478
+ props.node.backgroundLayers,
4479
+ props.resolveAssetUrl,
4480
+ props.apiBaseUrl
4481
+ );
4476
4482
  let containerPaddingClass = "";
4477
4483
  if (props.node.containerPadding == "small") {
4478
4484
  containerPaddingClass = "container-small";
@@ -4515,7 +4521,6 @@ var DivContainer = async (props) => {
4515
4521
  let response = null;
4516
4522
  let childCollectionData = null;
4517
4523
  if (dataBindingProperties) {
4518
- const serviceClient = new ServiceClient(props.apiBaseUrl, props.session);
4519
4524
  endpoint = dataBindingProperties.dataSource;
4520
4525
  endpoint = endpoint.replace(/\{(\w+)\}/g, (_, key) => {
4521
4526
  return props.routeParameters?.[key] ?? `{${key}}`;
@@ -4527,9 +4532,15 @@ var DivContainer = async (props) => {
4527
4532
  endpoint += separator + odataString;
4528
4533
  }
4529
4534
  }
4530
- response = await serviceClient.get(endpoint);
4531
- result = response?.result;
4532
- if (dataBindingProperties.showNoResultsMessage && (result === void 0 || result.length == 0)) {
4535
+ if (props.fetchData) {
4536
+ response = await props.fetchData(endpoint);
4537
+ result = response?.result;
4538
+ } else {
4539
+ console.warn(
4540
+ "DivContainer data binding needs `fetchData` prop but none was provided."
4541
+ );
4542
+ }
4543
+ if (dataBindingProperties.showNoResultsMessage && (result === void 0 || Array.isArray(result) && result.length == 0)) {
4533
4544
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(NoDataFound_default, {});
4534
4545
  }
4535
4546
  if (dataBindingProperties.childCollectionName && props.dataitem) {
@@ -4551,6 +4562,8 @@ var DivContainer = async (props) => {
4551
4562
  host: props2.host,
4552
4563
  path: props2.path,
4553
4564
  apiBaseUrl: props2.apiBaseUrl,
4565
+ serviceClient: props2.serviceClient,
4566
+ resolveAssetUrl: props2.resolveAssetUrl,
4554
4567
  breadcrumb: props2.breadcrumb,
4555
4568
  dataitem,
4556
4569
  href
@@ -4700,7 +4713,9 @@ var PageBodyRenderer = (props) => {
4700
4713
  host: props.host,
4701
4714
  path: props.path,
4702
4715
  apiBaseUrl: props.apiBaseUrl,
4703
- widgetRegistry: props.widgetRegistry
4716
+ widgetRegistry: props.widgetRegistry,
4717
+ serviceClient: props.serviceClient,
4718
+ resolveAssetUrl: props.resolveAssetUrl
4704
4719
  }
4705
4720
  ) }) : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react55.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
4706
4721
  SelectedNode,
@@ -4712,7 +4727,9 @@ var PageBodyRenderer = (props) => {
4712
4727
  host: props.host,
4713
4728
  path: props.path,
4714
4729
  apiBaseUrl: props.apiBaseUrl,
4715
- widgetRegistry: props.widgetRegistry
4730
+ widgetRegistry: props.widgetRegistry,
4731
+ serviceClient: props.serviceClient,
4732
+ resolveAssetUrl: props.resolveAssetUrl
4716
4733
  }
4717
4734
  ) }) }) }, index);
4718
4735
  }) });
package/dist/index.mjs CHANGED
@@ -3985,7 +3985,7 @@ function EnterAnimationClient({ hasEnterAnimation, children }) {
3985
3985
  }
3986
3986
 
3987
3987
  // src/components/Slider.tsx
3988
- import { useState as useState11, useEffect as useEffect11, Children, cloneElement } from "react";
3988
+ import React52, { useState as useState11, useEffect as useEffect11, Children, cloneElement } from "react";
3989
3989
  import { Fragment as Fragment8, jsx as jsx67, jsxs as jsxs33 } from "react/jsx-runtime";
3990
3990
  var Slider = ({
3991
3991
  children,
@@ -4080,13 +4080,16 @@ var Slider = ({
4080
4080
  };
4081
4081
  const translateX = -currentSlide * (100 / slidesToShowState);
4082
4082
  const slides = Children.map(children, (child, index) => {
4083
+ if (!React52.isValidElement(child)) return null;
4084
+ const childProps = child.props;
4085
+ const mergedClassName = `${childProps.className ?? ""} w-full`.trim();
4083
4086
  return /* @__PURE__ */ jsx67(
4084
4087
  "div",
4085
4088
  {
4086
4089
  className: `flex-none ${scaleOnHover ? "group hover:z-50" : ""} relative`,
4087
4090
  style: { width: `calc(${100 / slidesToShowState}%)`, paddingRight: gap },
4088
4091
  children: cloneElement(child, {
4089
- className: `w-full`
4092
+ className: mergedClassName
4090
4093
  })
4091
4094
  },
4092
4095
  index
@@ -4347,16 +4350,15 @@ var getNestedValue = (obj, path) => {
4347
4350
  return current && current[key] !== void 0 ? current[key] : void 0;
4348
4351
  }, obj);
4349
4352
  };
4350
- function generateCompleteBackgroundString(layers) {
4353
+ function generateCompleteBackgroundString(layers, resolveAssetUrl, apiBaseUrl) {
4351
4354
  if (!layers || !Array.isArray(layers)) return "";
4352
4355
  return layers.filter((layer) => layer && layer.type && layer.value).map((layer) => {
4353
4356
  if (layer.type === "image" && typeof layer.value === "object") {
4354
4357
  const imageValue = layer.value;
4355
4358
  if (!imageValue.assetUrl) return "";
4356
- const url = `url('${AssetUtility_default.resolveUrl(
4357
- ApiPathServerUtility.getApiPath(),
4358
- imageValue.assetUrl
4359
- )}')`;
4359
+ const resolvedAssetUrl = resolveAssetUrl?.(imageValue.assetUrl) ?? AssetUtility_default.resolveUrl(apiBaseUrl, imageValue.assetUrl);
4360
+ if (!resolvedAssetUrl) return "";
4361
+ const url = `url('${resolvedAssetUrl}')`;
4360
4362
  const repeat = layer.repeat || "no-repeat";
4361
4363
  const position = layer.position || "center";
4362
4364
  const size = layer.size || "auto";
@@ -4440,7 +4442,11 @@ var DivContainer = async (props) => {
4440
4442
  const mobileStyles = props.node.mobileCssProperties;
4441
4443
  const dataBindingProperties = props.node.dataBinding;
4442
4444
  const updatedStyles = convertKeysToCamelCase(styles);
4443
- var background = generateCompleteBackgroundString(props.node.backgroundLayers);
4445
+ var background = generateCompleteBackgroundString(
4446
+ props.node.backgroundLayers,
4447
+ props.resolveAssetUrl,
4448
+ props.apiBaseUrl
4449
+ );
4444
4450
  let containerPaddingClass = "";
4445
4451
  if (props.node.containerPadding == "small") {
4446
4452
  containerPaddingClass = "container-small";
@@ -4483,7 +4489,6 @@ var DivContainer = async (props) => {
4483
4489
  let response = null;
4484
4490
  let childCollectionData = null;
4485
4491
  if (dataBindingProperties) {
4486
- const serviceClient = new ServiceClient(props.apiBaseUrl, props.session);
4487
4492
  endpoint = dataBindingProperties.dataSource;
4488
4493
  endpoint = endpoint.replace(/\{(\w+)\}/g, (_, key) => {
4489
4494
  return props.routeParameters?.[key] ?? `{${key}}`;
@@ -4495,9 +4500,15 @@ var DivContainer = async (props) => {
4495
4500
  endpoint += separator + odataString;
4496
4501
  }
4497
4502
  }
4498
- response = await serviceClient.get(endpoint);
4499
- result = response?.result;
4500
- if (dataBindingProperties.showNoResultsMessage && (result === void 0 || result.length == 0)) {
4503
+ if (props.fetchData) {
4504
+ response = await props.fetchData(endpoint);
4505
+ result = response?.result;
4506
+ } else {
4507
+ console.warn(
4508
+ "DivContainer data binding needs `fetchData` prop but none was provided."
4509
+ );
4510
+ }
4511
+ if (dataBindingProperties.showNoResultsMessage && (result === void 0 || Array.isArray(result) && result.length == 0)) {
4501
4512
  return /* @__PURE__ */ jsx69(NoDataFound_default, {});
4502
4513
  }
4503
4514
  if (dataBindingProperties.childCollectionName && props.dataitem) {
@@ -4519,6 +4530,8 @@ var DivContainer = async (props) => {
4519
4530
  host: props2.host,
4520
4531
  path: props2.path,
4521
4532
  apiBaseUrl: props2.apiBaseUrl,
4533
+ serviceClient: props2.serviceClient,
4534
+ resolveAssetUrl: props2.resolveAssetUrl,
4522
4535
  breadcrumb: props2.breadcrumb,
4523
4536
  dataitem,
4524
4537
  href
@@ -4668,7 +4681,9 @@ var PageBodyRenderer = (props) => {
4668
4681
  host: props.host,
4669
4682
  path: props.path,
4670
4683
  apiBaseUrl: props.apiBaseUrl,
4671
- widgetRegistry: props.widgetRegistry
4684
+ widgetRegistry: props.widgetRegistry,
4685
+ serviceClient: props.serviceClient,
4686
+ resolveAssetUrl: props.resolveAssetUrl
4672
4687
  }
4673
4688
  ) }) : /* @__PURE__ */ jsx70(React54.Fragment, { children: /* @__PURE__ */ jsx70(
4674
4689
  SelectedNode,
@@ -4680,7 +4695,9 @@ var PageBodyRenderer = (props) => {
4680
4695
  host: props.host,
4681
4696
  path: props.path,
4682
4697
  apiBaseUrl: props.apiBaseUrl,
4683
- widgetRegistry: props.widgetRegistry
4698
+ widgetRegistry: props.widgetRegistry,
4699
+ serviceClient: props.serviceClient,
4700
+ resolveAssetUrl: props.resolveAssetUrl
4684
4701
  }
4685
4702
  ) }) }) }, index);
4686
4703
  }) });
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.20260323055150",
3
+ "version": "0.8.1-dev.20260323091914",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",