@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260722054831 → 0.8.1-dev.20260722070133

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 DELETED
@@ -1,2782 +0,0 @@
1
- import {
2
- ServiceClient_default
3
- } from "./chunk-3GWLDT7C.mjs";
4
- import {
5
- Hyperlink,
6
- OdataBuilder
7
- } from "./chunk-TVL6KVD5.mjs";
8
- import "./chunk-56HSDML5.mjs";
9
-
10
- // src/components/pageRenderingEngine/PageBodyRenderer.tsx
11
- import React23 from "react";
12
-
13
- // src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
14
- import React15 from "react";
15
-
16
- // src/components/pageRenderingEngine/nodes/TextNode.tsx
17
- import { jsx, jsxs } from "react/jsx-runtime";
18
- var TextNode = (props) => {
19
- function cssStringToJson(cssString) {
20
- const styleObject = {};
21
- const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
22
- if (matches) {
23
- matches.forEach((match) => {
24
- const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
25
- if (parts && parts.length === 3) {
26
- const property = parts[1].trim();
27
- const value = parts[2].trim();
28
- styleObject[property] = value;
29
- }
30
- });
31
- }
32
- return styleObject;
33
- }
34
- function toCamelCase2(str) {
35
- return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
36
- }
37
- function convertKeysToCamelCase2(obj) {
38
- if (Array.isArray(obj)) {
39
- return obj.map(convertKeysToCamelCase2);
40
- } else if (obj !== null && typeof obj === "object") {
41
- return Object.fromEntries(
42
- Object.entries(obj).filter(([_, value]) => value !== "").map(([key, value]) => [
43
- toCamelCase2(key),
44
- convertKeysToCamelCase2(value)
45
- ])
46
- );
47
- }
48
- return obj;
49
- }
50
- function getFormatClass(format) {
51
- const classes = [];
52
- if (format & 1) classes.push("font-medium");
53
- if (format & 2) classes.push("italic");
54
- if (format & 4) classes.push("line-through");
55
- if (format & 8) classes.push("underline");
56
- if (format & 256) classes.push("lowercase");
57
- if (format & 512) classes.push("uppercase");
58
- if (format & 1024) classes.push("capitalize");
59
- return classes.join(" ");
60
- }
61
- const styles = convertKeysToCamelCase2(cssStringToJson(props.node.style));
62
- function replacePlaceholders(template, dataItem) {
63
- {
64
- }
65
- return template.replace(/{(\w+)}/g, (_, key) => {
66
- {
67
- }
68
- return key in dataItem ? dataItem[key] : `{${key}}`;
69
- });
70
- }
71
- function renderWithLineBreaks(text) {
72
- return text.split("\n").map((line, index, arr) => /* @__PURE__ */ jsxs("span", { children: [
73
- line,
74
- index < arr.length - 1 && /* @__PURE__ */ jsx("br", {})
75
- ] }, index));
76
- }
77
- const displayText = props.linkText ? props.linkText : props.node.text;
78
- const finalText = props.dataitem && props.linkText ? displayText : props.dataitem ? replacePlaceholders(props.node.text, props.dataitem) : props.node.text;
79
- const content = typeof finalText === "string" ? renderWithLineBreaks(finalText) : finalText;
80
- const formattedContent = props.node.format & 64 ? /* @__PURE__ */ jsx("sup", { children: content }) : props.node.format & 32 ? /* @__PURE__ */ jsx("sub", { children: content }) : content;
81
- return (
82
- // @ts-expect-error custom code
83
- /* @__PURE__ */ jsx("span", { style: { ...styles }, className: getFormatClass(props.node.format), children: formattedContent })
84
- );
85
- };
86
- var TextNode_default = TextNode;
87
-
88
- // src/components/pageRenderingEngine/nodes/LineBreakNode.tsx
89
- import { jsx as jsx2 } from "react/jsx-runtime";
90
- var LineBreakNode = () => {
91
- return /* @__PURE__ */ jsx2("div", { className: "py-0.5 lg:py-1.5" });
92
- };
93
- var LineBreakNode_default = LineBreakNode;
94
-
95
- // src/components/pageRenderingEngine/nodes/LinkNode.tsx
96
- import React from "react";
97
-
98
- // src/components/utilities/AssetUtility.tsx
99
- var AssetUtility = class {
100
- constructor() {
101
- }
102
- static resolveUrl(assetBaseUrl, url) {
103
- if (!url) return void 0;
104
- if (url.startsWith("http")) return url;
105
- if (!assetBaseUrl) return url;
106
- return `${assetBaseUrl}/${url}`;
107
- }
108
- // // static getAssetUrl(apiBaseUrl: string) {
109
- // // let domainName = apiBaseUrl.replace("https://", "");
110
- // // return `https://cdn.g-assets.com/${domainName}`;
111
- // // }
112
- // static getAssetFullPath(apiBaseUrl: string, relativePath: string) {
113
- // const domainName = apiBaseUrl.replace("https://", "");
114
- // return `https://cdn.g-assets.com/${domainName}/${relativePath}`;
115
- // }
116
- };
117
- var AssetUtility_default = AssetUtility;
118
-
119
- // src/components/pageRenderingEngine/nodes/ImageNode.tsx
120
- import dynamic2 from "next/dynamic";
121
-
122
- // src/components/DeviceAssetSelector.tsx
123
- import dynamic from "next/dynamic";
124
- import { jsx as jsx3 } from "react/jsx-runtime";
125
- var HlsPlayer = dynamic(() => import("./HlsPlayer-57543DTW.mjs"), { ssr: false });
126
- var FORMAT_CLASSES = {
127
- center: "justify-center",
128
- left: "justify-start",
129
- right: "justify-end"
130
- };
131
- var DeviceAssetSelector = ({
132
- assets,
133
- assetBaseUrl,
134
- session,
135
- width,
136
- tag,
137
- nodeProps,
138
- device
139
- }) => {
140
- const targetTag = tag || nodeProps?.tag;
141
- const selectAssetByDevice = (assets2, currentDevice) => assets2.find((a) => a.device === currentDevice) ?? assets2.find((a) => !a.device || a.device === "");
142
- const selectAsset = () => {
143
- if (!assets?.length) return void 0;
144
- if (targetTag) {
145
- const tagged = assets.filter((a) => a.tag === targetTag);
146
- if (tagged.length) {
147
- return tagged.find((a) => a.device === device) ?? tagged.find((a) => !a.device || a.device === "");
148
- }
149
- }
150
- return selectAssetByDevice(assets, device);
151
- };
152
- const selectedAsset = selectAsset();
153
- if (!selectedAsset) return null;
154
- const resolvedAssetUrl = AssetUtility_default.resolveUrl(assetBaseUrl, selectedAsset.assetUrl);
155
- const resolvedThumbnailUrl = selectedAsset.posterUrl ? AssetUtility_default.resolveUrl(assetBaseUrl, selectedAsset.posterUrl) : void 0;
156
- const title = selectedAsset.title || nodeProps?.title;
157
- const isHls = resolvedAssetUrl?.endsWith(".m3u8");
158
- const showControls = nodeProps?.showControls === "true";
159
- const loop = nodeProps?.loop === "true";
160
- const styles = {
161
- ...nodeProps?.borderRadius && { borderRadius: nodeProps.borderRadius },
162
- ...nodeProps?.width && { width: nodeProps.width },
163
- ...nodeProps?.height && { height: nodeProps.height }
164
- };
165
- const renderMedia = () => isHls ? /* @__PURE__ */ jsx3(
166
- HlsPlayer,
167
- {
168
- assetUrl: resolvedAssetUrl,
169
- posterUrl: resolvedThumbnailUrl,
170
- intrinsicWidth: selectedAsset.intrinsicWidth?.toString(),
171
- intrinsicHeight: selectedAsset.intrinsicHeight?.toString(),
172
- showControls,
173
- loop,
174
- playOptions: nodeProps?.playOptions,
175
- apiBaseUrl: assetBaseUrl,
176
- session
177
- }
178
- ) : /* @__PURE__ */ jsx3(
179
- "img",
180
- {
181
- style: styles,
182
- loading: "lazy",
183
- className: "object-cover w-full",
184
- src: resolvedAssetUrl,
185
- width: selectedAsset.intrinsicWidth,
186
- height: selectedAsset.intrinsicHeight,
187
- alt: title || "Asset image"
188
- }
189
- );
190
- if (width) return /* @__PURE__ */ jsx3("div", { style: { width }, children: renderMedia() });
191
- if (nodeProps?.format) {
192
- return /* @__PURE__ */ jsx3("div", { className: `flex ${FORMAT_CLASSES[nodeProps.format] ?? ""}`, children: renderMedia() });
193
- }
194
- return renderMedia();
195
- };
196
- var DeviceAssetSelector_default = DeviceAssetSelector;
197
-
198
- // src/components/pageRenderingEngine/nodes/ImageNode.tsx
199
- import { jsx as jsx4 } from "react/jsx-runtime";
200
- var HlsPlayer2 = dynamic2(() => import("./HlsPlayer-57543DTW.mjs"), { ssr: false });
201
- var getNestedValue = (obj, path) => {
202
- if (!obj || !path) return void 0;
203
- return path.split(".").reduce((current, key) => {
204
- return current && current[key] !== void 0 ? current[key] : void 0;
205
- }, obj);
206
- };
207
- var ImageNode = (props) => {
208
- let assets;
209
- let imageUrl;
210
- let posterUrl;
211
- const currentDevice = props.device;
212
- if (props.node.device) {
213
- const nodeDevice = props.node.device;
214
- if (nodeDevice !== currentDevice) return null;
215
- }
216
- if (props.node.imageUrl.startsWith("http")) {
217
- imageUrl = props.node.imageUrl;
218
- posterUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, props.node.posterUrl);
219
- } else if (props.dataitem && props.node.datafield) {
220
- const image = getNestedValue(props.dataitem, props.node.datafield);
221
- if (typeof image === "string") {
222
- const trimmed = image.trim();
223
- if (trimmed) {
224
- assets = JSON.parse(trimmed);
225
- }
226
- } else if (Array.isArray(image)) {
227
- assets = image;
228
- } else if (image && typeof image === "object") {
229
- assets = [image];
230
- }
231
- if (assets && assets.length > 0) {
232
- return /* @__PURE__ */ jsx4(
233
- DeviceAssetSelector_default,
234
- {
235
- device: props.device,
236
- assets,
237
- assetBaseUrl: props.assetBaseUrl,
238
- session: props.session,
239
- nodeProps: {
240
- title: props.node.title,
241
- showControls: props.node.showControls,
242
- loop: props.node.loop,
243
- playOptions: props.node.playOptions,
244
- borderRadius: props.node.borderRadius,
245
- width: props.node.width,
246
- height: props.node.height,
247
- format: props.node.format,
248
- tag: props.node.tag,
249
- placementCode: props.node.placementCode
250
- }
251
- }
252
- );
253
- } else {
254
- imageUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, props.node.imageUrl);
255
- posterUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, props.node.posterUrl);
256
- }
257
- } else {
258
- imageUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, props.node.imageUrl);
259
- posterUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl, props.node.posterUrl);
260
- }
261
- if (!imageUrl) return null;
262
- const styles = {
263
- ...props.node.height && { height: props.node.height },
264
- ...props.node.borderRadius && { borderRadius: props.node.borderRadius },
265
- ...props.node.width && { width: props.node.width }
266
- };
267
- const FORMAT_CLASSES2 = {
268
- center: "justify-center",
269
- left: "justify-start",
270
- right: "justify-end"
271
- };
272
- const isHls = imageUrl.endsWith(".m3u8");
273
- const renderMedia = () => isHls ? /* @__PURE__ */ jsx4(
274
- HlsPlayer2,
275
- {
276
- assetUrl: imageUrl,
277
- posterUrl,
278
- intrinsicWidth: props.node.intrinsicWidth,
279
- intrinsicHeight: props.node.intrinsicHeight,
280
- showControls: props.node.showControls === "true",
281
- loop: props.node.loop === "true",
282
- playOptions: props.node.playOptions,
283
- apiBaseUrl: props.apiBaseUrl,
284
- session: props.session
285
- }
286
- ) : /* @__PURE__ */ jsx4(
287
- "img",
288
- {
289
- style: styles,
290
- loading: "lazy",
291
- className: "object-cover",
292
- src: imageUrl,
293
- width: props.node.intrinsicWidth,
294
- alt: props.node.title,
295
- height: props.node.intrinsicHeight
296
- }
297
- );
298
- if (props.node.width) {
299
- return /* @__PURE__ */ jsx4("div", { className: `flex ${FORMAT_CLASSES2[props.node.format] ?? ""}`, children: renderMedia() });
300
- }
301
- return renderMedia();
302
- };
303
- var ImageNode_default = ImageNode;
304
-
305
- // src/components/pageRenderingEngine/nodes/LinkNode.tsx
306
- import dynamic3 from "next/dynamic";
307
- import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
308
- var LinkNodeButton = dynamic3(() => import("./LinkNodeButton-U7T2NP22.mjs"), {
309
- ssr: false
310
- });
311
- function getNestedValue2(obj, path) {
312
- if (!obj || !path) return void 0;
313
- return path.split(".").reduce((current, key) => {
314
- return current && current[key] !== void 0 ? current[key] : void 0;
315
- }, obj);
316
- }
317
- var LinkNode = (props) => {
318
- const NodeTypes2 = {
319
- text: TextNode_default,
320
- image: ImageNode_default
321
- };
322
- const { node, dataitem } = props;
323
- let linkUrl = node.url;
324
- if (node.datafield_link_url && dataitem) {
325
- const dynamicUrl = getNestedValue2(dataitem, node.datafield_link_url);
326
- if (dynamicUrl && typeof dynamicUrl === "string") {
327
- linkUrl = dynamicUrl;
328
- }
329
- }
330
- if (props.routeParameters && linkUrl && linkUrl.includes("{")) {
331
- Object.keys(props.routeParameters).forEach((param) => {
332
- const value = props.routeParameters[param];
333
- if (value !== void 0 && value !== null) {
334
- linkUrl = linkUrl.replace(
335
- new RegExp(`\\{${param}\\}`, "gi"),
336
- encodeURIComponent(String(value))
337
- );
338
- }
339
- });
340
- }
341
- let linkText = null;
342
- if (node.datafield_link_text && dataitem) {
343
- const dynamicText = dataitem[node.datafield_link_text];
344
- if (dynamicText && typeof dynamicText === "string") {
345
- linkText = dynamicText;
346
- }
347
- }
348
- const getLinkTypeFromCssClass = (cssClass) => {
349
- const classToTypeMap = {
350
- Primary: "Primary" /* Solid */,
351
- PrimaryHollow: "PrimaryHollow" /* Hollow */,
352
- Link: "Link" /* Link */
353
- };
354
- return classToTypeMap[cssClass];
355
- };
356
- const linkType = node.cssClass ? getLinkTypeFromCssClass(node.cssClass) : void 0;
357
- const isButton = node.isButton === true;
358
- const renderChildren = () => {
359
- if (!node.children || node.children.length === 0) return null;
360
- return /* @__PURE__ */ jsx5(Fragment, { children: node.children.map((childNode, index) => {
361
- const SelectedNode = NodeTypes2[childNode.type];
362
- if (!SelectedNode) {
363
- console.warn("Unknown node type:", childNode.type);
364
- return null;
365
- }
366
- return /* @__PURE__ */ jsx5(React.Fragment, { children: /* @__PURE__ */ jsx5(
367
- SelectedNode,
368
- {
369
- node: childNode,
370
- dataitem,
371
- linkText,
372
- routeParameters: props.routeParameters
373
- }
374
- ) }, index);
375
- }) });
376
- };
377
- const renderFallback = () => {
378
- if ((!node.children || node.children.length === 0) && linkText) {
379
- return /* @__PURE__ */ jsx5("span", { children: linkText });
380
- }
381
- if ((!node.children || node.children.length === 0) && !linkText) {
382
- return /* @__PURE__ */ jsx5("br", {});
383
- }
384
- return null;
385
- };
386
- if (isButton) {
387
- return /* @__PURE__ */ jsxs2(
388
- LinkNodeButton,
389
- {
390
- node,
391
- dataitem,
392
- routeParameters: props.routeParameters,
393
- session: props.session,
394
- apiBaseUrl: props.apiBaseUrl || "",
395
- linkText,
396
- linkType,
397
- linkUrl,
398
- children: [
399
- renderChildren(),
400
- renderFallback()
401
- ]
402
- }
403
- );
404
- }
405
- return /* @__PURE__ */ jsxs2(
406
- Hyperlink,
407
- {
408
- href: linkUrl || "#",
409
- linkType,
410
- alt: linkText || node.title || "",
411
- children: [
412
- renderChildren(),
413
- renderFallback()
414
- ]
415
- }
416
- );
417
- };
418
- var LinkNode_default = LinkNode;
419
-
420
- // src/components/pageRenderingEngine/nodes/SVGIconNode.tsx
421
- import { jsx as jsx6 } from "react/jsx-runtime";
422
- var SVGIconNode = ({ node }) => {
423
- if (!node?.svgCode) return null;
424
- return /* @__PURE__ */ jsx6(
425
- "span",
426
- {
427
- style: {
428
- display: "flex",
429
- width: node.width,
430
- height: node.height,
431
- color: node.color
432
- },
433
- dangerouslySetInnerHTML: { __html: node.svgCode }
434
- }
435
- );
436
- };
437
- var SVGIconNode_default = SVGIconNode;
438
-
439
- // src/components/pageRenderingEngine/nodes/EquationNode.tsx
440
- import katex from "katex";
441
- import { jsx as jsx7 } from "react/jsx-runtime";
442
- var EquationNode = ({ node }) => {
443
- const { equation, inline } = node;
444
- let html = "";
445
- try {
446
- html = katex.renderToString(equation, {
447
- displayMode: !inline,
448
- throwOnError: false
449
- });
450
- } catch (error) {
451
- html = katex.renderToString(`\\text{Invalid equation}`, {
452
- throwOnError: false
453
- });
454
- }
455
- if (inline) {
456
- return /* @__PURE__ */ jsx7(
457
- "span",
458
- {
459
- className: "katex-inline",
460
- dangerouslySetInnerHTML: { __html: html }
461
- }
462
- );
463
- }
464
- return /* @__PURE__ */ jsx7(
465
- "div",
466
- {
467
- className: "katex-block my-3 text-center",
468
- dangerouslySetInnerHTML: { __html: html }
469
- }
470
- );
471
- };
472
- var EquationNode_default = EquationNode;
473
-
474
- // src/components/controls/view/ViewControl.tsx
475
- import React14 from "react";
476
-
477
- // src/components/controls/view/ViewControlTypes.tsx
478
- var ViewControlTypes = {
479
- lineText: "lineText",
480
- emailText: "email",
481
- asset: "asset",
482
- video: "video",
483
- multilineTextBullets: "multilineTextBullets",
484
- boolean: "boolean",
485
- checkboxInput: "boolean",
486
- money: "money",
487
- date: "date",
488
- time: "time",
489
- datetime: "datetime",
490
- number: "number",
491
- multilineText: "multilineText",
492
- multilinetext: "multilinetext",
493
- moneyText: "moneyText",
494
- percentage: "percentage",
495
- status: "status",
496
- statusBg: "statusBg",
497
- progressIndicator: "progressIndicator",
498
- timeUntilStarts: "timeUntilStarts",
499
- timeUntilStartsStyled: "timeUntilStartsStyled",
500
- aiGeneratedSummary: "aiGeneratedSummary",
501
- booleanView: "booleanView",
502
- text: "text"
503
- };
504
- var ViewControlTypes_default = ViewControlTypes;
505
-
506
- // src/components/controls/view/NumberView.tsx
507
- import React2 from "react";
508
- import { jsx as jsx8 } from "react/jsx-runtime";
509
- var NumberView = (props) => {
510
- return /* @__PURE__ */ jsx8(React2.Fragment, { children: props.value });
511
- };
512
- var NumberView_default = NumberView;
513
-
514
- // src/components/controls/view/DateView.tsx
515
- import dynamic4 from "next/dynamic";
516
- var DateView = dynamic4(() => import("./DateViewClient-ELEHLGWS.mjs"), {
517
- ssr: false
518
- });
519
- var DateView_default = DateView;
520
-
521
- // src/components/controls/view/BooleanView.tsx
522
- import React3 from "react";
523
- import { jsx as jsx9 } from "react/jsx-runtime";
524
- var BooleanView = (props) => {
525
- const { value, customProps } = props;
526
- const showOnlyTrueIcon = customProps?.showOnlyTrueIcon;
527
- console.log("BooleanView Debug:", {
528
- value,
529
- type: typeof value,
530
- customProps,
531
- showOnlyTrueIcon
532
- });
533
- const booleanValue = (() => {
534
- if (typeof value === "boolean") return value;
535
- if (typeof value === "string") {
536
- return value.toLowerCase() === "true";
537
- }
538
- if (typeof value === "number") {
539
- return value === 1;
540
- }
541
- return false;
542
- })();
543
- if (showOnlyTrueIcon) {
544
- return /* @__PURE__ */ jsx9(React3.Fragment, { children: booleanValue === true && /* @__PURE__ */ jsx9(
545
- "svg",
546
- {
547
- className: "w-15 h-8 text-green-600",
548
- fill: "currentColor",
549
- viewBox: "0 0 20 20",
550
- children: /* @__PURE__ */ jsx9(
551
- "path",
552
- {
553
- fillRule: "evenodd",
554
- d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
555
- clipRule: "evenodd"
556
- }
557
- )
558
- }
559
- ) });
560
- }
561
- return /* @__PURE__ */ jsx9(React3.Fragment, { children: booleanValue ? "true" : "false" });
562
- };
563
- var BooleanView_default = BooleanView;
564
-
565
- // src/components/controls/view/Asset.tsx
566
- import React4 from "react";
567
- import { jsx as jsx10 } from "react/jsx-runtime";
568
- var MediaAsset = (props) => {
569
- let assets;
570
- if (props.value != void 0 && props.value != null && props.value != "") {
571
- try {
572
- assets = JSON.parse(props.value);
573
- console.log("Parsed Assets: ", assets);
574
- } catch (error) {
575
- console.error("Error parsing assets:", error);
576
- }
577
- }
578
- if (!assets || assets.length === 0) {
579
- return null;
580
- }
581
- console.log(props.customProps?.tag, "Tag in MediaAsset");
582
- return /* @__PURE__ */ jsx10(React4.Fragment, { children: /* @__PURE__ */ jsx10(
583
- DeviceAssetSelector_default,
584
- {
585
- assets,
586
- apiBaseUrl: props.apiBaseUrl,
587
- assetBaseUrl: props.assetBaseUrl ? props.assetBaseUrl : props.apiBaseUrl,
588
- session: props,
589
- width: props.width,
590
- customProps: props.customProps,
591
- tag: props.customProps?.tag
592
- }
593
- ) });
594
- };
595
- var Asset_default = MediaAsset;
596
-
597
- // src/components/controls/view/LineTextView.tsx
598
- import React5 from "react";
599
- import { jsx as jsx11 } from "react/jsx-runtime";
600
- var LineText = (props) => {
601
- return /* @__PURE__ */ jsx11(React5.Fragment, { children: props.value });
602
- };
603
- var LineTextView_default = LineText;
604
-
605
- // src/components/controls/view/EmailTextView.tsx
606
- import React6 from "react";
607
- import { jsx as jsx12 } from "react/jsx-runtime";
608
- var EmailText = (props) => {
609
- return /* @__PURE__ */ jsx12(React6.Fragment, { children: props.value });
610
- };
611
- var EmailTextView_default = EmailText;
612
-
613
- // src/components/controls/view/StatusBgView.tsx
614
- import React7 from "react";
615
- import { jsx as jsx13 } from "react/jsx-runtime";
616
- var StatusBg = (props) => {
617
- return /* @__PURE__ */ jsx13(React7.Fragment, { children: props.value && props.value != "" && /* @__PURE__ */ jsx13("span", { className: "py-0.5 px-1.5 text-xs capitalize text-white font-semibold rounded bg-status bg-status-" + props.value, children: props.value }) });
618
- };
619
- var StatusBgView_default = StatusBg;
620
-
621
- // src/components/controls/view/StatusView.tsx
622
- import React8 from "react";
623
- import { jsx as jsx14 } from "react/jsx-runtime";
624
- var Status = (props) => {
625
- return /* @__PURE__ */ jsx14(React8.Fragment, { children: /* @__PURE__ */ jsx14("span", { className: "capitalize font-semibold rounded text-status text-status-" + props.value, children: props.value }) });
626
- };
627
- var StatusView_default = Status;
628
-
629
- // src/components/controls/view/MoneyView.tsx
630
- import React9 from "react";
631
-
632
- // src/components/utilities/CurrencyUtility.tsx
633
- var CurrencyUtility = class {
634
- static getCurrencySymbol(currencyCode) {
635
- switch (currencyCode) {
636
- case "USD":
637
- return "$";
638
- case "INR":
639
- return "\u20B9";
640
- case "EUR":
641
- return "\u20AC";
642
- // Add more cases for other currency codes as needed
643
- default:
644
- return currencyCode;
645
- }
646
- }
647
- };
648
- var CurrencyUtility_default = CurrencyUtility;
649
-
650
- // src/components/controls/view/MoneyView.tsx
651
- import { jsx as jsx15, jsxs as jsxs3 } from "react/jsx-runtime";
652
- var Money = (props) => {
653
- const parsedNumber = parseFloat(props.value);
654
- return /* @__PURE__ */ jsx15(React9.Fragment, { children: !Number.isNaN(parsedNumber) && /* @__PURE__ */ jsxs3(React9.Fragment, { children: [
655
- /* @__PURE__ */ jsx15("span", { className: "mr-0.5", children: CurrencyUtility_default.getCurrencySymbol(props.unit) }),
656
- parsedNumber.toLocaleString()
657
- ] }) });
658
- };
659
- var MoneyView_default = Money;
660
-
661
- // src/components/controls/view/MultilineTextBulletsView.tsx
662
- import React10 from "react";
663
- import { jsx as jsx16 } from "react/jsx-runtime";
664
- var MultilineTextBullets = (props) => {
665
- const lines = props.value?.split("\\n");
666
- return /* @__PURE__ */ jsx16(React10.Fragment, { children: /* @__PURE__ */ jsx16("ul", { className: "list-disc", children: lines && lines.map((line, index) => {
667
- return /* @__PURE__ */ jsx16("li", { children: line }, index);
668
- }) }) });
669
- };
670
- var MultilineTextBulletsView_default = MultilineTextBullets;
671
-
672
- // src/components/controls/view/MultilineTextView.tsx
673
- import React11 from "react";
674
- import { jsx as jsx17 } from "react/jsx-runtime";
675
- var MultilineText = (props) => {
676
- return /* @__PURE__ */ jsx17(React11.Fragment, { children: /* @__PURE__ */ jsx17("span", { className: "whitespace-pre-line", children: props.value }) });
677
- };
678
- var MultilineTextView_default = MultilineText;
679
-
680
- // src/components/controls/view/PercentageView.tsx
681
- import React12 from "react";
682
- import { jsxs as jsxs4 } from "react/jsx-runtime";
683
- var PercentageView = (props) => {
684
- return /* @__PURE__ */ jsxs4(React12.Fragment, { children: [
685
- props.value,
686
- "%"
687
- ] });
688
- };
689
- var PercentageView_default = PercentageView;
690
-
691
- // src/components/controls/view/ProgressIndicator.tsx
692
- import React13 from "react";
693
- import { jsx as jsx18, jsxs as jsxs5 } from "react/jsx-runtime";
694
- var ProgressIndicator = (props) => {
695
- const percentage = 100;
696
- const circumference = Math.PI * 56;
697
- const offset = circumference * (1 - percentage / 100);
698
- return /* @__PURE__ */ jsx18(React13.Fragment, { children: /* @__PURE__ */ jsxs5("div", { className: "relative w-48 h-48", children: [
699
- /* @__PURE__ */ jsx18("div", { className: "absolute top-0 left-0 w-full h-full rounded-full border border-gray-200" }),
700
- /* @__PURE__ */ jsx18("div", { className: "absolute top-0 left-0 w-full h-full rounded-full overflow-hidden", children: /* @__PURE__ */ jsx18("div", { className: "w-full h-full rounded-full border-t-8 border-green-500", style: { transform: `rotate(-90deg)`, clipPath: `inset(0px ${offset}px 0px 0px)` } }) }),
701
- /* @__PURE__ */ jsx18("div", { className: "absolute top-0 left-0 w-full h-full flex items-center justify-center text-lg font-bold text-gray-800", children: /* @__PURE__ */ jsxs5("span", { children: [
702
- percentage,
703
- "%"
704
- ] }) })
705
- ] }) });
706
- };
707
- var ProgressIndicator_default = ProgressIndicator;
708
-
709
- // src/components/controls/view/AiGeneratedSummary.tsx
710
- import { jsx as jsx19, jsxs as jsxs6 } from "react/jsx-runtime";
711
- var AiGeneratedSummary = (props) => {
712
- const lines = props.value?.split("\n").filter((line) => line.trim() !== "") || [];
713
- return /* @__PURE__ */ jsxs6("details", { className: "group rounded-xl border-2 bg-white shadow-sm border-p overflow-hidden", children: [
714
- /* @__PURE__ */ jsx19("summary", { className: "flex items-start justify-between cursor-pointer list-none", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-start gap-3 ", children: [
715
- /* @__PURE__ */ jsx19("div", { className: "bg-primary-base bg-transparent rounded mt-1 p-1", children: /* @__PURE__ */ jsx19("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5", children: /* @__PURE__ */ jsx19("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z" }) }) }),
716
- /* @__PURE__ */ jsxs6("div", { children: [
717
- /* @__PURE__ */ jsx19("h3", { className: "text-lg font-semibold ", children: "Quick Read" }),
718
- /* @__PURE__ */ jsx19("p", { className: "text-sm text-gray-500 mb-0", children: "Summary is AI-generated, author-reviewed" })
719
- ] })
720
- ] }) }),
721
- /* @__PURE__ */ jsx19("div", { children: /* @__PURE__ */ jsx19("ul", { className: "list-disc pl-6 space-y-3 text-gray-700 ps-4 pl-4", children: lines.map((line, index) => /* @__PURE__ */ jsx19("li", { className: "m-0", children: line }, index)) }) })
722
- ] });
723
- };
724
- var AiGeneratedSummary_default = AiGeneratedSummary;
725
-
726
- // src/components/controls/view/DateTimeVew.tsx
727
- import dynamic5 from "next/dynamic";
728
- var DateTimeView = dynamic5(() => import("./DateTimeViewClient-22GW4AD7.mjs"), {
729
- ssr: false
730
- });
731
- var DateTimeVew_default = DateTimeView;
732
-
733
- // src/components/controls/view/ViewControl.tsx
734
- import { jsx as jsx20 } from "react/jsx-runtime";
735
- var ControlComponents = {
736
- [ViewControlTypes_default.lineText]: LineTextView_default,
737
- [ViewControlTypes_default.emailText]: EmailTextView_default,
738
- [ViewControlTypes_default.asset]: Asset_default,
739
- [ViewControlTypes_default.multilineTextBullets]: MultilineTextBulletsView_default,
740
- [ViewControlTypes_default.boolean]: BooleanView_default,
741
- [ViewControlTypes_default.checkboxInput]: BooleanView_default,
742
- // [ViewControlTypes.timeUntilStarts]: TimeUntilStarts,
743
- [ViewControlTypes_default.money]: MoneyView_default,
744
- [ViewControlTypes_default.date]: DateView_default,
745
- [ViewControlTypes_default.time]: DateView_default,
746
- [ViewControlTypes_default.datetime]: DateTimeVew_default,
747
- [ViewControlTypes_default.number]: NumberView_default,
748
- [ViewControlTypes_default.multilineText]: MultilineTextView_default,
749
- [ViewControlTypes_default.multilinetext]: MultilineTextView_default,
750
- [ViewControlTypes_default.moneyText]: MoneyView_default,
751
- [ViewControlTypes_default.percentage]: PercentageView_default,
752
- [ViewControlTypes_default.status]: StatusView_default,
753
- [ViewControlTypes_default.statusBg]: StatusBgView_default,
754
- [ViewControlTypes_default.progressIndicator]: ProgressIndicator_default,
755
- // [ViewControlTypes.timeUntilStarts]: TimeUntilStarts,
756
- // [ViewControlTypes.timeUntilStartsStyled]: TimeUntilStartsStyled,
757
- [ViewControlTypes_default.aiGeneratedSummary]: AiGeneratedSummary_default,
758
- [ViewControlTypes_default.booleanView]: BooleanView_default,
759
- [ViewControlTypes_default.text]: LineTextView_default
760
- };
761
- var ViewControl = React14.memo((props) => {
762
- const SelectedControlComponent = props.controlType ? ControlComponents[props.controlType] : void 0;
763
- return /* @__PURE__ */ jsx20(React14.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx20(SelectedControlComponent, { ...props }) : "Control not found:" + props.controlType });
764
- });
765
- var ViewControl_default = ViewControl;
766
-
767
- // src/components/pageRenderingEngine/nodes/DatafieldNode.tsx
768
- import { jsx as jsx21 } from "react/jsx-runtime";
769
- function getNestedProperty(obj, path) {
770
- if (!obj || !path) return null;
771
- if (path.includes(".")) {
772
- return path.split(".").reduce((prev, curr) => {
773
- if (prev && typeof prev === "object") {
774
- return prev[curr];
775
- }
776
- return null;
777
- }, obj);
778
- }
779
- const value = obj[path];
780
- if (Array.isArray(value)) {
781
- return value.map((item, index) => /* @__PURE__ */ jsx21("div", { children: String(item) }, index));
782
- }
783
- return value;
784
- }
785
- var DatafieldNode = (props) => {
786
- function cssStringToJson(cssString) {
787
- const styleObject = {};
788
- const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
789
- if (matches) {
790
- matches.forEach((match) => {
791
- const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
792
- if (parts && parts.length === 3) {
793
- styleObject[parts[1].trim()] = parts[2].trim();
794
- }
795
- });
796
- }
797
- return styleObject;
798
- }
799
- function toCamelCase2(str) {
800
- return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
801
- }
802
- function convertKeysToCamelCase2(obj) {
803
- return Object.fromEntries(
804
- Object.entries(obj).map(([key, value2]) => [
805
- toCamelCase2(key),
806
- value2
807
- ])
808
- );
809
- }
810
- const Formats = [
811
- "",
812
- "font-medium",
813
- "italic",
814
- "font-medium italic",
815
- "",
816
- "",
817
- "",
818
- "",
819
- "underline",
820
- "font-medium underline",
821
- "italic underline",
822
- "italic underline font-medium"
823
- ];
824
- const styles = convertKeysToCamelCase2(
825
- cssStringToJson(props.node.style)
826
- );
827
- const fieldName = props.node.fieldName ?? "";
828
- const value = props.dataitem ? getNestedProperty(props.dataitem, fieldName) : null;
829
- const isEmptyValue = value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0 || typeof value === "object" && value !== null && Object.keys(value).length === 0;
830
- const maxLines = props.node.maxLines;
831
- if (maxLines && Number(maxLines) > 0) {
832
- Object.assign(styles, {
833
- display: "-webkit-box",
834
- overflow: "hidden",
835
- WebkitBoxOrient: "vertical",
836
- WebkitLineClamp: String(maxLines)
837
- });
838
- }
839
- const dataType = props.node.dataType;
840
- if (isEmptyValue) return null;
841
- if (dataType === "rawContent") {
842
- return /* @__PURE__ */ jsx21(
843
- PageBodyRenderer_default,
844
- {
845
- rawBody: String(value ?? `@databound[${fieldName}]`),
846
- routeParameters: props.routeParameters,
847
- query: props.query,
848
- session: props.session,
849
- host: props.host,
850
- path: props.path,
851
- apiBaseUrl: props.apiBaseUrl,
852
- breadcrumb: props.breadcrumb,
853
- donotApplyContainerClass: true,
854
- widgetRenderer: props.widgetRenderer
855
- }
856
- );
857
- }
858
- return /* @__PURE__ */ jsx21(
859
- "span",
860
- {
861
- className: `datafield-node ${props.node.format < Formats.length ? Formats[props.node.format] : ""}`,
862
- style: styles,
863
- children: /* @__PURE__ */ jsx21(
864
- ViewControl_default,
865
- {
866
- controlType: dataType,
867
- value: value ?? `@databound[${fieldName}]`
868
- }
869
- )
870
- }
871
- );
872
- };
873
- var DatafieldNode_default = DatafieldNode;
874
-
875
- // src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
876
- import { Fragment as Fragment2, jsx as jsx22, jsxs as jsxs7 } from "react/jsx-runtime";
877
- var ParagraphNode = (props) => {
878
- const NodeTypes2 = {
879
- ["text"]: TextNode_default,
880
- ["linebreak"]: LineBreakNode_default,
881
- ["link"]: LinkNode_default,
882
- ["datafield"]: DatafieldNode_default,
883
- ["equation"]: EquationNode_default,
884
- ["svg-icon"]: SVGIconNode_default
885
- };
886
- const FormatClass = {
887
- "center": "text-center",
888
- "right": "text-right"
889
- };
890
- {
891
- }
892
- const formatClasses = FormatClass[props.node.format] || "";
893
- const isInlineOnlyParent = props.parentTag === "summary";
894
- const hasChildren = props.node.children && props.node.children.length > 0;
895
- if (isInlineOnlyParent) {
896
- return /* @__PURE__ */ jsx22(Fragment2, { children: hasChildren && props.node.children.map((node, index) => {
897
- const SelectedNode = NodeTypes2[node.type];
898
- return /* @__PURE__ */ jsx22(React15.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx22(
899
- SelectedNode,
900
- {
901
- node,
902
- dataitem: props.dataitem,
903
- session: props.session,
904
- apiBaseUrl: props.apiBaseUrl,
905
- routeParameters: props.routeParameters
906
- }
907
- ) }, index);
908
- }) });
909
- }
910
- return /* @__PURE__ */ jsxs7("div", { className: " " + formatClasses, children: [
911
- hasChildren && props.node.children.map((node, index) => {
912
- const SelectedNode = NodeTypes2[node.type];
913
- return /* @__PURE__ */ jsx22(React15.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx22(
914
- SelectedNode,
915
- {
916
- node,
917
- dataitem: props.dataitem,
918
- session: props.session,
919
- apiBaseUrl: props.apiBaseUrl,
920
- routeParameters: props.routeParameters
921
- }
922
- ) }, index);
923
- }),
924
- !hasChildren && /* @__PURE__ */ jsx22("div", { className: "py-1.5 lg:py-2" })
925
- ] });
926
- };
927
- var ParagraphNode_default = ParagraphNode;
928
-
929
- // src/components/pageRenderingEngine/nodes/HeadingNode.tsx
930
- import React16 from "react";
931
- import { Fragment as Fragment3, jsx as jsx23 } from "react/jsx-runtime";
932
- var HeadingNode = (props) => {
933
- const NodeTypes2 = {
934
- ["text"]: TextNode_default,
935
- ["link"]: LinkNode_default,
936
- ["svg-icon"]: SVGIconNode_default,
937
- ["linebreak"]: LineBreakNode_default,
938
- ["datafield"]: DatafieldNode_default
939
- };
940
- const HeadingTag = `${props.node.tag}`;
941
- const FormatClass = {
942
- "center": "text-center"
943
- };
944
- {
945
- }
946
- const formatClasses = FormatClass[props.node.format] || "";
947
- return /* @__PURE__ */ jsx23(Fragment3, { children: React16.createElement(
948
- HeadingTag,
949
- { className: formatClasses },
950
- props.node.children && props.node.children.map((childNode, index) => {
951
- const SelectedNode = NodeTypes2[childNode.type];
952
- return /* @__PURE__ */ jsx23(React16.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx23(SelectedNode, { node: childNode, dataitem: props.dataitem, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
953
- })
954
- ) });
955
- };
956
- var HeadingNode_default = HeadingNode;
957
-
958
- // src/components/pageRenderingEngine/nodes/ListNode.tsx
959
- import React18 from "react";
960
-
961
- // src/components/pageRenderingEngine/nodes/ListItemNode.tsx
962
- import React17 from "react";
963
- import { jsx as jsx24 } from "react/jsx-runtime";
964
- var ListItemNode = (props) => {
965
- const NodeTypes2 = {
966
- text: TextNode_default,
967
- linebreak: LineBreakNode_default,
968
- link: LinkNode_default,
969
- list: ListNode_default
970
- };
971
- let foundFirstBreak = false;
972
- const firstTextChild = props.node.children?.find((c) => c.type === "text");
973
- let liStyle = {};
974
- if (firstTextChild?.style) {
975
- const match = firstTextChild.style.match(/font-size\s*:\s*([^;]+);?/);
976
- if (match) {
977
- liStyle.fontSize = match[1].trim();
978
- }
979
- }
980
- return /* @__PURE__ */ jsx24("li", { style: liStyle, children: props.node.children && props.node.children.map((node, index) => {
981
- const SelectedNode = NodeTypes2[node.type];
982
- if (node.type === "linebreak") {
983
- if (!foundFirstBreak) {
984
- foundFirstBreak = true;
985
- return /* @__PURE__ */ jsx24("div", {}, index);
986
- } else {
987
- return /* @__PURE__ */ jsx24("div", { className: "py-1 lg:py-2" }, index);
988
- }
989
- } else {
990
- foundFirstBreak = false;
991
- return /* @__PURE__ */ jsx24(React17.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx24(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
992
- }
993
- }) });
994
- };
995
- var ListItemNode_default = ListItemNode;
996
-
997
- // src/components/pageRenderingEngine/nodes/ListNode.tsx
998
- import { jsx as jsx25, jsxs as jsxs8 } from "react/jsx-runtime";
999
- var ListNode = (props) => {
1000
- const NodeTypes2 = {
1001
- listitem: ListItemNode_default
1002
- };
1003
- return /* @__PURE__ */ jsxs8(React18.Fragment, { children: [
1004
- props.node.listType == "bullet" && /* @__PURE__ */ jsx25("ul", { children: props.node.children && props.node.children.map((node, index) => {
1005
- const SelectedNode = NodeTypes2[node.type];
1006
- return /* @__PURE__ */ jsx25(React18.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx25(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
1007
- }) }),
1008
- props.node.listType == "number" && /* @__PURE__ */ jsx25("ol", { children: props.node.children && props.node.children.map((node, index) => {
1009
- const SelectedNode = NodeTypes2[node.type];
1010
- return /* @__PURE__ */ jsx25(React18.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx25(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
1011
- }) })
1012
- ] });
1013
- };
1014
- var ListNode_default = ListNode;
1015
-
1016
- // src/components/pageRenderingEngine/nodes/QuoteNode.tsx
1017
- import React19 from "react";
1018
- import { jsx as jsx26 } from "react/jsx-runtime";
1019
- var QuoteNode = (props) => {
1020
- const NodeTypes2 = {
1021
- ["text"]: TextNode_default,
1022
- ["linebreak"]: LineBreakNode_default,
1023
- ["link"]: LinkNode_default
1024
- };
1025
- return /* @__PURE__ */ jsx26("blockquote", { children: props.node.children && props.node.children.map((node, index) => {
1026
- const SelectedNode = NodeTypes2[node.type];
1027
- return /* @__PURE__ */ jsx26(React19.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx26(SelectedNode, { node, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
1028
- }) });
1029
- };
1030
- var QuoteNode_default = QuoteNode;
1031
-
1032
- // src/components/pageRenderingEngine/nodes/CodeNode.tsx
1033
- import React20 from "react";
1034
- import dynamic6 from "next/dynamic";
1035
- import { jsx as jsx27, jsxs as jsxs9 } from "react/jsx-runtime";
1036
- var CopyButton = dynamic6(() => import("./CopyButton-XONTQQW7.mjs"), {
1037
- ssr: false,
1038
- // optional: fallback UI while loading
1039
- loading: () => /* @__PURE__ */ jsx27("span", { className: "text-gray-400 text-xs", children: "Copy" })
1040
- });
1041
- var CodeNode = (props) => {
1042
- const NodeTypes2 = {
1043
- text: TextNode_default,
1044
- linebreak: LineBreakNode_default,
1045
- link: LinkNode_default
1046
- };
1047
- const textContent = props.node?.children?.map((node) => {
1048
- if (node.type === "text") return node.text || "";
1049
- if (node.type === "linebreak") return "\n";
1050
- if (node.type === "link") return node.text || node.url || "";
1051
- return "";
1052
- }).join("") ?? "";
1053
- return /* @__PURE__ */ jsxs9("div", { children: [
1054
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center relative bg-neutral-strong px-4 py-3 text-xs font-sans justify-between rounded-t-md ", children: [
1055
- /* @__PURE__ */ jsx27("span", { children: "Code Snippet" }),
1056
- /* @__PURE__ */ jsx27(CopyButton, { text: textContent })
1057
- ] }),
1058
- /* @__PURE__ */ jsx27("code", { className: "bg-neutral-soft p-4 text-sm whitespace-pre-wrap border border-2 block", children: props.node.children && props.node.children.map((node, index) => {
1059
- const SelectedNode = NodeTypes2[node.type];
1060
- return /* @__PURE__ */ jsx27(React20.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx27(
1061
- SelectedNode,
1062
- {
1063
- node,
1064
- session: props.session,
1065
- apiBaseUrl: props.apiBaseUrl,
1066
- routeParameters: props.routeParameters
1067
- }
1068
- ) }, index);
1069
- }) })
1070
- ] });
1071
- };
1072
- var CodeNode_default = CodeNode;
1073
-
1074
- // src/components/pageRenderingEngine/nodes/HorizontalRuleNode.tsx
1075
- import { jsx as jsx28 } from "react/jsx-runtime";
1076
- var HorizontalRuleNode = () => {
1077
- return /* @__PURE__ */ jsx28("hr", {});
1078
- };
1079
- var HorizontalRuleNode_default = HorizontalRuleNode;
1080
-
1081
- // src/components/pageRenderingEngine/nodes/WidgetNode.tsx
1082
- import React21 from "react";
1083
- import { Fragment as Fragment4, jsx as jsx29 } from "react/jsx-runtime";
1084
- var WidgetNode = (props) => {
1085
- const getWidgetParameters = () => {
1086
- const widgetInputParameters = {
1087
- ...props.routeParameters ?? {}
1088
- };
1089
- const rawWidgetParams = props.node.widgetParameters ?? props.node.widgetParams;
1090
- let widgetParameters = {};
1091
- const isJSON = (str) => {
1092
- const s = str.trim();
1093
- return s.startsWith("{") && s.endsWith("}") || s.startsWith("[") && s.endsWith("]");
1094
- };
1095
- if (rawWidgetParams) {
1096
- if (typeof rawWidgetParams === "string" && isJSON(rawWidgetParams)) {
1097
- try {
1098
- widgetParameters = JSON.parse(rawWidgetParams);
1099
- } catch {
1100
- widgetParameters = {};
1101
- }
1102
- } else if (typeof rawWidgetParams === "object") {
1103
- widgetParameters = rawWidgetParams;
1104
- }
1105
- }
1106
- if (props.dataitem && typeof props.dataitem === "object") {
1107
- Object.keys(widgetParameters).forEach((key) => {
1108
- if (props.dataitem[key] !== void 0 && props.dataitem[key] !== null) {
1109
- widgetParameters[key] = props.dataitem[key];
1110
- }
1111
- });
1112
- }
1113
- const resolveValue = (val) => {
1114
- if (typeof val === "string") {
1115
- const m = /^\{(.+)\}$/.exec(val);
1116
- if (m) {
1117
- const actualKey = m[1];
1118
- return props.routeParameters?.[actualKey] ?? val;
1119
- }
1120
- return val;
1121
- }
1122
- if (Array.isArray(val)) {
1123
- return val.map(resolveValue);
1124
- }
1125
- if (val && typeof val === "object") {
1126
- const out = {};
1127
- for (const k of Object.keys(val)) {
1128
- out[k] = resolveValue(val[k]);
1129
- }
1130
- return out;
1131
- }
1132
- return val;
1133
- };
1134
- for (const key of Object.keys(widgetParameters)) {
1135
- const rawVal = widgetParameters[key];
1136
- if (rawVal === "route") {
1137
- widgetInputParameters[key] = key === "itemPath" ? props.path : widgetInputParameters[key] ?? null;
1138
- } else {
1139
- widgetInputParameters[key] = resolveValue(rawVal);
1140
- }
1141
- }
1142
- widgetInputParameters["widgetTitle"] = props.node.widgetTitle;
1143
- return widgetInputParameters;
1144
- };
1145
- const widgetCode = props.node?.widgetCode;
1146
- if (!widgetCode) {
1147
- return /* @__PURE__ */ jsx29(Fragment4, { children: "Invalid widget" });
1148
- }
1149
- const widgetParams = getWidgetParameters();
1150
- const WidgetRenderer = props.widgetRenderer;
1151
- if (!WidgetRenderer) {
1152
- return null;
1153
- }
1154
- return (
1155
- // eslint-disable-next-line react-hooks/static-components
1156
- /* @__PURE__ */ jsx29(React21.Fragment, { children: /* @__PURE__ */ jsx29(
1157
- WidgetRenderer,
1158
- {
1159
- params: widgetParams,
1160
- query: props.query,
1161
- session: props.session,
1162
- host: props.host,
1163
- path: props.path,
1164
- apiBaseUrl: props.apiBaseUrl,
1165
- widgetCode
1166
- }
1167
- ) })
1168
- );
1169
- };
1170
- var WidgetNode_default = WidgetNode;
1171
-
1172
- // src/components/pageRenderingEngine/nodes/DivContainer.tsx
1173
- import dynamic9 from "next/dynamic";
1174
- import React22 from "react";
1175
-
1176
- // src/components/pageRenderingEngine/nodes/EmbedNode.tsx
1177
- import dynamic7 from "next/dynamic";
1178
- import { jsx as jsx30 } from "react/jsx-runtime";
1179
- var IframeClient = dynamic7(() => import("./IframeClient-J22NMEVY.mjs"), {
1180
- ssr: false
1181
- });
1182
- var EmbedNode = (props) => {
1183
- let src;
1184
- if (props.node.provider == "youtube") {
1185
- src = `https://www.youtube-nocookie.com/embed/${props.node.embedSrc}`;
1186
- } else if (props.node.provider == "bunny") {
1187
- src = `https://iframe.mediadelivery.net/embed/${props.node.embedSrc}?autoplay=false&loop=false&muted=false&preload=true&responsive=true`;
1188
- } else {
1189
- src = props.node.embedSrc;
1190
- }
1191
- return /* @__PURE__ */ jsx30("div", { className: "aspect-video", children: src && /* @__PURE__ */ jsx30(IframeClient, { src }) });
1192
- };
1193
- var EmbedNode_default = EmbedNode;
1194
-
1195
- // src/components/utilities/AnimationUtility.tsx
1196
- var normalizeSelector = (guid) => {
1197
- const trimmedGuid = guid?.trim();
1198
- if (!trimmedGuid) {
1199
- return ".animation-fallback";
1200
- }
1201
- const baseValue = trimmedGuid.replace(/^#/, "").replace(/^\./, "");
1202
- if (typeof CSS !== "undefined" && typeof CSS.escape === "function") {
1203
- return `#${CSS.escape(baseValue)}`;
1204
- }
1205
- return `#${baseValue}`;
1206
- };
1207
- var AnimationUtility = class {
1208
- static generateAnimationCSS(config, guid) {
1209
- const {
1210
- duration = 700,
1211
- delay = 0,
1212
- easing = "ease-out",
1213
- distance = 30,
1214
- scaleStart = 1,
1215
- scaleEnd = 1.2,
1216
- repeat = 1,
1217
- intensity = 20,
1218
- speedPerChar = 100,
1219
- cursor = true,
1220
- mode = "enter",
1221
- direction = "left",
1222
- backgroundColor,
1223
- borderColor
1224
- } = config;
1225
- let base = "", visible = "", keyframes = "";
1226
- const selector = normalizeSelector(guid);
1227
- switch (config.animation) {
1228
- case "Fade":
1229
- base = `opacity:0; transition:opacity ${duration}ms ${easing} ${delay}ms;`;
1230
- visible = `opacity:1;`;
1231
- break;
1232
- case "FadeInUp":
1233
- base = `opacity:0; transform:translateY(${distance}px); transition:all ${duration}ms ${easing} ${delay}ms;`;
1234
- visible = `opacity:1; transform:translateY(0);`;
1235
- break;
1236
- case "Slide":
1237
- const slideTransform = this.getSlideTransform(direction, distance);
1238
- base = `opacity:0; transform:${slideTransform.start}; transition:all ${duration}ms ${easing} ${delay}ms; will-change: transform, opacity;`;
1239
- visible = `opacity:1; transform:${slideTransform.end}; will-change: unset;`;
1240
- break;
1241
- case "ZoomIn":
1242
- if (mode === "enter") {
1243
- base = `opacity:0; transform:scale(${scaleStart}); transition:all ${duration}ms ${easing} ${delay}ms;`;
1244
- visible = `opacity:1; transform:scale(${scaleEnd});`;
1245
- } else {
1246
- base = `transform:scale(${scaleStart}); transition:transform ${duration / 1e3}s ${easing} ${delay / 1e3}s;`;
1247
- visible = `transform:scale(${scaleEnd});`;
1248
- }
1249
- break;
1250
- case "Bounce":
1251
- keyframes = `
1252
- @keyframes bounce {
1253
- 0%,20%,50%,80%,100% { transform: translateY(0); }
1254
- 40% { transform: translateY(-${intensity}px); }
1255
- 60% { transform: translateY(-${intensity / 2}px); }
1256
- }
1257
- `;
1258
- if (mode === "enter") {
1259
- base = `opacity:0;`;
1260
- visible = `opacity:1; animation: bounce ${duration}ms ${easing} ${delay}ms ${repeat};`;
1261
- } else {
1262
- base = ``;
1263
- visible = `animation: bounce ${duration / 1e3}s ${easing} ${delay / 1e3}s ${repeat};`;
1264
- }
1265
- break;
1266
- case "Background":
1267
- base = `transition: background-color ${duration}ms ${easing} ${delay}ms;`;
1268
- visible = `background-color: ${backgroundColor};`;
1269
- break;
1270
- case "Border":
1271
- base = `transition: border-color ${duration}ms ${easing} ${delay}ms;`;
1272
- visible = `border-color: ${borderColor};`;
1273
- break;
1274
- case "Typewriter":
1275
- keyframes = `
1276
- @keyframes typewriter { from { width: 0 } to { width: 100% } }
1277
- @keyframes blink { 50% { border-color: transparent } }
1278
- `;
1279
- base = `
1280
- overflow:hidden;
1281
- border-right:${cursor ? "2px solid black" : "none"};
1282
- white-space:nowrap;
1283
- width:0;
1284
- margin:0 auto;
1285
- `;
1286
- visible = `
1287
- animation:typewriter ${speedPerChar * 30}ms steps(30,end) ${delay}ms forwards
1288
- ${cursor ? ", blink .75s step-end infinite" : ""};
1289
- `;
1290
- break;
1291
- }
1292
- if (mode === "hover") {
1293
- return `
1294
- ${keyframes}
1295
- ${selector} { ${base} }
1296
- ${selector}:hover { ${visible} }
1297
- `;
1298
- } else {
1299
- return `
1300
- ${keyframes}
1301
- ${selector} { ${base} }
1302
- ${selector}.visible { ${visible} }
1303
- `;
1304
- }
1305
- }
1306
- // Helper method to generate slide transforms based on direction
1307
- static getSlideTransform(direction, distance) {
1308
- switch (direction) {
1309
- case "left":
1310
- return { start: `translateX(${distance}px)`, end: `translateX(0)` };
1311
- case "right":
1312
- return { start: `translateX(-${distance}px)`, end: `translateX(0)` };
1313
- case "up":
1314
- return { start: `translateY(${distance}px)`, end: `translateY(0)` };
1315
- case "down":
1316
- return { start: `translateY(-${distance}px)`, end: `translateY(0)` };
1317
- default:
1318
- return { start: `translateX(${distance}px)`, end: `translateX(0)` };
1319
- }
1320
- }
1321
- };
1322
- var AnimationUtility_default = AnimationUtility;
1323
-
1324
- // src/components/utilities/PathUtility.tsx
1325
- var PathUtility = class {
1326
- constructor() {
1327
- }
1328
- normalizePath(path) {
1329
- if (path == null) {
1330
- return "/";
1331
- }
1332
- const trimmedPath = path.replace(/^\/|\/$/g, "");
1333
- return trimmedPath === "" ? "/" : "/" + trimmedPath + "/";
1334
- }
1335
- joinAndNormalizePaths(path1, path2) {
1336
- path1 = path1.replace(/\/$/, "");
1337
- path2 = path2.replace(/^\//, "");
1338
- const joinedPath = `${path1}/${path2}`;
1339
- const normalizedPath = joinedPath.replace(/\/{2,}/g, "/");
1340
- return normalizedPath === "" ? "/" : "/" + normalizedPath;
1341
- }
1342
- removeLeadingAndTrailingSlashes(path) {
1343
- if (path == null) {
1344
- return "/";
1345
- }
1346
- const trimmedPath = path.replace(/^\/|\/$/g, "");
1347
- return trimmedPath;
1348
- }
1349
- removeTrailingSlash(path) {
1350
- if (path == null) {
1351
- return "/";
1352
- }
1353
- const trimmedPath = path.replace(/\/$/, "");
1354
- return trimmedPath;
1355
- }
1356
- joinPaths(path1, path2) {
1357
- if (!path1.endsWith("/") && !path2.startsWith("/")) {
1358
- return `${path1}/${path2}`;
1359
- } else if (path1.endsWith("/") && path2.startsWith("/")) {
1360
- return `${path1}${path2.substr(1)}`;
1361
- } else {
1362
- return `${path1}${path2}`;
1363
- }
1364
- }
1365
- getFirstSegment(path) {
1366
- if (!path || path === "/") {
1367
- return "";
1368
- }
1369
- const segments = path.split("/").filter(Boolean);
1370
- return segments.length > 0 ? segments[0] : "";
1371
- }
1372
- getFileNameFromUrl(url) {
1373
- if (!url || url.indexOf("/") === -1) {
1374
- return url;
1375
- }
1376
- const parts = url.split("/");
1377
- const filename = parts[parts.length - 1];
1378
- return filename;
1379
- }
1380
- };
1381
- var PathUtility_default = new PathUtility();
1382
-
1383
- // src/components/NoDataFound.tsx
1384
- import { jsx as jsx31, jsxs as jsxs10 } from "react/jsx-runtime";
1385
- var NoDataFound = () => {
1386
- return /* @__PURE__ */ jsxs10("div", { className: "flex flex-col items-center justify-center py-12 px-4 text-center bg-neutral-weak", children: [
1387
- /* @__PURE__ */ jsx31("div", { className: "mb-5", children: /* @__PURE__ */ jsx31("div", { className: "mx-auto w-20 h-20 rounded-full flex items-center justify-center bg-neutral-soft", children: /* @__PURE__ */ jsx31(
1388
- "svg",
1389
- {
1390
- className: "w-10 h-10",
1391
- fill: "none",
1392
- stroke: "currentColor",
1393
- viewBox: "0 0 24 24",
1394
- xmlns: "http://www.w3.org/2000/svg",
1395
- children: /* @__PURE__ */ jsx31(
1396
- "path",
1397
- {
1398
- strokeLinecap: "round",
1399
- strokeLinejoin: "round",
1400
- strokeWidth: "1.5",
1401
- d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"
1402
- }
1403
- )
1404
- }
1405
- ) }) }),
1406
- /* @__PURE__ */ jsx31("h3", { className: "text-lg font-medium mb-2", children: "No data available" }),
1407
- /* @__PURE__ */ jsx31("p", { className: " max-w-sm mb-0", children: "No records found. Data may be empty or not available at the moment." })
1408
- ] });
1409
- };
1410
- var NoDataFound_default = NoDataFound;
1411
-
1412
- // src/components/pageRenderingEngine/nodes/ImageGalleryNode.tsx
1413
- import dynamic8 from "next/dynamic";
1414
- import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs11 } from "react/jsx-runtime";
1415
- var HlsPlayer3 = dynamic8(() => import("./HlsPlayer-57543DTW.mjs"), { ssr: false });
1416
- var deviceToMediaQuery = (device) => {
1417
- switch (device) {
1418
- case "lg":
1419
- return "(min-width: 769px)";
1420
- case "md":
1421
- return "(min-width: 481px) and (max-width: 768px)";
1422
- case "sm":
1423
- return "(max-width: 480px)";
1424
- default:
1425
- return null;
1426
- }
1427
- };
1428
- var DEVICE_ORDER = ["lg", "md", "sm", "tv"];
1429
- var parseMaybeNumber = (value) => {
1430
- if (typeof value === "number")
1431
- return Number.isFinite(value) ? value : void 0;
1432
- if (typeof value !== "string") return void 0;
1433
- const n = Number(value);
1434
- return Number.isFinite(n) ? n : void 0;
1435
- };
1436
- function resolveAssetUrl(fieldValue, tag) {
1437
- if (!fieldValue) {
1438
- return void 0;
1439
- }
1440
- if (typeof fieldValue === "string") {
1441
- const trimmed = fieldValue.trim();
1442
- if (trimmed.startsWith("itemassets/") || trimmed.startsWith("/itemassets/") || trimmed.startsWith("http")) {
1443
- return trimmed;
1444
- }
1445
- try {
1446
- const parsed = JSON.parse(trimmed);
1447
- return resolveAssetUrl(parsed, tag);
1448
- } catch {
1449
- return void 0;
1450
- }
1451
- }
1452
- if (Array.isArray(fieldValue)) {
1453
- const asset = tag ? fieldValue.find(
1454
- (x) => x?.tag?.toLowerCase() === tag?.toLowerCase()
1455
- ) : fieldValue[0];
1456
- return asset?.assetUrl;
1457
- }
1458
- if (typeof fieldValue === "object" && fieldValue !== null) {
1459
- const assetObject = fieldValue;
1460
- if (assetObject.assetUrl) {
1461
- return assetObject.assetUrl;
1462
- }
1463
- }
1464
- return void 0;
1465
- }
1466
- var getNestedValue3 = (obj, path) => {
1467
- if (!obj || !path) {
1468
- return void 0;
1469
- }
1470
- return path.split(".").reduce((current, key) => {
1471
- return current?.[key];
1472
- }, obj);
1473
- };
1474
- var ImageGalleryNode = (props) => {
1475
- const resolveImageUrl = (image) => {
1476
- let imageUrl = image.imageUrl;
1477
- if (image.datafield && props.dataitem) {
1478
- const fieldValue = getNestedValue3(props.dataitem, image.datafield);
1479
- const resolvedAsset = resolveAssetUrl(fieldValue, image.tag);
1480
- if (resolvedAsset) {
1481
- imageUrl = resolvedAsset;
1482
- }
1483
- }
1484
- if (!imageUrl) {
1485
- return "";
1486
- }
1487
- if (imageUrl.startsWith("http")) {
1488
- return imageUrl;
1489
- }
1490
- const base = props.assetBaseUrl.replace(/\/$/, "");
1491
- const path = imageUrl.replace(/^\//, "");
1492
- return `${base}/${path}`;
1493
- };
1494
- const resolvePosterUrl = (posterUrl) => {
1495
- if (!posterUrl) return void 0;
1496
- return AssetUtility_default.resolveUrl(props.assetBaseUrl, posterUrl);
1497
- };
1498
- const rawImages = Array.isArray(props.node.images) ? props.node.images : [];
1499
- const hlsImages = rawImages.filter(
1500
- (img) => resolveImageUrl(img).endsWith(".m3u8")
1501
- );
1502
- const staticImages = rawImages.filter(
1503
- (img) => !resolveImageUrl(img).endsWith(".m3u8")
1504
- );
1505
- const hlsSources = [
1506
- ...DEVICE_ORDER.flatMap((deviceKey) => {
1507
- const img = hlsImages.find((i) => i.device === deviceKey);
1508
- if (!img) return [];
1509
- const src = resolveImageUrl(img);
1510
- if (!src) return [];
1511
- const media = deviceToMediaQuery(img.device);
1512
- const posterUrl = resolvePosterUrl(img.posterUrl);
1513
- return [
1514
- {
1515
- src,
1516
- ...media ? { media } : {},
1517
- ...posterUrl ? { posterUrl } : {}
1518
- }
1519
- ];
1520
- }),
1521
- ...hlsImages.filter((img) => !img.device).map((img) => {
1522
- const src = resolveImageUrl(img);
1523
- const posterUrl = resolvePosterUrl(img.posterUrl);
1524
- return { src, ...posterUrl ? { posterUrl } : {} };
1525
- }).filter((s) => !!s.src)
1526
- ];
1527
- const primaryHls = hlsImages.find((img) => !img.device) ?? hlsImages[0];
1528
- const hlsIntrinsicWidth = primaryHls ? parseMaybeNumber(primaryHls.intrinsicWidth)?.toString() : void 0;
1529
- const hlsIntrinsicHeight = primaryHls ? parseMaybeNumber(primaryHls.intrinsicHeight)?.toString() : void 0;
1530
- const hlsStyles = {};
1531
- if (primaryHls?.height) hlsStyles.height = primaryHls.height;
1532
- if (primaryHls?.width) hlsStyles.width = primaryHls.width;
1533
- if (primaryHls?.borderRadius)
1534
- hlsStyles.borderRadius = primaryHls.borderRadius;
1535
- const staticSources = staticImages.filter((img) => !!img.device);
1536
- const staticFallback = staticImages.find((img) => !img.device) ?? null;
1537
- const FormatClass = {
1538
- center: "justify-center",
1539
- left: "justify-start",
1540
- right: "justify-end"
1541
- };
1542
- const formatClasses = FormatClass[props.node.format || ""] || "";
1543
- return /* @__PURE__ */ jsxs11(Fragment5, { children: [
1544
- hlsSources.length > 0 && /* @__PURE__ */ jsx32(Fragment5, { children: /* @__PURE__ */ jsx32(
1545
- HlsPlayer3,
1546
- {
1547
- sources: hlsSources,
1548
- intrinsicWidth: hlsIntrinsicWidth,
1549
- intrinsicHeight: hlsIntrinsicHeight,
1550
- showControls: primaryHls?.showControls ?? false,
1551
- loop: primaryHls?.loop ?? false,
1552
- playOptions: primaryHls?.playOptions ?? "",
1553
- placementCode: primaryHls?.placementCode ?? "",
1554
- apiBaseUrl: props.apiBaseUrl,
1555
- session: props.session,
1556
- styles: hlsStyles
1557
- }
1558
- ) }),
1559
- (staticFallback || staticSources.length > 0) && /* @__PURE__ */ jsx32(Fragment5, { children: staticFallback ? /* @__PURE__ */ jsxs11("picture", { children: [
1560
- DEVICE_ORDER.map((deviceKey) => {
1561
- const match = staticSources.find(
1562
- (img) => img.device === deviceKey
1563
- );
1564
- if (!match) {
1565
- return null;
1566
- }
1567
- const srcUrl = resolveImageUrl(match);
1568
- if (!srcUrl) {
1569
- return null;
1570
- }
1571
- return /* @__PURE__ */ jsx32(
1572
- "source",
1573
- {
1574
- media: deviceToMediaQuery(match.device),
1575
- srcSet: srcUrl,
1576
- width: parseMaybeNumber(match.intrinsicWidth),
1577
- height: parseMaybeNumber(match.intrinsicHeight)
1578
- },
1579
- deviceKey
1580
- );
1581
- }),
1582
- (() => {
1583
- const img = staticFallback;
1584
- const imageUrl = resolveImageUrl(img);
1585
- if (!imageUrl) {
1586
- return null;
1587
- }
1588
- const styles = {
1589
- width: img.width || "auto",
1590
- height: img.height || "auto"
1591
- };
1592
- if (img.borderRadius) {
1593
- styles.borderRadius = img.borderRadius;
1594
- }
1595
- return /* @__PURE__ */ jsx32(
1596
- "img",
1597
- {
1598
- loading: "lazy",
1599
- style: styles,
1600
- className: "object-cover max-w-full",
1601
- src: imageUrl,
1602
- width: parseMaybeNumber(img.intrinsicWidth),
1603
- height: parseMaybeNumber(img.intrinsicHeight),
1604
- alt: img.title ?? "Gallery image"
1605
- }
1606
- );
1607
- })()
1608
- ] }) : (
1609
- /* Case 2: Only device-specific images exist */
1610
- /* @__PURE__ */ jsx32(Fragment5, { children: staticSources.map((img, index) => {
1611
- const imageUrl = resolveImageUrl(img);
1612
- if (!imageUrl) {
1613
- return null;
1614
- }
1615
- const styles = {
1616
- width: img.width || "auto",
1617
- height: img.height || "auto"
1618
- };
1619
- if (img.borderRadius) {
1620
- styles.borderRadius = img.borderRadius;
1621
- }
1622
- let display = "none";
1623
- switch (img.device) {
1624
- case "sm":
1625
- display = props.device === "sm" ? "block" : "none";
1626
- break;
1627
- case "md":
1628
- display = props.device === "md" ? "block" : "none";
1629
- break;
1630
- case "lg":
1631
- display = props.device === "lg" ? "block" : "none";
1632
- break;
1633
- default:
1634
- display = "block";
1635
- }
1636
- return /* @__PURE__ */ jsx32(
1637
- "img",
1638
- {
1639
- loading: "lazy",
1640
- src: imageUrl,
1641
- style: {
1642
- ...styles,
1643
- display
1644
- },
1645
- className: "object-cover max-w-full",
1646
- width: parseMaybeNumber(img.intrinsicWidth),
1647
- height: parseMaybeNumber(img.intrinsicHeight),
1648
- alt: img.title ?? "Gallery image"
1649
- },
1650
- index
1651
- );
1652
- }) })
1653
- ) })
1654
- ] });
1655
- };
1656
- var ImageGalleryNode_default = ImageGalleryNode;
1657
-
1658
- // src/components/pageRenderingEngine/nodes/DivContainer.tsx
1659
- import Link from "next/link";
1660
-
1661
- // src/utilities/RoleUtility.tsx
1662
- var decodeJWT = (token) => {
1663
- if (!token) return null;
1664
- try {
1665
- const cleanToken = token.replace(/^Bearer\s+/i, "");
1666
- const parts = cleanToken.split(".");
1667
- if (parts.length !== 3) {
1668
- console.warn("Invalid JWT token format");
1669
- return null;
1670
- }
1671
- const payload = parts[1];
1672
- const decoded = JSON.parse(atob(payload));
1673
- return decoded;
1674
- } catch (error) {
1675
- console.warn("Failed to decode JWT token:", error);
1676
- return null;
1677
- }
1678
- };
1679
- var extractRolesFromToken = (decodedPayload) => {
1680
- if (!decodedPayload) return [];
1681
- const roles = [];
1682
- if (decodedPayload.role && typeof decodedPayload.role === "string") {
1683
- roles.push(decodedPayload.role);
1684
- }
1685
- if (decodedPayload.rolecode && typeof decodedPayload.rolecode === "string") {
1686
- roles.push(decodedPayload.rolecode);
1687
- }
1688
- if (decodedPayload.roles && Array.isArray(decodedPayload.roles)) {
1689
- roles.push(...decodedPayload.roles);
1690
- }
1691
- if (decodedPayload.realm_access?.roles && Array.isArray(decodedPayload.realm_access.roles)) {
1692
- roles.push(...decodedPayload.realm_access.roles);
1693
- }
1694
- if (decodedPayload.resource_access && typeof decodedPayload.resource_access === "object") {
1695
- Object.values(decodedPayload.resource_access).forEach((resource) => {
1696
- if (resource?.roles && Array.isArray(resource.roles)) {
1697
- roles.push(...resource.roles);
1698
- }
1699
- });
1700
- }
1701
- return [...new Set(roles)];
1702
- };
1703
- var getUserRoles = (oAuthToken) => {
1704
- const decodedPayload = decodeJWT(oAuthToken);
1705
- return extractRolesFromToken(decodedPayload);
1706
- };
1707
- var hasRole = (userRoles, requiredRole) => {
1708
- if (!requiredRole || !userRoles) return false;
1709
- return userRoles.some(
1710
- (role) => role.toLowerCase() === requiredRole.toLowerCase()
1711
- );
1712
- };
1713
- var shouldRenderByRole = (roleCode, userRoles) => {
1714
- if (!roleCode || roleCode.trim() === "") {
1715
- return true;
1716
- }
1717
- const trimmedRoleCode = roleCode.trim();
1718
- if (trimmedRoleCode.startsWith("!")) {
1719
- const requiredRole = trimmedRoleCode.substring(1);
1720
- return !hasRole(userRoles, requiredRole);
1721
- }
1722
- return hasRole(userRoles, trimmedRoleCode);
1723
- };
1724
- var validateRoleVisibility = (roleCode, oAuthToken) => {
1725
- const userRoles = getUserRoles(oAuthToken);
1726
- return shouldRenderByRole(roleCode, userRoles);
1727
- };
1728
-
1729
- // src/utilities/VisibilityUtility.tsx
1730
- var getNestedValue4 = (obj, path) => {
1731
- if (!obj || !path) return void 0;
1732
- return path.split(".").reduce((current, key) => {
1733
- return current && current[key] !== void 0 ? current[key] : void 0;
1734
- }, obj);
1735
- };
1736
- var shouldRenderByFieldVisibility = (fieldVisibleOnTrue, dataItem) => {
1737
- if (!fieldVisibleOnTrue) {
1738
- return true;
1739
- }
1740
- const condition = fieldVisibleOnTrue.trim();
1741
- const isNegated = condition.startsWith("!");
1742
- const fieldName = isNegated ? condition.substring(1).trim() : condition;
1743
- const fieldValue = getNestedValue4(dataItem, fieldName);
1744
- if (fieldValue == null || fieldValue === 0) {
1745
- return false;
1746
- }
1747
- return isNegated ? fieldValue !== true : fieldValue !== false;
1748
- };
1749
- var shouldRenderByRole2 = (roleCode, oAuthToken) => {
1750
- if (!roleCode || roleCode.trim() === "") {
1751
- return true;
1752
- }
1753
- return validateRoleVisibility(roleCode, oAuthToken ?? void 0);
1754
- };
1755
- var shouldRenderByVisibility = (visibility, session) => {
1756
- const normalizedVisibility = visibility?.trim().toLowerCase();
1757
- const hasAuthToken = Boolean(session?.oAuthToken?.trim());
1758
- switch (normalizedVisibility) {
1759
- case "authorized":
1760
- return hasAuthToken;
1761
- case "anonymous":
1762
- return !hasAuthToken;
1763
- case "all":
1764
- case "":
1765
- case null:
1766
- case void 0:
1767
- default:
1768
- return true;
1769
- }
1770
- };
1771
- var shouldRenderContainer = (node, dataItem, session) => {
1772
- return shouldRenderByVisibility(node.visibility, session) && shouldRenderByRole2(node.roleCode, session?.oAuthToken) && shouldRenderByFieldVisibility(node.fieldVisibleOnTrue, dataItem);
1773
- };
1774
-
1775
- // src/components/pageRenderingEngine/nodes/DocumentNode.tsx
1776
- import { Fragment as Fragment6, jsx as jsx33, jsxs as jsxs12 } from "react/jsx-runtime";
1777
- var getNestedValue5 = (obj, path) => {
1778
- if (!obj || !path) return void 0;
1779
- return path.split(".").reduce((current, key) => {
1780
- return current && current[key] !== void 0 ? current[key] : void 0;
1781
- }, obj);
1782
- };
1783
- var PdfIcon = () => /* @__PURE__ */ jsxs12(
1784
- "svg",
1785
- {
1786
- xmlns: "http://www.w3.org/2000/svg",
1787
- viewBox: "0 0 48 48",
1788
- className: "w-10 h-10",
1789
- children: [
1790
- /* @__PURE__ */ jsx33(
1791
- "path",
1792
- {
1793
- fill: "#e53935",
1794
- d: "M38,42H10c-2.209,0-4-1.791-4-4V10c0-2.209,1.791-4,4-4h28c2.209,0,4,1.791,4,4v28 C42,40.209,40.209,42,38,42z"
1795
- }
1796
- ),
1797
- /* @__PURE__ */ jsx33(
1798
- "path",
1799
- {
1800
- fill: "#fff",
1801
- d: "M34.841,26.799c-1.692-1.757-6.314-1.041-7.42-0.911c-1.627-1.562-2.734-3.45-3.124-4.101 c0.586-1.757,0.976-3.515,1.041-5.402c0-1.627-0.651-3.385-2.473-3.385c-0.651,0-1.237,0.391-1.562,0.911 c-0.781,1.367-0.456,4.101,0.781,6.899c-0.716,2.018-1.367,3.97-3.189,7.42c-1.888,0.781-5.858,2.604-6.183,4.556 c-0.13,0.586,0.065,1.172,0.521,1.627C13.688,34.805,14.273,35,14.859,35c2.408,0,4.751-3.32,6.379-6.118 c1.367-0.456,3.515-1.107,5.663-1.497c2.538,2.213,4.751,2.538,5.923,2.538c1.562,0,2.148-0.651,2.343-1.237 C35.492,28.036,35.297,27.32,34.841,26.799z M33.214,27.905c-0.065,0.456-0.651,0.911-1.692,0.651 c-1.237-0.325-2.343-0.911-3.32-1.692c0.846-0.13,2.734-0.325,4.101-0.065C32.824,26.929,33.344,27.254,33.214,27.905z M22.344,14.497c0.13-0.195,0.325-0.325,0.521-0.325c0.586,0,0.716,0.716,0.716,1.302c-0.065,1.367-0.325,2.734-0.781,4.036 C21.824,16.905,22.019,15.083,22.344,14.497z M22.214,27.124c0.521-1.041,1.237-2.864,1.497-3.645 c0.586,0.976,1.562,2.148,2.083,2.669C25.794,26.213,23.776,26.604,22.214,27.124z M18.374,29.728 c-1.497,2.473-3.059,4.036-3.905,4.036c-0.13,0-0.26-0.065-0.391-0.13c-0.195-0.13-0.26-0.325-0.195-0.586 C14.078,32.136,15.77,30.899,18.374,29.728z"
1802
- }
1803
- )
1804
- ]
1805
- }
1806
- );
1807
- var ExcelIcon = () => /* @__PURE__ */ jsxs12(
1808
- "svg",
1809
- {
1810
- xmlns: "http://www.w3.org/2000/svg",
1811
- viewBox: "0 0 48 48",
1812
- className: "w-10 h-10",
1813
- children: [
1814
- /* @__PURE__ */ jsx33(
1815
- "path",
1816
- {
1817
- fill: "#169154",
1818
- d: "M29,6H15.744C14.781,6,14,6.781,14,7.744v7.259h15V6z"
1819
- }
1820
- ),
1821
- /* @__PURE__ */ jsx33(
1822
- "path",
1823
- {
1824
- fill: "#18482a",
1825
- d: "M14,33.054v7.202C14,41.219,14.781,42,15.743,42H29v-8.946H14z"
1826
- }
1827
- ),
1828
- /* @__PURE__ */ jsx33("path", { fill: "#0c8045", d: "M14 15.003H29V24.005000000000003H14z" }),
1829
- /* @__PURE__ */ jsx33("path", { fill: "#17472a", d: "M14 24.005H29V33.055H14z" }),
1830
- /* @__PURE__ */ jsxs12("g", { children: [
1831
- /* @__PURE__ */ jsx33(
1832
- "path",
1833
- {
1834
- fill: "#29c27f",
1835
- d: "M42.256,6H29v9.003h15V7.744C44,6.781,43.219,6,42.256,6z"
1836
- }
1837
- ),
1838
- /* @__PURE__ */ jsx33(
1839
- "path",
1840
- {
1841
- fill: "#27663f",
1842
- d: "M29,33.054V42h13.257C43.219,42,44,41.219,44,40.257v-7.202H29z"
1843
- }
1844
- ),
1845
- /* @__PURE__ */ jsx33("path", { fill: "#19ac65", d: "M29 15.003H44V24.005000000000003H29z" }),
1846
- /* @__PURE__ */ jsx33("path", { fill: "#129652", d: "M29 24.005H44V33.055H29z" })
1847
- ] }),
1848
- /* @__PURE__ */ jsx33(
1849
- "path",
1850
- {
1851
- fill: "#0c7238",
1852
- d: "M22.319,34H5.681C4.753,34,4,33.247,4,32.319V15.681C4,14.753,4.753,14,5.681,14h16.638 C23.247,14,24,14.753,24,15.681v16.638C24,33.247,23.247,34,22.319,34z"
1853
- }
1854
- ),
1855
- /* @__PURE__ */ jsx33(
1856
- "path",
1857
- {
1858
- fill: "#fff",
1859
- d: "M9.807 19L12.193 19 14.129 22.754 16.175 19 18.404 19 15.333 24 18.474 29 16.123 29 14.013 25.07 11.912 29 9.526 29 12.719 23.982z"
1860
- }
1861
- )
1862
- ]
1863
- }
1864
- );
1865
- var WordIcon = () => /* @__PURE__ */ jsxs12(
1866
- "svg",
1867
- {
1868
- xmlns: "http://www.w3.org/2000/svg",
1869
- viewBox: "0 0 48 48",
1870
- className: "w-10 h-10",
1871
- baseProfile: "basic",
1872
- children: [
1873
- /* @__PURE__ */ jsx33(
1874
- "path",
1875
- {
1876
- fill: "#283593",
1877
- d: "M9,33.595l14.911-18.706L41,26v13.306C41,41.346,39.346,43,37.306,43H15.332 C11.835,43,9,40.164,9,36.667C9,36.667,9,33.595,9,33.595z"
1878
- }
1879
- ),
1880
- /* @__PURE__ */ jsxs12(
1881
- "linearGradient",
1882
- {
1883
- id: "qh2LT5tehRDFkLLfb-odWa",
1884
- x1: "9",
1885
- x2: "33.506",
1886
- y1: "364.445",
1887
- y2: "364.445",
1888
- gradientTransform: "translate(0 -339.89)",
1889
- gradientUnits: "userSpaceOnUse",
1890
- children: [
1891
- /* @__PURE__ */ jsx33("stop", { offset: "0", "stop-color": "#66c0ff" }),
1892
- /* @__PURE__ */ jsx33("stop", { offset: ".26", "stop-color": "#0094f0" })
1893
- ]
1894
- }
1895
- ),
1896
- /* @__PURE__ */ jsx33(
1897
- "path",
1898
- {
1899
- fill: "url(#qh2LT5tehRDFkLLfb-odWa)",
1900
- d: "M9,20.208c0-2.624,2.126-4.75,4.749-4.75h21.857L41,12.778v13.527 C41,28.346,39.346,30,37.306,30H15.332C11.835,30,9,32.836,9,36.333L9,20.208L9,20.208z"
1901
- }
1902
- ),
1903
- /* @__PURE__ */ jsx33(
1904
- "path",
1905
- {
1906
- fill: "#1e88e5",
1907
- "fill-opacity": ".6",
1908
- d: "M9,20.208c0-2.624,2.126-4.75,4.749-4.75h21.857L41,12.778v13.527 C41,28.346,39.346,30,37.306,30H15.332C11.835,30,9,32.836,9,36.333L9,20.208L9,20.208z"
1909
- }
1910
- ),
1911
- /* @__PURE__ */ jsx33(
1912
- "path",
1913
- {
1914
- fill: "#00e5ff",
1915
- d: "M9,10.333C9,6.836,11.835,4,15.332,4h21.975C39.346,4,41,5.654,41,7.694v5.611 C41,15.346,39.346,17,37.306,17H15.332C11.835,17,9,19.836,9,23.333C9,23.333,9,10.333,9,10.333z"
1916
- }
1917
- ),
1918
- /* @__PURE__ */ jsx33(
1919
- "path",
1920
- {
1921
- fill: "#1565c0",
1922
- d: "M7.5,23h10c1.933,0,3.5,1.567,3.5,3.5v10c0,1.933-1.567,3.5-3.5,3.5h-10C5.567,40,4,38.433,4,36.5 v-10C4,24.567,5.567,23,7.5,23z"
1923
- }
1924
- ),
1925
- /* @__PURE__ */ jsx33(
1926
- "path",
1927
- {
1928
- fill: "#fff",
1929
- d: "M18.327,26.643l-2.092,9.713l-2.501,0.002L12.5,30.529l-1.293,5.829H8.683l-2.01-9.713h2.062 l1.24,6.41l1.232-6.41h2.528l1.291,6.41l1.21-6.41L18.327,26.643L18.327,26.643z"
1930
- }
1931
- )
1932
- ]
1933
- }
1934
- );
1935
- var StandardIcon = () => /* @__PURE__ */ jsxs12(
1936
- "svg",
1937
- {
1938
- xmlns: "http://www.w3.org/2000/svg",
1939
- viewBox: "0 0 48 48",
1940
- className: "w-10 h-10",
1941
- children: [
1942
- /* @__PURE__ */ jsx33("path", { fill: "#90CAF9", d: "M40 45L8 45 8 3 30 3 40 13z" }),
1943
- /* @__PURE__ */ jsx33("path", { fill: "#E1F5FE", d: "M38.5 14L29 14 29 4.5z" })
1944
- ]
1945
- }
1946
- );
1947
- var PowerPointIcon = () => /* @__PURE__ */ jsxs12(
1948
- "svg",
1949
- {
1950
- xmlns: "http://www.w3.org/2000/svg",
1951
- viewBox: "0 0 48 48",
1952
- className: "w-10 h-10",
1953
- children: [
1954
- /* @__PURE__ */ jsx33(
1955
- "path",
1956
- {
1957
- fill: "#dc4c2c",
1958
- d: "M8,24c0,9.941,8.059,18,18,18s18-8.059,18-18H26H8z"
1959
- }
1960
- ),
1961
- /* @__PURE__ */ jsx33("path", { fill: "#f7a278", d: "M26,6v18h18C44,14.059,35.941,6,26,6z" }),
1962
- /* @__PURE__ */ jsx33("path", { fill: "#c06346", d: "M26,6C16.059,6,8,14.059,8,24h18V6z" }),
1963
- /* @__PURE__ */ jsx33(
1964
- "path",
1965
- {
1966
- fill: "#9b341f",
1967
- d: "M22.319,34H5.681C4.753,34,4,33.247,4,32.319V15.681C4,14.753,4.753,14,5.681,14h16.638 C23.247,14,24,14.753,24,15.681v16.638C24,33.247,23.247,34,22.319,34z"
1968
- }
1969
- ),
1970
- /* @__PURE__ */ jsx33(
1971
- "path",
1972
- {
1973
- fill: "#fff",
1974
- d: "M14.673,19.012H10v10h2.024v-3.521H14.3c1.876,0,3.397-1.521,3.397-3.397v-0.058 C17.697,20.366,16.343,19.012,14.673,19.012z M15.57,22.358c0,0.859-0.697,1.556-1.556,1.556h-1.99v-3.325h1.99 c0.859,0,1.556,0.697,1.556,1.556V22.358z"
1975
- }
1976
- )
1977
- ]
1978
- }
1979
- );
1980
- var TextIcon = () => /* @__PURE__ */ jsxs12(
1981
- "svg",
1982
- {
1983
- xmlns: "http://www.w3.org/2000/svg",
1984
- viewBox: "0 0 48 48",
1985
- className: "w-10 h-10",
1986
- children: [
1987
- /* @__PURE__ */ jsx33("path", { fill: "#90CAF9", d: "M40 45L8 45 8 3 30 3 40 13z" }),
1988
- /* @__PURE__ */ jsx33("path", { fill: "#E1F5FE", d: "M38.5 14L29 14 29 4.5z" }),
1989
- /* @__PURE__ */ jsx33(
1990
- "path",
1991
- {
1992
- fill: "#1976D2",
1993
- d: "M16 21H33V23H16zM16 25H29V27H16zM16 29H33V31H16zM16 33H29V35H16z"
1994
- }
1995
- )
1996
- ]
1997
- }
1998
- );
1999
- var ArchiveIcon = () => /* @__PURE__ */ jsxs12(
2000
- "svg",
2001
- {
2002
- xmlns: "http://www.w3.org/2000/svg",
2003
- zoomAndPan: "magnify",
2004
- viewBox: "0 0 75 74.999997",
2005
- preserveAspectRatio: "xMidYMid meet",
2006
- version: "1.0",
2007
- className: "w-10 h-10",
2008
- children: [
2009
- /* @__PURE__ */ jsx33("defs", { children: /* @__PURE__ */ jsx33("clipPath", { id: "273d29c8a6", children: /* @__PURE__ */ jsx33(
2010
- "path",
2011
- {
2012
- d: "M 8.90625 0 L 65.90625 0 L 65.90625 75 L 8.90625 75 Z M 8.90625 0 ",
2013
- "clip-rule": "nonzero"
2014
- }
2015
- ) }) }),
2016
- /* @__PURE__ */ jsx33("g", { "clip-path": "url(#273d29c8a6)", children: /* @__PURE__ */ jsx33(
2017
- "path",
2018
- {
2019
- fill: "#ff9100",
2020
- d: "M 65.882812 75 L 8.929688 75 L 8.929688 0 L 48.085938 0 L 65.882812 17.855469 Z M 65.882812 75 ",
2021
- "fill-opacity": "1",
2022
- "fill-rule": "nonzero"
2023
- }
2024
- ) }),
2025
- /* @__PURE__ */ jsx33(
2026
- "path",
2027
- {
2028
- fill: "#fbe9e7",
2029
- d: "M 63.214844 19.644531 L 46.304688 19.644531 L 46.304688 2.679688 Z M 63.214844 19.644531 ",
2030
- "fill-opacity": "1",
2031
- "fill-rule": "nonzero"
2032
- }
2033
- ),
2034
- /* @__PURE__ */ jsx33(
2035
- "path",
2036
- {
2037
- fill: "#ffe0b2",
2038
- d: "M 26.523438 50.59375 L 33.824219 50.59375 L 33.824219 53.570312 L 22.339844 53.570312 L 22.339844 51.410156 L 29.566406 38.789062 L 22.265625 38.789062 L 22.265625 35.796875 L 33.691406 35.796875 L 33.691406 37.910156 Z M 26.523438 50.59375 ",
2039
- "fill-opacity": "1",
2040
- "fill-rule": "nonzero"
2041
- }
2042
- ),
2043
- /* @__PURE__ */ jsx33(
2044
- "path",
2045
- {
2046
- fill: "#ffe0b2",
2047
- d: "M 36.183594 35.796875 L 39.757812 35.796875 L 39.757812 53.570312 L 36.183594 53.570312 Z M 36.183594 35.796875 ",
2048
- "fill-opacity": "1",
2049
- "fill-rule": "nonzero"
2050
- }
2051
- ),
2052
- /* @__PURE__ */ jsx33(
2053
- "path",
2054
- {
2055
- fill: "#ffe0b2",
2056
- d: "M 46.34375 47.320312 L 46.34375 53.570312 L 42.765625 53.570312 L 42.765625 35.796875 L 48.800781 35.796875 C 50.550781 35.796875 51.953125 36.34375 52.992188 37.433594 C 54.035156 38.523438 54.554688 39.9375 54.554688 41.683594 C 54.554688 43.425781 54.039062 44.796875 53.011719 45.808594 C 51.980469 46.820312 50.550781 47.320312 48.726562 47.320312 Z M 46.34375 44.332031 L 48.800781 44.332031 C 49.484375 44.332031 50.007812 44.105469 50.382812 43.660156 C 50.757812 43.210938 50.941406 42.5625 50.941406 41.707031 C 50.941406 40.816406 50.753906 40.113281 50.371094 39.585938 C 49.988281 39.0625 49.476562 38.796875 48.839844 38.789062 L 46.34375 38.789062 Z M 46.34375 44.332031 ",
2057
- "fill-opacity": "1",
2058
- "fill-rule": "nonzero"
2059
- }
2060
- )
2061
- ]
2062
- }
2063
- );
2064
- var getFileDetails = (url) => {
2065
- const extMatch = url.match(/\.([a-zA-Z0-9]+)(?:[\?#]|$)/);
2066
- const ext = extMatch ? extMatch[1].toLowerCase() : "";
2067
- let Icon = StandardIcon;
2068
- let extLabel = "FILE";
2069
- if (ext === "pdf") {
2070
- Icon = PdfIcon;
2071
- extLabel = "PDF";
2072
- } else if (["xls", "xlsx", "csv"].includes(ext)) {
2073
- Icon = ExcelIcon;
2074
- extLabel = "Excel";
2075
- } else if (["doc", "docx"].includes(ext)) {
2076
- Icon = WordIcon;
2077
- extLabel = "Word";
2078
- } else if (["ppt", "pptx"].includes(ext)) {
2079
- Icon = PowerPointIcon;
2080
- extLabel = "PowerPoint";
2081
- } else if (["txt", "rtf"].includes(ext)) {
2082
- Icon = TextIcon;
2083
- extLabel = "Text";
2084
- } else if (["zip", "rar", "7z"].includes(ext)) {
2085
- Icon = ArchiveIcon;
2086
- extLabel = "Archive";
2087
- } else if (ext) {
2088
- extLabel = ext.toUpperCase();
2089
- }
2090
- return { Icon, extLabel };
2091
- };
2092
- var DocumentNode = (props) => {
2093
- console.log("DocumentNode rendered");
2094
- console.log("props", props);
2095
- console.log("dataitem", props.dataitem);
2096
- console.log("node", props.node);
2097
- let documents = [];
2098
- if (props.dataitem && props.node.documentKey) {
2099
- const docData = getNestedValue5(props.dataitem, props.node.documentKey);
2100
- if (typeof docData === "string") {
2101
- const trimmed = docData.trim();
2102
- if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
2103
- try {
2104
- const parsed = JSON.parse(trimmed);
2105
- if (Array.isArray(parsed)) {
2106
- documents = parsed.filter(
2107
- (item) => item && item.assetUrl
2108
- );
2109
- } else if (parsed?.assetUrl) {
2110
- documents = [parsed];
2111
- }
2112
- } catch {
2113
- }
2114
- } else {
2115
- documents = [
2116
- {
2117
- assetUrl: docData
2118
- }
2119
- ];
2120
- }
2121
- } else if (Array.isArray(docData)) {
2122
- documents = docData.filter((item) => item && item.assetUrl);
2123
- } else if (docData && typeof docData === "object" && docData.assetUrl) {
2124
- documents = [docData];
2125
- }
2126
- }
2127
- const handleDownload = async (e, url, filename) => {
2128
- e.preventDefault();
2129
- try {
2130
- const response = await fetch(url);
2131
- if (!response.ok) throw new Error("Network response was not ok");
2132
- const blob = await response.blob();
2133
- const blobUrl = window.URL.createObjectURL(blob);
2134
- const link = document.createElement("a");
2135
- link.href = blobUrl;
2136
- link.download = filename;
2137
- document.body.appendChild(link);
2138
- link.click();
2139
- document.body.removeChild(link);
2140
- window.URL.revokeObjectURL(blobUrl);
2141
- } catch (error) {
2142
- console.warn("Blob download failed (possibly due to CORS), falling back to browser default navigation:", error);
2143
- window.open(url, "_blank", "noopener,noreferrer");
2144
- }
2145
- };
2146
- if (documents.length === 0) {
2147
- return /* @__PURE__ */ jsx33(Fragment6, { children: /* @__PURE__ */ jsxs12("div", { className: "py-4 px-2 bg-neutral-weak border rounded text-center flex flex-col gap-2", children: [
2148
- /* @__PURE__ */ jsx33("div", { className: "mx-auto w-10 h-10 rounded-full flex items-center justify-center bg-neutral-soft", children: /* @__PURE__ */ jsx33(
2149
- "svg",
2150
- {
2151
- className: "w-5 h-5",
2152
- fill: "none",
2153
- stroke: "currentColor",
2154
- viewBox: "0 0 24 24",
2155
- xmlns: "http://www.w3.org/2000/svg",
2156
- children: /* @__PURE__ */ jsx33(
2157
- "path",
2158
- {
2159
- strokeLinecap: "round",
2160
- strokeLinejoin: "round",
2161
- strokeWidth: "1.5",
2162
- d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"
2163
- }
2164
- )
2165
- }
2166
- ) }),
2167
- /* @__PURE__ */ jsx33("div", { className: "text-sm font-medium", children: "No documents found" }),
2168
- /* @__PURE__ */ jsx33("div", { className: "text-xs", children: "No records found. Data may be empty or not available at the moment." })
2169
- ] }) });
2170
- }
2171
- return /* @__PURE__ */ jsx33("div", { className: "", children: documents.map((doc, index) => {
2172
- const documentUrl = AssetUtility_default.resolveUrl(
2173
- props.assetBaseUrl,
2174
- doc.assetUrl
2175
- );
2176
- let documentTitle = doc.title;
2177
- if (!documentUrl) {
2178
- return null;
2179
- }
2180
- if (!documentTitle) {
2181
- try {
2182
- const pathName = new URL(documentUrl).pathname;
2183
- documentTitle = pathName.split("/").pop()?.replace(/\.[^/.]+$/, "") || "Document";
2184
- } catch {
2185
- documentTitle = documentUrl.split("/").pop()?.replace(/\.[^/.]+$/, "") || "Document";
2186
- }
2187
- }
2188
- const { Icon, extLabel } = getFileDetails(documentUrl);
2189
- const extMatch = documentUrl.match(/\.([a-zA-Z0-9]+)(?:[\?#]|$)/);
2190
- const ext = extMatch ? extMatch[1] : "";
2191
- const filename = ext ? `${documentTitle}.${ext}` : documentTitle;
2192
- return /* @__PURE__ */ jsxs12(
2193
- "div",
2194
- {
2195
- className: `flex items-center justify-between py-4 bg-default gap-4 ${index !== 0 ? "border-t" : ""}`,
2196
- children: [
2197
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center space-x-4", children: [
2198
- /* @__PURE__ */ jsx33("div", { className: "flex items-center justify-center p-2 rounded bg-neutral-soft", children: /* @__PURE__ */ jsx33(Icon, {}) }),
2199
- /* @__PURE__ */ jsx33("div", { className: "flex items-baseline space-x-2", children: /* @__PURE__ */ jsx33("h4", { className: "text-base font-semibold", children: documentTitle }) })
2200
- ] }),
2201
- /* @__PURE__ */ jsxs12(
2202
- "a",
2203
- {
2204
- href: documentUrl,
2205
- download: filename,
2206
- onClick: (e) => handleDownload(e, documentUrl, filename),
2207
- target: "_blank",
2208
- rel: "noopener noreferrer",
2209
- 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",
2210
- children: [
2211
- /* @__PURE__ */ jsxs12(
2212
- "svg",
2213
- {
2214
- className: "w-4 h-4 mr-2",
2215
- fill: "none",
2216
- stroke: "currentColor",
2217
- viewBox: "0 0 24 24",
2218
- children: [
2219
- /* @__PURE__ */ jsx33(
2220
- "path",
2221
- {
2222
- strokeLinecap: "round",
2223
- strokeLinejoin: "round",
2224
- strokeWidth: "2",
2225
- d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
2226
- }
2227
- ),
2228
- /* @__PURE__ */ jsx33(
2229
- "path",
2230
- {
2231
- strokeLinecap: "round",
2232
- strokeLinejoin: "round",
2233
- strokeWidth: "2",
2234
- d: "M12 12v5m0 0l-3-3m3 3l3-3M12 8v4"
2235
- }
2236
- )
2237
- ]
2238
- }
2239
- ),
2240
- "Download"
2241
- ]
2242
- }
2243
- )
2244
- ]
2245
- },
2246
- `${documentUrl}-${index}`
2247
- );
2248
- }) });
2249
- };
2250
- var DocumentNode_default = DocumentNode;
2251
-
2252
- // src/components/pageRenderingEngine/nodes/DivContainer.tsx
2253
- import { jsx as jsx34, jsxs as jsxs13 } from "react/jsx-runtime";
2254
- var Pagination = dynamic9(() => import("./Pagination-6OFACRMQ.mjs"), { ssr: true });
2255
- var Slider = dynamic9(() => import("./Slider-PEIVH6A5.mjs"), {
2256
- ssr: false
2257
- });
2258
- function toCamelCase(str) {
2259
- return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
2260
- }
2261
- function convertKeysToCamelCase(obj) {
2262
- if (!obj || typeof obj !== "object") return obj;
2263
- if (Array.isArray(obj)) return obj.map(convertKeysToCamelCase);
2264
- return Object.fromEntries(
2265
- Object.entries(obj).filter(([_, value]) => value !== "" && value !== void 0).map(([key, value]) => [toCamelCase(key), convertKeysToCamelCase(value)])
2266
- );
2267
- }
2268
- var getNestedValue6 = (obj, path) => {
2269
- if (!obj || !path) return void 0;
2270
- return path.split(".").reduce((current, key) => {
2271
- {
2272
- }
2273
- return current && current[key] !== void 0 ? current[key] : void 0;
2274
- }, obj);
2275
- };
2276
- function resolveAssetUrl2(fieldValue, tag) {
2277
- if (!fieldValue) {
2278
- return void 0;
2279
- }
2280
- if (typeof fieldValue === "string") {
2281
- const trimmed = fieldValue.trim();
2282
- if (trimmed.startsWith("itemassets/") || trimmed.startsWith("/itemassets/") || trimmed.startsWith("http")) {
2283
- return trimmed;
2284
- }
2285
- try {
2286
- const parsed = JSON.parse(trimmed);
2287
- return resolveAssetUrl2(parsed, tag);
2288
- } catch {
2289
- return void 0;
2290
- }
2291
- }
2292
- if (Array.isArray(fieldValue)) {
2293
- const asset = tag ? fieldValue.find(
2294
- (x) => x?.tag?.toLowerCase() === tag?.toLowerCase()
2295
- ) : fieldValue[0];
2296
- return asset?.assetUrl;
2297
- }
2298
- if (typeof fieldValue === "object" && fieldValue !== null) {
2299
- const assetObject = fieldValue;
2300
- if (assetObject.assetUrl) {
2301
- return assetObject.assetUrl;
2302
- }
2303
- }
2304
- return void 0;
2305
- }
2306
- function generateCompleteBackgroundString(layers, apiBaseUrl, dataItem) {
2307
- if (!layers || !Array.isArray(layers)) return "";
2308
- return layers.filter((layer) => layer && layer.type && layer.value).map((layer) => {
2309
- if (layer.type === "image" && typeof layer.value === "object") {
2310
- const imageValue = layer.value;
2311
- let assetUrl = imageValue.assetUrl || "";
2312
- if (layer.datafield && dataItem) {
2313
- const fieldValue = getNestedValue6(dataItem, layer.datafield);
2314
- const resolvedAssetUrl = resolveAssetUrl2(fieldValue, layer.tag);
2315
- if (resolvedAssetUrl) {
2316
- assetUrl = resolvedAssetUrl;
2317
- }
2318
- }
2319
- if (!assetUrl) {
2320
- return "";
2321
- }
2322
- const url = `url('${AssetUtility_default.resolveUrl(apiBaseUrl, assetUrl)}')`;
2323
- const repeat = layer.repeat || "no-repeat";
2324
- const position = layer.position || "center";
2325
- const size = layer.size || "auto";
2326
- const attachment = layer.attachment || "scroll";
2327
- return `${url} ${position} / ${size} ${repeat} ${attachment}`;
2328
- }
2329
- if (layer.type === "gradient" && typeof layer.value === "object") {
2330
- const gradient = layer.value;
2331
- if (!gradient.colors || !gradient.direction) {
2332
- return "";
2333
- }
2334
- const colors = gradient.colors.map(
2335
- (colorStop) => `color-mix(in srgb, ${colorStop.color}, transparent ${colorStop.transparency ?? 0}%) ${colorStop.start || "0%"}`
2336
- ).join(", ");
2337
- return `linear-gradient(${gradient.direction}, ${colors})`;
2338
- }
2339
- return "";
2340
- }).filter((bg) => bg.trim() !== "").join(", ");
2341
- }
2342
- var generateCssString = (guid, stylesObject, tabletStylesObject, mobileStylesObject) => {
2343
- const gridColumns = stylesObject?.gridTemplateColumns ? String(stylesObject.gridTemplateColumns).match(/\d+/g) ?? [] : [];
2344
- const hasGridProperties = (gridColumns?.length ?? 0) > 0;
2345
- const largeCols = hasGridProperties ? parseInt(gridColumns[0]) : 4;
2346
- const tabletColumns = hasGridProperties ? Math.ceil(parseInt(gridColumns[0]) / 2) : 2;
2347
- const mobileColumns = 1;
2348
- const cssRules = Object.entries(stylesObject || {}).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
2349
- const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
2350
- return `${cssKey}: ${value};`;
2351
- });
2352
- let css = `#${guid} {
2353
- ${cssRules.join(
2354
- "\n"
2355
- )}
2356
- transition: all 0.3s ease-in-out; }`;
2357
- if (tabletStylesObject) {
2358
- const tabletCssRules = Object.entries(tabletStylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
2359
- const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
2360
- return `${cssKey}: ${value};`;
2361
- });
2362
- if (tabletCssRules.length > 0) {
2363
- css += `
2364
- @media (max-width: 768px) {
2365
- #${guid} {
2366
- ${tabletCssRules.join("\n")}
2367
- }
2368
- }`;
2369
- }
2370
- }
2371
- if (mobileStylesObject) {
2372
- const mobileCssRules = Object.entries(mobileStylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
2373
- const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
2374
- return `${cssKey}: ${value};`;
2375
- });
2376
- if (mobileCssRules.length > 0) {
2377
- css += `
2378
- @media (max-width: 480px) {
2379
- #${guid} {
2380
- ${mobileCssRules.join("\n")}
2381
- }
2382
- }`;
2383
- }
2384
- }
2385
- const updatedTabletStyles = convertKeysToCamelCase(
2386
- tabletStylesObject
2387
- );
2388
- const updatedMobileStyles = convertKeysToCamelCase(
2389
- mobileStylesObject
2390
- );
2391
- if (hasGridProperties) {
2392
- const tabletHasGrid = tabletStylesObject?.gridTemplateColumns !== void 0 || tabletStylesObject?.["grid-template-columns"] !== void 0;
2393
- const mobileHasGrid = mobileStylesObject?.gridTemplateColumns !== void 0 || mobileStylesObject?.["grid-template-columns"] !== void 0;
2394
- if (!tabletHasGrid) {
2395
- css += `
2396
- @media (max-width: 768px) {
2397
- #${guid} {
2398
- grid-template-columns: repeat(${tabletColumns}, minmax(0, 1fr));
2399
- }
2400
- }`;
2401
- }
2402
- if (!mobileHasGrid) {
2403
- css += `
2404
- @media (max-width: 480px) {
2405
- #${guid} {
2406
- grid-template-columns: repeat(${mobileColumns}, minmax(0, 1fr));
2407
- grid-column: unset;
2408
- column-gap: unset;
2409
- }
2410
- }`;
2411
- }
2412
- }
2413
- return {
2414
- css,
2415
- gridColsLarge: largeCols,
2416
- gridColsMedium: tabletColumns,
2417
- gridColsSmall: mobileColumns
2418
- };
2419
- };
2420
- var DivContainer = async (props) => {
2421
- const NodeTypes2 = {
2422
- paragraph: ParagraphNode_default,
2423
- heading: HeadingNode_default,
2424
- list: ListNode_default,
2425
- quote: QuoteNode_default,
2426
- code: CodeNode_default,
2427
- image: ImageNode_default,
2428
- "image-gallery": ImageGalleryNode_default,
2429
- horizontalrule: HorizontalRuleNode_default,
2430
- widget: WidgetNode_default,
2431
- embed: EmbedNode_default,
2432
- "div-container": DivContainer,
2433
- text: TextNode_default,
2434
- datafield: DatafieldNode_default,
2435
- "svg-icon": SVGIconNode_default,
2436
- document: DocumentNode_default
2437
- };
2438
- const styles = props.node.cssProperties;
2439
- const mobileStyles = props.node.mobileCssProperties;
2440
- const tabletStyles = props.node.tabletCssProperties;
2441
- const dataBindingProperties = props.node.dataBinding;
2442
- const updatedStyles = convertKeysToCamelCase(styles);
2443
- let containerPaddingClass = "";
2444
- if (props.node.containerPadding == "small") {
2445
- containerPaddingClass = "container-small";
2446
- } else if (props.node.containerPadding == "large") {
2447
- containerPaddingClass = "container-large";
2448
- }
2449
- {
2450
- }
2451
- const updatedStyle = { ...updatedStyles };
2452
- const guid = "css" + crypto.randomUUID().toLocaleLowerCase();
2453
- const animationSelector = `#${guid}`;
2454
- const { enterAnimation, exitAnimation, hoverAnimation } = props.node;
2455
- let animationCSS = "";
2456
- if (enterAnimation?.name) {
2457
- animationCSS += AnimationUtility_default.generateAnimationCSS(
2458
- {
2459
- animation: enterAnimation.name,
2460
- mode: "enter",
2461
- ...enterAnimation.properties
2462
- },
2463
- animationSelector
2464
- );
2465
- }
2466
- if (hoverAnimation?.name) {
2467
- animationCSS += AnimationUtility_default.generateAnimationCSS(
2468
- {
2469
- animation: hoverAnimation.name,
2470
- mode: "hover",
2471
- ...hoverAnimation.properties
2472
- },
2473
- animationSelector
2474
- );
2475
- }
2476
- const isHidden = !shouldRenderContainer(
2477
- {
2478
- visibility: props.node.visibility,
2479
- roleCode: props.node.roleCode,
2480
- fieldVisibleOnTrue: props.node.fieldVisibleOnTrue
2481
- },
2482
- props.dataitem,
2483
- props.session
2484
- );
2485
- let odataString = void 0;
2486
- let endpoint = void 0;
2487
- let result = null;
2488
- let response = null;
2489
- let childCollectionData = null;
2490
- if (dataBindingProperties) {
2491
- const serviceClient = new ServiceClient_default(props.apiBaseUrl, props.session);
2492
- endpoint = dataBindingProperties.dataSource;
2493
- {
2494
- }
2495
- endpoint = endpoint.replace(/\{(\w+)\}/g, (_, key) => {
2496
- return props.routeParameters?.[key] ?? `{${key}}`;
2497
- });
2498
- if (dataBindingProperties.applyODataParams) {
2499
- odataString = OdataBuilder.getOdataQueryString(props.query);
2500
- if (odataString) {
2501
- const separator = endpoint.includes("?") ? "&" : "?";
2502
- endpoint += separator + odataString;
2503
- }
2504
- }
2505
- response = await serviceClient.get(endpoint);
2506
- result = response?.result;
2507
- if (dataBindingProperties.showNoResultsMessage && (result === void 0 || result.length == 0)) {
2508
- return /* @__PURE__ */ jsx34(NoDataFound_default, {});
2509
- }
2510
- if (dataBindingProperties.childCollectionName && props.dataitem) {
2511
- childCollectionData = getNestedValue6(
2512
- props.dataitem,
2513
- dataBindingProperties.childCollectionName
2514
- );
2515
- }
2516
- }
2517
- const cssResult = generateCssString(
2518
- guid,
2519
- updatedStyle,
2520
- tabletStyles,
2521
- mobileStyles
2522
- );
2523
- function renderNode(node, props2, dataitem, key, href) {
2524
- {
2525
- }
2526
- const SelectedNode = NodeTypes2[node.type];
2527
- if (!SelectedNode) return null;
2528
- return /* @__PURE__ */ jsx34(React22.Fragment, { children: /* @__PURE__ */ jsx34(
2529
- SelectedNode,
2530
- {
2531
- node,
2532
- parentTag: Wrapper,
2533
- routeParameters: props2.routeParameters,
2534
- query: props2.query,
2535
- session: props2.session,
2536
- host: props2.host,
2537
- path: props2.path,
2538
- apiBaseUrl: props2.apiBaseUrl,
2539
- breadcrumb: props2.breadcrumb,
2540
- dataitem,
2541
- href,
2542
- assetBaseUrl: props2.assetBaseUrl,
2543
- device: props2.device,
2544
- widgetRenderer: props2.widgetRenderer
2545
- }
2546
- ) }, key);
2547
- }
2548
- function renderChildren(nodes, props2, data, key, href) {
2549
- if (!nodes) return null;
2550
- const childNodes = nodes.map((node, index) => {
2551
- if (
2552
- // @ts-expect-error custom code
2553
- node.type === "div-container" && node.dataBinding?.childCollectionName && data
2554
- ) {
2555
- return renderNode(node, props2, data, index, href);
2556
- }
2557
- return renderNode(node, props2, data, index, href);
2558
- });
2559
- return childNodes;
2560
- }
2561
- function queryObjectToString(query) {
2562
- if (!query) return "";
2563
- return Object.entries(query).map(
2564
- ([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
2565
- ).join("&");
2566
- }
2567
- function resolveHrefTemplate(template, dataItem) {
2568
- return template.replace(/\{([^}]+)\}/g, (match, key) => {
2569
- return dataItem[key] !== void 0 ? dataItem[key] : match;
2570
- });
2571
- }
2572
- const dataToRender = (() => {
2573
- if (childCollectionData && Array.isArray(childCollectionData)) {
2574
- return childCollectionData;
2575
- }
2576
- if (result && props.node.dataBinding?.responseType === "array") {
2577
- return result;
2578
- }
2579
- if (result && props.node.dataBinding?.responseType === "object") {
2580
- return [result];
2581
- }
2582
- return [props.dataitem];
2583
- })();
2584
- const backgroundDataItem = dataToRender.length > 0 ? dataToRender[0] : props.dataitem;
2585
- const background = generateCompleteBackgroundString(
2586
- props.node.backgroundLayers,
2587
- props.assetBaseUrl,
2588
- backgroundDataItem
2589
- );
2590
- const backgroundStyle = background && background !== "" ? { background } : {};
2591
- const combinedStyles = {
2592
- ...backgroundStyle
2593
- };
2594
- if (props.node.enableBackgroundClipText) {
2595
- combinedStyles.WebkitBackgroundClip = "text";
2596
- combinedStyles.backgroundClip = "text";
2597
- }
2598
- const renderLink = result && props.node.dataBinding?.responseType === "array" ? true : false;
2599
- {
2600
- }
2601
- let Wrapper;
2602
- let wrapperProps;
2603
- let noLinkColor = false;
2604
- switch (true) {
2605
- case props.node.componentProperties?.type === "slider":
2606
- Wrapper = Slider;
2607
- const largeCols = props.node.componentProperties?.columns || 4;
2608
- const slidesToShow = {
2609
- large: largeCols,
2610
- medium: Math.ceil(largeCols / 2),
2611
- small: 1
2612
- };
2613
- wrapperProps = {
2614
- ...props.node.componentProperties,
2615
- slidesToShow
2616
- };
2617
- break;
2618
- case !!(props.node.href || props.href):
2619
- Wrapper = Link;
2620
- let href = props.node.href || props.href;
2621
- if (href?.includes("{")) {
2622
- href = resolveHrefTemplate(href, props.dataitem);
2623
- }
2624
- const currentPath = decodeURIComponent(
2625
- PathUtility_default.removeTrailingSlash(props.path) + "?" + queryObjectToString(props.query)
2626
- );
2627
- const resolvedHref = decodeURIComponent(href || "");
2628
- const isSelected = currentPath === resolvedHref;
2629
- noLinkColor = true;
2630
- wrapperProps = {
2631
- href,
2632
- "data-isselected": isSelected,
2633
- "data-path": currentPath,
2634
- "data-href": resolvedHref
2635
- };
2636
- break;
2637
- default: {
2638
- const replacementTag = props.node.replaceDivTagWith;
2639
- const allowedTags = ["div", "section", "article", "details", "summary"];
2640
- if (replacementTag && allowedTags.includes(replacementTag)) {
2641
- {
2642
- }
2643
- Wrapper = replacementTag;
2644
- } else {
2645
- Wrapper = "div";
2646
- }
2647
- wrapperProps = {};
2648
- break;
2649
- }
2650
- }
2651
- if (isHidden) {
2652
- return null;
2653
- }
2654
- const classNames = [
2655
- containerPaddingClass,
2656
- props.node.autoFormat && "auto-format",
2657
- props.node.bgClass,
2658
- noLinkColor && "no-link-color",
2659
- !!props.node.enterAnimation && "enter-animation"
2660
- ].filter(Boolean).join(" ");
2661
- return /* @__PURE__ */ jsxs13(React22.Fragment, { children: [
2662
- /* @__PURE__ */ jsx34(
2663
- "style",
2664
- {
2665
- dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS }
2666
- }
2667
- ),
2668
- /* @__PURE__ */ jsx34(
2669
- Wrapper,
2670
- {
2671
- id: guid,
2672
- style: combinedStyles,
2673
- className: classNames || void 0,
2674
- ...wrapperProps,
2675
- children: dataToRender.map(
2676
- (item, idx) => item?.links?.view && renderLink ? renderChildren(
2677
- props.node.children,
2678
- props,
2679
- item,
2680
- idx,
2681
- props.href ? void 0 : item?.links?.view
2682
- )?.map((child, i) => /* @__PURE__ */ jsx34(React22.Fragment, { children: child }, i)) : renderChildren(props.node.children, props, item, idx)
2683
- )
2684
- }
2685
- ),
2686
- dataBindingProperties && props.node.dataBinding.enablePagination && /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsx34(
2687
- Pagination,
2688
- {
2689
- path: props.path,
2690
- query: props.query,
2691
- dataset: response
2692
- }
2693
- ) })
2694
- ] });
2695
- };
2696
- var DivContainer_default = DivContainer;
2697
-
2698
- // src/components/pageRenderingEngine/PageBodyRenderer.tsx
2699
- import { jsx as jsx35 } from "react/jsx-runtime";
2700
- var NodeTypes = {
2701
- ["paragraph"]: ParagraphNode_default,
2702
- ["heading"]: HeadingNode_default,
2703
- ["list"]: ListNode_default,
2704
- ["quote"]: QuoteNode_default,
2705
- ["code"]: CodeNode_default,
2706
- ["image"]: ImageNode_default,
2707
- ["image-gallery"]: ImageGalleryNode_default,
2708
- ["horizontalrule"]: HorizontalRuleNode_default,
2709
- ["widget"]: WidgetNode_default,
2710
- // ["form-container"]: FormContainerNode,
2711
- ["div-container"]: DivContainer_default,
2712
- ["svg-icon"]: SVGIconNode_default,
2713
- ["embed"]: EmbedNode_default,
2714
- ["document"]: DocumentNode_default
2715
- };
2716
- var PageBodyRenderer = (props) => {
2717
- let pageBodyTree;
2718
- if (props.rawBody != void 0 && props.rawBody != null && props.rawBody != "") {
2719
- try {
2720
- pageBodyTree = JSON.parse(props.rawBody.toString());
2721
- } catch (error) {
2722
- }
2723
- }
2724
- let rootNode;
2725
- if (pageBodyTree && pageBodyTree.root) {
2726
- rootNode = pageBodyTree.root;
2727
- }
2728
- const shouldRenderNode = (node) => {
2729
- {
2730
- }
2731
- if (node.type === "div-container" && node.roleCode) {
2732
- return validateRoleVisibility(node.roleCode, props.session?.oAuthToken);
2733
- }
2734
- return true;
2735
- };
2736
- return /* @__PURE__ */ jsx35(React23.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
2737
- {
2738
- }
2739
- const SelectedNode = NodeTypes[node.type];
2740
- if (!shouldRenderNode(node)) {
2741
- return null;
2742
- }
2743
- return /* @__PURE__ */ jsx35(React23.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx35(React23.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ jsx35(React23.Fragment, { children: /* @__PURE__ */ jsx35(
2744
- SelectedNode,
2745
- {
2746
- node,
2747
- firstNode: true,
2748
- routeParameters: props.routeParameters,
2749
- query: props.query,
2750
- session: props.session,
2751
- host: props.host,
2752
- path: props.path,
2753
- apiBaseUrl: props.apiBaseUrl,
2754
- serviceClient: props.serviceClient,
2755
- assetBaseUrl: props.assetBaseUrl,
2756
- device: props.device,
2757
- widgetRenderer: props.widgetRenderer
2758
- }
2759
- ) }) : /* @__PURE__ */ jsx35(React23.Fragment, { children: /* @__PURE__ */ jsx35(
2760
- SelectedNode,
2761
- {
2762
- node,
2763
- routeParameters: props.routeParameters,
2764
- query: props.query,
2765
- session: props.session,
2766
- host: props.host,
2767
- path: props.path,
2768
- apiBaseUrl: props.apiBaseUrl,
2769
- serviceClient: props.serviceClient,
2770
- assetBaseUrl: props.assetBaseUrl,
2771
- device: props.device,
2772
- widgetRenderer: props.widgetRenderer
2773
- }
2774
- ) }) }) }, index);
2775
- }) });
2776
- };
2777
- var PageBodyRenderer_default = PageBodyRenderer;
2778
- export {
2779
- PageBodyRenderer_default as PageBodyRenderer,
2780
- ViewControl_default as ViewControl,
2781
- ViewControlTypes_default as ViewControlTypes
2782
- };