tee3apps-cms-sdk-react 0.0.20 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/index.js +3 -3
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +3 -3
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/src/Page.tsx +2 -2
  7. package/src/PageComponents/BoxComponent.tsx +123 -25
  8. package/src/PageComponents/Visual-Components/CarouselComponent.tsx +300 -167
  9. package/src/PageComponents/Visual-Components/GroupBrandComponent.tsx +396 -390
  10. package/src/PageComponents/Visual-Components/GroupCategoryComponent.tsx +21 -13
  11. package/src/PageComponents/Visual-Components/GroupImageList.tsx +642 -668
  12. package/src/PageComponents/Visual-Components/GroupProductComponent.tsx +46 -20
  13. package/src/PageComponents/Visual-Components/GroupVideoList.tsx +693 -589
  14. package/src/PageComponents/Visual-Components/ImageComponent.tsx +74 -18
  15. package/src/PageComponents/Visual-Components/LottieComponent.tsx +14 -8
  16. package/src/PageComponents/Visual-Components/NavigationComponent.tsx +74 -27
  17. package/src/PageComponents/Visual-Components/RichTextComponent.tsx +1 -1
  18. package/src/PageComponents/Visual-Components/TabComponent.tsx +1624 -876
  19. package/src/PageComponents/Visual-Components/TextComponent.tsx +24 -10
  20. package/src/PageComponents/Visual-Components/VideoComponent.tsx +33 -11
  21. package/src/PageComponents/Visual-Components/tab.css +645 -611
  22. package/src/index.css +126 -81
  23. package/src/Components/BoxRenderer.tsx +0 -108
  24. package/src/Components/ComponentRenderer.tsx +0 -29
  25. package/src/Components/ImageComponent.tsx +0 -68
  26. package/src/Components/RowComponent.tsx +0 -66
  27. package/src/Components/TextComponent.tsx +0 -47
@@ -77,33 +77,36 @@ const ImageComponent: React.FC<ImageComponentMainProps> = ({
77
77
  case 'PRODUCT': {
78
78
  const pdType = element.product?.pd_type;
79
79
  const code =
80
- element.product?.pd_id?.code ||
81
- element.product?.code ||
80
+ element.product?.pd_id?.code ??
81
+ element.product?.code ??
82
82
  element.product?.product_data?.code;
83
83
 
84
- if (!code) return null;
84
+ // Check for empty string as well as null/undefined
85
+ if (!code || code === '') return null;
85
86
 
86
87
  return pdType === 'VARIANT'
87
- ? `/variant/${code}`
88
- : `model/${code}`;
88
+ ? `/${code}`
89
+ : `/model/${code}`;
89
90
  }
90
91
 
91
92
  case 'TAG': {
92
- const tagCode = element.tag?.code;
93
- if (!tagCode) return null;
93
+ const tagCode = element.tag?.code;
94
+ // Check for empty string as well as null/undefined
95
+ if (!tagCode || tagCode === '') return null;
94
96
  // return `/${tagCode}/s?type=tag`;
95
97
  return `/tag/${tagCode}`;
96
98
  }
97
99
 
98
100
  case 'PAGE': {
99
- const pageId = element.page?._id || element.page?.code;
101
+ const pageId = element.page?._id ?? element.page?.code;
100
102
  const pgType = element.page?.pg_type;
101
- if (!pageId || !pgType) return null;
103
+ // Check for empty string as well as null/undefined
104
+ if (!pageId || pageId === '' || !pgType || pgType === '') return null;
102
105
  return `/page/${pageId}?type=${pgType}`;
103
106
  }
104
107
 
105
108
  default:
106
- return element.slug || null;
109
+ return element.slug ?? null;
107
110
  }
108
111
  };
109
112
 
@@ -124,15 +127,47 @@ const ImageComponent: React.FC<ImageComponentMainProps> = ({
124
127
  const currentMode = getCurrentMode();
125
128
  const containerHeight = boxHeight === 'auto' ? 'auto' : boxHeight;
126
129
  const link = bannerLink(props);
127
- const imageUrl = `${Linodeurl}${props.images?.url || props.images?.all?.url}`;
128
- const altText = props.images.alt || '';
130
+
131
+ // Use nullish coalescing to safely access image properties
132
+ const imageUrl = `${Linodeurl}${props.images?.url ?? props.images?.all?.url ?? ''}`;
133
+ const altText = props.images?.alt ?? props.images?.all?.alt ?? '';
134
+
135
+ // Don't render if no image URL is available
136
+ if (!props.images || (!props.images?.url && !props.images?.all?.url)) {
137
+ return (
138
+ <div
139
+ className="image-box"
140
+ style={{
141
+ borderRadius: `${currentMode?.borderRadius ?? 0}px`,
142
+ height: containerHeight,
143
+ overflow: 'hidden',
144
+ display: 'flex',
145
+ alignItems: 'center',
146
+ justifyContent: 'center',
147
+ backgroundColor: '#f0f0f0',
148
+ color: '#999',
149
+ fontSize: '14px'
150
+ }}
151
+ >
152
+ No image available
153
+ </div>
154
+ );
155
+ }
129
156
 
130
157
  const imageElement = (
131
158
  <img
132
159
  src={imageUrl}
133
160
  alt={altText}
134
161
  className="fitted-image"
135
- style={{ cursor: link ? 'pointer' : 'default' }}
162
+ style={{
163
+ cursor: link ? 'pointer' : 'default',
164
+ objectFit: 'fill',
165
+ width: '100%',
166
+ height: '100%',
167
+ display: 'block',
168
+ minWidth: 0,
169
+ minHeight: 0
170
+ }}
136
171
  />
137
172
  );
138
173
 
@@ -140,21 +175,42 @@ const ImageComponent: React.FC<ImageComponentMainProps> = ({
140
175
  <div
141
176
  className="image-box"
142
177
  style={{
143
- borderRadius: `${currentMode.borderRadius}px`,
144
- height: containerHeight,
178
+ borderRadius: `${currentMode?.borderRadius ?? 0}px`,
179
+ height: containerHeight === 'auto' ? '100%' : containerHeight,
180
+ width: '100%',
145
181
  overflow: 'hidden',
182
+ position: 'relative'
146
183
  }}
147
184
  >
148
185
  {link ? (
149
186
  <a
150
187
  href={link}
151
- target={props?.linktype=='EXTERNAL' ? props?.link?.target :'_self'}
152
- style={{ display: 'block', width: '100%', height: '100%' }}
188
+ target={props?.linktype === 'EXTERNAL' ? props?.link?.target ?? '_blank' : '_self'}
189
+ style={{
190
+ display: 'block',
191
+ width: '100%',
192
+ height: '100%',
193
+ position: 'absolute',
194
+ top: 0,
195
+ left: 0,
196
+ right: 0,
197
+ bottom: 0
198
+ }}
153
199
  >
154
200
  {imageElement}
155
201
  </a>
156
202
  ) : (
157
- imageElement
203
+ <div style={{
204
+ width: '100%',
205
+ height: '100%',
206
+ position: 'absolute',
207
+ top: 0,
208
+ left: 0,
209
+ right: 0,
210
+ bottom: 0
211
+ }}>
212
+ {imageElement}
213
+ </div>
158
214
  )}
159
215
  </div>
160
216
  );
@@ -73,8 +73,8 @@ const LottieComponent: React.FC<LottieComponentMainProps> = ({ props, deviceMode
73
73
  if (!code) return null;
74
74
 
75
75
  return pdType === 'VARIANT'
76
- ? `/${code}/s?type=variant`
77
- : `/${code}/s?type=model`;
76
+ ? `/${code}`
77
+ : `/model/${code}`;
78
78
  }
79
79
 
80
80
  case 'TAG': {
@@ -155,8 +155,8 @@ const LottieComponent: React.FC<LottieComponentMainProps> = ({ props, deviceMode
155
155
  >
156
156
  <div
157
157
  style={{
158
- width: '100%',
159
- height: '100%',
158
+ width: currentMode.width,
159
+ height: currentMode.height,
160
160
  display: 'inline-block',
161
161
  backgroundColor: 'white',
162
162
  cursor: isClickable ? 'pointer' : 'default',
@@ -168,7 +168,10 @@ const LottieComponent: React.FC<LottieComponentMainProps> = ({ props, deviceMode
168
168
  animationData={animationData}
169
169
  loop={currentMode.loop}
170
170
  autoplay={currentMode.autoplay}
171
- style={{ width: '100%', height: '100%' }}
171
+ style={{
172
+ width: currentMode.width,
173
+ height: currentMode.height
174
+ }}
172
175
  />
173
176
  )}
174
177
  {!animationData && !error && (
@@ -182,8 +185,8 @@ const LottieComponent: React.FC<LottieComponentMainProps> = ({ props, deviceMode
182
185
  ):(
183
186
  <div
184
187
  style={{
185
- width: '100%',
186
- height: '100%',
188
+ width: currentMode.width,
189
+ height: currentMode.height,
187
190
  display: 'inline-block',
188
191
  backgroundColor: 'white',
189
192
  cursor: isClickable ? 'pointer' : 'default',
@@ -195,7 +198,10 @@ const LottieComponent: React.FC<LottieComponentMainProps> = ({ props, deviceMode
195
198
  animationData={animationData}
196
199
  loop={currentMode.loop}
197
200
  autoplay={currentMode.autoplay}
198
- style={{ width: '100%', height: '100%' }}
201
+ style={{
202
+ width: currentMode.width,
203
+ height: currentMode.height
204
+ }}
199
205
  />
200
206
  )}
201
207
  {!animationData && !error && (
@@ -1,13 +1,13 @@
1
1
  import React from 'react'
2
2
 
3
3
  interface NavTitle {
4
- all: string
4
+ all?: string
5
5
  }
6
6
 
7
7
  interface NavItem {
8
8
  nl_id?: string
9
9
  id?: string
10
- title: any
10
+ title: NavTitle | string
11
11
  url?: string
12
12
  target?: string
13
13
  framename?: string
@@ -46,17 +46,66 @@ interface NavigationComponentMainProps {
46
46
 
47
47
  const NavigationComponent: React.FC<NavigationComponentMainProps> = ({ props, boxHeight }) => {
48
48
  const root = props.navData?.[0]
49
- const topItems: NavItem[] = root?.children || []
50
49
 
51
50
  const [openId, setOpenId] = React.useState<string | null>(null)
52
51
 
53
- const buildHref = (item: NavItem) => item.url || '#'
54
-
55
52
  const Item = ({ item, depth = 0, isRoot = false }: { item: NavItem; depth?: number; isRoot?: boolean }) => {
56
53
  const hasChildren = Array.isArray(item.children) && item.children.length > 0
57
54
  const isTop = depth === 0 && !isRoot
58
55
  const layer = isRoot ? props.styles.primary : (isTop ? props.styles.primary : props.styles.secondary)
59
56
 
57
+ // Get title text - handle both string and object formats
58
+ const getTitle = () => {
59
+ if (typeof item.title === 'string') {
60
+ return item.title
61
+ }
62
+ return item.title?.all || ''
63
+ }
64
+
65
+ // Handle navigation/redirecting
66
+ const handleNavigation = (e: React.MouseEvent) => {
67
+ if (!item.url) return
68
+
69
+ e.preventDefault()
70
+ e.stopPropagation()
71
+
72
+ const target = item.target || '_self'
73
+ const framename = item.framename || ''
74
+
75
+ if (target === '_framename') {
76
+ if (framename) {
77
+ // Navigate to a specific frame by name
78
+ // Try to find iframe element by name attribute first
79
+ const frameElement = document.querySelector(`iframe[name="${framename}"]`) as HTMLIFrameElement
80
+ if (frameElement) {
81
+ frameElement.src = item.url
82
+ } else {
83
+ // Try window.frames (for frameset-based frames)
84
+ const frames = window.frames as any
85
+ const frame = frames[framename]
86
+ if (frame) {
87
+ frame.location.href = item.url
88
+ } else {
89
+ // Fallback to opening in new window with framename
90
+ window.open(item.url, framename)
91
+ }
92
+ }
93
+ } else {
94
+ // If framename is empty, fallback to _self
95
+ window.location.href = item.url
96
+ }
97
+ } else if (target === '_blank') {
98
+ // Open in new tab/window
99
+ window.open(item.url, '_blank', 'noopener,noreferrer')
100
+ } else if (target === '_self' || !target) {
101
+ // Navigate in same window
102
+ window.location.href = item.url
103
+ } else {
104
+ // Custom target (could be a frame name or window name)
105
+ window.open(item.url, target)
106
+ }
107
+ }
108
+
60
109
  const baseStyles: React.CSSProperties = {
61
110
  display: 'flex',
62
111
  alignItems: 'center',
@@ -70,8 +119,13 @@ const NavigationComponent: React.FC<NavigationComponentMainProps> = ({ props, bo
70
119
  fontSize: isRoot ? 16 : (isTop ? 14 : 13),
71
120
  borderBottom: layer.isSeparator && !isTop && !isRoot ? `1px solid ${layer.color.separator}` : 'none',
72
121
  borderRadius: isRoot ? 8 : (isTop ? 6 : 4),
73
- cursor: 'pointer',
74
- fontWeight: isRoot ? 'bold' : 'normal'
122
+ cursor: item.url ? 'pointer' : (hasChildren ? 'pointer' : 'default'),
123
+ fontWeight: isRoot ? 'bold' : 'normal',
124
+ ...(isRoot && {
125
+ border: `1px solid ${layer.color.separator || '#e0e0e0'}`,
126
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
127
+ transition: 'all 0.2s ease-in-out'
128
+ })
75
129
  }
76
130
 
77
131
  const [hover, setHover] = React.useState(false)
@@ -84,34 +138,35 @@ const NavigationComponent: React.FC<NavigationComponentMainProps> = ({ props, bo
84
138
  >
85
139
  {isRoot ? (
86
140
  <div
141
+ onClick={item.url ? handleNavigation : undefined}
87
142
  style={{
88
143
  ...baseStyles,
89
144
  background: hover ? layer.colorHover.background : layer.color.background,
90
145
  color: hover ? layer.colorHover.text : layer.color.text,
91
- cursor: 'default'
146
+ cursor: item.url || hasChildren ? 'pointer' : 'default',
147
+ boxShadow: hover ? '0 4px 8px rgba(0,0,0,0.15)' : '0 2px 4px rgba(0,0,0,0.1)'
92
148
  }}
93
149
  >
94
- <span>{item?.title}</span>
150
+ <span>{getTitle()}</span>
95
151
  {hasChildren && (
96
152
  <span style={{ color: layer.color.arrow || layer.color.text }}>{'▾'}</span>
97
153
  )}
98
154
  </div>
99
155
  ) : (
100
- <a
101
- href={buildHref(item)}
102
- target={item.target || '_self'}
103
- rel={item.target === '_blank' ? 'noopener noreferrer' : undefined}
156
+ <div
157
+ onClick={item.url ? handleNavigation : undefined}
104
158
  style={{
105
159
  ...baseStyles,
106
160
  background: hover ? layer.colorHover.background : layer.color.background,
107
- color: hover ? layer.colorHover.text : layer.color.text
161
+ color: hover ? layer.colorHover.text : layer.color.text,
162
+ cursor: item.url || hasChildren ? 'pointer' : 'default'
108
163
  }}
109
164
  >
110
- <span>{item?.title}</span>
165
+ <span>{getTitle()}</span>
111
166
  {hasChildren && (
112
167
  <span style={{ color: layer.color.arrow || layer.color.text }}>{isTop ? '▾' : '›'}</span>
113
168
  )}
114
- </a>
169
+ </div>
115
170
  )}
116
171
 
117
172
 
@@ -152,16 +207,11 @@ const NavigationComponent: React.FC<NavigationComponentMainProps> = ({ props, bo
152
207
  return (
153
208
  <nav
154
209
  style={{
155
- width: '100%',
156
- display: 'flex',
210
+ display: 'inline-flex',
157
211
  alignItems: 'start',
158
- paddingTop: '5px',
159
- paddingLeft:'10px',
212
+ padding: '5px 10px',
160
213
  margin: '0px',
161
- background: props.styles.primary.color.background,
162
- borderRadius: 8,
163
- overflow: 'visible',
164
- height: boxHeight
214
+ overflow: 'visible'
165
215
  }}
166
216
  >
167
217
  {/* Render root node first */}
@@ -173,6 +223,3 @@ const NavigationComponent: React.FC<NavigationComponentMainProps> = ({ props, bo
173
223
  }
174
224
 
175
225
  export default NavigationComponent
176
-
177
-
178
-
@@ -7,7 +7,7 @@ export interface RichTextComponentProps {
7
7
  }
8
8
 
9
9
  const RichTextComponent: React.FC<{ props: RichTextComponentProps }> = ({ props }) => {
10
- const htmlContent = props?.content?.all || '';
10
+ const htmlContent = props?.content?.all || props?.content;
11
11
 
12
12
  return (
13
13
  <div