@infuro/cms-core 1.0.67 → 1.0.69

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 (150) hide show
  1. package/dist/{OrderTrackPage-W3J6WIG2.js → OrderTrackPage-VBZUVZOU.js} +1 -1
  2. package/dist/{OrderTrackPage-Z6FCJQYY.cjs → OrderTrackPage-VFIXWJOW.cjs} +4 -4
  3. package/dist/admin.cjs +121 -12
  4. package/dist/admin.js +121 -12
  5. package/dist/api.cjs +57 -54
  6. package/dist/api.js +24 -21
  7. package/dist/auth.cjs +62 -62
  8. package/dist/auth.js +6 -6
  9. package/dist/{chunk-XJNNOSJR.js → chunk-2BNVRFUQ.js} +1 -1
  10. package/dist/chunk-2JHGIWH7.cjs +2700 -0
  11. package/dist/{chunk-3DZRIZOD.cjs → chunk-3ASNJS2H.cjs} +3 -3
  12. package/dist/{chunk-7NMT3GBR.cjs → chunk-3LQS4ATQ.cjs} +4 -4
  13. package/dist/{chunk-GWDI752Q.js → chunk-3XCTGADT.js} +1 -1
  14. package/dist/chunk-47G65M5Q.cjs +18 -0
  15. package/dist/{chunk-XFDIIVZB.cjs → chunk-4MNVIGVJ.cjs} +11 -11
  16. package/dist/{chunk-OY2YTBMP.cjs → chunk-4WZNRVEZ.cjs} +3 -3
  17. package/dist/{chunk-OVTOP42W.js → chunk-53AMBXMM.js} +1 -1
  18. package/dist/chunk-5BKT4CS5.js +28 -0
  19. package/dist/chunk-5DSY3GQI.js +16 -0
  20. package/dist/{chunk-AYERBA7I.js → chunk-5NVGWJSY.js} +1 -1
  21. package/dist/{chunk-HF3L2GIT.cjs → chunk-5YMKJ3TH.cjs} +16 -16
  22. package/dist/{chunk-WFMVD567.cjs → chunk-6MM5OMRL.cjs} +11 -11
  23. package/dist/{chunk-5MZFQRDW.cjs → chunk-747MJJCZ.cjs} +147 -147
  24. package/dist/{chunk-SYBOCAWB.js → chunk-7QJI56OL.js} +1 -1
  25. package/dist/{chunk-DBPSJYLZ.js → chunk-BK5XW5XH.js} +1 -1
  26. package/dist/chunk-BQQMTQ4C.cjs +455 -0
  27. package/dist/{chunk-6YOQ7G5O.js → chunk-CFUSYGSA.js} +1 -1
  28. package/dist/{chunk-OOTLNH63.cjs → chunk-CIZZX57T.cjs} +2 -2
  29. package/dist/{chunk-7L6KWI7S.cjs → chunk-CTTV375J.cjs} +13 -13
  30. package/dist/{chunk-ZY64VJMS.js → chunk-D4LR3S77.js} +2 -2
  31. package/dist/{chunk-GLLCLRCQ.js → chunk-DBBYLSQP.js} +179 -49
  32. package/dist/{chunk-5NOZSG6J.js → chunk-DWNQTFJ5.js} +2 -2
  33. package/dist/{chunk-2IAXTKQN.cjs → chunk-DZNWS2MM.cjs} +2 -2
  34. package/dist/chunk-E62LKM6Z.cjs +49 -0
  35. package/dist/{chunk-CRFV5WJK.js → chunk-ECNYZG6T.js} +1 -1
  36. package/dist/{chunk-TZEMLHSP.cjs → chunk-EYUBL7YH.cjs} +7 -7
  37. package/dist/{chunk-WMMZZRDJ.cjs → chunk-HGR4IA7I.cjs} +18 -18
  38. package/dist/{chunk-TJ2MIQUT.cjs → chunk-JRW3GQD4.cjs} +4 -4
  39. package/dist/{chunk-3K5AIEIZ.js → chunk-JYRFSFXH.js} +1 -1
  40. package/dist/chunk-K6RXCLD5.js +45 -0
  41. package/dist/{chunk-TU23GJPJ.js → chunk-LJ5C4RBF.js} +3 -3
  42. package/dist/{chunk-O4AFPDQ4.cjs → chunk-LXWF6T7F.cjs} +33 -33
  43. package/dist/{chunk-EIZKW2PF.js → chunk-LY7CDNC6.js} +1 -1
  44. package/dist/{chunk-PA6YDMFZ.cjs → chunk-M5QDJOUP.cjs} +12 -12
  45. package/dist/{chunk-MQBT33IV.js → chunk-MGT4DJ2D.js} +1 -1
  46. package/dist/{chunk-2ISSXYBZ.js → chunk-MJDNS324.js} +5 -5
  47. package/dist/{chunk-H3IVLIPR.cjs → chunk-OXFC3DAM.cjs} +4 -4
  48. package/dist/chunk-PQJIJ4ZX.js +445 -0
  49. package/dist/{chunk-HY3AXLOI.cjs → chunk-PRXVSSIF.cjs} +13 -13
  50. package/dist/{chunk-TDV6EJHV.js → chunk-PRZOLCFW.js} +2 -2
  51. package/dist/{chunk-BVLN75LP.cjs → chunk-QL44NCZC.cjs} +1221 -1091
  52. package/dist/{chunk-VM6OVUUM.cjs → chunk-QN6PZLAP.cjs} +40 -40
  53. package/dist/{chunk-OV5TRZET.cjs → chunk-QXAQ3V7R.cjs} +27 -27
  54. package/dist/{chunk-NV5IRHI3.js → chunk-RBKVMHBH.js} +9 -9
  55. package/dist/{chunk-UPLVMVRX.cjs → chunk-RQCXRCYM.cjs} +2 -2
  56. package/dist/{chunk-WUQAOTHA.js → chunk-SERRQ736.js} +1 -1
  57. package/dist/{chunk-SS3K7OIM.cjs → chunk-SWSTGV4F.cjs} +81 -81
  58. package/dist/{chunk-RCE5SJBA.js → chunk-T47VP2ZT.js} +3 -3
  59. package/dist/{chunk-FLUF2GZH.js → chunk-WHMIWJL7.js} +1 -1
  60. package/dist/{chunk-JC6DLWTE.js → chunk-WQZ4AH2P.js} +1 -1
  61. package/dist/{chunk-D5FBNKQM.cjs → chunk-WXH3GMCF.cjs} +8 -8
  62. package/dist/chunk-XHPRD45G.cjs +32 -0
  63. package/dist/{chunk-THL5JDWJ.cjs → chunk-Y54WDY2O.cjs} +2 -2
  64. package/dist/{chunk-YRCKEGL2.js → chunk-YDMHG6BA.js} +1 -1
  65. package/dist/chunk-YHVA5NHI.js +2698 -0
  66. package/dist/{chunk-JXF23MPG.js → chunk-ZMIMKNSQ.js} +1 -1
  67. package/dist/cli.cjs +10 -10
  68. package/dist/cli.js +1 -1
  69. package/dist/email-queue-BJDH2ID7.cjs +29 -0
  70. package/dist/email-queue-MWP4R67H.js +8 -0
  71. package/dist/email-service-6JODEMUA.js +3 -0
  72. package/dist/email-service-VA4Q4ZRB.cjs +28 -0
  73. package/dist/emit-order-notification-trigger-X36V4DOH.cjs +16 -0
  74. package/dist/emit-order-notification-trigger-XKN2TWVF.js +3 -0
  75. package/dist/erp-config-enabled-32XTHBBT.cjs +11 -0
  76. package/dist/erp-config-enabled-CASE5YVI.js +2 -0
  77. package/dist/erp-order-invoice-5O42ZKC5.cjs +28 -0
  78. package/dist/erp-order-invoice-JEQKFXG4.js +7 -0
  79. package/dist/{event-order-defaults-DU7V3YND.cjs → event-order-defaults-TR45WAQQ.cjs} +10 -10
  80. package/dist/{event-order-defaults-H4RT7NMR.js → event-order-defaults-VXYO6NHT.js} +2 -2
  81. package/dist/generate-local-invoice-pdf-2NCA2WBL.cjs +12 -0
  82. package/dist/generate-local-invoice-pdf-XUH6GYEJ.js +3 -0
  83. package/dist/hooks.cjs +24 -24
  84. package/dist/hooks.js +2 -2
  85. package/dist/index.cjs +497 -494
  86. package/dist/index.d.cts +7 -1
  87. package/dist/index.d.ts +7 -1
  88. package/dist/index.js +39 -36
  89. package/dist/interpolate-KD37IRF2.js +2 -0
  90. package/dist/interpolate-WP6OSJHN.cjs +11 -0
  91. package/dist/invoice-templates-2ESQ7K4N.cjs +19 -0
  92. package/dist/invoice-templates-3AXTXERZ.js +2 -0
  93. package/dist/middleware.cjs +4 -4
  94. package/dist/middleware.js +2 -2
  95. package/dist/{order-assignees-handlers-L3RVKUBS.js → order-assignees-handlers-F7WOZHOG.js} +1 -1
  96. package/dist/{order-assignees-handlers-KF7RMTV5.cjs → order-assignees-handlers-JEJ5IDID.cjs} +3 -3
  97. package/dist/{order-completion-otp-handlers-HFGCPC4O.js → order-completion-otp-handlers-FIW7PZ6W.js} +12 -9
  98. package/dist/{order-completion-otp-handlers-DZAXK4GQ.cjs → order-completion-otp-handlers-LNAZTMTS.cjs} +25 -22
  99. package/dist/{order-inventory-76V4XIGW.js → order-inventory-R3AU6N4V.js} +2 -2
  100. package/dist/{order-inventory-2MYRKEPC.cjs → order-inventory-UUFPWLBW.cjs} +10 -10
  101. package/dist/order-notification-dispatcher-FS54ANAV.js +13 -0
  102. package/dist/order-notification-dispatcher-GG5C4LKZ.cjs +38 -0
  103. package/dist/paid-order-erp-GRXR2OG6.js +3 -0
  104. package/dist/paid-order-erp-X5QHPI23.cjs +12 -0
  105. package/dist/pg-boss-service-CMW3KQJM.js +2 -0
  106. package/dist/pg-boss-service-GA6ZVD5G.cjs +15 -0
  107. package/dist/{razorpay-U23LGY72.cjs → razorpay-GP2DXVP2.cjs} +2 -2
  108. package/dist/{razorpay-KLO2KNCB.js → razorpay-I3G5LNYH.js} +1 -1
  109. package/dist/{rbac-debug-db-KWV7D5PQ.cjs → rbac-debug-db-2ZI3XKA4.cjs} +4 -4
  110. package/dist/{rbac-debug-db-DFZWZ6GV.js → rbac-debug-db-IRKT6G62.js} +2 -2
  111. package/dist/resolve-invoice-asset-url-64QQUVC3.js +2 -0
  112. package/dist/resolve-invoice-asset-url-J7WAMD26.cjs +11 -0
  113. package/dist/retire-soft-deleted-unique-DZALT537.cjs +15 -0
  114. package/dist/{retire-soft-deleted-unique-NXQIH4BC.js → retire-soft-deleted-unique-F25KZBZK.js} +2 -2
  115. package/dist/sms-defaults-DSO3M26Y.js +2 -0
  116. package/dist/{sms-defaults-KCOPKQBA.cjs → sms-defaults-GDFILHHR.cjs} +5 -5
  117. package/dist/{sms-notification-templates-handlers-SJLO7JGZ.js → sms-notification-templates-handlers-ZGDCVS5Z.js} +1 -1
  118. package/dist/{sms-notification-templates-handlers-YSB3L2PK.cjs → sms-notification-templates-handlers-ZKLKFRFZ.cjs} +3 -3
  119. package/dist/{stripe-VU6OEG2D.cjs → stripe-2APRZHKU.cjs} +2 -2
  120. package/dist/{stripe-4FD27QVJ.js → stripe-7CO2ETTN.js} +1 -1
  121. package/dist/theme.cjs +10 -10
  122. package/dist/theme.js +3 -3
  123. package/dist/vendor-invite-status-45ZCWKCX.js +2 -0
  124. package/dist/{vendor-invite-status-77O7ZQ3U.cjs → vendor-invite-status-AT2E4FUA.cjs} +5 -5
  125. package/package.json +2 -1
  126. package/dist/chunk-GLD263KW.cjs +0 -862
  127. package/dist/chunk-OPJEV44S.js +0 -847
  128. package/dist/chunk-SHUYVCID.js +0 -4
  129. package/dist/chunk-USNT2KNT.cjs +0 -6
  130. package/dist/email-queue-4OY45JIU.cjs +0 -26
  131. package/dist/email-queue-HGXB2FIS.js +0 -5
  132. package/dist/email-service-5O24BSFR.cjs +0 -28
  133. package/dist/email-service-ADDF52PJ.js +0 -3
  134. package/dist/emit-order-notification-trigger-EJJZ6XTS.js +0 -3
  135. package/dist/emit-order-notification-trigger-ZD5YN3JM.cjs +0 -16
  136. package/dist/erp-config-enabled-CUMQ6N2V.cjs +0 -11
  137. package/dist/erp-config-enabled-T37X7T34.js +0 -2
  138. package/dist/erp-order-invoice-H6HCJ7YS.js +0 -4
  139. package/dist/erp-order-invoice-YUSPZ7CE.cjs +0 -25
  140. package/dist/interpolate-WAKPN56R.cjs +0 -11
  141. package/dist/interpolate-WDUWDF3I.js +0 -2
  142. package/dist/order-notification-dispatcher-ECPFI7CD.js +0 -10
  143. package/dist/order-notification-dispatcher-LL7ETKLU.cjs +0 -35
  144. package/dist/paid-order-erp-3USEG6WL.js +0 -3
  145. package/dist/paid-order-erp-FSQ3GSXE.cjs +0 -12
  146. package/dist/pg-boss-service-BDGOKM2T.cjs +0 -15
  147. package/dist/pg-boss-service-WCBJD4JB.js +0 -2
  148. package/dist/retire-soft-deleted-unique-5VXBA5XX.cjs +0 -15
  149. package/dist/sms-defaults-2NL24H57.js +0 -2
  150. package/dist/vendor-invite-status-PWJ3DE76.js +0 -2
@@ -1,862 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkUPLVMVRX_cjs = require('./chunk-UPLVMVRX.cjs');
4
- var chunkTZEMLHSP_cjs = require('./chunk-TZEMLHSP.cjs');
5
- var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
6
- var pdfLib = require('pdf-lib');
7
-
8
- // src/plugins/erp/erp-response-map.ts
9
- function pickString(o, keys) {
10
- for (const k of keys) {
11
- const v = o[k];
12
- if (typeof v === "string" && v.trim()) return v.trim();
13
- }
14
- return void 0;
15
- }
16
- chunkUSNT2KNT_cjs.__name(pickString, "pickString");
17
- function unwrapErpReadData(json) {
18
- if (!json || typeof json !== "object") return null;
19
- const o = json;
20
- const d = o.data;
21
- if (d && typeof d === "object" && !Array.isArray(d)) return d;
22
- return o;
23
- }
24
- chunkUSNT2KNT_cjs.__name(unwrapErpReadData, "unwrapErpReadData");
25
- function firstObject(data, keys) {
26
- for (const k of keys) {
27
- const v = data[k];
28
- if (v && typeof v === "object" && !Array.isArray(v)) return v;
29
- }
30
- return null;
31
- }
32
- chunkUSNT2KNT_cjs.__name(firstObject, "firstObject");
33
- function extractEvents(src) {
34
- const timeline = src.timeline ?? src.events ?? src.history ?? src.trackingEvents;
35
- if (!Array.isArray(timeline) || !timeline.length) return void 0;
36
- const events = [];
37
- for (const row of timeline) {
38
- if (!row || typeof row !== "object") continue;
39
- const r = row;
40
- const at = pickString(r, [
41
- "at",
42
- "timestamp",
43
- "date",
44
- "occurredAt"
45
- ]) ?? (r.at instanceof Date ? r.at.toISOString() : void 0);
46
- const label = pickString(r, [
47
- "label",
48
- "status",
49
- "title",
50
- "message",
51
- "description"
52
- ]);
53
- const detail = pickString(r, [
54
- "detail",
55
- "notes",
56
- "description"
57
- ]);
58
- if (at || label || detail) events.push({
59
- at,
60
- label,
61
- detail
62
- });
63
- }
64
- return events.length ? events : void 0;
65
- }
66
- chunkUSNT2KNT_cjs.__name(extractEvents, "extractEvents");
67
- function mapErpPayloadToFulfillment(data) {
68
- const nested = firstObject(data, [
69
- "fulfillment",
70
- "packaging",
71
- "shipment",
72
- "shipping",
73
- "delivery"
74
- ]);
75
- const src = nested || data;
76
- const status = pickString(src, [
77
- "status",
78
- "fulfillmentStatus",
79
- "state",
80
- "label",
81
- "packagingStatus"
82
- ]);
83
- const trackingId = pickString(src, [
84
- "trackingId",
85
- "tracking_id",
86
- "trackingNumber",
87
- "awb",
88
- "trackingUrl"
89
- ]);
90
- const events = extractEvents(src);
91
- if (!status && !trackingId && !(events && events.length)) return void 0;
92
- return {
93
- status,
94
- trackingId,
95
- events
96
- };
97
- }
98
- chunkUSNT2KNT_cjs.__name(mapErpPayloadToFulfillment, "mapErpPayloadToFulfillment");
99
- function mapErpPayloadToInvoiceNumber(data) {
100
- const nested = firstObject(data, [
101
- "invoice",
102
- "latestInvoice",
103
- "postedInvoice"
104
- ]);
105
- const src = nested || data;
106
- return pickString(src, [
107
- "invoiceNumber",
108
- "invoice_number",
109
- "number",
110
- "name",
111
- "id"
112
- ]);
113
- }
114
- chunkUSNT2KNT_cjs.__name(mapErpPayloadToInvoiceNumber, "mapErpPayloadToInvoiceNumber");
115
- function extractChildOrderRefsFromSalePayload(data) {
116
- const lists = [
117
- data.returns,
118
- data.returnOrders,
119
- data.relatedReturns,
120
- data.childOrders,
121
- data.children
122
- ];
123
- const seen = /* @__PURE__ */ new Set();
124
- const out = [];
125
- for (const list of lists) {
126
- if (!Array.isArray(list)) continue;
127
- for (const item of list) {
128
- if (!item || typeof item !== "object") continue;
129
- const o = item;
130
- const ref = pickString(o, [
131
- "platformReturnId",
132
- "platform_return_id",
133
- "refId",
134
- "ref_id"
135
- ]) ?? (typeof o.id === "string" ? o.id : void 0);
136
- if (!ref || seen.has(ref)) continue;
137
- seen.add(ref);
138
- const t = (pickString(o, [
139
- "kind",
140
- "type",
141
- "orderKind"
142
- ]) || "").toLowerCase();
143
- const orderKind = /replac/.test(t) ? "replacement" : "return";
144
- out.push({
145
- ref,
146
- orderKind
147
- });
148
- }
149
- }
150
- return out;
151
- }
152
- chunkUSNT2KNT_cjs.__name(extractChildOrderRefsFromSalePayload, "extractChildOrderRefsFromSalePayload");
153
-
154
- // src/lib/invoice/invoice-templates.ts
155
- var INVOICE_TEMPLATE_IDS = [
156
- "classic",
157
- "modern",
158
- "compact",
159
- "bold"
160
- ];
161
- var INVOICE_TEMPLATE_OPTIONS = [
162
- {
163
- id: "classic",
164
- label: "Classic",
165
- description: "Traditional invoice with header, lined items, and totals footer."
166
- },
167
- {
168
- id: "modern",
169
- label: "Modern",
170
- description: "Clean layout with accent bar and spacious typography."
171
- },
172
- {
173
- id: "compact",
174
- label: "Compact",
175
- description: "Dense single-page layout for high line-item counts."
176
- },
177
- {
178
- id: "bold",
179
- label: "Bold",
180
- description: "Strong header band and clear payment summary block."
181
- }
182
- ];
183
- function normalizeInvoiceTemplateId(raw) {
184
- const v = String(raw ?? "").trim().toLowerCase();
185
- return INVOICE_TEMPLATE_IDS.includes(v) ? v : "classic";
186
- }
187
- chunkUSNT2KNT_cjs.__name(normalizeInvoiceTemplateId, "normalizeInvoiceTemplateId");
188
-
189
- // src/lib/invoice/generate-local-invoice-pdf.ts
190
- var THEMES = {
191
- classic: {
192
- accent: pdfLib.rgb(0.15, 0.25, 0.45),
193
- headerBg: pdfLib.rgb(0.96, 0.96, 0.97),
194
- headerText: pdfLib.rgb(0.12, 0.12, 0.14),
195
- text: pdfLib.rgb(0.12, 0.12, 0.14),
196
- muted: pdfLib.rgb(0.4, 0.42, 0.45),
197
- line: pdfLib.rgb(0.82, 0.84, 0.86),
198
- bandText: pdfLib.rgb(1, 1, 1)
199
- },
200
- modern: {
201
- accent: pdfLib.rgb(0.1, 0.45, 0.55),
202
- headerBg: pdfLib.rgb(0.93, 0.97, 0.98),
203
- headerText: pdfLib.rgb(0.1, 0.12, 0.14),
204
- text: pdfLib.rgb(0.1, 0.12, 0.14),
205
- muted: pdfLib.rgb(0.38, 0.42, 0.45),
206
- line: pdfLib.rgb(0.78, 0.86, 0.88),
207
- bandText: pdfLib.rgb(1, 1, 1)
208
- },
209
- compact: {
210
- accent: pdfLib.rgb(0.2, 0.2, 0.22),
211
- headerBg: pdfLib.rgb(0.95, 0.95, 0.95),
212
- headerText: pdfLib.rgb(0.1, 0.1, 0.1),
213
- text: pdfLib.rgb(0.1, 0.1, 0.1),
214
- muted: pdfLib.rgb(0.45, 0.45, 0.45),
215
- line: pdfLib.rgb(0.85, 0.85, 0.85),
216
- bandText: pdfLib.rgb(1, 1, 1)
217
- },
218
- bold: {
219
- accent: pdfLib.rgb(0.55, 0.12, 0.12),
220
- headerBg: pdfLib.rgb(0.55, 0.12, 0.12),
221
- headerText: pdfLib.rgb(1, 1, 1),
222
- text: pdfLib.rgb(0.1, 0.1, 0.1),
223
- muted: pdfLib.rgb(0.4, 0.4, 0.4),
224
- line: pdfLib.rgb(0.8, 0.75, 0.75),
225
- bandText: pdfLib.rgb(1, 1, 1)
226
- }
227
- };
228
- function money(amount, currency) {
229
- const n = Number.isFinite(amount) ? amount : 0;
230
- const code = (currency || "INR").trim().toUpperCase() || "INR";
231
- return `${code} ${n.toFixed(2)}`;
232
- }
233
- chunkUSNT2KNT_cjs.__name(money, "money");
234
- function fmtDate(d) {
235
- const date = d instanceof Date ? d : new Date(d);
236
- if (Number.isNaN(date.getTime())) return String(d);
237
- const y = date.getFullYear();
238
- const m = String(date.getMonth() + 1).padStart(2, "0");
239
- const day = String(date.getDate()).padStart(2, "0");
240
- return `${day}-${m}-${y}`;
241
- }
242
- chunkUSNT2KNT_cjs.__name(fmtDate, "fmtDate");
243
- function winAnsiSafe(input) {
244
- return String(input ?? "").replace(/\u20B9/g, "INR ").replace(/\u20AC/g, "EUR ").replace(/\u00A3/g, "GBP ").replace(/[^\x09\x0A\x0D\x20-\x7E]/g, "?");
245
- }
246
- chunkUSNT2KNT_cjs.__name(winAnsiSafe, "winAnsiSafe");
247
- function addrLines(a) {
248
- if (!a) return [];
249
- const out = [];
250
- if (a.line1?.trim()) out.push(a.line1.trim());
251
- if (a.line2?.trim()) out.push(a.line2.trim());
252
- const cityLine = [
253
- a.city,
254
- a.state,
255
- a.postalCode
256
- ].filter((x) => x && String(x).trim()).join(", ");
257
- if (cityLine) out.push(cityLine);
258
- if (a.country?.trim()) out.push(a.country.trim());
259
- return out.map(winAnsiSafe);
260
- }
261
- chunkUSNT2KNT_cjs.__name(addrLines, "addrLines");
262
- function companyHeaderDetailLines(company) {
263
- const lines = [];
264
- if (company.supportEmail?.trim()) {
265
- lines.push(`Email: ${company.supportEmail.trim()}`);
266
- }
267
- if (company.supportPhone?.trim()) {
268
- lines.push(`Phone: ${company.supportPhone.trim()}`);
269
- }
270
- if (company.address?.trim()) {
271
- const parts = company.address.split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
272
- if (parts.length === 1) {
273
- lines.push(`Address: ${parts[0]}`);
274
- } else if (parts.length > 1) {
275
- lines.push(`Address: ${parts[0]}`);
276
- lines.push(...parts.slice(1));
277
- }
278
- }
279
- return lines.map(winAnsiSafe);
280
- }
281
- chunkUSNT2KNT_cjs.__name(companyHeaderDetailLines, "companyHeaderDetailLines");
282
- function drawText(page, text, x, y, font, size, color) {
283
- const safe = winAnsiSafe(text).slice(0, 120);
284
- if (!safe) return;
285
- page.drawText(safe, {
286
- x,
287
- y,
288
- size,
289
- font,
290
- color
291
- });
292
- }
293
- chunkUSNT2KNT_cjs.__name(drawText, "drawText");
294
- function wrapText(text, font, size, maxWidth) {
295
- const words = winAnsiSafe(text).split(/\s+/).filter(Boolean);
296
- if (!words.length) return [
297
- ""
298
- ];
299
- const lines = [];
300
- let cur = "";
301
- for (const w of words) {
302
- const next = cur ? `${cur} ${w}` : w;
303
- if (font.widthOfTextAtSize(next, size) <= maxWidth) {
304
- cur = next;
305
- } else {
306
- if (cur) lines.push(cur);
307
- cur = w;
308
- }
309
- }
310
- if (cur) lines.push(cur);
311
- return lines.slice(0, 4);
312
- }
313
- chunkUSNT2KNT_cjs.__name(wrapText, "wrapText");
314
- async function tryEmbedLogo(doc, logoUrl, maxW, maxH) {
315
- const url = String(logoUrl ?? "").trim();
316
- if (!url || !/^https?:\/\//i.test(url)) return null;
317
- try {
318
- const res = await fetch(url, {
319
- signal: AbortSignal.timeout(8e3)
320
- });
321
- if (!res.ok) return null;
322
- const buf = new Uint8Array(await res.arrayBuffer());
323
- if (buf.byteLength < 24 || buf.byteLength > 25e5) return null;
324
- const ct = (res.headers.get("content-type") || "").toLowerCase();
325
- const isPng = ct.includes("png") || buf[0] === 137 && buf[1] === 80 && buf[2] === 78 && buf[3] === 71;
326
- const isJpg = ct.includes("jpeg") || ct.includes("jpg") || buf[0] === 255 && buf[1] === 216;
327
- let image;
328
- if (isPng) image = await doc.embedPng(buf);
329
- else if (isJpg) image = await doc.embedJpg(buf);
330
- else {
331
- try {
332
- image = await doc.embedPng(buf);
333
- } catch {
334
- image = await doc.embedJpg(buf);
335
- }
336
- }
337
- const scale = Math.min(maxW / image.width, maxH / image.height, 1);
338
- return {
339
- image,
340
- width: image.width * scale,
341
- height: image.height * scale
342
- };
343
- } catch {
344
- return null;
345
- }
346
- }
347
- chunkUSNT2KNT_cjs.__name(tryEmbedLogo, "tryEmbedLogo");
348
- async function generateLocalInvoicePdf(input) {
349
- const templateId = normalizeInvoiceTemplateId(input.templateId);
350
- const theme = THEMES[templateId];
351
- const doc = await pdfLib.PDFDocument.create();
352
- const font = await doc.embedFont(pdfLib.StandardFonts.Helvetica);
353
- const fontBold = await doc.embedFont(pdfLib.StandardFonts.HelveticaBold);
354
- const pageWidth = 595.28;
355
- const pageHeight = 841.89;
356
- const margin = templateId === "compact" ? 36 : 48;
357
- let page = doc.addPage([
358
- pageWidth,
359
- pageHeight
360
- ]);
361
- let y = pageHeight - margin;
362
- const companyName = input.company.name || "Store";
363
- const logo = await tryEmbedLogo(doc, input.company.logoUrl, 120, 40);
364
- const ensureSpace = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((need) => {
365
- if (y - need < margin + 40) {
366
- page = doc.addPage([
367
- pageWidth,
368
- pageHeight
369
- ]);
370
- y = pageHeight - margin;
371
- }
372
- }, "ensureSpace");
373
- const companyDetails = companyHeaderDetailLines(input.company);
374
- const detailLineH = 11;
375
- const detailsBlockH = companyDetails.length * detailLineH;
376
- if (templateId === "bold" || templateId === "modern") {
377
- const contentH = 22 + 16 + detailsBlockH;
378
- const bandH = Math.max(templateId === "bold" ? 72 : 56, logo ? logo.height + 24 : 56, contentH + 20);
379
- page.drawRectangle({
380
- x: 0,
381
- y: pageHeight - bandH,
382
- width: pageWidth,
383
- height: bandH,
384
- color: theme.accent
385
- });
386
- if (logo) {
387
- page.drawImage(logo.image, {
388
- x: pageWidth - margin - logo.width,
389
- y: pageHeight - bandH + (bandH - logo.height) / 2,
390
- width: logo.width,
391
- height: logo.height
392
- });
393
- }
394
- let hy = pageHeight - 26;
395
- drawText(page, "TAX INVOICE", margin, hy, fontBold, 18, theme.bandText);
396
- hy -= 18;
397
- drawText(page, companyName, margin, hy, font, 11, theme.bandText);
398
- hy -= 14;
399
- for (const line of companyDetails) {
400
- drawText(page, line, margin, hy, font, 8, theme.bandText);
401
- hy -= detailLineH;
402
- }
403
- y = pageHeight - bandH - 24;
404
- } else {
405
- const contentH = 18 + 14 + detailsBlockH;
406
- const headerH = Math.max(44, logo ? logo.height + 16 : 44, contentH + 20);
407
- page.drawRectangle({
408
- x: margin,
409
- y: y - headerH + 16,
410
- width: pageWidth - margin * 2,
411
- height: headerH,
412
- color: theme.headerBg
413
- });
414
- if (logo) {
415
- page.drawImage(logo.image, {
416
- x: pageWidth - margin - 12 - logo.width,
417
- y: y - headerH + 16 + (headerH - logo.height) / 2,
418
- width: logo.width,
419
- height: logo.height
420
- });
421
- }
422
- let hy = y + 2;
423
- drawText(page, "TAX INVOICE", margin + 12, hy, fontBold, 16, theme.accent);
424
- hy -= 16;
425
- drawText(page, companyName, margin + 12, hy, font, 10, theme.muted);
426
- hy -= 13;
427
- for (const line of companyDetails) {
428
- drawText(page, line, margin + 12, hy, font, 8, theme.muted);
429
- hy -= detailLineH;
430
- }
431
- y -= headerH + 16;
432
- }
433
- drawText(page, `Invoice #: ${input.orderNumber}`, margin, y, fontBold, 11, theme.text);
434
- drawText(page, `Date: ${fmtDate(input.orderDate)}`, pageWidth / 2, y, font, 10, theme.muted);
435
- y -= 22;
436
- ensureSpace(100);
437
- const colW = (pageWidth - margin * 2 - 16) / 2;
438
- drawText(page, "Bill to", margin, y, fontBold, 10, theme.accent);
439
- drawText(page, "Ship to", margin + colW + 16, y, fontBold, 10, theme.accent);
440
- y -= 14;
441
- const bill = [
442
- input.customerName,
443
- input.customerEmail || "",
444
- input.customerPhone || "",
445
- ...addrLines(input.billingAddress)
446
- ].filter(Boolean);
447
- const ship = addrLines(input.shippingAddress).length ? [
448
- input.customerName,
449
- ...addrLines(input.shippingAddress)
450
- ] : bill;
451
- const rows = Math.max(bill.length, ship.length, 1);
452
- for (let i = 0; i < rows; i++) {
453
- ensureSpace(14);
454
- if (bill[i]) drawText(page, bill[i], margin, y, font, 9, theme.text);
455
- if (ship[i]) drawText(page, ship[i], margin + colW + 16, y, font, 9, theme.text);
456
- y -= 12;
457
- }
458
- y -= 12;
459
- const right = pageWidth - margin;
460
- const contentRight = right - 4;
461
- const colTotalW = 100;
462
- const colTaxW = 100;
463
- const colPriceW = 100;
464
- const colQtyW = 40;
465
- const totalRight = contentRight;
466
- const taxRight = totalRight - colTotalW;
467
- const priceRight = taxRight - colTaxW;
468
- const qtyRight = priceRight - colPriceW;
469
- const itemMaxW = Math.max(80, qtyRight - colQtyW - margin - 8);
470
- const drawRight = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((text, rightEdge, atY, f, size, color) => {
471
- const safe = winAnsiSafe(text).slice(0, 40);
472
- if (!safe) return;
473
- const w = f.widthOfTextAtSize(safe, size);
474
- page.drawText(safe, {
475
- x: rightEdge - w,
476
- y: atY,
477
- size,
478
- font: f,
479
- color
480
- });
481
- }, "drawRight");
482
- ensureSpace(30);
483
- const headerBarH = 20;
484
- const headerBarBottom = y - 5;
485
- page.drawRectangle({
486
- x: margin,
487
- y: headerBarBottom,
488
- width: pageWidth - margin * 2,
489
- height: headerBarH,
490
- color: theme.headerBg
491
- });
492
- const headerTextY = headerBarBottom + 6;
493
- drawText(page, "Item", margin + 4, headerTextY, fontBold, 9, theme.headerText);
494
- drawRight("Qty", qtyRight, headerTextY, fontBold, 9, theme.headerText);
495
- drawRight("Price", priceRight, headerTextY, fontBold, 9, theme.headerText);
496
- drawRight("Tax", taxRight, headerTextY, fontBold, 9, theme.headerText);
497
- drawRight("Total", totalRight, headerTextY, fontBold, 9, theme.headerText);
498
- y = headerBarBottom - 10;
499
- for (const line of input.lineItems) {
500
- const nameLines = wrapText(line.name || "Item", font, 9, itemMaxW);
501
- const skuText = line.sku ? winAnsiSafe(`SKU: ${line.sku}`).slice(0, 80) : "";
502
- const nameH = Math.max(11, nameLines.length * 11);
503
- const skuH = skuText ? 10 : 0;
504
- const blockH = nameH + skuH + 6;
505
- ensureSpace(blockH + 10);
506
- let ty = y;
507
- for (const nl of nameLines) {
508
- drawText(page, nl, margin + 4, ty, font, 9, theme.text);
509
- ty -= 11;
510
- }
511
- if (skuText) {
512
- drawText(page, skuText, margin + 4, ty, font, 7, theme.muted);
513
- ty -= 10;
514
- }
515
- drawRight(String(line.quantity), qtyRight, y, font, 9, theme.text);
516
- drawRight(money(line.unitPrice, input.currency), priceRight, y, font, 9, theme.text);
517
- drawRight(money(line.tax ?? 0, input.currency), taxRight, y, font, 9, theme.text);
518
- drawRight(money(line.total, input.currency), totalRight, y, font, 9, theme.text);
519
- const contentBottom = Math.min(ty, y - 12);
520
- y = contentBottom - 2;
521
- page.drawLine({
522
- start: {
523
- x: margin,
524
- y
525
- },
526
- end: {
527
- x: pageWidth - margin,
528
- y
529
- },
530
- thickness: 0.5,
531
- color: theme.line
532
- });
533
- y -= 8;
534
- }
535
- y -= 16;
536
- ensureSpace(90);
537
- const summaryLabelX = totalRight - colTotalW - colTaxW - 8;
538
- const rowsSummary = [
539
- [
540
- "Subtotal",
541
- money(input.subtotal, input.currency),
542
- false
543
- ],
544
- [
545
- "Discount",
546
- money(input.discount, input.currency),
547
- false
548
- ],
549
- [
550
- "Tax",
551
- money(input.tax, input.currency),
552
- false
553
- ],
554
- [
555
- "Total",
556
- money(input.total, input.currency),
557
- true
558
- ]
559
- ];
560
- for (const [label, value, strong] of rowsSummary) {
561
- const f = strong ? fontBold : font;
562
- const size = strong ? 11 : 9;
563
- drawText(page, label, summaryLabelX, y, f, size, strong ? theme.accent : theme.muted);
564
- drawRight(value, totalRight, y, f, size, theme.text);
565
- y -= strong ? 18 : 14;
566
- }
567
- y -= 20;
568
- ensureSpace(40);
569
- drawText(page, "Thank you for your purchase.", margin, y, font, 9, theme.muted);
570
- y -= 12;
571
- drawText(page, ``, margin, y, font, 7, theme.muted);
572
- return doc.save();
573
- }
574
- chunkUSNT2KNT_cjs.__name(generateLocalInvoicePdf, "generateLocalInvoicePdf");
575
-
576
- // src/lib/invoice/resolve-invoice-asset-url.ts
577
- function resolveInvoiceAssetUrl(raw) {
578
- const t = String(raw ?? "").trim();
579
- if (!t) return null;
580
- if (/^https?:\/\//i.test(t)) return t;
581
- if (t.startsWith("//")) return `https:${t}`;
582
- const base = (process.env.CMS_PUBLIC_URL || process.env.NEXT_PUBLIC_SITE_URL || process.env.NEXTAUTH_URL || "").trim().replace(/\/+$/, "");
583
- if (!base) return null;
584
- if (t.startsWith("/")) return `${base}${t}`;
585
- return `${base}/${t}`;
586
- }
587
- chunkUSNT2KNT_cjs.__name(resolveInvoiceAssetUrl, "resolveInvoiceAssetUrl");
588
-
589
- // src/lib/invoice/build-local-invoice-for-order.ts
590
- async function loadSettingsGroup(ds, entityMap, group) {
591
- if (!entityMap.configs) return {};
592
- const rows = await ds.getRepository(entityMap.configs).find({
593
- where: {
594
- settings: group,
595
- deleted: false
596
- }
597
- });
598
- return Object.fromEntries(rows.map((r) => [
599
- r.key,
600
- String(r.value ?? "")
601
- ]));
602
- }
603
- chunkUSNT2KNT_cjs.__name(loadSettingsGroup, "loadSettingsGroup");
604
- function addrFromRow(row) {
605
- if (!row || typeof row !== "object") return null;
606
- const a = row;
607
- return {
608
- line1: String(a.line1 ?? "").trim() || void 0,
609
- line2: a.line2 != null ? String(a.line2).trim() || null : null,
610
- city: String(a.city ?? "").trim() || void 0,
611
- state: String(a.state ?? "").trim() || void 0,
612
- postalCode: String(a.postalCode ?? "").trim() || void 0,
613
- country: String(a.country ?? "").trim() || void 0
614
- };
615
- }
616
- chunkUSNT2KNT_cjs.__name(addrFromRow, "addrFromRow");
617
- async function buildLocalInvoicePdfForOrder(ds, entityMap, orderId) {
618
- if (!entityMap.orders || !entityMap.order_items) {
619
- return {
620
- error: "Orders not configured",
621
- status: 503
622
- };
623
- }
624
- const orderRepo = ds.getRepository(entityMap.orders);
625
- let order = null;
626
- try {
627
- order = await orderRepo.findOne({
628
- where: {
629
- id: orderId,
630
- deleted: false
631
- },
632
- relations: [
633
- "contact",
634
- "billingAddress",
635
- "shippingAddress",
636
- "items",
637
- "items.product"
638
- ]
639
- });
640
- } catch {
641
- order = await orderRepo.findOne({
642
- where: {
643
- id: orderId,
644
- deleted: false
645
- },
646
- relations: [
647
- "contact",
648
- "billingAddress",
649
- "shippingAddress",
650
- "items"
651
- ]
652
- });
653
- }
654
- if (!order) return {
655
- error: "Not found",
656
- status: 404
657
- };
658
- const o = order;
659
- const kind = o.orderKind || "sale";
660
- if (kind !== "sale") return {
661
- error: "Invoice only for sale orders",
662
- status: 400
663
- };
664
- const [store, branding, email] = await Promise.all([
665
- loadSettingsGroup(ds, entityMap, "store"),
666
- loadSettingsGroup(ds, entityMap, "branding"),
667
- loadSettingsGroup(ds, entityMap, "email")
668
- ]);
669
- const companyDetails = chunkTZEMLHSP_cjs.mergeEmailLayoutCompanyDetails(branding, email, store);
670
- const fromBranding = chunkTZEMLHSP_cjs.getCompanyDetailsFromSettings(branding);
671
- const rawLogo = store.invoiceLogoUrl || store.companyLogo || store.logo || companyDetails.logoUrl || fromBranding.logoUrl || null;
672
- const logoUrl = resolveInvoiceAssetUrl(rawLogo);
673
- const companyName = store.companyName || store.invoiceCompanyName || store.name || companyDetails.companyName || fromBranding.companyName || "Store";
674
- const supportEmail = store.companyEmail || store.invoiceEmail || store.email || companyDetails.supportEmail || fromBranding.supportEmail;
675
- const supportPhone = store.companyPhone || store.invoicePhone || store.phone || companyDetails.supportPhone;
676
- const address = store.companyAddress || store.invoiceAddress || store.address;
677
- const lineItems = (o.items ?? []).map((it) => {
678
- const name = it.product?.name && String(it.product.name).trim() || `Product #${it.productId ?? ""}`;
679
- return {
680
- name,
681
- quantity: Math.max(0, Math.floor(Number(it.quantity) || 0)),
682
- unitPrice: Number(it.unitPrice) || 0,
683
- tax: Number(it.tax) || 0,
684
- total: Number(it.total) || 0,
685
- sku: it.product?.sku ?? null
686
- };
687
- });
688
- const bytes = await generateLocalInvoicePdf({
689
- templateId: normalizeInvoiceTemplateId(store.invoiceTemplate),
690
- orderNumber: String(o.orderNumber || orderId),
691
- orderDate: o.createdAt || /* @__PURE__ */ new Date(),
692
- currency: String(o.currency || store.currency || "INR"),
693
- customerName: String(o.contact?.name ?? "").trim() || "Customer",
694
- customerEmail: o.contact?.email ?? null,
695
- customerPhone: o.contact?.phone ?? null,
696
- billingAddress: addrFromRow(o.billingAddress),
697
- shippingAddress: addrFromRow(o.shippingAddress),
698
- lineItems,
699
- subtotal: Number(o.subtotal) || 0,
700
- tax: Number(o.tax) || 0,
701
- discount: Number(o.discount) || 0,
702
- total: Number(o.total) || 0,
703
- company: {
704
- name: companyName,
705
- logoUrl,
706
- supportEmail,
707
- supportPhone,
708
- address
709
- }
710
- });
711
- return {
712
- bytes,
713
- filename: `invoice-${String(o.orderNumber || orderId).replace(/[^\w.-]+/g, "_")}.pdf`
714
- };
715
- }
716
- chunkUSNT2KNT_cjs.__name(buildLocalInvoicePdfForOrder, "buildLocalInvoicePdfForOrder");
717
-
718
- // src/plugins/erp/erp-order-invoice.ts
719
- function pickInvoiceId(data) {
720
- const nested = data.invoice && typeof data.invoice === "object" && !Array.isArray(data.invoice) ? data.invoice : null;
721
- const src = nested || data;
722
- for (const k of [
723
- "invoiceId",
724
- "invoice_id",
725
- "id"
726
- ]) {
727
- const v = src[k];
728
- if (typeof v === "string" && v.trim()) return v.trim();
729
- }
730
- return void 0;
731
- }
732
- chunkUSNT2KNT_cjs.__name(pickInvoiceId, "pickInvoiceId");
733
- function jsonErr(msg, status) {
734
- return new Response(JSON.stringify({
735
- error: msg
736
- }), {
737
- status,
738
- headers: {
739
- "Content-Type": "application/json"
740
- }
741
- });
742
- }
743
- chunkUSNT2KNT_cjs.__name(jsonErr, "jsonErr");
744
- var ORDER_INVOICE_EMAIL_ELIGIBLE_STATUSES = /* @__PURE__ */ new Set([
745
- "pending",
746
- "placed",
747
- "confirmed",
748
- "processing",
749
- "completed"
750
- ]);
751
- function isOrderEligibleForInvoiceEmail(status, orderKind) {
752
- const kind = (orderKind || "sale").trim().toLowerCase();
753
- if (kind !== "sale") return false;
754
- return ORDER_INVOICE_EMAIL_ELIGIBLE_STATUSES.has(String(status ?? "").trim().toLowerCase());
755
- }
756
- chunkUSNT2KNT_cjs.__name(isOrderEligibleForInvoiceEmail, "isOrderEligibleForInvoiceEmail");
757
- async function resolveOrderInvoicePdfBytes(cms, dataSource, entityMap, orderId, options = {}) {
758
- try {
759
- const orderRepo = dataSource.getRepository(entityMap.orders);
760
- const order = await orderRepo.findOne({
761
- where: {
762
- id: orderId,
763
- deleted: false
764
- }
765
- });
766
- if (!order) return {
767
- error: "Not found",
768
- status: 404
769
- };
770
- const kind = order.orderKind || "sale";
771
- if (kind !== "sale") return {
772
- error: "Invoice only for sale orders",
773
- status: 400
774
- };
775
- if (options.ownerContactId != null && order.contactId !== options.ownerContactId) {
776
- return {
777
- error: "Not found",
778
- status: 404
779
- };
780
- }
781
- const on = await chunkUPLVMVRX_cjs.isErpIntegrationEnabled(cms, dataSource, entityMap);
782
- const erp = cms.getPlugin("erp");
783
- if (on && erp?.submission) {
784
- const meta = order.metadata && typeof order.metadata === "object" && !Array.isArray(order.metadata) ? order.metadata : {};
785
- const inv = meta.invoice && typeof meta.invoice === "object" && !Array.isArray(meta.invoice) ? meta.invoice : {};
786
- let invoiceId = typeof inv.invoiceId === "string" ? inv.invoiceId.trim() : "";
787
- if (!invoiceId) {
788
- const refId = String(order.orderNumber || "");
789
- try {
790
- const r = await erp.submission.postErpReadAction("get-invoice", {
791
- platformOrderId: refId
792
- });
793
- const d = r.ok ? unwrapErpReadData(r.json) : null;
794
- invoiceId = d ? pickInvoiceId(d) || "" : "";
795
- } catch {
796
- invoiceId = "";
797
- }
798
- }
799
- if (invoiceId) {
800
- const pdf = await erp.submission.fetchInvoicePdf(invoiceId);
801
- if (pdf.ok && pdf.buffer) {
802
- return {
803
- bytes: new Uint8Array(pdf.buffer),
804
- filename: `order-invoice-${orderId}.pdf`,
805
- contentType: pdf.contentType || "application/pdf",
806
- source: "erp"
807
- };
808
- }
809
- }
810
- }
811
- const local = await buildLocalInvoicePdfForOrder(dataSource, entityMap, orderId);
812
- if ("error" in local) return {
813
- error: local.error,
814
- status: local.status
815
- };
816
- return {
817
- bytes: local.bytes,
818
- filename: local.filename.startsWith("invoice-") ? local.filename.replace(/^invoice-/, "order-invoice-") : local.filename,
819
- contentType: "application/pdf",
820
- source: "local"
821
- };
822
- } catch (err) {
823
- const msg = err instanceof Error ? err.message : String(err);
824
- console.error("[invoice] resolveOrderInvoicePdfBytes failed", {
825
- orderId,
826
- error: msg
827
- });
828
- return {
829
- error: `Invoice failed: ${msg}`,
830
- status: 500
831
- };
832
- }
833
- }
834
- chunkUSNT2KNT_cjs.__name(resolveOrderInvoicePdfBytes, "resolveOrderInvoicePdfBytes");
835
- async function streamOrderInvoicePdf(cms, dataSource, entityMap, orderId, options) {
836
- const resolved = await resolveOrderInvoicePdfBytes(cms, dataSource, entityMap, orderId, options);
837
- if ("error" in resolved) return jsonErr(resolved.error, resolved.status);
838
- return new Response(Buffer.from(resolved.bytes), {
839
- status: 200,
840
- headers: {
841
- "Content-Type": resolved.contentType,
842
- "Content-Disposition": `attachment; filename="${resolved.filename}"`,
843
- "X-Invoice-Source": resolved.source
844
- }
845
- });
846
- }
847
- chunkUSNT2KNT_cjs.__name(streamOrderInvoicePdf, "streamOrderInvoicePdf");
848
-
849
- exports.INVOICE_TEMPLATE_IDS = INVOICE_TEMPLATE_IDS;
850
- exports.INVOICE_TEMPLATE_OPTIONS = INVOICE_TEMPLATE_OPTIONS;
851
- exports.ORDER_INVOICE_EMAIL_ELIGIBLE_STATUSES = ORDER_INVOICE_EMAIL_ELIGIBLE_STATUSES;
852
- exports.buildLocalInvoicePdfForOrder = buildLocalInvoicePdfForOrder;
853
- exports.extractChildOrderRefsFromSalePayload = extractChildOrderRefsFromSalePayload;
854
- exports.generateLocalInvoicePdf = generateLocalInvoicePdf;
855
- exports.isOrderEligibleForInvoiceEmail = isOrderEligibleForInvoiceEmail;
856
- exports.mapErpPayloadToFulfillment = mapErpPayloadToFulfillment;
857
- exports.mapErpPayloadToInvoiceNumber = mapErpPayloadToInvoiceNumber;
858
- exports.normalizeInvoiceTemplateId = normalizeInvoiceTemplateId;
859
- exports.resolveInvoiceAssetUrl = resolveInvoiceAssetUrl;
860
- exports.resolveOrderInvoicePdfBytes = resolveOrderInvoicePdfBytes;
861
- exports.streamOrderInvoicePdf = streamOrderInvoicePdf;
862
- exports.unwrapErpReadData = unwrapErpReadData;