pdf-catalog-generator 3.1.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.js +126 -117
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +126 -117
- 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) {
|
|
@@ -206,12 +229,12 @@ var dynamicFieldStyles = renderer.StyleSheet.create({
|
|
|
206
229
|
flexShrink: 1
|
|
207
230
|
}
|
|
208
231
|
});
|
|
209
|
-
function renderDynamicFields(fields,
|
|
232
|
+
function renderDynamicFields(fields, styles9) {
|
|
210
233
|
if (fields.length === 0) return null;
|
|
211
|
-
const containerStyle =
|
|
212
|
-
const rowStyle =
|
|
213
|
-
const labelStyle =
|
|
214
|
-
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;
|
|
215
238
|
return /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: containerStyle, children: fields.map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: rowStyle, children: [
|
|
216
239
|
/* @__PURE__ */ jsxRuntime.jsxs(renderer.Text, { style: labelStyle, children: [
|
|
217
240
|
formatFieldName(key),
|
|
@@ -255,7 +278,7 @@ function mergeTemplateConfig(config = {}) {
|
|
|
255
278
|
...config
|
|
256
279
|
};
|
|
257
280
|
}
|
|
258
|
-
var
|
|
281
|
+
var styles2 = renderer.StyleSheet.create({
|
|
259
282
|
productContainer: {
|
|
260
283
|
flexDirection: "row",
|
|
261
284
|
flexWrap: "wrap",
|
|
@@ -319,27 +342,27 @@ var styles = renderer.StyleSheet.create({
|
|
|
319
342
|
}
|
|
320
343
|
});
|
|
321
344
|
var Template1 = ({ products }) => {
|
|
322
|
-
return /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
345
|
+
return /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles2.productContainer, children: products.map((product, index) => {
|
|
323
346
|
const fields = extractProductFields(product);
|
|
324
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
325
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
326
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
327
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
328
|
-
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)
|
|
329
352
|
] }),
|
|
330
|
-
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
353
|
+
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles2.productDescription, children: fields.description }),
|
|
331
354
|
renderDynamicFields(fields.dynamicFields),
|
|
332
355
|
renderBuyButton(
|
|
333
356
|
fields.link,
|
|
334
|
-
|
|
357
|
+
styles2.buyButton,
|
|
335
358
|
"Buy Now",
|
|
336
|
-
renderPrice(fields.price,
|
|
359
|
+
renderPrice(fields.price, styles2.productPrice)
|
|
337
360
|
)
|
|
338
361
|
] }, index);
|
|
339
362
|
}) });
|
|
340
363
|
};
|
|
341
364
|
var Template1_default = Template1;
|
|
342
|
-
var
|
|
365
|
+
var styles3 = renderer.StyleSheet.create({
|
|
343
366
|
productContainer: {
|
|
344
367
|
flexDirection: "row",
|
|
345
368
|
flexWrap: "wrap",
|
|
@@ -416,14 +439,14 @@ var styles2 = renderer.StyleSheet.create({
|
|
|
416
439
|
}
|
|
417
440
|
});
|
|
418
441
|
var Template2 = ({ products }) => {
|
|
419
|
-
return /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
442
|
+
return /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style: styles3.productContainer, children: products.map((product, index) => {
|
|
420
443
|
const fields = extractProductFields(product);
|
|
421
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
422
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
423
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
424
|
-
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)
|
|
425
448
|
] }),
|
|
426
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
449
|
+
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style: styles3.productSectionText, children: [
|
|
427
450
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
428
451
|
renderer.View,
|
|
429
452
|
{
|
|
@@ -433,20 +456,20 @@ var Template2 = ({ products }) => {
|
|
|
433
456
|
justifyContent: "space-between"
|
|
434
457
|
},
|
|
435
458
|
children: [
|
|
436
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
437
|
-
renderPrice(fields.price,
|
|
459
|
+
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles3.productTitle, children: fields.title }),
|
|
460
|
+
renderPrice(fields.price, styles3.productPrice)
|
|
438
461
|
]
|
|
439
462
|
}
|
|
440
463
|
),
|
|
441
|
-
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
464
|
+
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles3.productDescription, children: fields.description }),
|
|
442
465
|
renderDynamicFields(fields.dynamicFields),
|
|
443
|
-
renderBuyButton(fields.link,
|
|
466
|
+
renderBuyButton(fields.link, styles3.buyButton)
|
|
444
467
|
] })
|
|
445
468
|
] }, index);
|
|
446
469
|
}) });
|
|
447
470
|
};
|
|
448
471
|
var Template2_default = Template2;
|
|
449
|
-
var
|
|
472
|
+
var styles4 = renderer.StyleSheet.create({
|
|
450
473
|
productSection: {
|
|
451
474
|
width: "100%",
|
|
452
475
|
height: "100vh",
|
|
@@ -526,10 +549,10 @@ var compactDynamicFieldStyles = renderer.StyleSheet.create({
|
|
|
526
549
|
var Template3 = ({ products }) => {
|
|
527
550
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: products.map((product, index) => {
|
|
528
551
|
const fields = extractProductFields(product, { maxDynamicFields: 5 });
|
|
529
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
530
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
531
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
532
|
-
/* @__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 }),
|
|
533
556
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
534
557
|
renderer.View,
|
|
535
558
|
{
|
|
@@ -539,25 +562,25 @@ var Template3 = ({ products }) => {
|
|
|
539
562
|
justifyContent: "space-between"
|
|
540
563
|
},
|
|
541
564
|
children: [
|
|
542
|
-
renderPrice(fields.price,
|
|
543
|
-
renderRating(fields.rating,
|
|
565
|
+
renderPrice(fields.price, styles4.productPrice),
|
|
566
|
+
renderRating(fields.rating, styles4.productRate)
|
|
544
567
|
]
|
|
545
568
|
}
|
|
546
569
|
),
|
|
547
|
-
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
570
|
+
fields.description && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style: styles4.productDescription, children: fields.description }),
|
|
548
571
|
renderDynamicFields(fields.dynamicFields, {
|
|
549
572
|
row: compactDynamicFieldStyles.detailRow,
|
|
550
573
|
label: compactDynamicFieldStyles.detailLabel,
|
|
551
574
|
value: compactDynamicFieldStyles.detailValue
|
|
552
575
|
}),
|
|
553
|
-
renderBuyButton(fields.link,
|
|
576
|
+
renderBuyButton(fields.link, styles4.buyButton)
|
|
554
577
|
] }),
|
|
555
578
|
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { break: true })
|
|
556
579
|
] }, index);
|
|
557
580
|
}) });
|
|
558
581
|
};
|
|
559
582
|
var Template3_default = Template3;
|
|
560
|
-
var
|
|
583
|
+
var styles5 = renderer.StyleSheet.create({
|
|
561
584
|
page: {
|
|
562
585
|
width: "100%",
|
|
563
586
|
height: "100%",
|
|
@@ -654,21 +677,21 @@ var Template4 = ({
|
|
|
654
677
|
)
|
|
655
678
|
);
|
|
656
679
|
const fields = extractProductFields(product);
|
|
657
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
658
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
659
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
660
|
-
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 })
|
|
661
684
|
] }),
|
|
662
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
663
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
664
|
-
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) })
|
|
665
688
|
] }),
|
|
666
689
|
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { break: true })
|
|
667
690
|
] }, index);
|
|
668
691
|
}) });
|
|
669
692
|
};
|
|
670
693
|
var Template4_default = Template4;
|
|
671
|
-
var
|
|
694
|
+
var styles6 = renderer.StyleSheet.create({
|
|
672
695
|
page: {
|
|
673
696
|
width: "100%",
|
|
674
697
|
height: "100%",
|
|
@@ -781,22 +804,22 @@ var Template5 = ({
|
|
|
781
804
|
const { imageUrl, title, dynamicFields } = extractProductFields(product);
|
|
782
805
|
const image2Url = getImage2Url(product);
|
|
783
806
|
const secondImage = image2Url || imageUrl;
|
|
784
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
785
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
786
|
-
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
787
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
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 })
|
|
788
811
|
] }),
|
|
789
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
790
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
791
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
792
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
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 }) })
|
|
793
816
|
] }),
|
|
794
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
795
|
-
title && /* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
796
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
797
|
-
row:
|
|
798
|
-
label:
|
|
799
|
-
value:
|
|
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
|
|
800
823
|
}) })
|
|
801
824
|
] })
|
|
802
825
|
] }),
|
|
@@ -805,7 +828,7 @@ var Template5 = ({
|
|
|
805
828
|
}) });
|
|
806
829
|
};
|
|
807
830
|
var Template5_default = Template5;
|
|
808
|
-
var
|
|
831
|
+
var styles7 = renderer.StyleSheet.create({
|
|
809
832
|
page: {
|
|
810
833
|
width: "100%",
|
|
811
834
|
height: "100%",
|
|
@@ -946,26 +969,26 @@ var Template6 = ({
|
|
|
946
969
|
const { imageUrl, title, dynamicFields } = extractProductFields(product);
|
|
947
970
|
const image2Url = getImage2Url2(product);
|
|
948
971
|
const secondImage = image2Url || imageUrl;
|
|
949
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
950
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
951
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
952
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
953
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
954
|
-
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
955
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
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" })
|
|
956
979
|
] }),
|
|
957
980
|
renderDynamicFields(dynamicFields, {
|
|
958
|
-
row:
|
|
959
|
-
label:
|
|
960
|
-
value:
|
|
981
|
+
row: styles7.fieldRow,
|
|
982
|
+
label: styles7.fieldLabel,
|
|
983
|
+
value: styles7.fieldValue
|
|
961
984
|
})
|
|
962
985
|
] })
|
|
963
986
|
] }),
|
|
964
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
965
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
966
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
967
|
-
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.Image, { style:
|
|
968
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.Text, { style:
|
|
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 })
|
|
969
992
|
] }) })
|
|
970
993
|
] }),
|
|
971
994
|
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { break: true })
|
|
@@ -973,7 +996,7 @@ var Template6 = ({
|
|
|
973
996
|
}) });
|
|
974
997
|
};
|
|
975
998
|
var Template6_default = Template6;
|
|
976
|
-
var
|
|
999
|
+
var styles8 = renderer.StyleSheet.create({
|
|
977
1000
|
page: {
|
|
978
1001
|
flexDirection: "column",
|
|
979
1002
|
backgroundColor: "#FFFFFF"
|
|
@@ -1005,26 +1028,6 @@ renderer.Font.registerEmojiSource({
|
|
|
1005
1028
|
format: "png",
|
|
1006
1029
|
url: "https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/72x72/"
|
|
1007
1030
|
});
|
|
1008
|
-
function normalizeImageSource(imageSource) {
|
|
1009
|
-
if (imageSource.startsWith("data:")) {
|
|
1010
|
-
return imageSource;
|
|
1011
|
-
}
|
|
1012
|
-
if (imageSource.startsWith("http://") || imageSource.startsWith("https://")) {
|
|
1013
|
-
return imageSource;
|
|
1014
|
-
}
|
|
1015
|
-
let mimeType = "image/png";
|
|
1016
|
-
const base64Start = imageSource.substring(0, 20).toLowerCase();
|
|
1017
|
-
if (base64Start.includes("ivborw0kggo") || imageSource.startsWith("iVBORw0KGgo")) {
|
|
1018
|
-
mimeType = "image/png";
|
|
1019
|
-
} else if (base64Start.includes("/9j/4aaq") || imageSource.startsWith("/9j/4AAQ")) {
|
|
1020
|
-
mimeType = "image/jpeg";
|
|
1021
|
-
} else if (base64Start.includes("r0lgodlh") || imageSource.startsWith("R0lGODlh")) {
|
|
1022
|
-
mimeType = "image/gif";
|
|
1023
|
-
} else if (base64Start.includes("uklgr") || imageSource.startsWith("UklGR")) {
|
|
1024
|
-
mimeType = "image/webp";
|
|
1025
|
-
}
|
|
1026
|
-
return `data:${mimeType};base64,${imageSource}`;
|
|
1027
|
-
}
|
|
1028
1031
|
async function generateProductCatalog(config) {
|
|
1029
1032
|
const { products, companyLogo, companyName, template = "template1" } = config;
|
|
1030
1033
|
let TemplateComponent;
|
|
@@ -1051,39 +1054,45 @@ async function generateProductCatalog(config) {
|
|
|
1051
1054
|
TemplateComponent = Template1_default;
|
|
1052
1055
|
}
|
|
1053
1056
|
if (template === "template4") {
|
|
1054
|
-
const doc2 = /* @__PURE__ */ jsxRuntime.jsx(renderer.Document, { children: /* @__PURE__ */ jsxRuntime.
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
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
|
+
] }) });
|
|
1062
1068
|
const blob2 = await renderer.pdf(doc2).toBlob();
|
|
1063
1069
|
const arrayBuffer2 = await blob2.arrayBuffer();
|
|
1064
1070
|
return new Uint8Array(arrayBuffer2);
|
|
1065
1071
|
}
|
|
1066
1072
|
if (template === "template5" || template === "template6") {
|
|
1067
1073
|
const Template = template === "template5" ? Template5_default : Template6_default;
|
|
1068
|
-
const doc2 = /* @__PURE__ */ jsxRuntime.jsx(renderer.Document, { children: /* @__PURE__ */ jsxRuntime.
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
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
|
+
] }) });
|
|
1076
1085
|
const blob2 = await renderer.pdf(doc2).toBlob();
|
|
1077
1086
|
const arrayBuffer2 = await blob2.arrayBuffer();
|
|
1078
1087
|
return new Uint8Array(arrayBuffer2);
|
|
1079
1088
|
}
|
|
1080
|
-
const doc = /* @__PURE__ */ jsxRuntime.jsx(renderer.Document, { children: /* @__PURE__ */ jsxRuntime.jsxs(renderer.Page, { size: "A4", style:
|
|
1081
|
-
/* @__PURE__ */ jsxRuntime.jsxs(renderer.View, { style:
|
|
1082
|
-
companyLogo && /* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
1083
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { style:
|
|
1084
|
-
/* @__PURE__ */ jsxRuntime.jsx(renderer.View, { break: true })
|
|
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 }) })
|
|
1085
1093
|
] }),
|
|
1086
|
-
/* @__PURE__ */ jsxRuntime.jsx(TemplateComponent, { products })
|
|
1094
|
+
/* @__PURE__ */ jsxRuntime.jsx(TemplateComponent, { products }),
|
|
1095
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoweredByTeziApp_default, {})
|
|
1087
1096
|
] }) });
|
|
1088
1097
|
const blob = await renderer.pdf(doc).toBlob();
|
|
1089
1098
|
const arrayBuffer = await blob.arrayBuffer();
|