pdf-catalog-generator 3.0.0 → 3.1.2
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 +420 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +419 -80
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25,6 +25,29 @@ function _interopNamespace(e) {
|
|
|
25
25
|
var XLSX__namespace = /*#__PURE__*/_interopNamespace(XLSX);
|
|
26
26
|
|
|
27
27
|
// src/generator.tsx
|
|
28
|
+
var styles = renderer.StyleSheet.create({
|
|
29
|
+
wrapper: {
|
|
30
|
+
position: "absolute",
|
|
31
|
+
bottom: 6,
|
|
32
|
+
right: 10,
|
|
33
|
+
flexDirection: "row",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
opacity: 0.5
|
|
36
|
+
},
|
|
37
|
+
label: {
|
|
38
|
+
fontSize: 6.5,
|
|
39
|
+
color: "#666666",
|
|
40
|
+
letterSpacing: 0.2
|
|
41
|
+
},
|
|
42
|
+
link: {
|
|
43
|
+
fontSize: 6.5,
|
|
44
|
+
color: "#666666",
|
|
45
|
+
textDecoration: "none",
|
|
46
|
+
letterSpacing: 0.2
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var PoweredByTeziApp = () => /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles.wrapper, fixed: true, children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Link, { style: styles.link, src: "https://teziapp.com", children: "Powered by Tezi App" }) });
|
|
50
|
+
var PoweredByTeziApp_default = PoweredByTeziApp;
|
|
28
51
|
|
|
29
52
|
// src/utils/fieldHelpers.ts
|
|
30
53
|
function formatFieldName(fieldName) {
|
|
@@ -151,7 +174,12 @@ var KNOWN_FIELD_NAMES_LOWER = [
|
|
|
151
174
|
"link",
|
|
152
175
|
"url",
|
|
153
176
|
"producturl",
|
|
154
|
-
"href"
|
|
177
|
+
"href",
|
|
178
|
+
"image2",
|
|
179
|
+
"imageurl2",
|
|
180
|
+
"img2",
|
|
181
|
+
"photo2",
|
|
182
|
+
"picture2"
|
|
155
183
|
];
|
|
156
184
|
function extractProductFields(product, options = {}) {
|
|
157
185
|
const { maxDynamicFields, excludeFields = [] } = options;
|
|
@@ -201,12 +229,12 @@ var dynamicFieldStyles = renderer.StyleSheet.create({
|
|
|
201
229
|
flexShrink: 1
|
|
202
230
|
}
|
|
203
231
|
});
|
|
204
|
-
function renderDynamicFields(fields,
|
|
232
|
+
function renderDynamicFields(fields, styles9) {
|
|
205
233
|
if (fields.length === 0) return null;
|
|
206
|
-
const containerStyle =
|
|
207
|
-
const rowStyle =
|
|
208
|
-
const labelStyle =
|
|
209
|
-
const valueStyle =
|
|
234
|
+
const containerStyle = styles9?.container || { marginBottom: 8 };
|
|
235
|
+
const rowStyle = styles9?.row || dynamicFieldStyles.detailRow;
|
|
236
|
+
const labelStyle = styles9?.label || dynamicFieldStyles.detailLabel;
|
|
237
|
+
const valueStyle = styles9?.value || dynamicFieldStyles.detailValue;
|
|
210
238
|
return /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: containerStyle, children: fields.map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: rowStyle, children: [
|
|
211
239
|
/* @__PURE__ */ jsxRuntime.jsxs(renderer.Text, { style: labelStyle, children: [
|
|
212
240
|
formatFieldName(key),
|
|
@@ -250,7 +278,7 @@ function mergeTemplateConfig(config = {}) {
|
|
|
250
278
|
...config
|
|
251
279
|
};
|
|
252
280
|
}
|
|
253
|
-
var
|
|
281
|
+
var styles2 = renderer.StyleSheet.create({
|
|
254
282
|
productContainer: {
|
|
255
283
|
flexDirection: "row",
|
|
256
284
|
flexWrap: "wrap",
|
|
@@ -314,27 +342,27 @@ var styles = renderer.StyleSheet.create({
|
|
|
314
342
|
}
|
|
315
343
|
});
|
|
316
344
|
var Template1 = ({ products }) => {
|
|
317
|
-
return /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
345
|
+
return /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles2.productContainer, children: products.map((product, index) => {
|
|
318
346
|
const fields = extractProductFields(product);
|
|
319
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
320
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
321
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
322
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
323
|
-
renderRating(fields.rating,
|
|
347
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles2.productSection, children: [
|
|
348
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles2.image, src: fields.imageUrl }),
|
|
349
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles2.productTitleBox, children: [
|
|
350
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles2.productTitle, children: fields.title }),
|
|
351
|
+
renderRating(fields.rating, styles2.productRate)
|
|
324
352
|
] }),
|
|
325
|
-
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
353
|
+
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles2.productDescription, children: fields.description }),
|
|
326
354
|
renderDynamicFields(fields.dynamicFields),
|
|
327
355
|
renderBuyButton(
|
|
328
356
|
fields.link,
|
|
329
|
-
|
|
357
|
+
styles2.buyButton,
|
|
330
358
|
"Buy Now",
|
|
331
|
-
renderPrice(fields.price,
|
|
359
|
+
renderPrice(fields.price, styles2.productPrice)
|
|
332
360
|
)
|
|
333
361
|
] }, index);
|
|
334
362
|
}) });
|
|
335
363
|
};
|
|
336
364
|
var Template1_default = Template1;
|
|
337
|
-
var
|
|
365
|
+
var styles3 = renderer.StyleSheet.create({
|
|
338
366
|
productContainer: {
|
|
339
367
|
flexDirection: "row",
|
|
340
368
|
flexWrap: "wrap",
|
|
@@ -411,14 +439,14 @@ var styles2 = renderer.StyleSheet.create({
|
|
|
411
439
|
}
|
|
412
440
|
});
|
|
413
441
|
var Template2 = ({ products }) => {
|
|
414
|
-
return /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
442
|
+
return /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles3.productContainer, children: products.map((product, index) => {
|
|
415
443
|
const fields = extractProductFields(product);
|
|
416
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
417
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
418
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
419
|
-
renderRating(fields.rating,
|
|
444
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles3.productSection, children: [
|
|
445
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles3.productSectionImage, children: [
|
|
446
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles3.image, src: fields.imageUrl }),
|
|
447
|
+
renderRating(fields.rating, styles3.productRate)
|
|
420
448
|
] }),
|
|
421
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
449
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles3.productSectionText, children: [
|
|
422
450
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
423
451
|
renderer.View,
|
|
424
452
|
{
|
|
@@ -428,20 +456,20 @@ var Template2 = ({ products }) => {
|
|
|
428
456
|
justifyContent: "space-between"
|
|
429
457
|
},
|
|
430
458
|
children: [
|
|
431
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
432
|
-
renderPrice(fields.price,
|
|
459
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles3.productTitle, children: fields.title }),
|
|
460
|
+
renderPrice(fields.price, styles3.productPrice)
|
|
433
461
|
]
|
|
434
462
|
}
|
|
435
463
|
),
|
|
436
|
-
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
464
|
+
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles3.productDescription, children: fields.description }),
|
|
437
465
|
renderDynamicFields(fields.dynamicFields),
|
|
438
|
-
renderBuyButton(fields.link,
|
|
466
|
+
renderBuyButton(fields.link, styles3.buyButton)
|
|
439
467
|
] })
|
|
440
468
|
] }, index);
|
|
441
469
|
}) });
|
|
442
470
|
};
|
|
443
471
|
var Template2_default = Template2;
|
|
444
|
-
var
|
|
472
|
+
var styles4 = renderer.StyleSheet.create({
|
|
445
473
|
productSection: {
|
|
446
474
|
width: "100%",
|
|
447
475
|
height: "100vh",
|
|
@@ -521,10 +549,10 @@ var compactDynamicFieldStyles = renderer.StyleSheet.create({
|
|
|
521
549
|
var Template3 = ({ products }) => {
|
|
522
550
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: products.map((product, index) => {
|
|
523
551
|
const fields = extractProductFields(product, { maxDynamicFields: 5 });
|
|
524
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
525
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
526
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
527
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
552
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles4.productSection, children: [
|
|
553
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles4.image, src: fields.imageUrl }),
|
|
554
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles4.productDetailsBox, children: [
|
|
555
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles4.productTitle, children: fields.title }),
|
|
528
556
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
529
557
|
renderer.View,
|
|
530
558
|
{
|
|
@@ -534,25 +562,25 @@ var Template3 = ({ products }) => {
|
|
|
534
562
|
justifyContent: "space-between"
|
|
535
563
|
},
|
|
536
564
|
children: [
|
|
537
|
-
renderPrice(fields.price,
|
|
538
|
-
renderRating(fields.rating,
|
|
565
|
+
renderPrice(fields.price, styles4.productPrice),
|
|
566
|
+
renderRating(fields.rating, styles4.productRate)
|
|
539
567
|
]
|
|
540
568
|
}
|
|
541
569
|
),
|
|
542
|
-
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
570
|
+
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles4.productDescription, children: fields.description }),
|
|
543
571
|
renderDynamicFields(fields.dynamicFields, {
|
|
544
572
|
row: compactDynamicFieldStyles.detailRow,
|
|
545
573
|
label: compactDynamicFieldStyles.detailLabel,
|
|
546
574
|
value: compactDynamicFieldStyles.detailValue
|
|
547
575
|
}),
|
|
548
|
-
renderBuyButton(fields.link,
|
|
576
|
+
renderBuyButton(fields.link, styles4.buyButton)
|
|
549
577
|
] }),
|
|
550
578
|
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { break: true })
|
|
551
579
|
] }, index);
|
|
552
580
|
}) });
|
|
553
581
|
};
|
|
554
582
|
var Template3_default = Template3;
|
|
555
|
-
var
|
|
583
|
+
var styles5 = renderer.StyleSheet.create({
|
|
556
584
|
page: {
|
|
557
585
|
width: "100%",
|
|
558
586
|
height: "100%",
|
|
@@ -649,21 +677,326 @@ var Template4 = ({
|
|
|
649
677
|
)
|
|
650
678
|
);
|
|
651
679
|
const fields = extractProductFields(product);
|
|
652
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
653
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
654
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
655
|
-
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
680
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles5.page, children: [
|
|
681
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles5.header, children: [
|
|
682
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles5.companyName, children: companyName || "" }),
|
|
683
|
+
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles5.brandLogo, src: companyLogo })
|
|
656
684
|
] }),
|
|
657
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
658
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
659
|
-
allFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
685
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles5.productContainer, children: [
|
|
686
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles5.productImage, src: fields.imageUrl }),
|
|
687
|
+
allFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles5.detailsBox, children: renderFieldsInColumns(allFields) })
|
|
660
688
|
] }),
|
|
661
689
|
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { break: true })
|
|
662
690
|
] }, index);
|
|
663
691
|
}) });
|
|
664
692
|
};
|
|
665
693
|
var Template4_default = Template4;
|
|
666
|
-
var
|
|
694
|
+
var styles6 = renderer.StyleSheet.create({
|
|
695
|
+
page: {
|
|
696
|
+
width: "100%",
|
|
697
|
+
height: "100%",
|
|
698
|
+
position: "relative",
|
|
699
|
+
backgroundColor: "#FFFFFF",
|
|
700
|
+
flexDirection: "column"
|
|
701
|
+
},
|
|
702
|
+
header: {
|
|
703
|
+
height: 80,
|
|
704
|
+
display: "flex",
|
|
705
|
+
flexDirection: "row",
|
|
706
|
+
alignItems: "center",
|
|
707
|
+
paddingHorizontal: 30,
|
|
708
|
+
paddingTop: 20,
|
|
709
|
+
paddingBottom: 10,
|
|
710
|
+
borderBottomWidth: 1,
|
|
711
|
+
borderBottomColor: "#E0E0E0",
|
|
712
|
+
marginBottom: 10
|
|
713
|
+
},
|
|
714
|
+
logo: {
|
|
715
|
+
height: 50,
|
|
716
|
+
marginRight: 20,
|
|
717
|
+
objectFit: "contain"
|
|
718
|
+
},
|
|
719
|
+
companyName: {
|
|
720
|
+
fontSize: 24,
|
|
721
|
+
fontWeight: "bold",
|
|
722
|
+
color: "#333333",
|
|
723
|
+
letterSpacing: 1
|
|
724
|
+
},
|
|
725
|
+
contentContainer: {
|
|
726
|
+
flex: 1,
|
|
727
|
+
flexDirection: "row",
|
|
728
|
+
paddingHorizontal: 30,
|
|
729
|
+
paddingBottom: 30,
|
|
730
|
+
gap: 20
|
|
731
|
+
},
|
|
732
|
+
imageSection: {
|
|
733
|
+
flex: 2,
|
|
734
|
+
flexDirection: "row",
|
|
735
|
+
gap: 15
|
|
736
|
+
},
|
|
737
|
+
imageWrapper: {
|
|
738
|
+
flex: 1,
|
|
739
|
+
height: "100%",
|
|
740
|
+
backgroundColor: "#F9F9F9",
|
|
741
|
+
borderRadius: 4,
|
|
742
|
+
overflow: "hidden"
|
|
743
|
+
},
|
|
744
|
+
productImage: {
|
|
745
|
+
width: "100%",
|
|
746
|
+
height: "100%",
|
|
747
|
+
objectFit: "cover"
|
|
748
|
+
},
|
|
749
|
+
detailsSection: {
|
|
750
|
+
flex: 1,
|
|
751
|
+
backgroundColor: "#F5F5F5",
|
|
752
|
+
padding: 20,
|
|
753
|
+
borderRadius: 8,
|
|
754
|
+
justifyContent: "center"
|
|
755
|
+
},
|
|
756
|
+
productTitle: {
|
|
757
|
+
fontSize: 18,
|
|
758
|
+
fontWeight: "bold",
|
|
759
|
+
color: "#222222",
|
|
760
|
+
marginBottom: 15,
|
|
761
|
+
borderBottomWidth: 2,
|
|
762
|
+
borderBottomColor: "#333333",
|
|
763
|
+
paddingBottom: 5
|
|
764
|
+
},
|
|
765
|
+
dynamicFieldsContainer: {
|
|
766
|
+
gap: 8
|
|
767
|
+
},
|
|
768
|
+
detailRow: {
|
|
769
|
+
flexDirection: "row",
|
|
770
|
+
marginBottom: 6,
|
|
771
|
+
borderBottomWidth: 1,
|
|
772
|
+
borderBottomColor: "#E0E0E0",
|
|
773
|
+
paddingBottom: 4
|
|
774
|
+
},
|
|
775
|
+
detailLabel: {
|
|
776
|
+
fontSize: 10,
|
|
777
|
+
fontWeight: "bold",
|
|
778
|
+
color: "#555555",
|
|
779
|
+
width: "40%"
|
|
780
|
+
},
|
|
781
|
+
detailValue: {
|
|
782
|
+
fontSize: 10,
|
|
783
|
+
color: "#333333",
|
|
784
|
+
flex: 1,
|
|
785
|
+
flexWrap: "wrap"
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
function getImage2Url(product) {
|
|
789
|
+
const image2Fields = ["image2", "imageurl2", "img2", "photo2", "picture2"];
|
|
790
|
+
for (const field of image2Fields) {
|
|
791
|
+
const value = product[field];
|
|
792
|
+
if (value && typeof value === "string" && value.trim() !== "") {
|
|
793
|
+
return value;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
return null;
|
|
797
|
+
}
|
|
798
|
+
var Template5 = ({
|
|
799
|
+
products,
|
|
800
|
+
companyLogo,
|
|
801
|
+
companyName
|
|
802
|
+
}) => {
|
|
803
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: products.map((product, index) => {
|
|
804
|
+
const { imageUrl, title, dynamicFields } = extractProductFields(product);
|
|
805
|
+
const image2Url = getImage2Url(product);
|
|
806
|
+
const secondImage = image2Url || imageUrl;
|
|
807
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles6.page, children: [
|
|
808
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles6.header, children: [
|
|
809
|
+
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles6.logo, src: companyLogo }),
|
|
810
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles6.companyName, children: companyName })
|
|
811
|
+
] }),
|
|
812
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles6.contentContainer, children: [
|
|
813
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles6.imageSection, children: [
|
|
814
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles6.imageWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles6.productImage, src: imageUrl }) }),
|
|
815
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles6.imageWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles6.productImage, src: secondImage }) })
|
|
816
|
+
] }),
|
|
817
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles6.detailsSection, children: [
|
|
818
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles6.productTitle, children: title }),
|
|
819
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles6.dynamicFieldsContainer, children: renderDynamicFields(dynamicFields, {
|
|
820
|
+
row: styles6.detailRow,
|
|
821
|
+
label: styles6.detailLabel,
|
|
822
|
+
value: styles6.detailValue
|
|
823
|
+
}) })
|
|
824
|
+
] })
|
|
825
|
+
] }),
|
|
826
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { break: true })
|
|
827
|
+
] }, index);
|
|
828
|
+
}) });
|
|
829
|
+
};
|
|
830
|
+
var Template5_default = Template5;
|
|
831
|
+
var styles7 = renderer.StyleSheet.create({
|
|
832
|
+
page: {
|
|
833
|
+
width: "100%",
|
|
834
|
+
height: "100%",
|
|
835
|
+
flexDirection: "row",
|
|
836
|
+
backgroundColor: "#FFFFFF"
|
|
837
|
+
},
|
|
838
|
+
leftColumn: {
|
|
839
|
+
width: "50%",
|
|
840
|
+
height: "100%",
|
|
841
|
+
position: "relative",
|
|
842
|
+
borderRightWidth: 1,
|
|
843
|
+
borderRightColor: "#E0E0E0"
|
|
844
|
+
},
|
|
845
|
+
rightColumn: {
|
|
846
|
+
width: "50%",
|
|
847
|
+
height: "100%",
|
|
848
|
+
display: "flex",
|
|
849
|
+
flexDirection: "column",
|
|
850
|
+
position: "relative"
|
|
851
|
+
},
|
|
852
|
+
imageFull: {
|
|
853
|
+
width: "100%",
|
|
854
|
+
height: "100%",
|
|
855
|
+
objectFit: "cover"
|
|
856
|
+
},
|
|
857
|
+
rightImageContainer: {
|
|
858
|
+
flex: 1,
|
|
859
|
+
width: "100%",
|
|
860
|
+
position: "relative",
|
|
861
|
+
justifyContent: "center",
|
|
862
|
+
alignItems: "center",
|
|
863
|
+
padding: 20
|
|
864
|
+
},
|
|
865
|
+
rightImage: {
|
|
866
|
+
width: "100%",
|
|
867
|
+
height: "100%",
|
|
868
|
+
objectFit: "contain"
|
|
869
|
+
},
|
|
870
|
+
specsOverlay: {
|
|
871
|
+
position: "absolute",
|
|
872
|
+
bottom: 40,
|
|
873
|
+
// Lifted slightly from absolute bottom
|
|
874
|
+
right: 0,
|
|
875
|
+
backgroundColor: "#FFFFFF",
|
|
876
|
+
padding: 15,
|
|
877
|
+
width: "65%",
|
|
878
|
+
// Takes up a good chunk of the corner
|
|
879
|
+
borderTopLeftRadius: 4,
|
|
880
|
+
borderBottomLeftRadius: 4,
|
|
881
|
+
shadowColor: "#000",
|
|
882
|
+
shadowOpacity: 0.2,
|
|
883
|
+
shadowRadius: 3,
|
|
884
|
+
borderWidth: 1,
|
|
885
|
+
borderColor: "#EEEEEE"
|
|
886
|
+
},
|
|
887
|
+
specsHeader: {
|
|
888
|
+
flexDirection: "row",
|
|
889
|
+
alignItems: "center",
|
|
890
|
+
marginBottom: 10,
|
|
891
|
+
borderBottomWidth: 1,
|
|
892
|
+
borderBottomColor: "#333",
|
|
893
|
+
paddingBottom: 5
|
|
894
|
+
},
|
|
895
|
+
miniLogo: {
|
|
896
|
+
width: 20,
|
|
897
|
+
height: 20,
|
|
898
|
+
objectFit: "contain",
|
|
899
|
+
marginRight: 8
|
|
900
|
+
},
|
|
901
|
+
designNumber: {
|
|
902
|
+
fontSize: 12,
|
|
903
|
+
fontWeight: "bold",
|
|
904
|
+
color: "#000"
|
|
905
|
+
},
|
|
906
|
+
footer: {
|
|
907
|
+
height: 100,
|
|
908
|
+
backgroundColor: "#1A1A1A",
|
|
909
|
+
flexDirection: "row",
|
|
910
|
+
alignItems: "center",
|
|
911
|
+
justifyContent: "flex-end",
|
|
912
|
+
paddingHorizontal: 30,
|
|
913
|
+
width: "100%"
|
|
914
|
+
},
|
|
915
|
+
footerContent: {
|
|
916
|
+
flexDirection: "row",
|
|
917
|
+
alignItems: "center"
|
|
918
|
+
},
|
|
919
|
+
footerLogo: {
|
|
920
|
+
width: 40,
|
|
921
|
+
height: 40,
|
|
922
|
+
objectFit: "contain",
|
|
923
|
+
marginRight: 15,
|
|
924
|
+
backgroundColor: "#FFF",
|
|
925
|
+
// White background for logo visibility
|
|
926
|
+
padding: 2,
|
|
927
|
+
borderRadius: 2
|
|
928
|
+
},
|
|
929
|
+
footerText: {
|
|
930
|
+
color: "#FFFFFF",
|
|
931
|
+
fontSize: 14,
|
|
932
|
+
fontWeight: "bold",
|
|
933
|
+
letterSpacing: 1,
|
|
934
|
+
textTransform: "uppercase"
|
|
935
|
+
},
|
|
936
|
+
// Custom styles for dynamic fields in the overlay
|
|
937
|
+
fieldRow: {
|
|
938
|
+
flexDirection: "row",
|
|
939
|
+
marginBottom: 4
|
|
940
|
+
},
|
|
941
|
+
fieldLabel: {
|
|
942
|
+
fontSize: 9,
|
|
943
|
+
fontWeight: "bold",
|
|
944
|
+
color: "#333",
|
|
945
|
+
width: "40%"
|
|
946
|
+
},
|
|
947
|
+
fieldValue: {
|
|
948
|
+
fontSize: 9,
|
|
949
|
+
color: "#555",
|
|
950
|
+
flex: 1
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
function getImage2Url2(product) {
|
|
954
|
+
const image2Fields = ["image2", "imageurl2", "img2", "photo2", "picture2"];
|
|
955
|
+
for (const field of image2Fields) {
|
|
956
|
+
const value = product[field];
|
|
957
|
+
if (value && typeof value === "string" && value.trim() !== "") {
|
|
958
|
+
return value;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
return null;
|
|
962
|
+
}
|
|
963
|
+
var Template6 = ({
|
|
964
|
+
products,
|
|
965
|
+
companyLogo,
|
|
966
|
+
companyName
|
|
967
|
+
}) => {
|
|
968
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: products.map((product, index) => {
|
|
969
|
+
const { imageUrl, title, dynamicFields } = extractProductFields(product);
|
|
970
|
+
const image2Url = getImage2Url2(product);
|
|
971
|
+
const secondImage = image2Url || imageUrl;
|
|
972
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles7.page, children: [
|
|
973
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles7.leftColumn, children: [
|
|
974
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles7.imageFull, src: imageUrl }),
|
|
975
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles7.specsOverlay, children: [
|
|
976
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles7.specsHeader, children: [
|
|
977
|
+
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles7.miniLogo, src: companyLogo }),
|
|
978
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles7.designNumber, children: title || "Specifications" })
|
|
979
|
+
] }),
|
|
980
|
+
renderDynamicFields(dynamicFields, {
|
|
981
|
+
row: styles7.fieldRow,
|
|
982
|
+
label: styles7.fieldLabel,
|
|
983
|
+
value: styles7.fieldValue
|
|
984
|
+
})
|
|
985
|
+
] })
|
|
986
|
+
] }),
|
|
987
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles7.rightColumn, children: [
|
|
988
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles7.rightImageContainer, children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles7.rightImage, src: secondImage }) }),
|
|
989
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles7.footer, children: /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles7.footerContent, children: [
|
|
990
|
+
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles7.footerLogo, src: companyLogo }),
|
|
991
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles7.footerText, children: companyName })
|
|
992
|
+
] }) })
|
|
993
|
+
] }),
|
|
994
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { break: true })
|
|
995
|
+
] }, index);
|
|
996
|
+
}) });
|
|
997
|
+
};
|
|
998
|
+
var Template6_default = Template6;
|
|
999
|
+
var styles8 = renderer.StyleSheet.create({
|
|
667
1000
|
page: {
|
|
668
1001
|
flexDirection: "column",
|
|
669
1002
|
backgroundColor: "#FFFFFF"
|
|
@@ -695,26 +1028,6 @@ renderer.Font.registerEmojiSource({
|
|
|
695
1028
|
format: "png",
|
|
696
1029
|
url: "https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/72x72/"
|
|
697
1030
|
});
|
|
698
|
-
function normalizeImageSource(imageSource) {
|
|
699
|
-
if (imageSource.startsWith("data:")) {
|
|
700
|
-
return imageSource;
|
|
701
|
-
}
|
|
702
|
-
if (imageSource.startsWith("http://") || imageSource.startsWith("https://")) {
|
|
703
|
-
return imageSource;
|
|
704
|
-
}
|
|
705
|
-
let mimeType = "image/png";
|
|
706
|
-
const base64Start = imageSource.substring(0, 20).toLowerCase();
|
|
707
|
-
if (base64Start.includes("ivborw0kggo") || imageSource.startsWith("iVBORw0KGgo")) {
|
|
708
|
-
mimeType = "image/png";
|
|
709
|
-
} else if (base64Start.includes("/9j/4aaq") || imageSource.startsWith("/9j/4AAQ")) {
|
|
710
|
-
mimeType = "image/jpeg";
|
|
711
|
-
} else if (base64Start.includes("r0lgodlh") || imageSource.startsWith("R0lGODlh")) {
|
|
712
|
-
mimeType = "image/gif";
|
|
713
|
-
} else if (base64Start.includes("uklgr") || imageSource.startsWith("UklGR")) {
|
|
714
|
-
mimeType = "image/webp";
|
|
715
|
-
}
|
|
716
|
-
return `data:${mimeType};base64,${imageSource}`;
|
|
717
|
-
}
|
|
718
1031
|
async function generateProductCatalog(config) {
|
|
719
1032
|
const { products, companyLogo, companyName, template = "template1" } = config;
|
|
720
1033
|
let TemplateComponent;
|
|
@@ -731,29 +1044,55 @@ async function generateProductCatalog(config) {
|
|
|
731
1044
|
case "template4":
|
|
732
1045
|
TemplateComponent = Template4_default;
|
|
733
1046
|
break;
|
|
1047
|
+
case "template5":
|
|
1048
|
+
TemplateComponent = Template5_default;
|
|
1049
|
+
break;
|
|
1050
|
+
case "template6":
|
|
1051
|
+
TemplateComponent = Template6_default;
|
|
1052
|
+
break;
|
|
734
1053
|
default:
|
|
735
1054
|
TemplateComponent = Template1_default;
|
|
736
1055
|
}
|
|
737
1056
|
if (template === "template4") {
|
|
738
|
-
const doc2 = /* @__PURE__ */ jsxRuntime.jsx(renderer.Document, { children: /* @__PURE__ */ jsxRuntime.
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
1057
|
+
const doc2 = /* @__PURE__ */ jsxRuntime.jsx(renderer.Document, { children: /* @__PURE__ */ jsxRuntime.jsxs(renderer.Page, { size: "A4", style: styles8.page, children: [
|
|
1058
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1059
|
+
Template4_default,
|
|
1060
|
+
{
|
|
1061
|
+
products,
|
|
1062
|
+
companyLogo,
|
|
1063
|
+
companyName
|
|
1064
|
+
}
|
|
1065
|
+
),
|
|
1066
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoweredByTeziApp_default, {})
|
|
1067
|
+
] }) });
|
|
746
1068
|
const blob2 = await renderer.pdf(doc2).toBlob();
|
|
747
1069
|
const arrayBuffer2 = await blob2.arrayBuffer();
|
|
748
1070
|
return new Uint8Array(arrayBuffer2);
|
|
749
1071
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
754
|
-
|
|
1072
|
+
if (template === "template5" || template === "template6") {
|
|
1073
|
+
const Template = template === "template5" ? Template5_default : Template6_default;
|
|
1074
|
+
const doc2 = /* @__PURE__ */ jsxRuntime.jsx(renderer.Document, { children: /* @__PURE__ */ jsxRuntime.jsxs(renderer.Page, { size: "A4", orientation: "landscape", style: styles8.page, children: [
|
|
1075
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1076
|
+
Template,
|
|
1077
|
+
{
|
|
1078
|
+
products,
|
|
1079
|
+
companyLogo,
|
|
1080
|
+
companyName
|
|
1081
|
+
}
|
|
1082
|
+
),
|
|
1083
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoweredByTeziApp_default, {})
|
|
1084
|
+
] }) });
|
|
1085
|
+
const blob2 = await renderer.pdf(doc2).toBlob();
|
|
1086
|
+
const arrayBuffer2 = await blob2.arrayBuffer();
|
|
1087
|
+
return new Uint8Array(arrayBuffer2);
|
|
1088
|
+
}
|
|
1089
|
+
const doc = /* @__PURE__ */ jsxRuntime.jsx(renderer.Document, { children: /* @__PURE__ */ jsxRuntime.jsxs(renderer.Page, { size: "A4", style: styles8.page, children: [
|
|
1090
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles8.header, children: [
|
|
1091
|
+
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles8.logoSection, children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style: styles8.logo, src: companyLogo }) }),
|
|
1092
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles8.storeNameSection, children: /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles8.storeName, children: companyName }) })
|
|
755
1093
|
] }),
|
|
756
|
-
/* @__PURE__ */ jsxRuntime.jsx(TemplateComponent, { products })
|
|
1094
|
+
/* @__PURE__ */ jsxRuntime.jsx(TemplateComponent, { products }),
|
|
1095
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoweredByTeziApp_default, {})
|
|
757
1096
|
] }) });
|
|
758
1097
|
const blob = await renderer.pdf(doc).toBlob();
|
|
759
1098
|
const arrayBuffer = await blob.arrayBuffer();
|
|
@@ -803,6 +1142,8 @@ exports.Template1 = Template1_default;
|
|
|
803
1142
|
exports.Template2 = Template2_default;
|
|
804
1143
|
exports.Template3 = Template3_default;
|
|
805
1144
|
exports.Template4 = Template4_default;
|
|
1145
|
+
exports.Template5 = Template5_default;
|
|
1146
|
+
exports.Template6 = Template6_default;
|
|
806
1147
|
exports.dynamicFieldStyles = dynamicFieldStyles;
|
|
807
1148
|
exports.extractProductFields = extractProductFields;
|
|
808
1149
|
exports.formatFieldName = formatFieldName;
|