@bookmypuja-tech/bmp-pdf 0.1.7 → 0.1.9

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.ts CHANGED
@@ -46,6 +46,17 @@ interface IPujaReport {
46
46
  prasadam?: string;
47
47
  }[];
48
48
  }
49
+ interface IQuickReport {
50
+ templeName: string;
51
+ receiptNumber: string;
52
+ address: string;
53
+ pujas: {
54
+ name: string;
55
+ pujaQty?: number;
56
+ pujaAmount: number;
57
+ pujaDate: Date;
58
+ }[];
59
+ }
49
60
 
50
61
  declare const A4Print: ({ data, dates, }: {
51
62
  data: IPrintablePuja[];
@@ -66,5 +77,6 @@ declare const getPrintBlob: ({ size, data, dates, }: {
66
77
  declare const printDevoteeReceipt2Inch: (data: IPujaReceipt) => Promise<void>;
67
78
  declare const printTotalReceipt2Inch: (data: ITotalReceipt) => Promise<void>;
68
79
  declare const printePujaReport2Inch: (data: IPujaReport) => Promise<void>;
80
+ declare const printQuickPrintReceipt2Inch: (data: IQuickReport) => Promise<void>;
69
81
 
70
- export { A4Print, type IPrintablePuja, type IPujaReceipt, T2Inch, getPrintBlob, printDevoteeReceipt2Inch, printTotalReceipt2Inch, printePujaReport2Inch };
82
+ export { A4Print, type IPrintablePuja, type IPujaReceipt, T2Inch, getPrintBlob, printDevoteeReceipt2Inch, printQuickPrintReceipt2Inch, printTotalReceipt2Inch, printePujaReport2Inch };
package/dist/index.js CHANGED
@@ -213,7 +213,7 @@ var A4Print = ({
213
213
  var A4Print_default = A4Print;
214
214
 
215
215
  // src/index.tsx
216
- import React6 from "react";
216
+ import React7 from "react";
217
217
 
218
218
  // src/sizes/T2Inch.tsx
219
219
  import React2 from "react";
@@ -546,6 +546,32 @@ var getPujaReportReceipt2InchBase64Data = async (receiptData) => {
546
546
  return btoa(String.fromCharCode.apply(null, Array.from(data)));
547
547
  };
548
548
 
549
+ // src/sizes/receipt/QuickReceipt2Inch.tsx
550
+ import React6 from "react";
551
+ import { Br as Br4, Cut as Cut4, Line as Line4, Printer as Printer4, render as render4, Text as Text6 } from "react-thermal-printer";
552
+ var QuickReceipt2Inch = (data) => {
553
+ const timeRightNow = /* @__PURE__ */ new Date();
554
+ return /* @__PURE__ */ React6.createElement(Printer4, { type: "epson", width: 32, characterSet: "iso8859_15_latin9" }, data.pujas.map((puja) => {
555
+ return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(Text6, { align: "center", bold: true }, data.templeName), /* @__PURE__ */ React6.createElement(Text6, { align: "center" }, data.address), data.receiptNumber ? /* @__PURE__ */ React6.createElement(Text6, { align: "center" }, "Invoice no: ", String(data.receiptNumber)) : null, /* @__PURE__ */ React6.createElement(Text6, { align: "center" }, "Print:", " ", timeRightNow.toLocaleDateString("en-US", {
556
+ month: "short",
557
+ day: "numeric",
558
+ year: "numeric"
559
+ }), ",", " ", timeRightNow.toLocaleTimeString("en-US", {
560
+ hour: "numeric",
561
+ minute: "numeric",
562
+ hour12: true
563
+ }).toLowerCase()), /* @__PURE__ */ React6.createElement(Line4, null), /* @__PURE__ */ React6.createElement(Text6, { bold: true, size: { height: 2, width: 1 } }, puja.name, Number(puja.pujaQty) > 1 && ` (Qty:${puja.pujaQty})`), /* @__PURE__ */ React6.createElement(Text6, { align: "left" }, puja.pujaDate.toLocaleDateString("en-US", {
564
+ month: "short",
565
+ day: "numeric",
566
+ year: "numeric"
567
+ }), " ", "Rs ", Number(puja.pujaAmount).toLocaleString("en-IN")), /* @__PURE__ */ React6.createElement(Br4, null), /* @__PURE__ */ React6.createElement(Br4, null), /* @__PURE__ */ React6.createElement(Br4, null), /* @__PURE__ */ React6.createElement(Br4, null), /* @__PURE__ */ React6.createElement(Br4, null), /* @__PURE__ */ React6.createElement(Line4, null), /* @__PURE__ */ React6.createElement(Text6, { align: "center" }, "Thank You"), /* @__PURE__ */ React6.createElement(Text6, { align: "center" }, "bookmypuja.app"), /* @__PURE__ */ React6.createElement(Cut4, { lineFeeds: 2 }));
568
+ }));
569
+ };
570
+ var getQuickReceipt2InchBase64Data = async (receiptData) => {
571
+ const data = await render4(QuickReceipt2Inch(receiptData));
572
+ return btoa(String.fromCharCode.apply(null, Array.from(data)));
573
+ };
574
+
549
575
  // src/index.tsx
550
576
  var getPrintBlob = ({
551
577
  size,
@@ -553,10 +579,10 @@ var getPrintBlob = ({
553
579
  dates
554
580
  }) => {
555
581
  if (size === "A4") {
556
- const blob = pdf(/* @__PURE__ */ React6.createElement(A4Print_default, { data, dates })).toBlob();
582
+ const blob = pdf(/* @__PURE__ */ React7.createElement(A4Print_default, { data, dates })).toBlob();
557
583
  return blob;
558
584
  } else {
559
- const blob = pdf(/* @__PURE__ */ React6.createElement(T2Inch_default, { data, dates })).toBlob();
585
+ const blob = pdf(/* @__PURE__ */ React7.createElement(T2Inch_default, { data, dates })).toBlob();
560
586
  return blob;
561
587
  }
562
588
  };
@@ -578,11 +604,18 @@ var printePujaReport2Inch = async (data) => {
578
604
  var P = "package=ru.a402d.rawbtprinter;end;";
579
605
  window.location.href = "intent:base64," + base64DataObject + S + P;
580
606
  };
607
+ var printQuickPrintReceipt2Inch = async (data) => {
608
+ const base64DataObject = await getQuickReceipt2InchBase64Data(data);
609
+ var S = "#Intent;scheme=rawbt;";
610
+ var P = "package=ru.a402d.rawbtprinter;end;";
611
+ window.location.href = "intent:base64," + base64DataObject + S + P;
612
+ };
581
613
  export {
582
614
  A4Print_default as A4Print,
583
615
  T2Inch_default as T2Inch,
584
616
  getPrintBlob,
585
617
  printDevoteeReceipt2Inch,
618
+ printQuickPrintReceipt2Inch,
586
619
  printTotalReceipt2Inch,
587
620
  printePujaReport2Inch
588
621
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bookmypuja-tech/bmp-pdf",
3
3
  "description": "PDF Report Generation for Temple360 and T-360 by BookMyPuja",
4
- "version": "0.1.7",
4
+ "version": "0.1.9",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",