arcli 2.0.0 → 2.2.0

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 (511) hide show
  1. package/CHANGELOG.md +106 -1
  2. package/README.md +21 -14
  3. package/dist/cli/arca-runtime.js +41 -0
  4. package/dist/cli/commands/billing-family.command.js +36 -9
  5. package/dist/cli/commands/billing-shortcuts.command.js +8 -2
  6. package/dist/cli/commands/billing.command.batch.js +28 -12
  7. package/dist/cli/commands/billing.command.interactive-preview.js +12 -13
  8. package/dist/cli/commands/billing.command.options.js +83 -39
  9. package/dist/cli/commands/billing.command.output.js +3 -3
  10. package/dist/cli/commands/billing.command.parser.js +44 -30
  11. package/dist/cli/commands/billing.command.pdf.js +9 -6
  12. package/dist/cli/commands/billing.command.shared.js +86 -49
  13. package/dist/cli/commands/billing.command.shortcuts.js +3 -4
  14. package/dist/cli/commands/completion.command.js +140 -0
  15. package/dist/cli/commands/config.command.js +44 -45
  16. package/dist/cli/commands/cuit-argument.js +10 -0
  17. package/dist/cli/commands/examples.command.js +0 -1
  18. package/dist/cli/commands/export-shortcut.command.js +19 -0
  19. package/dist/cli/commands/export.command.js +106 -0
  20. package/dist/cli/commands/export.command.options.js +140 -0
  21. package/dist/cli/commands/export.command.parser.js +84 -0
  22. package/dist/cli/commands/export.command.pdf.js +61 -0
  23. package/dist/cli/commands/fce-obligation.command.js +8 -16
  24. package/dist/cli/commands/interactive.command.js +9 -8
  25. package/dist/cli/commands/padron.command.js +46 -0
  26. package/dist/cli/commands/parameters.command.js +13 -13
  27. package/dist/cli/commands/pdf.command.js +17 -31
  28. package/dist/cli/commands/storybook.command.js +4 -4
  29. package/dist/cli/commands/vouchers.command.js +14 -14
  30. package/dist/cli/error-output.js +89 -11
  31. package/dist/cli/global-options.js +55 -0
  32. package/dist/cli/help-argv.js +0 -1
  33. package/dist/cli/help.js +243 -391
  34. package/dist/cli/ignored-global-options.js +32 -0
  35. package/dist/cli/index.js +12 -14
  36. package/dist/cli/interactive/advanced-options.js +13 -14
  37. package/dist/cli/interactive/config.flow.js +59 -20
  38. package/dist/cli/interactive/export.flow.js +263 -0
  39. package/dist/cli/interactive/history.flow.js +2 -3
  40. package/dist/cli/interactive/interactive-mode.js +63 -33
  41. package/dist/cli/interactive/invoice-picker.js +7 -7
  42. package/dist/cli/interactive/invoice.flow.js +35 -13
  43. package/dist/cli/interactive/note.flow.js +16 -16
  44. package/dist/cli/interactive/pdf.flow.js +9 -7
  45. package/dist/cli/interactive/prompts.js +0 -1
  46. package/dist/cli/interactive/receiver-padron.js +52 -0
  47. package/dist/cli/interactive/repeat.flow.js +10 -11
  48. package/dist/cli/interactive/session.js +13 -8
  49. package/dist/cli/interactive/status.flow.js +0 -1
  50. package/dist/cli/interactive/update.flow.js +0 -1
  51. package/dist/cli/interactive/validators.js +7 -6
  52. package/dist/cli/option-parsers.js +14 -4
  53. package/dist/cli/program.js +14 -5
  54. package/dist/cli/skipped-options.js +14 -0
  55. package/dist/cli/spinner.js +0 -1
  56. package/dist/cli/types.js +0 -1
  57. package/dist/cli/version.js +1 -2
  58. package/dist/index.js +0 -1
  59. package/dist/lib/dates/arca-date.js +3 -4
  60. package/dist/lib/errors/app-error.js +2 -2
  61. package/dist/lib/files/read-json-file.js +2 -3
  62. package/dist/lib/files/restrict-to-owner.js +0 -1
  63. package/dist/lib/files/write-new-file.js +29 -0
  64. package/dist/lib/identity/cuit.js +26 -0
  65. package/dist/lib/identity/format-cuit.js +1 -2
  66. package/dist/lib/links.js +2 -1
  67. package/dist/lib/numbers/argentine-amount.js +3 -4
  68. package/dist/lib/numbers/strict-integer.js +0 -1
  69. package/dist/lib/paths/mask-path.js +0 -1
  70. package/dist/lib/security/certificate.js +10 -8
  71. package/dist/lib/security/pem.js +2 -3
  72. package/dist/modules/billing/billing-response.js +16 -5
  73. package/dist/modules/billing/billing.amounts.js +3 -4
  74. package/dist/modules/billing/billing.associated-period.js +7 -8
  75. package/dist/modules/billing/billing.associated-vouchers.js +5 -6
  76. package/dist/modules/billing/billing.batch.js +12 -5
  77. package/dist/modules/billing/billing.constants.js +0 -1
  78. package/dist/modules/billing/billing.currency.js +4 -5
  79. package/dist/modules/billing/billing.date-range.js +27 -11
  80. package/dist/modules/billing/billing.display.js +14 -8
  81. package/dist/modules/billing/billing.errors.js +2 -3
  82. package/dist/modules/billing/billing.fce.js +3 -4
  83. package/dist/modules/billing/billing.iva-receptor.js +2 -3
  84. package/dist/modules/billing/billing.json-format.js +0 -1
  85. package/dist/modules/billing/billing.json-input.js +278 -0
  86. package/dist/modules/billing/billing.labels.js +1 -2
  87. package/dist/modules/billing/billing.mappers.js +0 -1
  88. package/dist/modules/billing/billing.padron.js +59 -0
  89. package/dist/modules/billing/billing.presenter.js +0 -1
  90. package/dist/modules/billing/billing.schemas.js +20 -6
  91. package/dist/modules/billing/billing.serialize.js +11 -15
  92. package/dist/modules/billing/billing.service.js +25 -4
  93. package/dist/modules/billing/billing.text.js +4 -13
  94. package/dist/modules/billing/billing.types.internal.js +0 -1
  95. package/dist/modules/billing/billing.types.js +0 -1
  96. package/dist/modules/billing/billing.validation.js +13 -11
  97. package/dist/modules/billing/voucher-kind-map.js +15 -16
  98. package/dist/modules/completion/completion.js +53 -0
  99. package/dist/modules/completion/completion.presenter.js +35 -0
  100. package/dist/modules/completion/installer.js +92 -0
  101. package/dist/modules/completion/shell-scripts.js +46 -0
  102. package/dist/modules/config/certificate-expiry.js +90 -0
  103. package/dist/modules/config/config-doctor.js +42 -28
  104. package/dist/modules/config/config-value-parser.js +32 -17
  105. package/dist/modules/config/config.export-credentials.js +23 -0
  106. package/dist/modules/config/config.presenter.js +28 -6
  107. package/dist/modules/config/config.schemas.js +27 -12
  108. package/dist/modules/config/config.sections.js +31 -11
  109. package/dist/modules/config/config.service.js +38 -9
  110. package/dist/modules/examples/examples.js +72 -37
  111. package/dist/modules/export/export.items.js +149 -0
  112. package/dist/modules/export/export.json-input.js +91 -0
  113. package/dist/modules/export/export.mappers.js +293 -0
  114. package/dist/modules/export/export.presenter.js +2 -0
  115. package/dist/modules/export/export.response.js +86 -0
  116. package/dist/modules/export/export.serialize.js +70 -0
  117. package/dist/modules/export/export.service.js +146 -0
  118. package/dist/modules/export/export.text.js +177 -0
  119. package/dist/modules/export/export.types.js +36 -0
  120. package/dist/modules/fce/fce-obligation.js +3 -4
  121. package/dist/modules/fce/fce-obligation.presenter.js +2 -3
  122. package/dist/modules/interactive/amount-input.js +0 -1
  123. package/dist/modules/interactive/choices.js +10 -2
  124. package/dist/modules/interactive/config-fields.js +17 -3
  125. package/dist/modules/interactive/equivalent-command.js +6 -3
  126. package/dist/modules/interactive/export-equivalent-command.js +40 -0
  127. package/dist/modules/interactive/invoice-copy.js +1 -2
  128. package/dist/modules/interactive/periods.js +0 -1
  129. package/dist/modules/interactive/wizard.js +0 -1
  130. package/dist/modules/padron/padron.js +23 -0
  131. package/dist/modules/padron/padron.presenter.js +48 -0
  132. package/dist/modules/parameters/health.js +0 -1
  133. package/dist/modules/parameters/parameters.js +2 -3
  134. package/dist/modules/parameters/parameters.presenter.js +14 -12
  135. package/dist/modules/parameters/status.js +0 -1
  136. package/dist/modules/pdf/pdf-data.mapper.js +94 -3
  137. package/dist/modules/pdf/pdf-decision.js +0 -1
  138. package/dist/modules/pdf/pdf-file-name.js +0 -1
  139. package/dist/modules/pdf/pdf-issuer.js +3 -3
  140. package/dist/modules/pdf/pdf-legends.js +35 -0
  141. package/dist/modules/pdf/pdf.errors.js +0 -1
  142. package/dist/modules/pdf/pdf.types.js +0 -1
  143. package/dist/modules/storybook/showcase-theme.js +0 -1
  144. package/dist/modules/storybook/showcase.js +35 -23
  145. package/dist/modules/update-check/changelog.js +0 -1
  146. package/dist/modules/update-check/update-check.presenter.js +6 -7
  147. package/dist/modules/update-check/update-check.service.js +0 -1
  148. package/dist/modules/vouchers/voucher-history.js +0 -1
  149. package/dist/modules/vouchers/voucher-history.presenter.js +3 -4
  150. package/dist/services/arca/arca-billing.gateway.js +18 -4
  151. package/dist/services/arca/arca-client.factory.js +27 -1
  152. package/dist/services/arca/arca-context.resolver.js +17 -7
  153. package/dist/services/arca/arca-export.gateway.js +146 -0
  154. package/dist/services/arca/arca-fce-obligation.gateway.js +2 -3
  155. package/dist/services/arca/arca-padron.gateway.js +103 -0
  156. package/dist/services/arca/arca-parameters.gateway.js +2 -3
  157. package/dist/services/arca/arca-voucher-history.gateway.js +2 -3
  158. package/dist/services/arca/last-voucher.js +26 -0
  159. package/dist/services/clipboard/clipboard.js +0 -1
  160. package/dist/services/pdf/escape-html.js +0 -1
  161. package/dist/services/pdf/pdf-browser.js +0 -1
  162. package/dist/services/pdf/pdf-exporter.js +26 -11
  163. package/dist/services/pdf/pdf-plugin.js +41 -14
  164. package/dist/ui/components/certificateBanner.js +8 -0
  165. package/dist/ui/components/contentPanel.js +0 -1
  166. package/dist/ui/components/errorPanel.js +0 -1
  167. package/dist/ui/components/index.js +1 -1
  168. package/dist/ui/components/keyValuePanel.js +0 -1
  169. package/dist/ui/components/noticePanel.js +0 -1
  170. package/dist/ui/components/rawPanel.js +0 -1
  171. package/dist/ui/components/sectionHeading.js +0 -1
  172. package/dist/ui/components/statusBar.js +0 -1
  173. package/dist/ui/components/statusPanel.js +0 -1
  174. package/dist/ui/components/testingBanner.js +0 -1
  175. package/dist/ui/index.js +0 -1
  176. package/dist/ui/presenters/billing.presenter.js +0 -1
  177. package/dist/ui/presenters/config.presenter.js +1 -2
  178. package/dist/ui/presenters/errors.presenter.js +14 -12
  179. package/dist/ui/presenters/errors.zod-presenter.js +13 -35
  180. package/dist/ui/presenters/export.presenter.js +1 -0
  181. package/dist/ui/presenters/index.js +1 -1
  182. package/dist/ui/presenters/pdf.presenter.js +1 -2
  183. package/dist/ui/presenters/showcase.presenter.js +0 -1
  184. package/dist/ui/primitives/index.js +0 -1
  185. package/dist/ui/primitives/renderDivider.js +0 -1
  186. package/dist/ui/primitives/renderFooter.js +0 -1
  187. package/dist/ui/primitives/renderJson.js +0 -1
  188. package/dist/ui/primitives/renderKeyValue.js +0 -1
  189. package/dist/ui/primitives/renderLogo.js +0 -1
  190. package/dist/ui/primitives/renderObject.js +0 -1
  191. package/dist/ui/primitives/renderPanel.js +0 -1
  192. package/dist/ui/primitives/renderSubtitle.js +0 -1
  193. package/dist/ui/primitives/renderTable.js +0 -1
  194. package/dist/ui/primitives/terminalWidth.js +0 -1
  195. package/dist/ui/primitives/text.js +0 -1
  196. package/dist/ui/stream/index.js +0 -1
  197. package/dist/ui/stream/terminal-stream.js +13 -2
  198. package/dist/ui/theme/index.js +0 -1
  199. package/dist/ui/theme/theme.js +0 -1
  200. package/llms.txt +122 -45
  201. package/package.json +1 -2
  202. package/dist/cli/commands/billing-family.command.d.ts +0 -2
  203. package/dist/cli/commands/billing-family.command.js.map +0 -1
  204. package/dist/cli/commands/billing-shortcuts.command.d.ts +0 -2
  205. package/dist/cli/commands/billing-shortcuts.command.js.map +0 -1
  206. package/dist/cli/commands/billing.command.batch.d.ts +0 -22
  207. package/dist/cli/commands/billing.command.batch.js.map +0 -1
  208. package/dist/cli/commands/billing.command.interactive-preview.d.ts +0 -18
  209. package/dist/cli/commands/billing.command.interactive-preview.js.map +0 -1
  210. package/dist/cli/commands/billing.command.options.d.ts +0 -2
  211. package/dist/cli/commands/billing.command.options.js.map +0 -1
  212. package/dist/cli/commands/billing.command.output.d.ts +0 -14
  213. package/dist/cli/commands/billing.command.output.js.map +0 -1
  214. package/dist/cli/commands/billing.command.parser.d.ts +0 -28
  215. package/dist/cli/commands/billing.command.parser.js.map +0 -1
  216. package/dist/cli/commands/billing.command.pdf.d.ts +0 -24
  217. package/dist/cli/commands/billing.command.pdf.js.map +0 -1
  218. package/dist/cli/commands/billing.command.shared.d.ts +0 -7
  219. package/dist/cli/commands/billing.command.shared.js.map +0 -1
  220. package/dist/cli/commands/billing.command.shortcuts.d.ts +0 -7
  221. package/dist/cli/commands/billing.command.shortcuts.js.map +0 -1
  222. package/dist/cli/commands/config.command.d.ts +0 -7
  223. package/dist/cli/commands/config.command.js.map +0 -1
  224. package/dist/cli/commands/examples.command.d.ts +0 -2
  225. package/dist/cli/commands/examples.command.js.map +0 -1
  226. package/dist/cli/commands/fce-obligation.command.d.ts +0 -2
  227. package/dist/cli/commands/fce-obligation.command.js.map +0 -1
  228. package/dist/cli/commands/interactive.command.d.ts +0 -3
  229. package/dist/cli/commands/interactive.command.js.map +0 -1
  230. package/dist/cli/commands/parameters.command.d.ts +0 -2
  231. package/dist/cli/commands/parameters.command.js.map +0 -1
  232. package/dist/cli/commands/pdf.command.d.ts +0 -2
  233. package/dist/cli/commands/pdf.command.js.map +0 -1
  234. package/dist/cli/commands/storybook.command.d.ts +0 -2
  235. package/dist/cli/commands/storybook.command.js.map +0 -1
  236. package/dist/cli/commands/vouchers.command.d.ts +0 -2
  237. package/dist/cli/commands/vouchers.command.js.map +0 -1
  238. package/dist/cli/error-output.d.ts +0 -7
  239. package/dist/cli/error-output.js.map +0 -1
  240. package/dist/cli/help-argv.d.ts +0 -5
  241. package/dist/cli/help-argv.js.map +0 -1
  242. package/dist/cli/help.d.ts +0 -12
  243. package/dist/cli/help.js.map +0 -1
  244. package/dist/cli/index.d.ts +0 -2
  245. package/dist/cli/index.js.map +0 -1
  246. package/dist/cli/interactive/advanced-options.d.ts +0 -21
  247. package/dist/cli/interactive/advanced-options.js.map +0 -1
  248. package/dist/cli/interactive/config.flow.d.ts +0 -5
  249. package/dist/cli/interactive/config.flow.js.map +0 -1
  250. package/dist/cli/interactive/history.flow.d.ts +0 -6
  251. package/dist/cli/interactive/history.flow.js.map +0 -1
  252. package/dist/cli/interactive/interactive-mode.d.ts +0 -3
  253. package/dist/cli/interactive/interactive-mode.js.map +0 -1
  254. package/dist/cli/interactive/invoice-picker.d.ts +0 -25
  255. package/dist/cli/interactive/invoice-picker.js.map +0 -1
  256. package/dist/cli/interactive/invoice.flow.d.ts +0 -20
  257. package/dist/cli/interactive/invoice.flow.js.map +0 -1
  258. package/dist/cli/interactive/note.flow.d.ts +0 -32
  259. package/dist/cli/interactive/note.flow.js.map +0 -1
  260. package/dist/cli/interactive/pdf.flow.d.ts +0 -5
  261. package/dist/cli/interactive/pdf.flow.js.map +0 -1
  262. package/dist/cli/interactive/prompts.d.ts +0 -57
  263. package/dist/cli/interactive/prompts.js.map +0 -1
  264. package/dist/cli/interactive/repeat.flow.d.ts +0 -13
  265. package/dist/cli/interactive/repeat.flow.js.map +0 -1
  266. package/dist/cli/interactive/session.d.ts +0 -22
  267. package/dist/cli/interactive/session.js.map +0 -1
  268. package/dist/cli/interactive/status.flow.d.ts +0 -3
  269. package/dist/cli/interactive/status.flow.js.map +0 -1
  270. package/dist/cli/interactive/update.flow.d.ts +0 -6
  271. package/dist/cli/interactive/update.flow.js.map +0 -1
  272. package/dist/cli/interactive/validators.d.ts +0 -9
  273. package/dist/cli/interactive/validators.js.map +0 -1
  274. package/dist/cli/option-parsers.d.ts +0 -6
  275. package/dist/cli/option-parsers.js.map +0 -1
  276. package/dist/cli/program.d.ts +0 -2
  277. package/dist/cli/program.js.map +0 -1
  278. package/dist/cli/spinner.d.ts +0 -8
  279. package/dist/cli/spinner.js.map +0 -1
  280. package/dist/cli/types.d.ts +0 -6
  281. package/dist/cli/types.js.map +0 -1
  282. package/dist/cli/version.d.ts +0 -1
  283. package/dist/cli/version.js.map +0 -1
  284. package/dist/index.d.ts +0 -1
  285. package/dist/index.js.map +0 -1
  286. package/dist/lib/dates/arca-date.d.ts +0 -19
  287. package/dist/lib/dates/arca-date.js.map +0 -1
  288. package/dist/lib/errors/app-error.d.ts +0 -17
  289. package/dist/lib/errors/app-error.js.map +0 -1
  290. package/dist/lib/files/read-json-file.d.ts +0 -1
  291. package/dist/lib/files/read-json-file.js.map +0 -1
  292. package/dist/lib/files/restrict-to-owner.d.ts +0 -7
  293. package/dist/lib/files/restrict-to-owner.js.map +0 -1
  294. package/dist/lib/identity/format-cuit.d.ts +0 -2
  295. package/dist/lib/identity/format-cuit.js.map +0 -1
  296. package/dist/lib/links.d.ts +0 -2
  297. package/dist/lib/links.js.map +0 -1
  298. package/dist/lib/numbers/argentine-amount.d.ts +0 -23
  299. package/dist/lib/numbers/argentine-amount.js.map +0 -1
  300. package/dist/lib/numbers/strict-integer.d.ts +0 -4
  301. package/dist/lib/numbers/strict-integer.js.map +0 -1
  302. package/dist/lib/paths/mask-path.d.ts +0 -1
  303. package/dist/lib/paths/mask-path.js.map +0 -1
  304. package/dist/lib/security/certificate.d.ts +0 -7
  305. package/dist/lib/security/certificate.js.map +0 -1
  306. package/dist/lib/security/pem.d.ts +0 -5
  307. package/dist/lib/security/pem.js.map +0 -1
  308. package/dist/modules/billing/billing-response.d.ts +0 -4
  309. package/dist/modules/billing/billing-response.js.map +0 -1
  310. package/dist/modules/billing/billing.amounts.d.ts +0 -21
  311. package/dist/modules/billing/billing.amounts.js.map +0 -1
  312. package/dist/modules/billing/billing.associated-period.d.ts +0 -8
  313. package/dist/modules/billing/billing.associated-period.js.map +0 -1
  314. package/dist/modules/billing/billing.associated-vouchers.d.ts +0 -12
  315. package/dist/modules/billing/billing.associated-vouchers.js.map +0 -1
  316. package/dist/modules/billing/billing.batch.d.ts +0 -23
  317. package/dist/modules/billing/billing.batch.js.map +0 -1
  318. package/dist/modules/billing/billing.constants.d.ts +0 -2
  319. package/dist/modules/billing/billing.constants.js.map +0 -1
  320. package/dist/modules/billing/billing.currency.d.ts +0 -18
  321. package/dist/modules/billing/billing.currency.js.map +0 -1
  322. package/dist/modules/billing/billing.date-range.d.ts +0 -9
  323. package/dist/modules/billing/billing.date-range.js.map +0 -1
  324. package/dist/modules/billing/billing.display.d.ts +0 -13
  325. package/dist/modules/billing/billing.display.js.map +0 -1
  326. package/dist/modules/billing/billing.errors.d.ts +0 -12
  327. package/dist/modules/billing/billing.errors.js.map +0 -1
  328. package/dist/modules/billing/billing.fce.d.ts +0 -21
  329. package/dist/modules/billing/billing.fce.js.map +0 -1
  330. package/dist/modules/billing/billing.iva-receptor.d.ts +0 -8
  331. package/dist/modules/billing/billing.iva-receptor.js.map +0 -1
  332. package/dist/modules/billing/billing.json-format.d.ts +0 -6
  333. package/dist/modules/billing/billing.json-format.js.map +0 -1
  334. package/dist/modules/billing/billing.labels.d.ts +0 -9
  335. package/dist/modules/billing/billing.labels.js.map +0 -1
  336. package/dist/modules/billing/billing.mappers.d.ts +0 -8
  337. package/dist/modules/billing/billing.mappers.js.map +0 -1
  338. package/dist/modules/billing/billing.presenter.d.ts +0 -7
  339. package/dist/modules/billing/billing.presenter.js.map +0 -1
  340. package/dist/modules/billing/billing.schemas.d.ts +0 -142
  341. package/dist/modules/billing/billing.schemas.js.map +0 -1
  342. package/dist/modules/billing/billing.serialize.d.ts +0 -8
  343. package/dist/modules/billing/billing.serialize.js.map +0 -1
  344. package/dist/modules/billing/billing.service.d.ts +0 -27
  345. package/dist/modules/billing/billing.service.js.map +0 -1
  346. package/dist/modules/billing/billing.text.d.ts +0 -8
  347. package/dist/modules/billing/billing.text.js.map +0 -1
  348. package/dist/modules/billing/billing.types.d.ts +0 -13
  349. package/dist/modules/billing/billing.types.internal.d.ts +0 -30
  350. package/dist/modules/billing/billing.types.internal.js.map +0 -1
  351. package/dist/modules/billing/billing.types.js.map +0 -1
  352. package/dist/modules/billing/billing.validation.d.ts +0 -7
  353. package/dist/modules/billing/billing.validation.js.map +0 -1
  354. package/dist/modules/billing/voucher-kind-map.d.ts +0 -9
  355. package/dist/modules/billing/voucher-kind-map.js.map +0 -1
  356. package/dist/modules/config/config-doctor.d.ts +0 -15
  357. package/dist/modules/config/config-doctor.js.map +0 -1
  358. package/dist/modules/config/config-value-parser.d.ts +0 -2
  359. package/dist/modules/config/config-value-parser.js.map +0 -1
  360. package/dist/modules/config/config.presenter.d.ts +0 -15
  361. package/dist/modules/config/config.presenter.js.map +0 -1
  362. package/dist/modules/config/config.schemas.d.ts +0 -154
  363. package/dist/modules/config/config.schemas.js.map +0 -1
  364. package/dist/modules/config/config.sections.d.ts +0 -14
  365. package/dist/modules/config/config.sections.js.map +0 -1
  366. package/dist/modules/config/config.service.d.ts +0 -35
  367. package/dist/modules/config/config.service.js.map +0 -1
  368. package/dist/modules/examples/examples.d.ts +0 -1
  369. package/dist/modules/examples/examples.js.map +0 -1
  370. package/dist/modules/fce/fce-obligation.d.ts +0 -20
  371. package/dist/modules/fce/fce-obligation.js.map +0 -1
  372. package/dist/modules/fce/fce-obligation.presenter.d.ts +0 -9
  373. package/dist/modules/fce/fce-obligation.presenter.js.map +0 -1
  374. package/dist/modules/interactive/amount-input.d.ts +0 -4
  375. package/dist/modules/interactive/amount-input.js.map +0 -1
  376. package/dist/modules/interactive/choices.d.ts +0 -13
  377. package/dist/modules/interactive/choices.js.map +0 -1
  378. package/dist/modules/interactive/config-fields.d.ts +0 -20
  379. package/dist/modules/interactive/config-fields.js.map +0 -1
  380. package/dist/modules/interactive/equivalent-command.d.ts +0 -8
  381. package/dist/modules/interactive/equivalent-command.js.map +0 -1
  382. package/dist/modules/interactive/invoice-copy.d.ts +0 -19
  383. package/dist/modules/interactive/invoice-copy.js.map +0 -1
  384. package/dist/modules/interactive/periods.d.ts +0 -7
  385. package/dist/modules/interactive/periods.js.map +0 -1
  386. package/dist/modules/interactive/wizard.d.ts +0 -16
  387. package/dist/modules/interactive/wizard.js.map +0 -1
  388. package/dist/modules/parameters/health.d.ts +0 -17
  389. package/dist/modules/parameters/health.js.map +0 -1
  390. package/dist/modules/parameters/parameters.d.ts +0 -50
  391. package/dist/modules/parameters/parameters.js.map +0 -1
  392. package/dist/modules/parameters/parameters.presenter.d.ts +0 -12
  393. package/dist/modules/parameters/parameters.presenter.js.map +0 -1
  394. package/dist/modules/parameters/status.d.ts +0 -31
  395. package/dist/modules/parameters/status.js.map +0 -1
  396. package/dist/modules/pdf/pdf-data.mapper.d.ts +0 -4
  397. package/dist/modules/pdf/pdf-data.mapper.js.map +0 -1
  398. package/dist/modules/pdf/pdf-decision.d.ts +0 -14
  399. package/dist/modules/pdf/pdf-decision.js.map +0 -1
  400. package/dist/modules/pdf/pdf-file-name.d.ts +0 -3
  401. package/dist/modules/pdf/pdf-file-name.js.map +0 -1
  402. package/dist/modules/pdf/pdf-issuer.d.ts +0 -8
  403. package/dist/modules/pdf/pdf-issuer.js.map +0 -1
  404. package/dist/modules/pdf/pdf.errors.d.ts +0 -9
  405. package/dist/modules/pdf/pdf.errors.js.map +0 -1
  406. package/dist/modules/pdf/pdf.types.d.ts +0 -91
  407. package/dist/modules/pdf/pdf.types.js.map +0 -1
  408. package/dist/modules/storybook/showcase-theme.d.ts +0 -7
  409. package/dist/modules/storybook/showcase-theme.js.map +0 -1
  410. package/dist/modules/storybook/showcase.d.ts +0 -2
  411. package/dist/modules/storybook/showcase.js.map +0 -1
  412. package/dist/modules/update-check/changelog.d.ts +0 -23
  413. package/dist/modules/update-check/changelog.js.map +0 -1
  414. package/dist/modules/update-check/update-check.presenter.d.ts +0 -6
  415. package/dist/modules/update-check/update-check.presenter.js.map +0 -1
  416. package/dist/modules/update-check/update-check.service.d.ts +0 -11
  417. package/dist/modules/update-check/update-check.service.js.map +0 -1
  418. package/dist/modules/vouchers/voucher-history.d.ts +0 -39
  419. package/dist/modules/vouchers/voucher-history.js.map +0 -1
  420. package/dist/modules/vouchers/voucher-history.presenter.d.ts +0 -29
  421. package/dist/modules/vouchers/voucher-history.presenter.js.map +0 -1
  422. package/dist/services/arca/arca-billing.gateway.d.ts +0 -10
  423. package/dist/services/arca/arca-billing.gateway.js.map +0 -1
  424. package/dist/services/arca/arca-client.factory.d.ts +0 -5
  425. package/dist/services/arca/arca-client.factory.js.map +0 -1
  426. package/dist/services/arca/arca-context.resolver.d.ts +0 -44
  427. package/dist/services/arca/arca-context.resolver.js.map +0 -1
  428. package/dist/services/arca/arca-fce-obligation.gateway.d.ts +0 -7
  429. package/dist/services/arca/arca-fce-obligation.gateway.js.map +0 -1
  430. package/dist/services/arca/arca-parameters.gateway.d.ts +0 -10
  431. package/dist/services/arca/arca-parameters.gateway.js.map +0 -1
  432. package/dist/services/arca/arca-voucher-history.gateway.d.ts +0 -8
  433. package/dist/services/arca/arca-voucher-history.gateway.js.map +0 -1
  434. package/dist/services/clipboard/clipboard.d.ts +0 -2
  435. package/dist/services/clipboard/clipboard.js.map +0 -1
  436. package/dist/services/pdf/escape-html.d.ts +0 -6
  437. package/dist/services/pdf/escape-html.js.map +0 -1
  438. package/dist/services/pdf/pdf-browser.d.ts +0 -5
  439. package/dist/services/pdf/pdf-browser.js.map +0 -1
  440. package/dist/services/pdf/pdf-exporter.d.ts +0 -19
  441. package/dist/services/pdf/pdf-exporter.js.map +0 -1
  442. package/dist/services/pdf/pdf-plugin.d.ts +0 -50
  443. package/dist/services/pdf/pdf-plugin.js.map +0 -1
  444. package/dist/ui/components/contentPanel.d.ts +0 -5
  445. package/dist/ui/components/contentPanel.js.map +0 -1
  446. package/dist/ui/components/errorPanel.d.ts +0 -1
  447. package/dist/ui/components/errorPanel.js.map +0 -1
  448. package/dist/ui/components/index.d.ts +0 -9
  449. package/dist/ui/components/index.js.map +0 -1
  450. package/dist/ui/components/keyValuePanel.d.ts +0 -3
  451. package/dist/ui/components/keyValuePanel.js.map +0 -1
  452. package/dist/ui/components/noticePanel.d.ts +0 -3
  453. package/dist/ui/components/noticePanel.js.map +0 -1
  454. package/dist/ui/components/rawPanel.d.ts +0 -1
  455. package/dist/ui/components/rawPanel.js.map +0 -1
  456. package/dist/ui/components/sectionHeading.d.ts +0 -3
  457. package/dist/ui/components/sectionHeading.js.map +0 -1
  458. package/dist/ui/components/statusBar.d.ts +0 -19
  459. package/dist/ui/components/statusBar.js.map +0 -1
  460. package/dist/ui/components/statusPanel.d.ts +0 -3
  461. package/dist/ui/components/statusPanel.js.map +0 -1
  462. package/dist/ui/components/testingBanner.d.ts +0 -2
  463. package/dist/ui/components/testingBanner.js.map +0 -1
  464. package/dist/ui/index.d.ts +0 -5
  465. package/dist/ui/index.js.map +0 -1
  466. package/dist/ui/presenters/billing.presenter.d.ts +0 -2
  467. package/dist/ui/presenters/billing.presenter.js.map +0 -1
  468. package/dist/ui/presenters/config.presenter.d.ts +0 -1
  469. package/dist/ui/presenters/config.presenter.js.map +0 -1
  470. package/dist/ui/presenters/errors.presenter.d.ts +0 -1
  471. package/dist/ui/presenters/errors.presenter.js.map +0 -1
  472. package/dist/ui/presenters/errors.zod-presenter.d.ts +0 -4
  473. package/dist/ui/presenters/errors.zod-presenter.js.map +0 -1
  474. package/dist/ui/presenters/index.d.ts +0 -6
  475. package/dist/ui/presenters/index.js.map +0 -1
  476. package/dist/ui/presenters/pdf.presenter.d.ts +0 -13
  477. package/dist/ui/presenters/pdf.presenter.js.map +0 -1
  478. package/dist/ui/presenters/showcase.presenter.d.ts +0 -1
  479. package/dist/ui/presenters/showcase.presenter.js.map +0 -1
  480. package/dist/ui/primitives/index.d.ts +0 -10
  481. package/dist/ui/primitives/index.js.map +0 -1
  482. package/dist/ui/primitives/renderDivider.d.ts +0 -5
  483. package/dist/ui/primitives/renderDivider.js.map +0 -1
  484. package/dist/ui/primitives/renderFooter.d.ts +0 -7
  485. package/dist/ui/primitives/renderFooter.js.map +0 -1
  486. package/dist/ui/primitives/renderJson.d.ts +0 -3
  487. package/dist/ui/primitives/renderJson.js.map +0 -1
  488. package/dist/ui/primitives/renderKeyValue.d.ts +0 -14
  489. package/dist/ui/primitives/renderKeyValue.js.map +0 -1
  490. package/dist/ui/primitives/renderLogo.d.ts +0 -3
  491. package/dist/ui/primitives/renderLogo.js.map +0 -1
  492. package/dist/ui/primitives/renderObject.d.ts +0 -1
  493. package/dist/ui/primitives/renderObject.js.map +0 -1
  494. package/dist/ui/primitives/renderPanel.d.ts +0 -27
  495. package/dist/ui/primitives/renderPanel.js.map +0 -1
  496. package/dist/ui/primitives/renderSubtitle.d.ts +0 -7
  497. package/dist/ui/primitives/renderSubtitle.js.map +0 -1
  498. package/dist/ui/primitives/renderTable.d.ts +0 -6
  499. package/dist/ui/primitives/renderTable.js.map +0 -1
  500. package/dist/ui/primitives/terminalWidth.d.ts +0 -4
  501. package/dist/ui/primitives/terminalWidth.js.map +0 -1
  502. package/dist/ui/primitives/text.d.ts +0 -28
  503. package/dist/ui/primitives/text.js.map +0 -1
  504. package/dist/ui/stream/index.d.ts +0 -1
  505. package/dist/ui/stream/index.js.map +0 -1
  506. package/dist/ui/stream/terminal-stream.d.ts +0 -16
  507. package/dist/ui/stream/terminal-stream.js.map +0 -1
  508. package/dist/ui/theme/index.d.ts +0 -1
  509. package/dist/ui/theme/index.js.map +0 -1
  510. package/dist/ui/theme/theme.d.ts +0 -68
  511. package/dist/ui/theme/theme.js.map +0 -1
@@ -1,7 +1,8 @@
1
1
  import { resolveIvaRateLabel } from '../billing/billing.amounts.js';
2
2
  import { formatIvaConditionLabel } from '../billing/billing.labels.js';
3
3
  import { PdfError } from './pdf.errors.js';
4
- export const DEFAULT_ITEM_DESCRIPTION = 'Segun detalle';
4
+ import { buildPdfLegends, EXPORT_IVA_LEGEND } from './pdf-legends.js';
5
+ export const DEFAULT_ITEM_DESCRIPTION = 'Según detalle';
5
6
  // Mismos nombres que usa la plantilla del SDK para calcular el tipo de documento del QR.
6
7
  const DOCUMENT_TYPE_NAMES = {
7
8
  80: 'CUIT',
@@ -62,7 +63,7 @@ function buildItems(result, description) {
62
63
  function resolveVoucherNumber(result) {
63
64
  const number = result.response.raw?.response?.FeDetResp?.FECAEDetResponse?.[0]?.CbteDesde ?? result.payload.CbteDesde;
64
65
  if (!number) {
65
- throw new PdfError('PDF_GENERATION_ERROR', 'La respuesta de ARCA no trae el numero del comprobante.');
66
+ throw new PdfError('PDF_GENERATION_ERROR', 'La respuesta de ARCA no trae el número del comprobante.');
66
67
  }
67
68
  return number;
68
69
  }
@@ -110,6 +111,7 @@ export function mapBillingResultToPdfData(result, issuer, extras = {}) {
110
111
  iva: iva.length > 0 ? iva : undefined,
111
112
  // La plantilla del SDK solo conoce pesos y dolares; el resto se muestra con su codigo ARCA.
112
113
  moneda: CURRENCY_CODES[payload.MonId] ?? payload.MonId,
114
+ observaciones: buildPdfLegends(result),
113
115
  puntoVenta: payload.PtoVta,
114
116
  receptor: {
115
117
  condicionIva: capitalizeWords(formatIvaConditionLabel(payload.CondicionIVAReceptorId)),
@@ -121,4 +123,93 @@ export function mapBillingResultToPdfData(result, issuer, extras = {}) {
121
123
  },
122
124
  };
123
125
  }
124
- //# sourceMappingURL=pdf-data.mapper.js.map
126
+ /** En WSFEX el numero tambien lo asigna ARCA al autorizar. */
127
+ function resolveExportVoucherNumber(result) {
128
+ const number = result.response.raw?.FEXAuthorizeResult?.FEXResultAuth?.Cbte_nro || result.payload.Cbte_nro;
129
+ if (!number) {
130
+ throw new PdfError('PDF_GENERATION_ERROR', 'La respuesta de ARCA no trae el número del comprobante.');
131
+ }
132
+ return number;
133
+ }
134
+ /**
135
+ * WSFEX usa sus propios codigos de moneda (`DOL`, `060`), pero la E de Comprobantes en linea muestra la divisa con
136
+ * el codigo ISO: "USD - Dólar Estadounidense". Las que no estan aca salen con el codigo de WSFEX.
137
+ */
138
+ /** El titulo que lleva la E de Comprobantes en linea, en lugar del "FACTURA" de la plantilla. */
139
+ const EXPORT_VOUCHER_TITLE = 'FACTURA DE EXPORTACIÓN';
140
+ const ISO_CURRENCY_CODES = { '012': 'BRL', '060': 'EUR', DOL: 'USD', PES: 'ARS' };
141
+ function formatExportDivisa(result) {
142
+ const { Moneda_Id: code } = result.payload;
143
+ const isoCode = ISO_CURRENCY_CODES[code.trim().toUpperCase()] ?? code;
144
+ return result.display.currencyName ? `${isoCode} - ${result.display.currencyName}` : isoCode;
145
+ }
146
+ /** Como en ARCA: "55000004242 (POLONIA - Persona Jurídica)", con el tipo de entidad de la tabla DST_CUIT. */
147
+ function formatExportCountryCuit(result) {
148
+ const { Cuit_pais_cliente: cuit } = result.payload;
149
+ const name = result.display.countryCuitName ?? result.display.countryName;
150
+ return name ? `${cuit} (${name})` : String(cuit);
151
+ }
152
+ function formatExportIncoterm(payload) {
153
+ const code = payload.Incoterms.trim();
154
+ const description = payload.Incoterms_Ds.trim();
155
+ if (!code) {
156
+ return undefined;
157
+ }
158
+ return description && description.toUpperCase() !== code.toUpperCase() ? `${code} - ${description}` : code;
159
+ }
160
+ /**
161
+ * La letra E tiene su propio diseno en `@arcasdk/pdf`: destino, divisa, forma y fecha de pago, incoterm y la leyenda
162
+ * de IVA exento, con los items reales de WSFEX. `concepto` e `importeNetoGravado` los pide el tipo del plugin, pero la
163
+ * plantilla de la E no los muestra.
164
+ */
165
+ export function mapExportResultToPdfData(result, issuer, extras = {}) {
166
+ const { display, payload, response } = result;
167
+ if (!response.cae || !response.caeVencimiento) {
168
+ throw new PdfError('PDF_GENERATION_ERROR', 'El comprobante no tiene CAE: no se puede generar el PDF.');
169
+ }
170
+ const number = resolveExportVoucherNumber(result);
171
+ const items = payload.Items.Item.map((item) => ({
172
+ cantidad: item.Pro_qty,
173
+ codigo: item.Pro_codigo || undefined,
174
+ descripcion: item.Pro_ds,
175
+ precioUnitario: item.Pro_precio_uni,
176
+ subtotal: item.Pro_total_item,
177
+ unidadMedida: display.unitNames[item.Pro_umed] ?? 'unidad',
178
+ }));
179
+ const observaciones = [payload.Obs_comerciales, payload.Obs].map((value) => value.trim()).filter(Boolean);
180
+ return {
181
+ cae: response.cae,
182
+ caeFechaVencimiento: response.caeVencimiento,
183
+ cbteDesde: number,
184
+ cbteFecha: payload.Fecha_cbte,
185
+ cbteDescripcion: EXPORT_VOUCHER_TITLE,
186
+ cbteHasta: number,
187
+ cbteLetra: result.voucherKind.letter.toUpperCase(),
188
+ cbteTipo: payload.Cbte_Tipo,
189
+ concepto: payload.Tipo_expo === 2 ? 2 : 1,
190
+ condicionIvaExportacion: EXPORT_IVA_LEGEND,
191
+ cotizacion: payload.Moneda_ctz,
192
+ destinoComprobante: display.countryName ?? String(payload.Dst_cmp),
193
+ divisa: formatExportDivisa(result),
194
+ emisor: issuer,
195
+ fechaPago: payload.Fecha_pago,
196
+ formaPago: payload.Forma_pago,
197
+ importeIva: 0,
198
+ importeNetoGravado: payload.Imp_total,
199
+ importeTotal: round(payload.Imp_total),
200
+ incoterms: formatExportIncoterm(payload),
201
+ items,
202
+ moneda: payload.Moneda_Id,
203
+ observaciones: observaciones.length > 0 ? observaciones.join(' · ') : undefined,
204
+ puntoVenta: payload.Punto_vta,
205
+ receptor: {
206
+ condicionIva: 'Cliente del exterior',
207
+ cuitPais: formatExportCountryCuit(result),
208
+ documentoNro: String(payload.Cuit_pais_cliente),
209
+ documentoTipo: 'CUIT',
210
+ domicilio: extras.receptorDomicilio?.trim() || payload.Domicilio_cliente,
211
+ idImpositivo: payload.Id_impositivo || undefined,
212
+ razonSocial: extras.receptorNombre?.trim() || payload.Cliente,
213
+ },
214
+ };
215
+ }
@@ -16,4 +16,3 @@ export function resolvePdfDecision(input) {
16
16
  export function canHavePdf(result) {
17
17
  return !result.dryRun && result.response.status !== 'rechazado' && Boolean(result.response.cae);
18
18
  }
19
- //# sourceMappingURL=pdf-decision.js.map
@@ -4,4 +4,3 @@ export function buildPdfFileName(voucherKind, pointOfSale, number) {
4
4
  const voucherNumber = String(number).padStart(8, '0');
5
5
  return `${voucherKind.family}-${voucherKind.letter}_${pv}-${voucherNumber}.pdf`;
6
6
  }
7
- //# sourceMappingURL=pdf-file-name.js.map
@@ -26,7 +26,7 @@ export function resolvePdfIssuer(config, letter) {
26
26
  });
27
27
  throw new PdfError('PDF_ISSUER_INCOMPLETE', `Faltan datos del emisor para el PDF: ${missing.join(', ')}.`, {
28
28
  details: { faltan: missing },
29
- suggestion: `Configurelos una vez con:\n${commands.join('\n')}`,
29
+ suggestion: `Configuralos una vez con:\n${commands.join('\n')}`,
30
30
  });
31
31
  }
32
32
  // La letra alcanza para la condicion habitual: A y B las emite un responsable inscripto, C un monotributista.
@@ -36,8 +36,8 @@ export function resolvePdfIssuer(config, letter) {
36
36
  cuit: config.cuit,
37
37
  domicilioComercial: emisor.domicilio,
38
38
  fechaInicioActividades: emisor.inicioActividades,
39
- iibb: emisor.iibb ?? 'Exento',
39
+ // Sin el dato no se afirma nada: "Exento" seria declarar una exencion que nadie informo.
40
+ iibb: emisor.iibb ?? '-',
40
41
  razonSocial: emisor.razonSocial,
41
42
  };
42
43
  }
43
- //# sourceMappingURL=pdf-issuer.js.map
@@ -0,0 +1,35 @@
1
+ import { resolveBillingIvaConditionCode } from '../billing/billing.mappers.js';
2
+ /** RG 5614 (Ley 27.743): titulo y datos del regimen de transparencia fiscal, en comprobantes a consumidor final. */
3
+ export const TRANSPARENCY_TITLE = 'Régimen de Transparencia Fiscal al Consumidor (Ley 27.743)';
4
+ /** RG 5003 (RG 1415, art. 15, inc. a): comprobante A a un sujeto adherido al monotributo. */
5
+ export const MONOTRIBUTO_CREDIT_LEGEND = 'El crédito fiscal discriminado en el presente comprobante, sólo podrá ser computado a efectos del Régimen de Sostenimiento e Inclusión Fiscal para Pequeños Contribuyentes de la Ley Nº 27.618';
6
+ /** Leyenda de IVA de la factura de exportacion E, con el mismo texto que la E de Comprobantes en linea. */
7
+ export const EXPORT_IVA_LEGEND = 'IVA EXENTO OPERACIÓN DE EXPORTACIÓN';
8
+ const MONOTRIBUTO_CONDITION_CODES = new Set([
9
+ resolveBillingIvaConditionCode('responsable-monotributo'),
10
+ resolveBillingIvaConditionCode('monotributista-social'),
11
+ resolveBillingIvaConditionCode('monotributo-trabajador-independiente-promovido'),
12
+ ]);
13
+ function formatAmount(value, currency) {
14
+ const amount = new Intl.NumberFormat('es-AR', { maximumFractionDigits: 2, minimumFractionDigits: 2 }).format(value);
15
+ return `${currency === 'PES' ? '$' : currency} ${amount}`;
16
+ }
17
+ /**
18
+ * Leyendas que la normativa exige en el comprobante y la plantilla de `@arcasdk/pdf` 0.2.x no trae.
19
+ * Van en texto plano: la plantilla las muestra como observaciones, debajo del CAE.
20
+ */
21
+ export function buildPdfLegends(result) {
22
+ const { payload, voucherKind } = result;
23
+ if (voucherKind.letter === 'b') {
24
+ // arcli no informa tributos: no hay impuestos internos ni otros nacionales indirectos que mostrar.
25
+ return [
26
+ TRANSPARENCY_TITLE,
27
+ `IVA Contenido: ${formatAmount(payload.ImpIVA, payload.MonId)}`,
28
+ `Otros Impuestos Nacionales Indirectos: ${formatAmount(0, payload.MonId)}`,
29
+ ].join(' · ');
30
+ }
31
+ if (voucherKind.letter === 'a' && MONOTRIBUTO_CONDITION_CODES.has(payload.CondicionIVAReceptorId)) {
32
+ return MONOTRIBUTO_CREDIT_LEGEND;
33
+ }
34
+ return undefined;
35
+ }
@@ -6,4 +6,3 @@ export class PdfError extends AppError {
6
6
  }
7
7
  }
8
8
  export const PDF_INSTALL_SUGGESTION = 'Instalelo con `arcli pdf instalar`.';
9
- //# sourceMappingURL=pdf.errors.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=pdf.types.js.map
@@ -3,4 +3,3 @@ export const STORYBOOK_SHOWCASE_THEME = {
3
3
  indexPanelWidth: 'wide',
4
4
  sceneWidth: 'wide',
5
5
  };
6
- //# sourceMappingURL=showcase-theme.js.map
@@ -1,5 +1,6 @@
1
1
  import { ConfigurationError, InputValidationError } from '../../lib/errors/app-error.js';
2
- import { badge, colorize, contentPanel, formatCliError, highlightJsonValues, renderKeyValueRows, renderLogo, renderObject, renderPanel, resolveKeyValueLabelWidth, sectionHeading, statusBar, statusPanel, testingBanner, toneText, } from '../../ui/index.js';
2
+ import { CERTIFICATE_GUIDE_URL } from '../../lib/links.js';
3
+ import { badge, certificateBanner, colorize, contentPanel, formatCliError, highlightJsonValues, renderKeyValueRows, renderLogo, renderObject, renderPanel, resolveKeyValueLabelWidth, sectionHeading, statusBar, statusPanel, testingBanner, toneText, } from '../../ui/index.js';
3
4
  import { formatBillingResultAsJson, formatBillingResultAsText } from '../billing/billing.presenter.js';
4
5
  import { formatConfig, formatConfigAsText, formatConfigDoctor, formatConfigDoctorAsText, } from '../config/config.presenter.js';
5
6
  import { buildConfigDoctorReport } from '../config/config-doctor.js';
@@ -72,7 +73,7 @@ function createSampleConfig() {
72
73
  produccion: '/Users/demo/.arcli/produccion/certificado.crt',
73
74
  testing: '/Users/demo/.arcli/testing/certificado.crt',
74
75
  },
75
- cuit: '20409509763',
76
+ cuit: '20333333334',
76
77
  conceptoPorDefecto: 'servicios',
77
78
  cotizacionPorDefecto: 1,
78
79
  emisor: {},
@@ -100,7 +101,7 @@ function createSampleUpdateCheckResult() {
100
101
  function createSampleValidation() {
101
102
  return {
102
103
  certPath: '/Users/demo/.arcli/testing/certificado.crt',
103
- cuit: 20409509763,
104
+ cuit: 20333333334,
104
105
  environment: 'testing',
105
106
  keyPath: '/Users/demo/.arcli/testing/clave.key',
106
107
  outputJson: false,
@@ -145,14 +146,14 @@ function buildColorsScene() {
145
146
  const BORDER_SAMPLES = [
146
147
  ['ticket', 'Factura', 'Comprobantes: vista previa y resultado', 'success', 'RESULTADO'],
147
148
  ['error', 'Error', 'Errores del CLI o de ARCA', 'danger'],
148
- ['attention', 'Observaciones', 'Observaciones de ARCA y avisos del regimen FCE', 'warning'],
149
+ ['attention', 'Observaciones', 'Observaciones de ARCA y avisos del régimen FCE', 'warning'],
149
150
  ['tip', 'Sugerencias', 'Sugerencias para resolver un problema', 'warning'],
150
- ['sheet', 'Configuracion', 'Fichas de consulta: configuracion y regimen FCE', 'info'],
151
- ['checklist', 'Revision', 'Revision de configuracion', 'success', 'VEREDICTO'],
152
- ['listing', 'Ultimos comprobantes', 'Listados en tabla, como los ultimos comprobantes', 'info'],
153
- ['note', 'Aviso', 'Avisos simples, por ejemplo "No se emitio nada"', undefined],
154
- ['warning', 'Testing', 'Banner del entorno de testing', 'warning'],
155
- ['info', 'Nueva version', 'Aviso de nueva version disponible', 'info'],
151
+ ['sheet', 'Configuración', 'Fichas de consulta: configuración y régimen FCE', 'info'],
152
+ ['checklist', 'Revision', 'Revisión de configuración', 'success', 'VEREDICTO'],
153
+ ['listing', 'Últimos comprobantes', 'Listados en tabla, como los últimos comprobantes', 'info'],
154
+ ['note', 'Aviso', 'Avisos simples, por ejemplo "No se emitió nada"', undefined],
155
+ ['warning', 'Testing', 'Banners del entorno de testing y del certificado por vencer', 'warning'],
156
+ ['info', 'Nueva versión', 'Aviso de nueva versión disponible', 'info'],
156
157
  ['data', 'Billing json', 'JSON y respuestas crudas', 'subtle'],
157
158
  ['common', 'Contenido', 'Base para paneles sin estilo propio', undefined],
158
159
  ['debug', 'Storybook', 'Storybook y debug visual', 'debug'],
@@ -178,7 +179,7 @@ function buildBordersScene() {
178
179
  return [
179
180
  sceneTitle('Bordes', 'Un estilo por tipo de panel; ARCLI_ASCII=1 los cambia por ASCII'),
180
181
  ...boxes,
181
- `${colorize('Barra de estado (modo interactivo):', 'muted')}\n${statusBar([{ text: '20-40950976-3' }, { text: 'PV 3' }], [
182
+ `${colorize('Barra de estado (modo interactivo):', 'muted')}\n${statusBar([{ text: '20-33333333-4' }, { text: 'PV 3' }], [
182
183
  { color: 'success', text: 'ARCA FUNCIONANDO' },
183
184
  { color: 'testing', text: 'TESTING' },
184
185
  ], { rightSeparator: 'rule' })}`,
@@ -200,8 +201,8 @@ function buildBillingScene() {
200
201
  const observed = formatBillingResultAsText(createBillingResult({
201
202
  response: {
202
203
  ...createBillingResult().response,
203
- observaciones: ['La CUIT receptora no existe en padron.'],
204
- observacion: 'La CUIT receptora no existe en padron.',
204
+ observaciones: ['La CUIT receptora no existe en padrón.'],
205
+ observacion: 'La CUIT receptora no existe en padrón.',
205
206
  raw: {
206
207
  response: {
207
208
  FeDetResp: {
@@ -210,14 +211,14 @@ function buildBillingScene() {
210
211
  },
211
212
  },
212
213
  status: 'observado',
213
- suggestions: ['Revise el CUIT del receptor o use uno valido de testing.'],
214
+ suggestions: ['Revisá el CUIT del receptor o usá uno válido de testing.'],
214
215
  },
215
216
  voucherKind: createVoucherKind({ displayName: 'Factura A', shortcut: 'fa', letter: 'a', arcaType: 1 }),
216
217
  payload: {
217
218
  ...createBillingResult().payload,
218
219
  CbteTipo: 1,
219
220
  DocTipo: 80,
220
- DocNro: 20123456789,
221
+ DocNro: 20123456786,
221
222
  CondicionIVAReceptorId: 1,
222
223
  ImpNeto: 0.83,
223
224
  ImpIVA: 0.17,
@@ -238,7 +239,7 @@ function buildBillingScene() {
238
239
  },
239
240
  resultado: 'R',
240
241
  status: 'rechazado',
241
- suggestions: ['ARCA devolvio un error transitorio. Espere unos segundos y vuelva a intentar la emision.'],
242
+ suggestions: ['ARCA devolvió un error transitorio. Esperá unos segundos y volvé a intentar la emisión.'],
242
243
  },
243
244
  }));
244
245
  const bruto = formatBillingResultAsText(createBillingResult(), { raw: true });
@@ -253,16 +254,16 @@ function buildBillingScene() {
253
254
  }
254
255
  function buildConfigScene() {
255
256
  const config = createSampleConfig();
256
- const doctor = buildConfigDoctorReport(config, { validation: createSampleValidation() });
257
+ const doctor = buildConfigDoctorReport(config, [{ environment: 'testing' }]);
257
258
  return [
258
- sceneTitle('Configuracion', 'Vista actual y revision'),
259
+ sceneTitle('Configuración', 'Vista actual y revisión'),
259
260
  formatConfigAsText(config, { pdfFolder: '~/arcli/comprobantes', ticketPath: createSampleValidation().ticketPath }),
260
261
  formatConfigDoctorAsText(doctor),
261
262
  ].join('\n\n');
262
263
  }
263
264
  function buildErrorScene() {
264
265
  return [
265
- sceneTitle('Errores', 'Configuracion, entrada y error inesperado'),
266
+ sceneTitle('Errores', 'Configuración, entrada y error inesperado'),
266
267
  formatCliError(new ConfigurationError('Falta la ruta de la clave privada para testing.', {
267
268
  path: '/Users/demo/.arcli/testing/clave.key',
268
269
  }), false),
@@ -276,9 +277,9 @@ function buildJsonScene() {
276
277
  pdfFolder: '~/arcli/comprobantes',
277
278
  ticketPath: createSampleValidation().ticketPath,
278
279
  }));
279
- const doctorJson = highlightJsonValues(formatConfigDoctor(buildConfigDoctorReport(createSampleConfig(), { validation: createSampleValidation() })));
280
+ const doctorJson = highlightJsonValues(formatConfigDoctor(buildConfigDoctorReport(createSampleConfig(), [{ environment: 'testing' }])));
280
281
  return [
281
- sceneTitle('Json', 'Contratos estructurados para automatizacion y respuesta bruta'),
282
+ sceneTitle('Json', 'Contratos estructurados para automatización y respuesta bruta'),
282
283
  contentPanel('Billing json', billingJson, 'wide', 'subtle', 'left', 'data'),
283
284
  contentPanel('Config json', configJson, 'wide', 'subtle', 'left', 'data'),
284
285
  contentPanel('Doctor json', doctorJson, 'wide', 'subtle', 'left', 'data'),
@@ -286,9 +287,19 @@ function buildJsonScene() {
286
287
  }
287
288
  function buildComponentsScene() {
288
289
  const notice = testingBanner();
290
+ const certificateNotice = certificateBanner({
291
+ expired: false,
292
+ guideUrl: CERTIFICATE_GUIDE_URL,
293
+ summary: 'El certificado de producción vence el 20/11/2026 (en 10 días).',
294
+ });
295
+ const expiredCertificateNotice = certificateBanner({
296
+ expired: true,
297
+ guideUrl: CERTIFICATE_GUIDE_URL,
298
+ summary: 'El certificado de producción venció el 20/11/2026.',
299
+ });
289
300
  const updateNotice = renderUpdateNoticePanel(createSampleUpdateCheckResult());
290
301
  const keyValueRows = [
291
- ['CUIT', '20-40950976-3'],
302
+ ['CUIT', '20-33333333-4'],
292
303
  ['Punto de venta', 3],
293
304
  ['Entorno', 'testing'],
294
305
  ];
@@ -326,6 +337,8 @@ function buildComponentsScene() {
326
337
  return [
327
338
  sceneTitle('Componentes', 'Notice, badges y paneles base'),
328
339
  notice,
340
+ certificateNotice,
341
+ expiredCertificateNotice,
329
342
  updateNotice,
330
343
  keyValue,
331
344
  status,
@@ -358,4 +371,3 @@ export function renderStorybookShowcase(scene) {
358
371
  }
359
372
  return scenes[scene];
360
373
  }
361
- //# sourceMappingURL=showcase.js.map
@@ -96,4 +96,3 @@ export async function fetchChangelog(version) {
96
96
  clearTimeout(timeout);
97
97
  }
98
98
  }
99
- //# sourceMappingURL=changelog.js.map
@@ -5,7 +5,7 @@ export const UPDATE_COMMAND = 'npm install -g arcli@latest';
5
5
  const MAX_CHANGELOG_ENTRIES = 3;
6
6
  const MAX_CHANGES_PER_ENTRY = 6;
7
7
  export function renderUpdateNoticePanel(result) {
8
- return noticePanel(`Nueva version disponible: ${result.latestVersion} (actual: ${result.currentVersion})\n` +
8
+ return noticePanel(`Nueva versión disponible: ${result.latestVersion} (actual: ${result.currentVersion})\n` +
9
9
  `Actualiza con: ${UPDATE_COMMAND}`, 'info', 'info');
10
10
  }
11
11
  const KIND_LABELS = {
@@ -34,7 +34,7 @@ function formatChange(change) {
34
34
  function formatChanges(changes) {
35
35
  const lines = changes.slice(0, MAX_CHANGES_PER_ENTRY).map(formatChange);
36
36
  const hidden = changes.length - MAX_CHANGES_PER_ENTRY;
37
- return hidden > 0 ? [...lines, colorize(`${CHANGE_INDENT}y ${hidden} cambio(s) mas`, 'muted')] : lines;
37
+ return hidden > 0 ? [...lines, colorize(`${CHANGE_INDENT}y ${hidden} cambio(s) más`, 'muted')] : lines;
38
38
  }
39
39
  function formatChangelog(entries) {
40
40
  if (!entries || entries.length === 0) {
@@ -51,7 +51,7 @@ function formatChangelog(entries) {
51
51
  ]);
52
52
  const hidden = entries.length - MAX_CHANGELOG_ENTRIES;
53
53
  if (hidden > 0) {
54
- lines.push('', colorize(`Y ${hidden} version(es) mas en ${CHANGELOG_PAGE_URL}`, 'muted'));
54
+ lines.push('', colorize(`Y ${hidden} versión(es) más en ${CHANGELOG_PAGE_URL}`, 'muted'));
55
55
  }
56
56
  return lines;
57
57
  }
@@ -60,13 +60,13 @@ export function renderUpdateDetails(result, entries) {
60
60
  const versions = renderPanel({
61
61
  borderType: 'sheet',
62
62
  content: [
63
- `Tu version ${result.currentVersion}`,
64
- `Nueva version ${colorize(bold(result.latestVersion), 'highlight')}`,
63
+ `Tu versión ${result.currentVersion}`,
64
+ `Nueva versión ${colorize(bold(result.latestVersion), 'highlight')}`,
65
65
  '',
66
66
  bold('NOVEDADES'),
67
67
  ...formatChangelog(entries),
68
68
  ],
69
- title: 'Actualizacion disponible',
69
+ title: 'Actualización disponible',
70
70
  width: 'wide',
71
71
  });
72
72
  const howTo = renderPanel({
@@ -81,4 +81,3 @@ export function renderUpdateDetails(result, entries) {
81
81
  });
82
82
  return `${versions}\n\n${howTo}`;
83
83
  }
84
- //# sourceMappingURL=update-check.presenter.js.map
@@ -69,4 +69,3 @@ export async function checkForUpdate(currentVersion, options = {}) {
69
69
  }
70
70
  return { currentVersion, latestVersion };
71
71
  }
72
- //# sourceMappingURL=update-check.service.js.map
@@ -45,4 +45,3 @@ export async function listVouchersFrom(gateway, pointOfSale, voucherType, fromNu
45
45
  }
46
46
  return vouchers.filter((voucher) => Boolean(voucher));
47
47
  }
48
- //# sourceMappingURL=voucher-history.js.map
@@ -18,7 +18,7 @@ export function formatReceiver(voucher) {
18
18
  }
19
19
  /** Titulo del listado de ultimos comprobantes, tambien usado por el selector del modo interactivo. */
20
20
  export function formatVoucherListTitle(report) {
21
- return `Ultimas ${report.voucherKind.displayName} · PV ${report.pointOfSale} · ${report.environment}`;
21
+ return `Últimas ${report.voucherKind.displayName} · PV ${report.pointOfSale} · ${report.environment}`;
22
22
  }
23
23
  /** Una fila del listado: numero, fecha, receptor, total y CAE, en columnas alineadas. */
24
24
  export function formatVoucherListRow(pointOfSale, voucher) {
@@ -121,14 +121,14 @@ export function formatVoucherDetailAsJson(report) {
121
121
  export function formatVoucherDetailAsText(report) {
122
122
  const { pointOfSale, voucher, voucherKind } = report;
123
123
  const rows = [
124
- ['Numero', formatVoucherNumber(pointOfSale, voucher.number)],
124
+ ['Número', formatVoucherNumber(pointOfSale, voucher.number)],
125
125
  ['Fecha', formatArcaDateAsArgentineDate(voucher.date)],
126
126
  ['Receptor', formatReceiver(voucher)],
127
127
  ['Concepto', formatConceptLabel(voucher.concept)],
128
128
  ['Moneda', formatCurrencyLabel(voucher.currency)],
129
129
  ];
130
130
  if (voucher.currency && voucher.currency !== 'PES') {
131
- rows.push(['Cotizacion', String(voucher.exchangeRate ?? 1)]);
131
+ rows.push(['Cotización', String(voucher.exchangeRate ?? 1)]);
132
132
  }
133
133
  rows.push(['Importe neto', formatMoneyLabel(voucher.netAmount)], ['Importe IVA', formatMoneyLabel(voucher.ivaAmount)]);
134
134
  if (voucher.exemptAmount)
@@ -143,4 +143,3 @@ export function formatVoucherDetailAsText(report) {
143
143
  }
144
144
  return keyValuePanel(voucherKind.displayName, renderKeyValueRows(rows, { labelWidth: resolveKeyValueLabelWidth('ticket', rows) }), voucher.result === 'A' ? 'APROBADO' : voucher.result === 'R' ? 'RECHAZADO' : undefined, 'ticket', voucher.result === 'R' ? 'danger' : 'success', 'ticket');
145
145
  }
146
- //# sourceMappingURL=voucher-history.presenter.js.map
@@ -1,17 +1,32 @@
1
1
  import { AppError } from '../../lib/errors/app-error.js';
2
+ import { getLastAuthorizedNumber } from './last-voucher.js';
3
+ /** Tope de numeracion de ARCA; el SDK lo valida igual en `createNextVoucher`. */
4
+ const MAX_VOUCHER_NUMBER = 99_999_999;
2
5
  export class ArcaBillingGateway {
3
6
  arca;
4
7
  constructor(arca) {
5
8
  this.arca = arca;
6
9
  }
7
- async createNextVoucher(payload) {
8
- return this.arca.electronicBillingService.createNextVoucher(payload);
10
+ /**
11
+ * Primer paso de `createNextVoucher` del SDK: autentica en WSAA y pide el ultimo numero autorizado.
12
+ * Si falla, no se envio nada a ARCA. Como el SDK, sin comprobantes previos arranca en 1.
13
+ */
14
+ async getNextVoucherNumber(pointOfSale, voucherType) {
15
+ const nextNumber = (await getLastAuthorizedNumber(this.arca, pointOfSale, voucherType)) + 1;
16
+ if (nextNumber > MAX_VOUCHER_NUMBER) {
17
+ throw new Error(`Número de comprobante no puede ser mayor a ${MAX_VOUCHER_NUMBER}`);
18
+ }
19
+ return nextNumber;
20
+ }
21
+ /** Segundo paso: la llamada que emite. Si falla, ARCA pudo haber autorizado el comprobante igual. */
22
+ async createVoucher(voucher) {
23
+ return this.arca.electronicBillingService.createVoucher(voucher);
9
24
  }
10
25
  async getQuotation(currencyCode) {
11
26
  const result = await this.arca.electronicBillingService.getQuotation(currencyCode);
12
27
  const exchangeRate = result.resultGet?.monCotiz;
13
28
  if (typeof exchangeRate !== 'number' || exchangeRate <= 0) {
14
- throw new AppError(`ARCA no devolvio una cotizacion valida para ${currencyCode}.`, {
29
+ throw new AppError(`ARCA no devolvió una cotización válida para ${currencyCode}.`, {
15
30
  code: 'ARCA_QUOTATION_ERROR',
16
31
  details: { errors: result.errors },
17
32
  });
@@ -19,4 +34,3 @@ export class ArcaBillingGateway {
19
34
  return exchangeRate;
20
35
  }
21
36
  }
22
- //# sourceMappingURL=arca-billing.gateway.js.map
@@ -1,7 +1,33 @@
1
1
  import { Arca } from '@arcasdk/core';
2
+ import { readPemFile } from '../../lib/security/pem.js';
3
+ import { CertificateExpiredError, inspectCertificateExpiry } from '../../modules/config/certificate-expiry.js';
4
+ import { resolveExportCredentials } from '../../modules/config/config.export-credentials.js';
2
5
  export class ArcaClientFactory {
6
+ /** Todo cliente de ARCA sale de aca: con el certificado vencido se corta antes de pedir el ticket a WSAA. */
3
7
  create(runtime) {
8
+ if (runtime.certificateExpiry?.expired) {
9
+ throw new CertificateExpiredError(runtime.certificateExpiry);
10
+ }
4
11
  return new Arca(runtime.context);
5
12
  }
13
+ /**
14
+ * WSFEX se autentica con el certificado autorizado al servicio wsfex. Si `exportacion.cert`/`exportacion.key`
15
+ * estan configurados usa esos archivos (y su propio vencimiento); si no, los mismos de facturacion.
16
+ */
17
+ createForExport(runtime) {
18
+ const credentials = resolveExportCredentials(runtime.config, runtime.environment);
19
+ if (!credentials.dedicated) {
20
+ return this.create(runtime);
21
+ }
22
+ const cert = readPemFile(credentials.cert, 'certificado');
23
+ const notice = inspectCertificateExpiry(cert, runtime.environment);
24
+ if (notice?.expired) {
25
+ throw new CertificateExpiredError(notice);
26
+ }
27
+ return new Arca({
28
+ ...runtime.context,
29
+ cert,
30
+ key: readPemFile(credentials.key, 'clave privada'),
31
+ });
32
+ }
6
33
  }
7
- //# sourceMappingURL=arca-client.factory.js.map
@@ -2,20 +2,31 @@ import { dirname } from 'node:path';
2
2
  import { ConfigurationError } from '../../lib/errors/app-error.js';
3
3
  import { restrictFolderToOwner } from '../../lib/files/restrict-to-owner.js';
4
4
  import { ensurePathExists, readPemFile } from '../../lib/security/pem.js';
5
+ import { inspectConfiguredCertificates } from '../../modules/config/certificate-expiry.js';
5
6
  import { ConfigService } from '../../modules/config/config.service.js';
6
7
  export class ArcaContextResolver {
7
8
  configService;
9
+ now;
8
10
  options;
9
11
  constructor(options = {}) {
10
12
  this.configService = options.configService;
13
+ this.now = options.now;
11
14
  this.options = options.options ?? {};
12
15
  }
13
16
  resolve() {
14
17
  const validation = this.validate();
18
+ const cert = this.readRequiredFile(validation.certPath, 'certificado');
19
+ const certificateNotices = inspectConfiguredCertificates(validation.config.cert, {
20
+ activeEnvironment: validation.environment,
21
+ activePem: cert,
22
+ now: this.now,
23
+ });
15
24
  return {
25
+ certificateExpiry: certificateNotices.find((notice) => notice.environment === validation.environment),
26
+ certificateNotices,
16
27
  config: validation.config,
17
28
  context: {
18
- cert: this.readRequiredFile(validation.certPath, 'certificado'),
29
+ cert,
19
30
  cuit: validation.cuit,
20
31
  key: this.readRequiredFile(validation.keyPath, 'clave privada'),
21
32
  production: validation.environment === 'produccion',
@@ -72,17 +83,17 @@ export class ArcaContextResolver {
72
83
  resolveCuit(config) {
73
84
  const rawValue = config.cuit;
74
85
  if (!rawValue) {
75
- throw new ConfigurationError('Falta el CUIT. Configurelo con "arcli config establecer cuit <valor>". Si quiere una guia rapida, use "arcli config revisar".');
86
+ throw new ConfigurationError('Falta el CUIT. Configuralo con "arcli config establecer cuit <valor>". Si querés una guía rápida, usá "arcli config revisar".');
76
87
  }
77
88
  const parsedValue = Number.parseInt(rawValue, 10);
78
89
  if (!Number.isInteger(parsedValue) || rawValue.length !== 11) {
79
- throw new ConfigurationError(`El CUIT "${rawValue}" no es valido. Debe tener 11 digitos.`);
90
+ throw new ConfigurationError(`El CUIT "${rawValue}" no es válido. Debe tener 11 digitos.`);
80
91
  }
81
92
  return parsedValue;
82
93
  }
83
94
  resolveEnvironment(config) {
84
95
  if (this.options.testing && this.options.produccion) {
85
- throw new ConfigurationError('Use --testing o --produccion, pero no ambos a la vez.');
96
+ throw new ConfigurationError('Usá --testing o --produccion, pero no ambos a la vez.');
86
97
  }
87
98
  if (this.options.testing) {
88
99
  return 'testing';
@@ -110,16 +121,15 @@ export class ArcaContextResolver {
110
121
  resolveCertificatePath(config, environment) {
111
122
  const filePath = config.cert[environment];
112
123
  if (!filePath) {
113
- throw new ConfigurationError(`Falta la ruta del certificado para ${environment}. Configure "cert.${environment}". Si necesita ayuda, pruebe "arcli config revisar".`);
124
+ throw new ConfigurationError(`Falta la ruta del certificado para ${environment}. Configurá "cert.${environment}". Si necesitás ayuda, probá "arcli config revisar".`);
114
125
  }
115
126
  return filePath;
116
127
  }
117
128
  resolveKeyPath(config, environment) {
118
129
  const filePath = config.key[environment];
119
130
  if (!filePath) {
120
- throw new ConfigurationError(`Falta la ruta de la clave privada para ${environment}. Configure "key.${environment}". Si necesita ayuda, pruebe "arcli config revisar".`);
131
+ throw new ConfigurationError(`Falta la ruta de la clave privada para ${environment}. Configurá "key.${environment}". Si necesitás ayuda, probá "arcli config revisar".`);
121
132
  }
122
133
  return filePath;
123
134
  }
124
135
  }
125
- //# sourceMappingURL=arca-context.resolver.js.map