tee3apps-cms-sdk-react 0.0.1

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 (43) hide show
  1. package/.env +11 -0
  2. package/README.md +255 -0
  3. package/dist/index.d.ts +5 -0
  4. package/dist/index.js +13 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +13 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +33 -0
  9. package/rollup.config.js +43 -0
  10. package/src/Components/BoxRenderer.tsx +108 -0
  11. package/src/Components/ComponentRenderer.tsx +29 -0
  12. package/src/Components/ImageComponent.tsx +68 -0
  13. package/src/Components/RowComponent.tsx +66 -0
  14. package/src/Components/TextComponent.tsx +47 -0
  15. package/src/ErrorBoundary.tsx +35 -0
  16. package/src/Page.tsx +124 -0
  17. package/src/PageComponents/BoxComponent.tsx +397 -0
  18. package/src/PageComponents/RowComponent.tsx +113 -0
  19. package/src/PageComponents/Visual-Components/CarouselComponent.tsx +366 -0
  20. package/src/PageComponents/Visual-Components/GroupBrandComponent.tsx +391 -0
  21. package/src/PageComponents/Visual-Components/GroupCategoryComponent.tsx +425 -0
  22. package/src/PageComponents/Visual-Components/GroupImageList.tsx +669 -0
  23. package/src/PageComponents/Visual-Components/GroupProductComponent.tsx +671 -0
  24. package/src/PageComponents/Visual-Components/GroupVideoList.tsx +590 -0
  25. package/src/PageComponents/Visual-Components/ImageComponent.tsx +163 -0
  26. package/src/PageComponents/Visual-Components/LinkComponent.tsx +68 -0
  27. package/src/PageComponents/Visual-Components/LottieComponent.tsx +213 -0
  28. package/src/PageComponents/Visual-Components/NavigationComponent.tsx +178 -0
  29. package/src/PageComponents/Visual-Components/Styles/ProductListViewOne.tsx +102 -0
  30. package/src/PageComponents/Visual-Components/Styles/ProductListViewTwo.tsx +104 -0
  31. package/src/PageComponents/Visual-Components/Styles/product-list-view-one.css +166 -0
  32. package/src/PageComponents/Visual-Components/Styles/product-list-view-two.css +182 -0
  33. package/src/PageComponents/Visual-Components/TabComponent.tsx +1169 -0
  34. package/src/PageComponents/Visual-Components/TextComponent.tsx +114 -0
  35. package/src/PageComponents/Visual-Components/VideoComponent.tsx +191 -0
  36. package/src/PageComponents/Visual-Components/tab.css +697 -0
  37. package/src/common.interface.ts +216 -0
  38. package/src/const.ts +6 -0
  39. package/src/env.d.ts +15 -0
  40. package/src/index.css +82 -0
  41. package/src/index.ts +2 -0
  42. package/src/types.ts +234 -0
  43. package/tsconfig.json +20 -0
@@ -0,0 +1,102 @@
1
+ import React from "react";
2
+ import "./product-list-view-one.css";
3
+ import { Linodeurl } from '../../../const';
4
+
5
+ const ProductListViewOne = (props: any) => {
6
+ const [target, setTarget] = React.useState("_blank");
7
+ console.warn(props)
8
+ React.useEffect(() => {
9
+ if (typeof window !== "undefined") {
10
+ if (window.matchMedia("(display-mode: standalone)").matches) {
11
+ setTarget("_self");
12
+ }
13
+ if (
14
+ /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
15
+ navigator.userAgent
16
+ )
17
+ ) {
18
+ setTarget("_self");
19
+ }
20
+ }
21
+ }, []);
22
+
23
+ const data = props.props || props;
24
+ const slug = data?._id; // Using code instead of slug
25
+
26
+ // Updated price extraction to match your JSON structure
27
+ const sellingPrice = Number(data?.price?.SP?.$numberDecimal || 0);
28
+ const mrpPrice = Number(data?.price?.MRP?.$numberDecimal || 0);
29
+
30
+ const calculateDiscount = (): number | null => {
31
+ if (!sellingPrice || !mrpPrice || mrpPrice <= sellingPrice) return null;
32
+ return Math.round(100 - (sellingPrice / mrpPrice) * 100);
33
+ };
34
+
35
+ const discount = calculateDiscount();
36
+
37
+ // Extract variant options for display
38
+ const getVariantOptions = () => {
39
+ if (!data?.variant) return "";
40
+ return data.variant
41
+ .map((v: any) => v.valueId?.name?.displayName || v.valueId?.name?.all || "")
42
+ .filter(Boolean)
43
+ .join(" • ");
44
+ };
45
+
46
+ const variantOptions = getVariantOptions();
47
+
48
+ return (
49
+ <div className="card">
50
+ <a href={`/${slug}`} target={target}>
51
+ <div className="card_grid">
52
+ <div className="card_top">
53
+ <img
54
+ src={`${Linodeurl}${data?.image?.all?.url || data?.image?.url}`}
55
+ alt={data?.name?.all || data?.name}
56
+ className="product_image"
57
+ />
58
+ </div>
59
+ <div className="card_bottom">
60
+ <div className="cardname">
61
+ <h3>{data?.name?.all || data?.name}</h3>
62
+ <h5>{variantOptions}</h5>
63
+ </div>
64
+ <div className="card_value">
65
+ {sellingPrice !== 0 && (
66
+ <div className="card_price">
67
+ <h4>₹{sellingPrice.toLocaleString("en-IN")}</h4>
68
+ <div className="card_right_grid">
69
+ {mrpPrice > sellingPrice && (
70
+ <p >₹{mrpPrice.toLocaleString("en-IN")}</p>
71
+ )}
72
+ {discount !== null && discount > 0 && (
73
+ <span>({discount}% OFF)</span>
74
+ )}
75
+ </div>
76
+ </div>
77
+ )}
78
+ <div className="review_counts">
79
+ <svg
80
+ xmlns="http://www.w3.org/2000/svg"
81
+ viewBox="0 0 20 20"
82
+ fill="#f46b27"
83
+ width="13"
84
+ height="13"
85
+ >
86
+ <path d="M10 15l-5.878 3.09 1.122-6.545L.488 6.91l6.562-.955L10 0l2.95 5.955 6.562.955-4.756 4.635 1.122 6.545z" />
87
+ </svg>
88
+ <p>{data?.starrating}</p>
89
+ <span>({data?.startRatingCount} Reviews)</span>
90
+ </div>
91
+ {/* {Number(data?.starrating) && Number(data?.startRatingCount) && (
92
+
93
+ )} */}
94
+ </div>
95
+ </div>
96
+ </div>
97
+ </a>
98
+ </div>
99
+ );
100
+ };
101
+
102
+ export default ProductListViewOne;
@@ -0,0 +1,104 @@
1
+ import React from "react";
2
+ import "./product-list-view-two.css";
3
+ import { Linodeurl } from '../../../const';
4
+
5
+ const ProductListViewTwo = (props: any) => {
6
+ console.warn(props);
7
+ const [target, setTarget] = React.useState("_blank");
8
+
9
+ React.useEffect(() => {
10
+ if (typeof window !== "undefined") {
11
+ if (window.matchMedia("(display-mode: standalone)").matches) {
12
+ setTarget("_self");
13
+ }
14
+ if (
15
+ /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
16
+ navigator.userAgent
17
+ )
18
+ ) {
19
+ setTarget("_self");
20
+ }
21
+ }
22
+ }, []);
23
+
24
+ const data = props.props || props;
25
+ const slug = data?._id; // Using code instead of slug since slug doesn't exist in your data
26
+
27
+ // Updated price extraction to match your JSON structure
28
+ const sellingPrice = Number(data?.price?.SP?.$numberDecimal || 0);
29
+ const mrpPrice = Number(data?.price?.MRP?.$numberDecimal || 0);
30
+
31
+ const calculateDiscount = () => {
32
+ if (!sellingPrice || !mrpPrice || mrpPrice <= sellingPrice) return null;
33
+ return Math.round(100 - (sellingPrice / mrpPrice) * 100);
34
+ };
35
+
36
+ const discount = calculateDiscount();
37
+
38
+ // Extract variant options for display
39
+ // const getVariantOptions = () => {
40
+ // if (!data?.variant) return "";
41
+ // return data.variant
42
+ // .map((v: any) => v.valueId?.name || v.valueId?.name || "")
43
+ // .filter(Boolean)
44
+ // .join(" • ");
45
+ // };
46
+
47
+ // const variantOptions = getVariantOptions();
48
+
49
+ return (
50
+ <div className="card">
51
+ <a href={`/${slug}`} target={target} rel="noopener noreferrer">
52
+ <div className="card_content">
53
+
54
+
55
+ <div className="card_middle">
56
+ <img
57
+ src={`${Linodeurl}${data?.image?.all?.url || data?.image?.url}`}
58
+ alt={data?.name?.all || data?.name}
59
+ className="product_image"
60
+ />
61
+
62
+ </div>
63
+ <div className="card_top">
64
+ <h3 className="product_name">{data?.name?.all || data?.name}</h3>
65
+ <h5 className="product_option">{data?.code}</h5>
66
+ </div>
67
+ <div className="card_bottom">
68
+ <div className="price_container">
69
+ {sellingPrice !== 0 && (
70
+ <>
71
+ <div className="price_row">
72
+ <h4 className="selling_price">₹{sellingPrice.toLocaleString("en-IN")}</h4>
73
+ {discount !== null && discount > 0 && (
74
+ <span className="discounts">{discount}% OFF</span>
75
+ )}
76
+ </div>
77
+ {mrpPrice > sellingPrice && (
78
+ <p className="save_amount">Save ₹{(mrpPrice - sellingPrice).toLocaleString("en-IN")}</p>
79
+ )}
80
+ </>
81
+ )}
82
+ </div>
83
+
84
+ <div className="review_container">
85
+ <div className="rating">
86
+ <svg
87
+ xmlns="http://www.w3.org/2000/svg"
88
+ viewBox="0 0 20 20"
89
+ width="14"
90
+ height="14"
91
+ >
92
+ <path d="M10 15l-5.878 3.09 1.122-6.545L.488 6.91l6.562-.955L10 0l2.95 5.955 6.562.955-4.756 4.635 1.122 6.545z" />
93
+ </svg>
94
+ <span className="rating_value">{data?.starrating}</span>
95
+ </div>
96
+ </div>
97
+ </div>
98
+ </div>
99
+ </a>
100
+ </div>
101
+ );
102
+ };
103
+
104
+ export default ProductListViewTwo;
@@ -0,0 +1,166 @@
1
+ .card a {
2
+ text-decoration: none;
3
+ }
4
+ .card {
5
+ border: 1px solid #e5e7eb;
6
+ border-radius: 8px;
7
+ overflow: hidden;
8
+ transition: all 0.3s ease;
9
+ background: white;
10
+ margin-bottom: 16px;
11
+ text-decoration: none;
12
+ }
13
+
14
+ .card:hover {
15
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
16
+ transform: translateY(-2px);
17
+ }
18
+
19
+ .card_grid {
20
+ grid-template-columns: 140px 1fr;
21
+ gap: 16px;
22
+ padding: 16px;
23
+ flex: flex;
24
+ flex-direction: column;
25
+ }
26
+
27
+ .card_top {
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ }
32
+
33
+ .card_top img {
34
+ width: 140px;
35
+ height: 140px;
36
+ object-fit: contain;
37
+ }
38
+ .card_bottom {
39
+ padding: 12px;
40
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
41
+ background-color: #fff;
42
+ text-decoration: none;
43
+ flex: flex;
44
+ flex-direction: column;
45
+ width: 260px; /* Adjust as needed */
46
+ box-sizing: border-box;
47
+ }
48
+
49
+ .card_bottom h3 {
50
+ font-size: 16px;
51
+ font-weight: 600;
52
+ margin: 0 0 4px;
53
+ color: #212121;
54
+ white-space: nowrap;
55
+ overflow: hidden;
56
+ text-overflow: ellipsis;
57
+ text-decoration: none;
58
+
59
+ }
60
+
61
+ .card_bottom h5 {
62
+ font-size: 14px;
63
+ color: #757575;
64
+ margin: 0 0 10px;
65
+ }
66
+
67
+ .card_bottom h4 {
68
+ font-size: 20px;
69
+ color: #212121;
70
+ margin: 0;
71
+ font-weight: 700;
72
+ }
73
+ .card_value {
74
+ position: relative;
75
+ }
76
+ .card_right_grid {
77
+ display: flex;
78
+ align-items: center;
79
+ gap: 8px;
80
+ margin-top: 4px;
81
+ }
82
+
83
+ .card_right_grid p {
84
+ font-size: 14px;
85
+ color: #9e9e9e;
86
+ text-decoration: line-through;
87
+ margin: 0;
88
+ }
89
+
90
+ .card_right_grid span {
91
+ font-size: 14px;
92
+ color: #388e3c;
93
+ font-weight: 600;
94
+ }
95
+
96
+ .review_counts {
97
+ position: absolute;
98
+ top: 0px; /* Adjust as needed */
99
+ right: -140px; /* Adjust as needed */
100
+ display: flex;
101
+ align-items: center;
102
+ gap: 4px;
103
+ padding: 4px 8px;
104
+ border-radius: 4px;
105
+ font-size: 12px;
106
+ z-index: 2; /* Ensure it appears above other elements */
107
+ }
108
+
109
+ .review_count p {
110
+ font-size: 14px;
111
+ font-weight: 600;
112
+ color: #f46b27;
113
+ margin: 0;
114
+ }
115
+
116
+ .review_count span {
117
+ font-size: 12px;
118
+ color: #757575;
119
+ }
120
+
121
+
122
+ .review_count {
123
+ display: flex;
124
+ align-items: center;
125
+ gap: 8px;
126
+ margin-top: 12px;
127
+ }
128
+
129
+ /* .review_count svg {
130
+ margin-right: 4px;
131
+ } */
132
+
133
+ @media (max-width: 768px) {
134
+ .card_grid {
135
+ grid-template-columns: 100px 1fr;
136
+ gap: 12px;
137
+ padding: 12px;
138
+ }
139
+
140
+ .card_left img {
141
+ width: 100px;
142
+ height: 100px;
143
+ }
144
+
145
+ .card_right h3 {
146
+ font-size: 14px;
147
+ }
148
+
149
+ .card_right h5 {
150
+ font-size: 12px;
151
+ }
152
+
153
+ .card_bottom h4 {
154
+ font-size: 16px;
155
+ }
156
+
157
+ .card_right_grid p{
158
+ font-size: 12px;
159
+ text-decoration: line-through;
160
+ /* text-decoration: dashed; */
161
+
162
+ }
163
+ .card_right_grid span {
164
+ font-size: 12px;
165
+ }
166
+ }
@@ -0,0 +1,182 @@
1
+ .card a {
2
+ text-decoration: none;
3
+ color: inherit;
4
+ }
5
+
6
+ .card {
7
+ border: 1px solid #e5e7eb;
8
+ border-radius: 8px;
9
+ overflow: hidden;
10
+ transition: all 0.3s ease;
11
+ background: white;
12
+ margin-bottom: 16px;
13
+ text-decoration: none;
14
+ display: flex;
15
+ flex-direction: column;
16
+ height: 100%;
17
+ }
18
+
19
+ .card:hover {
20
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
21
+ transform: translateY(-2px);
22
+ }
23
+
24
+ .card_content {
25
+ display: flex;
26
+ flex-direction: column;
27
+ height: 100%;
28
+ padding: 16px;
29
+ }
30
+
31
+ .card_top {
32
+ margin-bottom: 12px;
33
+ text-align: center;
34
+ flex: flex;
35
+ flex-direction: column;
36
+ }
37
+
38
+ .product_name {
39
+ font-size: 16px;
40
+ font-weight: 600;
41
+ margin: 0 0 4px;
42
+ color: #212121;
43
+ white-space: nowrap;
44
+ overflow: hidden;
45
+ text-overflow: ellipsis;
46
+ line-height: 1.3;
47
+ max-width: 250px;
48
+ }
49
+
50
+ .product_option {
51
+ font-size: 14px;
52
+ color: #757575;
53
+ margin: 0;
54
+ line-height: 1.3;
55
+ max-width: 250px;
56
+
57
+ }
58
+
59
+ .card_middle {
60
+ display: flex;
61
+ align-items: center;
62
+ justify-content: center;
63
+ margin: 12px 0;
64
+ flex-grow: 1;
65
+ }
66
+
67
+ .product_image {
68
+ width: 140px;
69
+ height: 140px;
70
+ object-fit: contain;
71
+ }
72
+
73
+ .card_bottom {
74
+ display: flex;
75
+ flex-direction: row;
76
+ justify-content: space-between;
77
+ align-items: flex-start;
78
+ flex-wrap: wrap;
79
+ gap: 8px;
80
+ }
81
+
82
+ .price_container {
83
+ display: flex;
84
+ flex-direction: column;
85
+ gap: 4px;
86
+ }
87
+
88
+ .price_row {
89
+ display: flex;
90
+ align-items: center;
91
+ gap: 8px;
92
+ flex-wrap: wrap;
93
+ }
94
+
95
+ .selling_price {
96
+ font-size: 22px;
97
+ color: #212121;
98
+ font-weight: 700;
99
+ margin: 0;
100
+ }
101
+
102
+ .mrp_price {
103
+ font-size: 14px;
104
+ color: #9e9e9e;
105
+ text-decoration: line-through;
106
+ margin: 0;
107
+ }
108
+
109
+ .discounts {
110
+ background-color: #139307;
111
+ color: #000000;
112
+ font-size: 12px;
113
+ font-weight: 600;
114
+ padding: 2px 6px;
115
+ border-radius: 4px;
116
+ }
117
+
118
+ .save_amount {
119
+ font-size: 12px;
120
+ color: #9e9e9e;
121
+ margin-top: -4px;
122
+ }
123
+
124
+ .review_container {
125
+ display: flex;
126
+ align-items: center;
127
+ gap: 4px;
128
+ margin-top: 4px;
129
+ }
130
+
131
+ .rating {
132
+ display: flex;
133
+ align-items: center;
134
+ gap: 2px;
135
+ }
136
+
137
+ .rating svg {
138
+ fill: #008f00; /* Green star */
139
+ }
140
+
141
+ .rating_value {
142
+ font-size: 14px;
143
+ font-weight: 600;
144
+ color: #000000;
145
+ }
146
+
147
+
148
+ @media (max-width: 768px) {
149
+ .card_content {
150
+ padding: 12px;
151
+ }
152
+
153
+ .product_name {
154
+ font-size: 14px;
155
+ }
156
+
157
+ .product_option {
158
+ font-size: 12px;
159
+ }
160
+
161
+ .product_image {
162
+ width: 100px;
163
+ height: 100px;
164
+ }
165
+
166
+ .selling_price {
167
+ font-size: 16px;
168
+ }
169
+
170
+ .mrp_price,
171
+ .discount {
172
+ font-size: 12px;
173
+ }
174
+
175
+ .rating_value {
176
+ font-size: 12px;
177
+ }
178
+
179
+ .review_count {
180
+ font-size: 11px;
181
+ }
182
+ }