pdf-catalog-generator 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +343 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +342 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import React$1 from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
interface ProductData {
|
|
5
5
|
[key: string]: string | number | boolean | null | undefined;
|
|
6
6
|
}
|
|
7
|
-
type TemplateType = 'template1' | 'template2' | 'template3' | 'template4';
|
|
7
|
+
type TemplateType = 'template1' | 'template2' | 'template3' | 'template4' | 'template5' | 'template6';
|
|
8
8
|
interface CatalogConfig {
|
|
9
9
|
products: ProductData[];
|
|
10
10
|
companyLogo?: string | null;
|
|
@@ -80,6 +80,10 @@ declare const Template3: React.FC<TemplateProps>;
|
|
|
80
80
|
|
|
81
81
|
declare const Template4: React.FC<TemplateProps>;
|
|
82
82
|
|
|
83
|
+
declare const Template5: React$1.FC<TemplateProps>;
|
|
84
|
+
|
|
85
|
+
declare const Template6: React$1.FC<TemplateProps>;
|
|
86
|
+
|
|
83
87
|
/**
|
|
84
88
|
* Format field name to human-readable label
|
|
85
89
|
* Examples:
|
|
@@ -133,7 +137,7 @@ declare function getDescriptionField(product: ProductData): string | null;
|
|
|
133
137
|
* List of known field names (lowercase) that should be excluded from dynamic field display
|
|
134
138
|
* These are the common fields that templates typically handle specially
|
|
135
139
|
*/
|
|
136
|
-
declare const KNOWN_FIELD_NAMES_LOWER: readonly ["image", "imageurl", "img", "photo", "picture", "title", "name", "productname", "description", "details", "info", "desc", "price", "cost", "amount", "rating", "stars", "score", "link", "url", "producturl", "href"];
|
|
140
|
+
declare const KNOWN_FIELD_NAMES_LOWER: readonly ["image", "imageurl", "img", "photo", "picture", "title", "name", "productname", "description", "details", "info", "desc", "price", "cost", "amount", "rating", "stars", "score", "link", "url", "producturl", "href", "image2", "imageurl2", "img2", "photo2", "picture2"];
|
|
137
141
|
/**
|
|
138
142
|
* Extracted product fields for template rendering
|
|
139
143
|
*/
|
|
@@ -255,4 +259,4 @@ declare const DEFAULT_TEMPLATE_CONFIG: TemplateConfig;
|
|
|
255
259
|
*/
|
|
256
260
|
declare function mergeTemplateConfig(config?: Partial<TemplateConfig>): TemplateConfig;
|
|
257
261
|
|
|
258
|
-
export { type CatalogConfig, DEFAULT_TEMPLATE_CONFIG, type ExtractedFields, KNOWN_FIELD_NAMES_LOWER, type ProductData, Template1, Template2, Template3, Template4, type TemplateConfig, type TemplateProps, type TemplateType, dynamicFieldStyles, extractProductFields, formatFieldName, generateProductCatalog, getDescriptionField, getDisplayFields, getFieldValue, getImageUrl, getLinkField, getPriceField, getRatingField, getTitleField, hasValue, mergeTemplateConfig, parseCSVBuffer, parseCSVFile, parseExcelFile, parseJSON, renderBuyButton, renderDynamicFields, renderPrice, renderRating };
|
|
262
|
+
export { type CatalogConfig, DEFAULT_TEMPLATE_CONFIG, type ExtractedFields, KNOWN_FIELD_NAMES_LOWER, type ProductData, Template1, Template2, Template3, Template4, Template5, Template6, type TemplateConfig, type TemplateProps, type TemplateType, dynamicFieldStyles, extractProductFields, formatFieldName, generateProductCatalog, getDescriptionField, getDisplayFields, getFieldValue, getImageUrl, getLinkField, getPriceField, getRatingField, getTitleField, hasValue, mergeTemplateConfig, parseCSVBuffer, parseCSVFile, parseExcelFile, parseJSON, renderBuyButton, renderDynamicFields, renderPrice, renderRating };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import React$1 from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
interface ProductData {
|
|
5
5
|
[key: string]: string | number | boolean | null | undefined;
|
|
6
6
|
}
|
|
7
|
-
type TemplateType = 'template1' | 'template2' | 'template3' | 'template4';
|
|
7
|
+
type TemplateType = 'template1' | 'template2' | 'template3' | 'template4' | 'template5' | 'template6';
|
|
8
8
|
interface CatalogConfig {
|
|
9
9
|
products: ProductData[];
|
|
10
10
|
companyLogo?: string | null;
|
|
@@ -80,6 +80,10 @@ declare const Template3: React.FC<TemplateProps>;
|
|
|
80
80
|
|
|
81
81
|
declare const Template4: React.FC<TemplateProps>;
|
|
82
82
|
|
|
83
|
+
declare const Template5: React$1.FC<TemplateProps>;
|
|
84
|
+
|
|
85
|
+
declare const Template6: React$1.FC<TemplateProps>;
|
|
86
|
+
|
|
83
87
|
/**
|
|
84
88
|
* Format field name to human-readable label
|
|
85
89
|
* Examples:
|
|
@@ -133,7 +137,7 @@ declare function getDescriptionField(product: ProductData): string | null;
|
|
|
133
137
|
* List of known field names (lowercase) that should be excluded from dynamic field display
|
|
134
138
|
* These are the common fields that templates typically handle specially
|
|
135
139
|
*/
|
|
136
|
-
declare const KNOWN_FIELD_NAMES_LOWER: readonly ["image", "imageurl", "img", "photo", "picture", "title", "name", "productname", "description", "details", "info", "desc", "price", "cost", "amount", "rating", "stars", "score", "link", "url", "producturl", "href"];
|
|
140
|
+
declare const KNOWN_FIELD_NAMES_LOWER: readonly ["image", "imageurl", "img", "photo", "picture", "title", "name", "productname", "description", "details", "info", "desc", "price", "cost", "amount", "rating", "stars", "score", "link", "url", "producturl", "href", "image2", "imageurl2", "img2", "photo2", "picture2"];
|
|
137
141
|
/**
|
|
138
142
|
* Extracted product fields for template rendering
|
|
139
143
|
*/
|
|
@@ -255,4 +259,4 @@ declare const DEFAULT_TEMPLATE_CONFIG: TemplateConfig;
|
|
|
255
259
|
*/
|
|
256
260
|
declare function mergeTemplateConfig(config?: Partial<TemplateConfig>): TemplateConfig;
|
|
257
261
|
|
|
258
|
-
export { type CatalogConfig, DEFAULT_TEMPLATE_CONFIG, type ExtractedFields, KNOWN_FIELD_NAMES_LOWER, type ProductData, Template1, Template2, Template3, Template4, type TemplateConfig, type TemplateProps, type TemplateType, dynamicFieldStyles, extractProductFields, formatFieldName, generateProductCatalog, getDescriptionField, getDisplayFields, getFieldValue, getImageUrl, getLinkField, getPriceField, getRatingField, getTitleField, hasValue, mergeTemplateConfig, parseCSVBuffer, parseCSVFile, parseExcelFile, parseJSON, renderBuyButton, renderDynamicFields, renderPrice, renderRating };
|
|
262
|
+
export { type CatalogConfig, DEFAULT_TEMPLATE_CONFIG, type ExtractedFields, KNOWN_FIELD_NAMES_LOWER, type ProductData, Template1, Template2, Template3, Template4, Template5, Template6, type TemplateConfig, type TemplateProps, type TemplateType, dynamicFieldStyles, extractProductFields, formatFieldName, generateProductCatalog, getDescriptionField, getDisplayFields, getFieldValue, getImageUrl, getLinkField, getPriceField, getRatingField, getTitleField, hasValue, mergeTemplateConfig, parseCSVBuffer, parseCSVFile, parseExcelFile, parseJSON, renderBuyButton, renderDynamicFields, renderPrice, renderRating };
|
package/dist/index.js
CHANGED
|
@@ -151,7 +151,12 @@ var KNOWN_FIELD_NAMES_LOWER = [
|
|
|
151
151
|
"link",
|
|
152
152
|
"url",
|
|
153
153
|
"producturl",
|
|
154
|
-
"href"
|
|
154
|
+
"href",
|
|
155
|
+
"image2",
|
|
156
|
+
"imageurl2",
|
|
157
|
+
"img2",
|
|
158
|
+
"photo2",
|
|
159
|
+
"picture2"
|
|
155
160
|
];
|
|
156
161
|
function extractProductFields(product, options = {}) {
|
|
157
162
|
const { maxDynamicFields, excludeFields = [] } = options;
|
|
@@ -201,12 +206,12 @@ var dynamicFieldStyles = renderer.StyleSheet.create({
|
|
|
201
206
|
flexShrink: 1
|
|
202
207
|
}
|
|
203
208
|
});
|
|
204
|
-
function renderDynamicFields(fields,
|
|
209
|
+
function renderDynamicFields(fields, styles8) {
|
|
205
210
|
if (fields.length === 0) return null;
|
|
206
|
-
const containerStyle =
|
|
207
|
-
const rowStyle =
|
|
208
|
-
const labelStyle =
|
|
209
|
-
const valueStyle =
|
|
211
|
+
const containerStyle = styles8?.container || { marginBottom: 8 };
|
|
212
|
+
const rowStyle = styles8?.row || dynamicFieldStyles.detailRow;
|
|
213
|
+
const labelStyle = styles8?.label || dynamicFieldStyles.detailLabel;
|
|
214
|
+
const valueStyle = styles8?.value || dynamicFieldStyles.detailValue;
|
|
210
215
|
return /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: containerStyle, children: fields.map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: rowStyle, children: [
|
|
211
216
|
/* @__PURE__ */ jsxRuntime.jsxs(renderer.Text, { style: labelStyle, children: [
|
|
212
217
|
formatFieldName(key),
|
|
@@ -664,6 +669,311 @@ var Template4 = ({
|
|
|
664
669
|
};
|
|
665
670
|
var Template4_default = Template4;
|
|
666
671
|
var styles5 = renderer.StyleSheet.create({
|
|
672
|
+
page: {
|
|
673
|
+
width: "100%",
|
|
674
|
+
height: "100%",
|
|
675
|
+
position: "relative",
|
|
676
|
+
backgroundColor: "#FFFFFF",
|
|
677
|
+
flexDirection: "column"
|
|
678
|
+
},
|
|
679
|
+
header: {
|
|
680
|
+
height: 80,
|
|
681
|
+
display: "flex",
|
|
682
|
+
flexDirection: "row",
|
|
683
|
+
alignItems: "center",
|
|
684
|
+
paddingHorizontal: 30,
|
|
685
|
+
paddingTop: 20,
|
|
686
|
+
paddingBottom: 10,
|
|
687
|
+
borderBottomWidth: 1,
|
|
688
|
+
borderBottomColor: "#E0E0E0",
|
|
689
|
+
marginBottom: 10
|
|
690
|
+
},
|
|
691
|
+
logo: {
|
|
692
|
+
height: 50,
|
|
693
|
+
marginRight: 20,
|
|
694
|
+
objectFit: "contain"
|
|
695
|
+
},
|
|
696
|
+
companyName: {
|
|
697
|
+
fontSize: 24,
|
|
698
|
+
fontWeight: "bold",
|
|
699
|
+
color: "#333333",
|
|
700
|
+
letterSpacing: 1
|
|
701
|
+
},
|
|
702
|
+
contentContainer: {
|
|
703
|
+
flex: 1,
|
|
704
|
+
flexDirection: "row",
|
|
705
|
+
paddingHorizontal: 30,
|
|
706
|
+
paddingBottom: 30,
|
|
707
|
+
gap: 20
|
|
708
|
+
},
|
|
709
|
+
imageSection: {
|
|
710
|
+
flex: 2,
|
|
711
|
+
flexDirection: "row",
|
|
712
|
+
gap: 15
|
|
713
|
+
},
|
|
714
|
+
imageWrapper: {
|
|
715
|
+
flex: 1,
|
|
716
|
+
height: "100%",
|
|
717
|
+
backgroundColor: "#F9F9F9",
|
|
718
|
+
borderRadius: 4,
|
|
719
|
+
overflow: "hidden"
|
|
720
|
+
},
|
|
721
|
+
productImage: {
|
|
722
|
+
width: "100%",
|
|
723
|
+
height: "100%",
|
|
724
|
+
objectFit: "cover"
|
|
725
|
+
},
|
|
726
|
+
detailsSection: {
|
|
727
|
+
flex: 1,
|
|
728
|
+
backgroundColor: "#F5F5F5",
|
|
729
|
+
padding: 20,
|
|
730
|
+
borderRadius: 8,
|
|
731
|
+
justifyContent: "center"
|
|
732
|
+
},
|
|
733
|
+
productTitle: {
|
|
734
|
+
fontSize: 18,
|
|
735
|
+
fontWeight: "bold",
|
|
736
|
+
color: "#222222",
|
|
737
|
+
marginBottom: 15,
|
|
738
|
+
borderBottomWidth: 2,
|
|
739
|
+
borderBottomColor: "#333333",
|
|
740
|
+
paddingBottom: 5
|
|
741
|
+
},
|
|
742
|
+
dynamicFieldsContainer: {
|
|
743
|
+
gap: 8
|
|
744
|
+
},
|
|
745
|
+
detailRow: {
|
|
746
|
+
flexDirection: "row",
|
|
747
|
+
marginBottom: 6,
|
|
748
|
+
borderBottomWidth: 1,
|
|
749
|
+
borderBottomColor: "#E0E0E0",
|
|
750
|
+
paddingBottom: 4
|
|
751
|
+
},
|
|
752
|
+
detailLabel: {
|
|
753
|
+
fontSize: 10,
|
|
754
|
+
fontWeight: "bold",
|
|
755
|
+
color: "#555555",
|
|
756
|
+
width: "40%"
|
|
757
|
+
},
|
|
758
|
+
detailValue: {
|
|
759
|
+
fontSize: 10,
|
|
760
|
+
color: "#333333",
|
|
761
|
+
flex: 1,
|
|
762
|
+
flexWrap: "wrap"
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
function getImage2Url(product) {
|
|
766
|
+
const image2Fields = ["image2", "imageurl2", "img2", "photo2", "picture2"];
|
|
767
|
+
for (const field of image2Fields) {
|
|
768
|
+
const value = product[field];
|
|
769
|
+
if (value && typeof value === "string" && value.trim() !== "") {
|
|
770
|
+
return value;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
return null;
|
|
774
|
+
}
|
|
775
|
+
var Template5 = ({
|
|
776
|
+
products,
|
|
777
|
+
companyLogo,
|
|
778
|
+
companyName
|
|
779
|
+
}) => {
|
|
780
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: products.map((product, index) => {
|
|
781
|
+
const { imageUrl, title, dynamicFields } = extractProductFields(product);
|
|
782
|
+
const image2Url = getImage2Url(product);
|
|
783
|
+
const secondImage = image2Url || imageUrl;
|
|
784
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles5.page, children: [
|
|
785
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles5.header, children: [
|
|
786
|
+
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles5.logo, src: companyLogo }),
|
|
787
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles5.companyName, children: companyName })
|
|
788
|
+
] }),
|
|
789
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles5.contentContainer, children: [
|
|
790
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles5.imageSection, children: [
|
|
791
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles5.imageWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles5.productImage, src: imageUrl }) }),
|
|
792
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles5.imageWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles5.productImage, src: secondImage }) })
|
|
793
|
+
] }),
|
|
794
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles5.detailsSection, children: [
|
|
795
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles5.productTitle, children: title }),
|
|
796
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles5.dynamicFieldsContainer, children: renderDynamicFields(dynamicFields, {
|
|
797
|
+
row: styles5.detailRow,
|
|
798
|
+
label: styles5.detailLabel,
|
|
799
|
+
value: styles5.detailValue
|
|
800
|
+
}) })
|
|
801
|
+
] })
|
|
802
|
+
] }),
|
|
803
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { break: true })
|
|
804
|
+
] }, index);
|
|
805
|
+
}) });
|
|
806
|
+
};
|
|
807
|
+
var Template5_default = Template5;
|
|
808
|
+
var styles6 = renderer.StyleSheet.create({
|
|
809
|
+
page: {
|
|
810
|
+
width: "100%",
|
|
811
|
+
height: "100%",
|
|
812
|
+
flexDirection: "row",
|
|
813
|
+
backgroundColor: "#FFFFFF"
|
|
814
|
+
},
|
|
815
|
+
leftColumn: {
|
|
816
|
+
width: "50%",
|
|
817
|
+
height: "100%",
|
|
818
|
+
position: "relative",
|
|
819
|
+
borderRightWidth: 1,
|
|
820
|
+
borderRightColor: "#E0E0E0"
|
|
821
|
+
},
|
|
822
|
+
rightColumn: {
|
|
823
|
+
width: "50%",
|
|
824
|
+
height: "100%",
|
|
825
|
+
display: "flex",
|
|
826
|
+
flexDirection: "column",
|
|
827
|
+
position: "relative"
|
|
828
|
+
},
|
|
829
|
+
imageFull: {
|
|
830
|
+
width: "100%",
|
|
831
|
+
height: "100%",
|
|
832
|
+
objectFit: "cover"
|
|
833
|
+
},
|
|
834
|
+
rightImageContainer: {
|
|
835
|
+
flex: 1,
|
|
836
|
+
width: "100%",
|
|
837
|
+
position: "relative",
|
|
838
|
+
justifyContent: "center",
|
|
839
|
+
alignItems: "center",
|
|
840
|
+
padding: 20
|
|
841
|
+
},
|
|
842
|
+
rightImage: {
|
|
843
|
+
width: "100%",
|
|
844
|
+
height: "100%",
|
|
845
|
+
objectFit: "contain"
|
|
846
|
+
},
|
|
847
|
+
specsOverlay: {
|
|
848
|
+
position: "absolute",
|
|
849
|
+
bottom: 40,
|
|
850
|
+
// Lifted slightly from absolute bottom
|
|
851
|
+
right: 0,
|
|
852
|
+
backgroundColor: "#FFFFFF",
|
|
853
|
+
padding: 15,
|
|
854
|
+
width: "65%",
|
|
855
|
+
// Takes up a good chunk of the corner
|
|
856
|
+
borderTopLeftRadius: 4,
|
|
857
|
+
borderBottomLeftRadius: 4,
|
|
858
|
+
shadowColor: "#000",
|
|
859
|
+
shadowOpacity: 0.2,
|
|
860
|
+
shadowRadius: 3,
|
|
861
|
+
borderWidth: 1,
|
|
862
|
+
borderColor: "#EEEEEE"
|
|
863
|
+
},
|
|
864
|
+
specsHeader: {
|
|
865
|
+
flexDirection: "row",
|
|
866
|
+
alignItems: "center",
|
|
867
|
+
marginBottom: 10,
|
|
868
|
+
borderBottomWidth: 1,
|
|
869
|
+
borderBottomColor: "#333",
|
|
870
|
+
paddingBottom: 5
|
|
871
|
+
},
|
|
872
|
+
miniLogo: {
|
|
873
|
+
width: 20,
|
|
874
|
+
height: 20,
|
|
875
|
+
objectFit: "contain",
|
|
876
|
+
marginRight: 8
|
|
877
|
+
},
|
|
878
|
+
designNumber: {
|
|
879
|
+
fontSize: 12,
|
|
880
|
+
fontWeight: "bold",
|
|
881
|
+
color: "#000"
|
|
882
|
+
},
|
|
883
|
+
footer: {
|
|
884
|
+
height: 100,
|
|
885
|
+
backgroundColor: "#1A1A1A",
|
|
886
|
+
flexDirection: "row",
|
|
887
|
+
alignItems: "center",
|
|
888
|
+
justifyContent: "flex-end",
|
|
889
|
+
paddingHorizontal: 30,
|
|
890
|
+
width: "100%"
|
|
891
|
+
},
|
|
892
|
+
footerContent: {
|
|
893
|
+
flexDirection: "row",
|
|
894
|
+
alignItems: "center"
|
|
895
|
+
},
|
|
896
|
+
footerLogo: {
|
|
897
|
+
width: 40,
|
|
898
|
+
height: 40,
|
|
899
|
+
objectFit: "contain",
|
|
900
|
+
marginRight: 15,
|
|
901
|
+
backgroundColor: "#FFF",
|
|
902
|
+
// White background for logo visibility
|
|
903
|
+
padding: 2,
|
|
904
|
+
borderRadius: 2
|
|
905
|
+
},
|
|
906
|
+
footerText: {
|
|
907
|
+
color: "#FFFFFF",
|
|
908
|
+
fontSize: 14,
|
|
909
|
+
fontWeight: "bold",
|
|
910
|
+
letterSpacing: 1,
|
|
911
|
+
textTransform: "uppercase"
|
|
912
|
+
},
|
|
913
|
+
// Custom styles for dynamic fields in the overlay
|
|
914
|
+
fieldRow: {
|
|
915
|
+
flexDirection: "row",
|
|
916
|
+
marginBottom: 4
|
|
917
|
+
},
|
|
918
|
+
fieldLabel: {
|
|
919
|
+
fontSize: 9,
|
|
920
|
+
fontWeight: "bold",
|
|
921
|
+
color: "#333",
|
|
922
|
+
width: "40%"
|
|
923
|
+
},
|
|
924
|
+
fieldValue: {
|
|
925
|
+
fontSize: 9,
|
|
926
|
+
color: "#555",
|
|
927
|
+
flex: 1
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
function getImage2Url2(product) {
|
|
931
|
+
const image2Fields = ["image2", "imageurl2", "img2", "photo2", "picture2"];
|
|
932
|
+
for (const field of image2Fields) {
|
|
933
|
+
const value = product[field];
|
|
934
|
+
if (value && typeof value === "string" && value.trim() !== "") {
|
|
935
|
+
return value;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
return null;
|
|
939
|
+
}
|
|
940
|
+
var Template6 = ({
|
|
941
|
+
products,
|
|
942
|
+
companyLogo,
|
|
943
|
+
companyName
|
|
944
|
+
}) => {
|
|
945
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: products.map((product, index) => {
|
|
946
|
+
const { imageUrl, title, dynamicFields } = extractProductFields(product);
|
|
947
|
+
const image2Url = getImage2Url2(product);
|
|
948
|
+
const secondImage = image2Url || imageUrl;
|
|
949
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles6.page, children: [
|
|
950
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles6.leftColumn, children: [
|
|
951
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles6.imageFull, src: imageUrl }),
|
|
952
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles6.specsOverlay, children: [
|
|
953
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles6.specsHeader, children: [
|
|
954
|
+
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles6.miniLogo, src: companyLogo }),
|
|
955
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles6.designNumber, children: title || "Specifications" })
|
|
956
|
+
] }),
|
|
957
|
+
renderDynamicFields(dynamicFields, {
|
|
958
|
+
row: styles6.fieldRow,
|
|
959
|
+
label: styles6.fieldLabel,
|
|
960
|
+
value: styles6.fieldValue
|
|
961
|
+
})
|
|
962
|
+
] })
|
|
963
|
+
] }),
|
|
964
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles6.rightColumn, children: [
|
|
965
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles6.rightImageContainer, children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles6.rightImage, src: secondImage }) }),
|
|
966
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles6.footer, children: /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles6.footerContent, children: [
|
|
967
|
+
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles6.footerLogo, src: companyLogo }),
|
|
968
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles6.footerText, children: companyName })
|
|
969
|
+
] }) })
|
|
970
|
+
] }),
|
|
971
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { break: true })
|
|
972
|
+
] }, index);
|
|
973
|
+
}) });
|
|
974
|
+
};
|
|
975
|
+
var Template6_default = Template6;
|
|
976
|
+
var styles7 = renderer.StyleSheet.create({
|
|
667
977
|
page: {
|
|
668
978
|
flexDirection: "column",
|
|
669
979
|
backgroundColor: "#FFFFFF"
|
|
@@ -731,11 +1041,17 @@ async function generateProductCatalog(config) {
|
|
|
731
1041
|
case "template4":
|
|
732
1042
|
TemplateComponent = Template4_default;
|
|
733
1043
|
break;
|
|
1044
|
+
case "template5":
|
|
1045
|
+
TemplateComponent = Template5_default;
|
|
1046
|
+
break;
|
|
1047
|
+
case "template6":
|
|
1048
|
+
TemplateComponent = Template6_default;
|
|
1049
|
+
break;
|
|
734
1050
|
default:
|
|
735
1051
|
TemplateComponent = Template1_default;
|
|
736
1052
|
}
|
|
737
1053
|
if (template === "template4") {
|
|
738
|
-
const doc2 = /* @__PURE__ */ jsxRuntime.jsx(renderer.Document, { children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Page, { size: "A4", style:
|
|
1054
|
+
const doc2 = /* @__PURE__ */ jsxRuntime.jsx(renderer.Document, { children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Page, { size: "A4", style: styles7.page, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
739
1055
|
Template4_default,
|
|
740
1056
|
{
|
|
741
1057
|
products,
|
|
@@ -747,10 +1063,24 @@ async function generateProductCatalog(config) {
|
|
|
747
1063
|
const arrayBuffer2 = await blob2.arrayBuffer();
|
|
748
1064
|
return new Uint8Array(arrayBuffer2);
|
|
749
1065
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
1066
|
+
if (template === "template5" || template === "template6") {
|
|
1067
|
+
const Template = template === "template5" ? Template5_default : Template6_default;
|
|
1068
|
+
const doc2 = /* @__PURE__ */ jsxRuntime.jsx(renderer.Document, { children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Page, { size: "A4", orientation: "landscape", style: styles7.page, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1069
|
+
Template,
|
|
1070
|
+
{
|
|
1071
|
+
products,
|
|
1072
|
+
companyLogo: companyLogo ? normalizeImageSource(companyLogo) : void 0,
|
|
1073
|
+
companyName
|
|
1074
|
+
}
|
|
1075
|
+
) }) });
|
|
1076
|
+
const blob2 = await renderer.pdf(doc2).toBlob();
|
|
1077
|
+
const arrayBuffer2 = await blob2.arrayBuffer();
|
|
1078
|
+
return new Uint8Array(arrayBuffer2);
|
|
1079
|
+
}
|
|
1080
|
+
const doc = /* @__PURE__ */ jsxRuntime.jsx(renderer.Document, { children: /* @__PURE__ */ jsxRuntime.jsxs(renderer.Page, { size: "A4", style: styles7.page, children: [
|
|
1081
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles7.header, children: [
|
|
1082
|
+
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles7.logoSection, children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles7.logo, src: normalizeImageSource(companyLogo) }) }),
|
|
1083
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles7.storeNameSection, children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles7.storeName, children: companyName }) }),
|
|
754
1084
|
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { break: true })
|
|
755
1085
|
] }),
|
|
756
1086
|
/* @__PURE__ */ jsxRuntime.jsx(TemplateComponent, { products })
|
|
@@ -803,6 +1133,8 @@ exports.Template1 = Template1_default;
|
|
|
803
1133
|
exports.Template2 = Template2_default;
|
|
804
1134
|
exports.Template3 = Template3_default;
|
|
805
1135
|
exports.Template4 = Template4_default;
|
|
1136
|
+
exports.Template5 = Template5_default;
|
|
1137
|
+
exports.Template6 = Template6_default;
|
|
806
1138
|
exports.dynamicFieldStyles = dynamicFieldStyles;
|
|
807
1139
|
exports.extractProductFields = extractProductFields;
|
|
808
1140
|
exports.formatFieldName = formatFieldName;
|