@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20261013062551 → 0.8.1-dev.20261013114908

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/server.mjs CHANGED
@@ -1222,7 +1222,7 @@ var WidgetNode = (props) => {
1222
1222
  var WidgetNode_default = WidgetNode;
1223
1223
 
1224
1224
  // src/components/pageRenderingEngine/nodes/DivContainer.tsx
1225
- import dynamic14 from "next/dynamic";
1225
+ import dynamic15 from "next/dynamic";
1226
1226
  import React23 from "react";
1227
1227
 
1228
1228
  // src/components/pageRenderingEngine/nodes/EmbedNode.tsx
@@ -2403,13 +2403,111 @@ var GoogleMapNode = (props) => {
2403
2403
  };
2404
2404
  var GoogleMapNode_default = GoogleMapNode;
2405
2405
 
2406
+ // src/components/pageRenderingEngine/nodes/MediaAccordionNode.tsx
2407
+ import dynamic14 from "next/dynamic";
2408
+ import { jsx as jsx38 } from "react/jsx-runtime";
2409
+ var MediaAccordionNodeClient = dynamic14(
2410
+ () => import("./MediaAccordionNodeClient-LTCRGB3L.mjs"),
2411
+ { ssr: false }
2412
+ );
2413
+ var getNestedValue6 = (value, path) => path.split(".").reduce((current, key) => {
2414
+ if (!current || typeof current !== "object") return void 0;
2415
+ return current[key];
2416
+ }, value);
2417
+ var getAssetUrl = (value) => {
2418
+ if (typeof value === "string") {
2419
+ const trimmed = value.trim();
2420
+ if (!trimmed) return {};
2421
+ try {
2422
+ return getAssetUrl(JSON.parse(trimmed));
2423
+ } catch {
2424
+ return { url: trimmed };
2425
+ }
2426
+ }
2427
+ if (Array.isArray(value)) {
2428
+ const image = value.find(
2429
+ (entry) => entry && typeof entry === "object" && "assetUrl" in entry
2430
+ );
2431
+ return getAssetUrl(image);
2432
+ }
2433
+ if (value && typeof value === "object") {
2434
+ const asset = value;
2435
+ return {
2436
+ url: typeof asset.assetUrl === "string" ? asset.assetUrl : void 0,
2437
+ posterUrl: typeof asset.posterUrl === "string" ? asset.posterUrl : void 0
2438
+ };
2439
+ }
2440
+ return {};
2441
+ };
2442
+ var fetchStoryItems = async (node, apiBaseUrl, session, routeParameters) => {
2443
+ const dataSource = node.dataSource?.trim();
2444
+ if (!dataSource) return void 0;
2445
+ const endpoint = dataSource.replace(
2446
+ /\{(\w+)\}/g,
2447
+ (placeholder, key) => routeParameters?.[key] == null ? placeholder : String(routeParameters[key])
2448
+ );
2449
+ try {
2450
+ const response = await new ServiceClient_default(apiBaseUrl, session).get(endpoint);
2451
+ if (!response?.isSuccessful) {
2452
+ console.error(
2453
+ "Story accordion API request failed:",
2454
+ response?.message || endpoint
2455
+ );
2456
+ return void 0;
2457
+ }
2458
+ const result = response.result;
2459
+ const records = Array.isArray(result) ? result : node.responseType === "object" && result ? [result] : [];
2460
+ return records.flatMap((record, index) => {
2461
+ const title = getNestedValue6(record, node.titleField || "title");
2462
+ const mappedMedia = getAssetUrl(
2463
+ getNestedValue6(record, node.mediaUrlField || "mediaUrl")
2464
+ );
2465
+ const explicitPoster = node.posterUrlField ? getAssetUrl(getNestedValue6(record, node.posterUrlField)).url : void 0;
2466
+ const mediaUrl = mappedMedia.url;
2467
+ if (!mediaUrl) return [];
2468
+ const typeValue = node.mediaTypeField ? getNestedValue6(record, node.mediaTypeField) : void 0;
2469
+ const mediaType = typeof typeValue === "string" ? typeValue.toLowerCase() === "video" ? "video" : "image" : /\.(mp4|webm|ogv|m3u8)(?:$|[?#])/i.test(mediaUrl) ? "video" : "image";
2470
+ return [
2471
+ {
2472
+ id: `api-story-${index}`,
2473
+ title: typeof title === "string" || typeof title === "number" ? String(title) : `Story ${index + 1}`,
2474
+ mediaUrl,
2475
+ posterUrl: explicitPoster || mappedMedia.posterUrl,
2476
+ mediaType
2477
+ }
2478
+ ];
2479
+ });
2480
+ } catch (error) {
2481
+ console.error("Story accordion API request failed:", error);
2482
+ return void 0;
2483
+ }
2484
+ };
2485
+ var MediaAccordionNode = async (props) => {
2486
+ const apiItems = await fetchStoryItems(
2487
+ props.node,
2488
+ props.apiBaseUrl,
2489
+ props.session,
2490
+ props.routeParameters
2491
+ );
2492
+ const node = apiItems ? { ...props.node, items: apiItems } : props.node;
2493
+ return /* @__PURE__ */ jsx38(
2494
+ MediaAccordionNodeClient,
2495
+ {
2496
+ node,
2497
+ apiBaseUrl: props.apiBaseUrl,
2498
+ assetBaseUrl: props.assetBaseUrl
2499
+ }
2500
+ );
2501
+ };
2502
+ var MediaAccordionNode_default = MediaAccordionNode;
2503
+
2406
2504
  // src/components/pageRenderingEngine/nodes/DivContainer.tsx
2407
- import { jsx as jsx38, jsxs as jsxs15 } from "react/jsx-runtime";
2408
- var Pagination = dynamic14(() => import("./Pagination-RMAXCIL7.mjs"), { ssr: true });
2409
- var DataBindingControls = dynamic14(() => import("./DataBindingControls-Z2AHWFYX.mjs"), {
2505
+ import { jsx as jsx39, jsxs as jsxs15 } from "react/jsx-runtime";
2506
+ var Pagination = dynamic15(() => import("./Pagination-RMAXCIL7.mjs"), { ssr: true });
2507
+ var DataBindingControls = dynamic15(() => import("./DataBindingControls-Z2AHWFYX.mjs"), {
2410
2508
  ssr: true
2411
2509
  });
2412
- var Slider = dynamic14(() => import("./Slider-BH5S4XRN.mjs"), {
2510
+ var Slider = dynamic15(() => import("./Slider-BH5S4XRN.mjs"), {
2413
2511
  ssr: false
2414
2512
  });
2415
2513
  function toCamelCase(str) {
@@ -2430,7 +2528,7 @@ function convertKeysToCamelCase(obj) {
2430
2528
  Object.entries(obj).filter(([_, value]) => value !== "" && value !== void 0).map(([key, value]) => [toCamelCase(key), convertKeysToCamelCase(value)])
2431
2529
  );
2432
2530
  }
2433
- var getNestedValue6 = (obj, path) => {
2531
+ var getNestedValue7 = (obj, path) => {
2434
2532
  if (!obj || !path) return void 0;
2435
2533
  return path.split(".").reduce((current, key) => {
2436
2534
  {
@@ -2475,7 +2573,7 @@ function generateCompleteBackgroundString(layers, apiBaseUrl, dataItem) {
2475
2573
  const imageValue = layer.value;
2476
2574
  let assetUrl = imageValue.assetUrl || "";
2477
2575
  if (layer.datafield && dataItem) {
2478
- const fieldValue = getNestedValue6(dataItem, layer.datafield);
2576
+ const fieldValue = getNestedValue7(dataItem, layer.datafield);
2479
2577
  const resolvedAssetUrl = resolveAssetUrl(fieldValue, layer.tag);
2480
2578
  if (resolvedAssetUrl) {
2481
2579
  assetUrl = resolvedAssetUrl;
@@ -2600,7 +2698,8 @@ var DivContainer = async (props) => {
2600
2698
  "svg-icon": SVGIconNode_default,
2601
2699
  document: DocumentNode_default,
2602
2700
  "google-map": GoogleMapNode_default,
2603
- counter: CounterNode_default
2701
+ counter: CounterNode_default,
2702
+ "story-accordion": MediaAccordionNode_default
2604
2703
  };
2605
2704
  const styles = props.node.cssProperties;
2606
2705
  const mobileStyles = props.node.mobileCssProperties;
@@ -2677,7 +2776,7 @@ var DivContainer = async (props) => {
2677
2776
  response = await serviceClient.get(endpoint);
2678
2777
  result = response?.result;
2679
2778
  if (dataBindingProperties.childCollectionName && props.dataitem) {
2680
- childCollectionData = getNestedValue6(
2779
+ childCollectionData = getNestedValue7(
2681
2780
  props.dataitem,
2682
2781
  dataBindingProperties.childCollectionName
2683
2782
  );
@@ -2699,7 +2798,7 @@ var DivContainer = async (props) => {
2699
2798
  }
2700
2799
  const SelectedNode = NodeTypes2[node.type];
2701
2800
  if (!SelectedNode) return null;
2702
- return /* @__PURE__ */ jsx38(React23.Fragment, { children: /* @__PURE__ */ jsx38(
2801
+ return /* @__PURE__ */ jsx39(React23.Fragment, { children: /* @__PURE__ */ jsx39(
2703
2802
  SelectedNode,
2704
2803
  {
2705
2804
  node,
@@ -2804,7 +2903,7 @@ var DivContainer = async (props) => {
2804
2903
  item,
2805
2904
  idx,
2806
2905
  props.href ? void 0 : item?.links?.view
2807
- )?.map((child, i) => /* @__PURE__ */ jsx38(React23.Fragment, { children: child }, i)) : renderChildren(props.node.children, props, item, idx)
2906
+ )?.map((child, i) => /* @__PURE__ */ jsx39(React23.Fragment, { children: child }, i)) : renderChildren(props.node.children, props, item, idx)
2808
2907
  );
2809
2908
  }
2810
2909
  return props.node.children.flatMap((node, childIndex) => {
@@ -2815,7 +2914,7 @@ var DivContainer = async (props) => {
2815
2914
  let repeatItems = null;
2816
2915
  const childCollectionName = node?.dataBinding?.childCollectionName;
2817
2916
  if (childCollectionName && props.dataitem) {
2818
- const nestedCollection = getNestedValue6(
2917
+ const nestedCollection = getNestedValue7(
2819
2918
  props.dataitem,
2820
2919
  childCollectionName
2821
2920
  );
@@ -2922,17 +3021,17 @@ var DivContainer = async (props) => {
2922
3021
  dataBindingProperties?.showFacets || dataBindingProperties?.showSortOptions || dataBindingProperties?.showSearchBar
2923
3022
  );
2924
3023
  const WrapperComponent = Wrapper;
2925
- const renderedContainer = /* @__PURE__ */ jsx38(
3024
+ const renderedContainer = /* @__PURE__ */ jsx39(
2926
3025
  WrapperComponent,
2927
3026
  {
2928
3027
  id: guid,
2929
3028
  style: combinedStyles,
2930
3029
  className: classNames || void 0,
2931
3030
  ...wrapperProps,
2932
- children: shouldShowNoDataMessage ? hasActiveFilter ? /* @__PURE__ */ jsx38(NoFilterResultsFound_default, {}) : /* @__PURE__ */ jsx38(NoDataFound_default, {}) : renderContainerChildren()
3031
+ children: shouldShowNoDataMessage ? hasActiveFilter ? /* @__PURE__ */ jsx39(NoFilterResultsFound_default, {}) : /* @__PURE__ */ jsx39(NoDataFound_default, {}) : renderContainerChildren()
2933
3032
  }
2934
3033
  );
2935
- const paginationControl = dataBindingProperties?.enablePagination ? /* @__PURE__ */ jsx38(
3034
+ const paginationControl = dataBindingProperties?.enablePagination ? /* @__PURE__ */ jsx39(
2936
3035
  Pagination,
2937
3036
  {
2938
3037
  path: props.path,
@@ -2941,14 +3040,14 @@ var DivContainer = async (props) => {
2941
3040
  }
2942
3041
  ) : null;
2943
3042
  return /* @__PURE__ */ jsxs15(React23.Fragment, { children: [
2944
- /* @__PURE__ */ jsx38(
3043
+ /* @__PURE__ */ jsx39(
2945
3044
  "style",
2946
3045
  {
2947
3046
  dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS }
2948
3047
  }
2949
3048
  ),
2950
3049
  showDataBindingControls ? /* @__PURE__ */ jsxs15(React23.Fragment, { children: [
2951
- /* @__PURE__ */ jsx38(
3050
+ /* @__PURE__ */ jsx39(
2952
3051
  DataBindingControls,
2953
3052
  {
2954
3053
  mode: "toolbar",
@@ -2970,7 +3069,7 @@ var DivContainer = async (props) => {
2970
3069
  renderedContainer,
2971
3070
  paginationControl
2972
3071
  ] }),
2973
- dataBindingProperties?.showFacets && /* @__PURE__ */ jsx38("aside", { className: "hidden lg:block", children: /* @__PURE__ */ jsx38(
3072
+ dataBindingProperties?.showFacets && /* @__PURE__ */ jsx39("aside", { className: "hidden lg:block", children: /* @__PURE__ */ jsx39(
2974
3073
  DataBindingControls,
2975
3074
  {
2976
3075
  mode: "facets",
@@ -2985,14 +3084,14 @@ var DivContainer = async (props) => {
2985
3084
  )
2986
3085
  ] }) : /* @__PURE__ */ jsxs15(React23.Fragment, { children: [
2987
3086
  renderedContainer,
2988
- paginationControl && /* @__PURE__ */ jsx38("div", { children: paginationControl })
3087
+ paginationControl && /* @__PURE__ */ jsx39("div", { children: paginationControl })
2989
3088
  ] })
2990
3089
  ] });
2991
3090
  };
2992
3091
  var DivContainer_default = DivContainer;
2993
3092
 
2994
3093
  // src/components/pageRenderingEngine/PageBodyRenderer.tsx
2995
- import { jsx as jsx39 } from "react/jsx-runtime";
3094
+ import { jsx as jsx40 } from "react/jsx-runtime";
2996
3095
  var NodeTypes = {
2997
3096
  ["paragraph"]: ParagraphNode_default,
2998
3097
  ["heading"]: HeadingNode_default,
@@ -3009,7 +3108,8 @@ var NodeTypes = {
3009
3108
  ["embed"]: EmbedNode_default,
3010
3109
  ["document"]: DocumentNode_default,
3011
3110
  ["google-map"]: GoogleMapNode_default,
3012
- ["counter"]: CounterNode_default
3111
+ ["counter"]: CounterNode_default,
3112
+ ["story-accordion"]: MediaAccordionNode_default
3013
3113
  };
3014
3114
  var PageBodyRenderer = (props) => {
3015
3115
  let pageBodyTree;
@@ -3031,14 +3131,14 @@ var PageBodyRenderer = (props) => {
3031
3131
  }
3032
3132
  return true;
3033
3133
  };
3034
- return /* @__PURE__ */ jsx39(React24.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
3134
+ return /* @__PURE__ */ jsx40(React24.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
3035
3135
  {
3036
3136
  }
3037
3137
  const SelectedNode = NodeTypes[node.type];
3038
3138
  if (!shouldRenderNode(node)) {
3039
3139
  return null;
3040
3140
  }
3041
- return /* @__PURE__ */ jsx39(React24.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx39(React24.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ jsx39(React24.Fragment, { children: /* @__PURE__ */ jsx39(
3141
+ return /* @__PURE__ */ jsx40(React24.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx40(React24.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ jsx40(React24.Fragment, { children: /* @__PURE__ */ jsx40(
3042
3142
  SelectedNode,
3043
3143
  {
3044
3144
  node,
@@ -3054,7 +3154,7 @@ var PageBodyRenderer = (props) => {
3054
3154
  device: props.device,
3055
3155
  widgetRenderer: props.widgetRenderer
3056
3156
  }
3057
- ) }) : /* @__PURE__ */ jsx39(React24.Fragment, { children: /* @__PURE__ */ jsx39(
3157
+ ) }) : /* @__PURE__ */ jsx40(React24.Fragment, { children: /* @__PURE__ */ jsx40(
3058
3158
  SelectedNode,
3059
3159
  {
3060
3160
  node,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clyrex-digital/clyrex-controls-dev",
3
- "version": "0.8.1-dev.20261013062551",
3
+ "version": "0.8.1-dev.20261013114908",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",