@infuro/cms-core 1.0.72 → 1.0.74

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 (43) hide show
  1. package/dist/admin.cjs +543 -120
  2. package/dist/admin.js +545 -122
  3. package/dist/api.cjs +37 -37
  4. package/dist/api.d.cts +13 -6
  5. package/dist/api.d.ts +13 -6
  6. package/dist/api.js +5 -5
  7. package/dist/auth.cjs +11 -11
  8. package/dist/auth.d.cts +15 -0
  9. package/dist/auth.d.ts +15 -0
  10. package/dist/auth.js +1 -1
  11. package/dist/{chunk-BQQMTQ4C.cjs → chunk-25T6HP5T.cjs} +2 -2
  12. package/dist/{chunk-TTOEY7AH.cjs → chunk-2JV4EDY3.cjs} +3 -3
  13. package/dist/{chunk-LJ5C4RBF.js → chunk-6TRH3VY7.js} +1 -1
  14. package/dist/{chunk-4MNVIGVJ.cjs → chunk-D3SR6CYU.cjs} +3 -3
  15. package/dist/{chunk-PQJIJ4ZX.js → chunk-DAUBLBTP.js} +1 -1
  16. package/dist/{chunk-SCE2GIKH.js → chunk-DEGN4BTH.js} +9 -0
  17. package/dist/{chunk-CKTRA3Q2.cjs → chunk-F3FKBNMQ.cjs} +9 -0
  18. package/dist/{chunk-SRGDHASW.cjs → chunk-H4UIIBFD.cjs} +2571 -2096
  19. package/dist/{chunk-YHVA5NHI.js → chunk-LUSJITTI.js} +43 -6
  20. package/dist/{chunk-43UVXBEH.js → chunk-OQOO2JMB.js} +2529 -2054
  21. package/dist/{chunk-HZZTDM5J.js → chunk-R5HLPH6P.js} +1 -1
  22. package/dist/{chunk-3LF4RYAJ.js → chunk-X3IJG25M.js} +1 -1
  23. package/dist/{chunk-2JHGIWH7.cjs → chunk-X5ILLSTD.cjs} +43 -6
  24. package/dist/{chunk-NIBEGDD4.cjs → chunk-ZBSH4GWB.cjs} +1 -1
  25. package/dist/{email-queue-MWP4R67H.js → email-queue-5TOJJT3P.js} +3 -3
  26. package/dist/{email-queue-BJDH2ID7.cjs → email-queue-X2A46VD3.cjs} +7 -7
  27. package/dist/{emit-order-notification-trigger-TBXAZAPS.js → emit-order-notification-trigger-3RAVWKLG.js} +1 -1
  28. package/dist/{emit-order-notification-trigger-I4HQSTEN.cjs → emit-order-notification-trigger-MY3KP7CD.cjs} +3 -3
  29. package/dist/{erp-order-invoice-5O42ZKC5.cjs → erp-order-invoice-23BDWC2H.cjs} +6 -6
  30. package/dist/{erp-order-invoice-JEQKFXG4.js → erp-order-invoice-SEZZUDMW.js} +2 -2
  31. package/dist/generate-local-invoice-pdf-V5FHS23Z.js +3 -0
  32. package/dist/{generate-local-invoice-pdf-2NCA2WBL.cjs → generate-local-invoice-pdf-XYBVKHNP.cjs} +2 -2
  33. package/dist/index.cjs +243 -243
  34. package/dist/index.d.cts +31 -9
  35. package/dist/index.d.ts +31 -9
  36. package/dist/index.js +10 -10
  37. package/dist/migrations/1783400000000-MakeProductConfigTaxIdNullable.ts +40 -0
  38. package/dist/{order-completion-otp-handlers-KHLZQQJX.js → order-completion-otp-handlers-2WOFSORP.js} +4 -4
  39. package/dist/{order-completion-otp-handlers-2ZKRK5SN.cjs → order-completion-otp-handlers-EWY47XUA.cjs} +6 -6
  40. package/dist/{order-notification-dispatcher-Z3MXNF4U.js → order-notification-dispatcher-COR2ZHM3.js} +4 -4
  41. package/dist/{order-notification-dispatcher-37KDVHBM.cjs → order-notification-dispatcher-KTOAMMSD.cjs} +9 -9
  42. package/package.json +1 -1
  43. package/dist/generate-local-invoice-pdf-XUH6GYEJ.js +0 -3
@@ -2369,6 +2369,41 @@ function wrapText(text, font, size, maxWidth) {
2369
2369
  return lines.slice(0, 4);
2370
2370
  }
2371
2371
  __name(wrapText, "wrapText");
2372
+ function wrapLinesToWidth(lines, font, size, maxWidth) {
2373
+ const result = [];
2374
+ for (const rawLine of lines) {
2375
+ if (!rawLine || !rawLine.trim()) continue;
2376
+ const words = winAnsiSafe(rawLine).split(/\s+/).filter(Boolean);
2377
+ if (!words.length) continue;
2378
+ let current = "";
2379
+ for (let word of words) {
2380
+ while (font.widthOfTextAtSize(word, size) > maxWidth) {
2381
+ let cut = word.length - 1;
2382
+ while (cut > 0 && font.widthOfTextAtSize(word.slice(0, cut), size) > maxWidth) {
2383
+ cut--;
2384
+ }
2385
+ if (cut <= 0) cut = 1;
2386
+ const head = word.slice(0, cut);
2387
+ if (current) {
2388
+ result.push(current);
2389
+ current = "";
2390
+ }
2391
+ result.push(head);
2392
+ word = word.slice(cut);
2393
+ }
2394
+ const candidate = current ? `${current} ${word}` : word;
2395
+ if (font.widthOfTextAtSize(candidate, size) <= maxWidth) {
2396
+ current = candidate;
2397
+ } else {
2398
+ if (current) result.push(current);
2399
+ current = word;
2400
+ }
2401
+ }
2402
+ if (current) result.push(current);
2403
+ }
2404
+ return result;
2405
+ }
2406
+ __name(wrapLinesToWidth, "wrapLinesToWidth");
2372
2407
  async function tryEmbedLogo(doc, logoUrl, maxW, maxH) {
2373
2408
  const url = String(logoUrl ?? "").trim();
2374
2409
  if (!url || !/^https?:\/\//i.test(url)) return null;
@@ -2532,21 +2567,23 @@ async function generateLocalInvoicePdf(input) {
2532
2567
  drawText(page, "Bill to", margin, y, fontBold, 10, theme.accent);
2533
2568
  drawText(page, "Ship to", margin + colW + 16, y, fontBold, 10, theme.accent);
2534
2569
  y -= 14;
2535
- const bill = [
2570
+ const billRaw = [
2536
2571
  input.customerName,
2537
2572
  input.customerEmail || "",
2538
2573
  input.customerPhone || "",
2539
2574
  ...addrLines(input.billingAddress)
2540
2575
  ].filter(Boolean);
2541
- const ship = addrLines(input.shippingAddress).length ? [
2576
+ const shipRaw = addrLines(input.shippingAddress).length ? [
2542
2577
  input.customerName,
2543
2578
  ...addrLines(input.shippingAddress)
2544
- ] : bill;
2545
- const rows = Math.max(bill.length, ship.length, 1);
2579
+ ] : billRaw;
2580
+ const billLines = wrapLinesToWidth(billRaw, font, 9, colW);
2581
+ const shipLines = wrapLinesToWidth(shipRaw, font, 9, colW);
2582
+ const rows = Math.max(billLines.length, shipLines.length, 1);
2546
2583
  for (let i = 0; i < rows; i++) {
2547
2584
  ensureSpace(14);
2548
- if (bill[i]) drawText(page, bill[i], margin, y, font, 9, theme.text);
2549
- if (ship[i]) drawText(page, ship[i], margin + colW + 16, y, font, 9, theme.text);
2585
+ if (billLines[i]) drawText(page, billLines[i], margin, y, font, 9, theme.text);
2586
+ if (shipLines[i]) drawText(page, shipLines[i], margin + colW + 16, y, font, 9, theme.text);
2550
2587
  y -= 12;
2551
2588
  }
2552
2589
  y -= 12;