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,11 +1,13 @@
1
1
  import { Separator } from '@inquirer/select';
2
2
  import { formatCuit } from '../../lib/identity/format-cuit.js';
3
+ import { CertificateExpiredError, inspectConfiguredCertificates, } from '../../modules/config/certificate-expiry.js';
3
4
  import { ConfigService } from '../../modules/config/config.service.js';
4
5
  import { listMissingSetupKeys } from '../../modules/interactive/config-fields.js';
5
6
  import { checkArcaHealth } from '../../modules/parameters/health.js';
6
7
  import { checkForUpdate } from '../../modules/update-check/update-check.service.js';
7
8
  import { ArcaParametersGateway } from '../../services/arca/arca-parameters.gateway.js';
8
9
  import { colorize, formatCliError, noticePanel, renderLogo, statusBar, writeTerminalError, writeTerminalOutput, } from '../../ui/index.js';
10
+ import { renderCertificateNotices } from '../arca-runtime.js';
9
11
  import { startSpinner } from '../spinner.js';
10
12
  import { CLI_VERSION } from '../version.js';
11
13
  import { runConfigMenu, runGuidedSetup } from './config.flow.js';
@@ -33,13 +35,13 @@ function resolveSession(options) {
33
35
  }
34
36
  catch (error) {
35
37
  writeTerminalError(formatCliError(error, false));
36
- writeTerminalOutput(noticePanel('Revisala desde "Configuracion" en el menu.', 'warning'));
38
+ writeTerminalOutput(noticePanel('Revisala desde "Configuración" en el menú.', 'warning'));
37
39
  return undefined;
38
40
  }
39
41
  }
40
42
  async function runOption(option, options) {
41
43
  if (option === 'config') {
42
- await runConfigMenu(options);
44
+ await runConfigMenu();
43
45
  return;
44
46
  }
45
47
  const session = resolveSession(options);
@@ -65,39 +67,68 @@ const HEALTH_LABELS = {
65
67
  funcionando: ['ARCA funcionando', 'success'],
66
68
  'sin-respuesta': ['ARCA sin respuesta', 'danger'],
67
69
  };
68
- function tryResolveSession(options) {
70
+ /** La razon social, si es tan larga que no entra en la barra, se corta. */
71
+ const MAX_ISSUER_NAME_LENGTH = 32;
72
+ function environmentSegment(environment) {
73
+ return environment === 'produccion'
74
+ ? { color: 'production', text: 'PRODUCCIÓN' }
75
+ : { color: 'testing', text: 'TESTING' };
76
+ }
77
+ /**
78
+ * Recuadro de los certificados por vencer o vencidos, de cualquier entorno, debajo de la barra: queda arriba de
79
+ * todo lo que se haga en la sesion.
80
+ */
81
+ function withCertificateBox(bar, notices) {
82
+ const box = renderCertificateNotices(notices);
83
+ return box ? `${bar}\n\n${box}` : bar;
84
+ }
85
+ /**
86
+ * Con el certificado activo vencido la sesion no se crea, asi que los del resto de los entornos se leen aparte de
87
+ * la config. Si no se puede, queda solo el vencido.
88
+ */
89
+ function noticesWithExpired(expired) {
90
+ const service = new ConfigService();
69
91
  try {
70
- return createInteractiveSession(options);
92
+ const others = inspectConfiguredCertificates(service.getConfig().cert ?? {}, {
93
+ activeEnvironment: expired.environment,
94
+ }).filter((notice) => notice.environment !== expired.environment);
95
+ return [expired, ...others];
71
96
  }
72
97
  catch {
73
- return undefined;
98
+ return [expired];
99
+ }
100
+ finally {
101
+ service.close();
74
102
  }
75
103
  }
76
- /** La razon social, si es tan larga que no entra en la barra, se corta. */
77
- const MAX_ISSUER_NAME_LENGTH = 32;
78
104
  /**
79
105
  * Barra de estado: a la izquierda, quien emite (razon social, o el CUIT si no esta configurada) y el punto de
80
- * venta; a la derecha, como esta ARCA y el entorno, cada uno en su color.
106
+ * venta; a la derecha, como esta ARCA y el entorno, cada uno en su color. Con el certificado por vencer o
107
+ * vencido, debajo va su recuadro.
81
108
  */
82
109
  async function buildHeader(options) {
83
- const session = tryResolveSession(options);
84
- if (!session) {
85
- return statusBar([{ text: 'falta completar la configuracion' }], [{ color: 'muted', text: 'ARCA SIN VERIFICAR' }]);
110
+ let session;
111
+ try {
112
+ session = createInteractiveSession(options);
113
+ }
114
+ catch (error) {
115
+ // Vencido no se consulta ARCA (WSAA lo rechazaria): se dice por que en lugar de "falta configurar".
116
+ if (error instanceof CertificateExpiredError) {
117
+ const bar = statusBar([{ text: 'certificado vencido' }], [{ color: 'danger', text: 'ARCA SIN VERIFICAR' }, environmentSegment(error.notice.environment)], { rightSeparator: 'rule' });
118
+ return withCertificateBox(bar, noticesWithExpired(error.notice));
119
+ }
120
+ return statusBar([{ text: 'falta completar la configuración' }], [{ color: 'muted', text: 'ARCA SIN VERIFICAR' }]);
86
121
  }
87
122
  const spinner = startSpinner('Consultando el estado de ARCA...');
88
123
  const health = await checkArcaHealth({ gateway: new ArcaParametersGateway(session.arca) });
89
124
  spinner?.stop();
90
125
  const [label, color] = HEALTH_LABELS[health];
91
- const { config, context, environment, pointOfSale } = session.runtime;
92
- return statusBar([
126
+ const { certificateNotices, config, context, environment, pointOfSale } = session.runtime;
127
+ const bar = statusBar([
93
128
  { text: formatIssuer(config.emisor?.razonSocial, context.cuit) },
94
129
  { text: `PV ${pointOfSale ?? 'sin configurar'}` },
95
- ], [
96
- { color, text: label.toUpperCase() },
97
- environment === 'produccion'
98
- ? { color: 'production', text: 'PRODUCCION' }
99
- : { color: 'testing', text: 'TESTING' },
100
- ], { rightSeparator: 'rule' });
130
+ ], [{ color, text: label.toUpperCase() }, environmentSegment(environment)], { rightSeparator: 'rule' });
131
+ return withCertificateBox(bar, certificateNotices);
101
132
  }
102
133
  function formatIssuer(businessName, cuit) {
103
134
  if (!businessName) {
@@ -108,7 +139,7 @@ function formatIssuer(businessName, cuit) {
108
139
  : businessName;
109
140
  }
110
141
  function updateChoice(update) {
111
- const name = `Actualizar a la version ${update.latestVersion}`;
142
+ const name = `Actualizar a la versión ${update.latestVersion}`;
112
143
  return { name: colorize(name, 'highlight'), short: name, value: 'actualizar' };
113
144
  }
114
145
  /** Asistente paso a paso encima del CLI. Ctrl+C cancela el flujo actual; en el menu, sale. */
@@ -127,7 +158,7 @@ export async function runInteractiveMode(options = {}) {
127
158
  if (listMissingSetup().length > 0) {
128
159
  menuUnderHeader = false;
129
160
  try {
130
- if (await confirm('Falta completar la configuracion. ¿La hacemos ahora, paso a paso?', 'Si, configurar', 'Despues')) {
161
+ if (await confirm('Falta completar la configuración. ¿La hacemos ahora, paso a paso?', 'Sí, configurar', 'Después')) {
131
162
  await runGuidedSetup();
132
163
  writeTerminalOutput(await buildHeader(options));
133
164
  menuUnderHeader = true;
@@ -142,29 +173,29 @@ export async function runInteractiveMode(options = {}) {
142
173
  for (;;) {
143
174
  let option;
144
175
  try {
145
- option = await chooseOne('¿Que queres hacer?', [
176
+ option = await chooseOne('¿Qué querés hacer?', [
146
177
  ...(update ? [updateChoice(update), new Separator(' ')] : []),
147
178
  { name: 'Emitir factura', value: 'factura' },
148
179
  {
149
- description: 'Copia una de las ultimas, con fechas nuevas',
180
+ description: 'Copia una de las últimas, con fechas nuevas',
150
181
  name: 'Repetir una factura anterior',
151
182
  value: 'repetir',
152
183
  },
153
184
  {
154
- description: 'Descuento, devolucion o anulacion de una factura',
155
- name: 'Emitir nota de credito',
185
+ description: 'Descuento, devolución o anulación de una factura',
186
+ name: 'Emitir nota de crédito',
156
187
  value: 'nota-credito',
157
188
  },
158
- { description: 'Cargo adicional sobre una factura', name: 'Emitir nota de debito', value: 'nota-debito' },
189
+ { description: 'Cargo adicional sobre una factura', name: 'Emitir nota de débito', value: 'nota-debito' },
159
190
  {
160
- description: 'Los ultimos de cada tipo, o buscar uno por numero',
191
+ description: 'Los últimos de cada tipo, o buscar uno por número',
161
192
  name: 'Consultar comprobantes',
162
193
  value: 'historial',
163
194
  },
164
- { description: 'Servidores, punto de venta y cotizacion del dolar', name: 'Estado de ARCA', value: 'estado' },
195
+ { description: 'Servidores, punto de venta y cotización del dólar', name: 'Estado de ARCA', value: 'estado' },
165
196
  {
166
- description: 'Revisar, configuracion guiada, cambiar un dato y PDF',
167
- name: 'Configuracion',
197
+ description: 'Revisar, configuración guiada, cambiar un dato y PDF',
198
+ name: 'Configuración',
168
199
  value: 'config',
169
200
  },
170
201
  new Separator(' '),
@@ -192,13 +223,12 @@ export async function runInteractiveMode(options = {}) {
192
223
  }
193
224
  catch (error) {
194
225
  if (isPromptCancellation(error)) {
195
- writeTerminalOutput(colorize('Cancelado. No se emitio nada.', 'muted'));
226
+ writeTerminalOutput(colorize('Cancelado. No se emitió nada.', 'muted'));
196
227
  }
197
228
  else {
198
229
  writeTerminalError(formatCliError(error, false));
199
230
  }
200
231
  }
201
232
  }
202
- writeTerminalOutput(colorize('¡Hasta la proxima!', 'muted'));
233
+ writeTerminalOutput(colorize('¡Hasta la próxima!', 'muted'));
203
234
  }
204
- //# sourceMappingURL=interactive-mode.js.map
@@ -1,4 +1,5 @@
1
1
  import { Separator } from '@inquirer/select';
2
+ import { parseStrictInteger } from '../../lib/numbers/strict-integer.js';
2
3
  import { BACK } from '../../modules/interactive/wizard.js';
3
4
  import { listVouchersFrom, RECENT_VOUCHERS_LIMIT } from '../../modules/vouchers/voucher-history.js';
4
5
  import { formatVoucherNumber, formatVoucherPickerRows } from '../../modules/vouchers/voucher-history.presenter.js';
@@ -27,8 +28,8 @@ async function withSpinner(text, run) {
27
28
  }
28
29
  function validatePositiveInteger(label) {
29
30
  return (value) => {
30
- const number = Number(value.trim());
31
- return Number.isInteger(number) && number > 0 ? true : `${label} tiene que ser un numero entero mayor a 0.`;
31
+ const number = parseStrictInteger(value);
32
+ return number !== undefined && number > 0 ? true : `${label} tiene que ser un número entero mayor a 0.`;
32
33
  };
33
34
  }
34
35
  /** Pide punto de venta y numero, y lo busca en ARCA. Volver o un comprobante inexistente vuelven a la lista. */
@@ -40,7 +41,7 @@ async function askVoucherByNumber(session, voucherKind, defaultPointOfSale) {
40
41
  if (pointOfSaleAnswer === BACK) {
41
42
  return BACK;
42
43
  }
43
- const numberAnswer = await askTextStep('Numero:', { validate: validatePositiveInteger('El numero') });
44
+ const numberAnswer = await askTextStep('Número:', { validate: validatePositiveInteger('El número') });
44
45
  if (numberAnswer === BACK) {
45
46
  return BACK;
46
47
  }
@@ -93,13 +94,13 @@ export async function pickInvoice(session, options) {
93
94
  choices.push(new Separator(' '), new Separator(colorize(' Cargando…', 'muted')));
94
95
  }
95
96
  else if (nextNumber > 0) {
96
- choices.push(new Separator(' '), { name: '+ Cargar mas…', value: LOAD_MORE });
97
+ choices.push(new Separator(' '), { name: '+ Cargar más…', value: LOAD_MORE });
97
98
  }
98
99
  choices.push(listRule(), new Separator(' '));
99
100
  }
100
101
  choices.push({
101
- description: 'Uno mas viejo o de otro punto de venta',
102
- name: '# Ingresar el numero a mano…',
102
+ description: 'Uno más viejo o de otro punto de venta',
103
+ name: '# Ingresar el número a mano…',
103
104
  value: BY_NUMBER,
104
105
  });
105
106
  // +2: el separador y "Volver" que agrega chooseStep.
@@ -150,4 +151,3 @@ export async function pickInvoice(session, options) {
150
151
  defaultChoice = answer;
151
152
  }
152
153
  }
153
- //# sourceMappingURL=invoice-picker.js.map
@@ -1,23 +1,37 @@
1
1
  import { billingCommandSchema } from '../../modules/billing/billing.schemas.js';
2
+ import { EXPORT_VOUCHER_KIND } from '../../modules/export/export.types.js';
2
3
  import { parseAmountInput } from '../../modules/interactive/amount-input.js';
3
- import { conceptChoices, invoiceKindChoices, ivaConditionChoices, receiverChoices, } from '../../modules/interactive/choices.js';
4
+ import { conceptChoices, exportInvoiceChoice, invoiceKindChoices, receiverChoices, } from '../../modules/interactive/choices.js';
4
5
  import { BACK, runWizard } from '../../modules/interactive/wizard.js';
5
6
  import { askAdvancedOptions } from './advanced-options.js';
7
+ import { runExportFlow } from './export.flow.js';
6
8
  import { askTextStep, chooseStep } from './prompts.js';
9
+ import { askReceiverIvaCondition, receiverInputFields } from './receiver-padron.js';
7
10
  import { previewAndEmit } from './session.js';
8
11
  import { normalizeDocumentNumber, validateAmount, validateCbu, validateCuit, validateDni } from './validators.js';
9
12
  const isFceInvoice = (state) => state.voucherKind?.family === 'factura-credito-electronica';
10
13
  /** Pasos del flujo de factura; cada uno se puede deshacer con "Volver". */
11
14
  export function invoiceSteps(session) {
12
15
  const { config } = session.runtime;
13
- return [
14
- {
15
- name: 'comprobante',
16
- run: async () => {
17
- const voucherKind = await chooseStep('¿Que comprobante queres emitir?', invoiceKindChoices());
18
- return voucherKind === BACK ? BACK : { voucherKind };
19
- },
16
+ const pickVoucherKind = {
17
+ name: 'comprobante',
18
+ run: async () => {
19
+ // Volver desde el primer paso de la E vuelve a este selector.
20
+ for (;;) {
21
+ const voucherKind = await chooseStep('¿Qué comprobante querés emitir?', [...invoiceKindChoices(), exportInvoiceChoice()]);
22
+ if (voucherKind === BACK) {
23
+ return BACK;
24
+ }
25
+ if (voucherKind !== EXPORT_VOUCHER_KIND) {
26
+ return { voucherKind: voucherKind };
27
+ }
28
+ if ((await runExportFlow(session)) !== BACK) {
29
+ return { exported: true };
30
+ }
31
+ }
20
32
  },
33
+ };
34
+ const billingSteps = [
21
35
  {
22
36
  name: 'receptor',
23
37
  run: async (state) => {
@@ -45,15 +59,14 @@ export function invoiceSteps(session) {
45
59
  {
46
60
  name: 'iva-receptor',
47
61
  run: async (state) => {
48
- const ivaCondition = await chooseStep('Condicion frente al IVA del receptor:', ivaConditionChoices(state.voucherKind?.letter ?? 'c'), config.ivaReceptorPorDefecto);
49
- return ivaCondition === BACK ? BACK : { ivaCondition };
62
+ return askReceiverIvaCondition(session, state, state.voucherKind?.letter ?? 'c', config.ivaReceptorPorDefecto);
50
63
  },
51
64
  skip: (state) => state.documentType === 'consumidor-final',
52
65
  },
53
66
  {
54
67
  name: 'concepto',
55
68
  run: async () => {
56
- const concept = await chooseStep('¿Que estas facturando?', conceptChoices(), config.conceptoPorDefecto);
69
+ const concept = await chooseStep('¿Qué estás facturando?', conceptChoices(), config.conceptoPorDefecto);
57
70
  return concept === BACK ? BACK : { concept };
58
71
  },
59
72
  },
@@ -84,6 +97,13 @@ export function invoiceSteps(session) {
84
97
  },
85
98
  },
86
99
  ];
100
+ return [
101
+ pickVoucherKind,
102
+ ...billingSteps.map((step) => ({
103
+ ...step,
104
+ skip: (state) => Boolean(state.exported) || Boolean(step.skip?.(state)),
105
+ })),
106
+ ];
87
107
  }
88
108
  /** Arma la entrada del CLI con lo que respondio el usuario. */
89
109
  export function buildInvoiceInput(state, session) {
@@ -93,10 +113,13 @@ export function buildInvoiceInput(state, session) {
93
113
  return billingCommandSchema.parse({
94
114
  ...state.advanced,
95
115
  cbu: isFceInvoice(state) ? (state.cbu ?? config.cbu) : undefined,
116
+ // Como en el CLI: en una FCE el alias de la config se informa junto con el CBU.
117
+ cbuAlias: isFceInvoice(state) ? config.aliasCbu : undefined,
96
118
  concept: state.concept,
97
119
  documentNumber: state.documentNumber,
98
120
  documentType: state.documentType,
99
121
  ivaCondition: state.ivaCondition,
122
+ ...receiverInputFields(state),
100
123
  // 21% sin alicuota configurada es el default del CLI. Si hay config, se deja explicito para que el
101
124
  // comando equivalente no tome la de la config.
102
125
  ivaRate: ivaRate === '21' && !config.alicuotaPorDefecto ? undefined : ivaRate,
@@ -107,9 +130,8 @@ export function buildInvoiceInput(state, session) {
107
130
  }
108
131
  export async function runInvoiceFlow(session) {
109
132
  const state = await runWizard(invoiceSteps(session), { advanced: { currencyCode: 'ARS', sameCurrency: false } });
110
- if (!state) {
133
+ if (!state || state.exported) {
111
134
  return;
112
135
  }
113
136
  await previewAndEmit(session, buildInvoiceInput(state, session));
114
137
  }
115
- //# sourceMappingURL=invoice.flow.js.map
@@ -2,13 +2,14 @@ import { formatArcaDateAsArgentineDate } from '../../lib/dates/arca-date.js';
2
2
  import { formatMoneyLabel } from '../../modules/billing/billing.labels.js';
3
3
  import { billingCommandSchema, } from '../../modules/billing/billing.schemas.js';
4
4
  import { parseAmountInput } from '../../modules/interactive/amount-input.js';
5
- import { conceptChoices, invoiceKindChoices, ivaConditionChoices, ivaRateChoices, noteKindChoices, receiverChoices, } from '../../modules/interactive/choices.js';
5
+ import { conceptChoices, invoiceKindChoices, ivaRateChoices, noteKindChoices, receiverChoices, } from '../../modules/interactive/choices.js';
6
6
  import { copyInvoiceAmounts } from '../../modules/interactive/invoice-copy.js';
7
7
  import { BACK, runWizard } from '../../modules/interactive/wizard.js';
8
8
  import { resolveDocumentType } from '../../modules/vouchers/voucher-history.js';
9
9
  import { noticePanel, writeTerminalOutput } from '../../ui/index.js';
10
10
  import { pickInvoice } from './invoice-picker.js';
11
11
  import { askTextStep, chooseStep } from './prompts.js';
12
+ import { askReceiverIvaCondition, receiverInputFields } from './receiver-padron.js';
12
13
  import { previewAndEmit, requirePointOfSale } from './session.js';
13
14
  import { normalizeDocumentNumber, validateAmount, validateCuit, validateDate, validateDni } from './validators.js';
14
15
  const CONCEPTS_BY_CODE = {
@@ -19,7 +20,7 @@ const CONCEPTS_BY_CODE = {
19
20
  const isPeriod = (state) => state.target === 'periodo';
20
21
  async function askNoteAmount(state) {
21
22
  const invoice = state.invoice;
22
- const label = state.kind === 'debito' ? 'Monto de la nota de debito:' : 'Monto de la nota de credito:';
23
+ const label = state.kind === 'debito' ? 'Monto de la nota de débito:' : 'Monto de la nota de crédito:';
23
24
  // Con varias alicuotas o tributos no se puede armar una nota igual a la factura: solo parcial.
24
25
  const canAnnulTotal = Boolean(invoice && !copyInvoiceAmounts(invoice, state.invoiceKind?.letter ?? 'c').limitation);
25
26
  if (state.kind === 'credito' && invoice && canAnnulTotal) {
@@ -50,22 +51,22 @@ export function noteSteps(session, pointOfSale) {
50
51
  {
51
52
  name: 'tipo-factura',
52
53
  run: async () => {
53
- const invoiceKind = await chooseStep('¿Sobre que tipo de factura?', invoiceKindChoices());
54
+ const invoiceKind = await chooseStep('¿Sobre qué tipo de factura?', invoiceKindChoices());
54
55
  return invoiceKind === BACK ? BACK : { invoiceKind, target: 'factura' };
55
56
  },
56
57
  },
57
58
  {
58
59
  name: 'asociacion',
59
60
  run: async () => {
60
- const target = await chooseStep('¿A que la asociamos?', [
61
+ const target = await chooseStep('¿A qué la asociamos?', [
61
62
  {
62
- description: 'Elegis una de las ultimas emitidas o la ingresas a mano',
63
+ description: 'Elegis una de las últimas emitidas o la ingresas a mano',
63
64
  name: 'A una factura',
64
65
  value: 'factura',
65
66
  },
66
67
  {
67
68
  description: 'Por ejemplo, un descuento sobre todo el mes',
68
- name: 'A un periodo',
69
+ name: 'A un período',
69
70
  value: 'periodo',
70
71
  },
71
72
  ]);
@@ -79,7 +80,7 @@ export function noteSteps(session, pointOfSale) {
79
80
  run: async (state) => {
80
81
  const invoiceKind = state.invoiceKind;
81
82
  const picked = await pickInvoice(session, {
82
- message: `¿Sobre que ${invoiceKind.displayName}?`,
83
+ message: `¿Sobre qué ${invoiceKind.displayName}?`,
83
84
  pointOfSale,
84
85
  voucherKind: invoiceKind,
85
86
  });
@@ -94,7 +95,7 @@ export function noteSteps(session, pointOfSale) {
94
95
  }
95
96
  const copy = copyInvoiceAmounts(invoice, invoiceKind.letter);
96
97
  if (copy.limitation) {
97
- writeTerminalOutput(noticePanel(`${copy.limitation} La nota solo puede ser parcial; revisa la alicuota.`, 'warning'));
98
+ writeTerminalOutput(noticePanel(`${copy.limitation} La nota solo puede ser parcial; revisa la alícuota.`, 'warning'));
98
99
  }
99
100
  // La nota hereda de la factura el receptor, el concepto, la moneda y la alicuota (si se puede deducir).
100
101
  return {
@@ -112,11 +113,11 @@ export function noteSteps(session, pointOfSale) {
112
113
  {
113
114
  name: 'periodo',
114
115
  run: async () => {
115
- const periodFrom = await askTextStep('Periodo desde:', { validate: validateDate });
116
+ const periodFrom = await askTextStep('Período desde:', { validate: validateDate });
116
117
  if (periodFrom === BACK) {
117
118
  return BACK;
118
119
  }
119
- const periodTo = await askTextStep('Periodo hasta:', { validate: validateDate });
120
+ const periodTo = await askTextStep('Período hasta:', { validate: validateDate });
120
121
  return periodTo === BACK ? BACK : { invoice: undefined, invoicePointOfSale: undefined, periodFrom, periodTo };
121
122
  },
122
123
  skip: (state) => !isPeriod(state),
@@ -149,7 +150,7 @@ export function noteSteps(session, pointOfSale) {
149
150
  {
150
151
  name: 'concepto',
151
152
  run: async () => {
152
- const concept = await chooseStep('¿Que concepto ajusta la nota?', conceptChoices());
153
+ const concept = await chooseStep('¿Qué concepto ajusta la nota?', conceptChoices());
153
154
  return concept === BACK ? BACK : { concept };
154
155
  },
155
156
  skip: (state) => !isPeriod(state),
@@ -165,15 +166,14 @@ export function noteSteps(session, pointOfSale) {
165
166
  name: 'iva-receptor',
166
167
  run: async (state) => {
167
168
  // ARCA no devuelve la condicion IVA de la factura, asi que se pregunta, filtrada por la letra.
168
- const ivaCondition = await chooseStep('Condicion frente al IVA del receptor:', ivaConditionChoices(state.invoiceKind?.letter ?? 'c'));
169
- return ivaCondition === BACK ? BACK : { ivaCondition };
169
+ return askReceiverIvaCondition(session, state, state.invoiceKind?.letter ?? 'c');
170
170
  },
171
171
  skip: (state) => state.documentType === 'consumidor-final',
172
172
  },
173
173
  {
174
174
  name: 'alicuota',
175
175
  run: async (state) => {
176
- const ivaRate = await chooseStep(isPeriod(state) ? 'Alicuota de IVA:' : 'Alicuota de IVA de la factura:', ivaRateChoices());
176
+ const ivaRate = await chooseStep(isPeriod(state) ? 'Alícuota de IVA:' : 'Alícuota de IVA de la factura:', ivaRateChoices());
177
177
  return ivaRate === BACK ? BACK : { ivaRate };
178
178
  },
179
179
  // En la C no hay IVA; si la factura deja deducir la alicuota, no se pregunta.
@@ -183,7 +183,7 @@ export function noteSteps(session, pointOfSale) {
183
183
  name: 'anulacion',
184
184
  run: async () => {
185
185
  const cancellation = await chooseStep('¿El comprador rechazo la factura?', [
186
- { name: 'Si, es una nota de anulacion', value: true },
186
+ { name: 'Sí, es una nota de anulación', value: true },
187
187
  { name: 'No', value: false },
188
188
  ]);
189
189
  return cancellation === BACK ? BACK : { cancellation };
@@ -218,6 +218,7 @@ export function buildNoteInput(state, session, pointOfSale) {
218
218
  exchangeRate: copy?.exchangeRate,
219
219
  exemptAmount: state.annulsTotal ? copy?.exemptAmount : undefined,
220
220
  ivaCondition: state.ivaCondition,
221
+ ...receiverInputFields(state),
221
222
  ivaRate: state.ivaRate === '21' && !session.runtime.config.alicuotaPorDefecto ? undefined : state.ivaRate,
222
223
  shortcut: noteKind.shortcut,
223
224
  totalAmount: state.totalAmount,
@@ -235,4 +236,3 @@ export async function runNoteFlow(session, kind) {
235
236
  }
236
237
  await previewAndEmit(session, buildNoteInput(state, session, pointOfSale));
237
238
  }
238
- //# sourceMappingURL=note.flow.js.map
@@ -10,7 +10,7 @@ const ISSUER_QUESTIONS = {
10
10
  cuit: 'CUIT del emisor',
11
11
  'emisor.domicilio': 'Domicilio comercial del emisor',
12
12
  'emisor.inicioActividades': 'Fecha de inicio de actividades (D/MM/YYYY)',
13
- 'emisor.razonSocial': 'Razon social o nombre del emisor',
13
+ 'emisor.razonSocial': 'Razón social o nombre del emisor',
14
14
  };
15
15
  function validateConfigValue(key, value) {
16
16
  try {
@@ -42,7 +42,7 @@ async function completeIssuer(config) {
42
42
  answers.push([key, value]);
43
43
  completed = applyIssuerValue(completed, key, value);
44
44
  }
45
- if (await confirm('¿Guardamos estos datos en la config para la proxima?', 'Si, guardar', 'No, solo esta vez')) {
45
+ if (await confirm('¿Guardamos estos datos en la config para la próxima?', 'Sí, guardar', 'No, solo esta vez')) {
46
46
  const service = new ConfigService();
47
47
  try {
48
48
  for (const [key, value] of answers) {
@@ -67,12 +67,15 @@ export async function offerPdf(config, input, result) {
67
67
  // Ya se emitio: un Ctrl+C aca no puede terminar en "No se emitio nada".
68
68
  try {
69
69
  if (decision === 'preguntar' &&
70
- !(await confirm('¿Generamos el PDF del comprobante?', 'Si, generar el PDF', 'No'))) {
70
+ !(await confirm('¿Generamos el PDF del comprobante?', 'Sí, generar el PDF', 'No'))) {
71
71
  return;
72
72
  }
73
- const description = await askText('Descripcion del comprobante (Enter para "Segun detalle")');
74
- const receiverName = await askText('Nombre o razon social del receptor (Enter para omitir)');
75
- const receiverAddress = await askText('Domicilio del receptor (Enter para omitir)');
73
+ const description = await askText('Descripción del comprobante (Enter para "Según detalle")');
74
+ // Lo que trajo el padron se propone: Enter lo deja, en lugar de borrarlo.
75
+ const receiverName = await askText(input.receiverName
76
+ ? 'Nombre o razón social del receptor:'
77
+ : 'Nombre o razón social del receptor (Enter para omitir)', { defaultValue: input.receiverName });
78
+ const receiverAddress = await askText(input.receiverAddress ? 'Domicilio del receptor:' : 'Domicilio del receptor (Enter para omitir)', { defaultValue: input.receiverAddress });
76
79
  const completedConfig = await completeIssuer(config);
77
80
  const withPdf = await attachPdfs({
78
81
  config: completedConfig,
@@ -97,4 +100,3 @@ export async function offerPdf(config, input, result) {
97
100
  writeTerminalOutput(noticePanel('El comprobante ya quedo emitido; no se genero el PDF.', 'muted'));
98
101
  }
99
102
  }
100
- //# sourceMappingURL=pdf.flow.js.map
@@ -223,4 +223,3 @@ export async function chooseManyStep(message, choices, selected = []) {
223
223
  }
224
224
  return result.answer;
225
225
  }
226
- //# sourceMappingURL=prompts.js.map
@@ -0,0 +1,52 @@
1
+ import { isIvaConditionAllowed } from '../../modules/billing/billing.iva-receptor.js';
2
+ import { ivaConditionChoices } from '../../modules/interactive/choices.js';
3
+ import { BACK } from '../../modules/interactive/wizard.js';
4
+ import { ArcaPadronGateway } from '../../services/arca/arca-padron.gateway.js';
5
+ import { startSpinner } from '../spinner.js';
6
+ import { chooseStep } from './prompts.js';
7
+ /** Consulta el padron si hay un CUIT y la config lo permite. Si falla, sigue sin datos: el usuario elige igual. */
8
+ async function lookupReceiver(session, state) {
9
+ const cuit = state.documentNumber;
10
+ if (state.documentType !== 'cuit' || !cuit || session.runtime.config.consultarPadron === false) {
11
+ return undefined;
12
+ }
13
+ if (state.receiver?.cuit === cuit) {
14
+ return state.receiver;
15
+ }
16
+ const spinner = startSpinner('Consultando el padrón...');
17
+ try {
18
+ const taxpayer = await new ArcaPadronGateway(session.arca).getTaxpayer(cuit);
19
+ return {
20
+ address: taxpayer?.address ?? undefined,
21
+ cuit,
22
+ ivaCondition: taxpayer?.ivaCondition ?? undefined,
23
+ name: taxpayer?.name ?? undefined,
24
+ };
25
+ }
26
+ catch {
27
+ return { cuit };
28
+ }
29
+ finally {
30
+ spinner?.stop();
31
+ }
32
+ }
33
+ /**
34
+ * Pregunta la condicion IVA del receptor. Con un CUIT, propone la del padron (marcada) y muestra el nombre;
35
+ * si no, la de la config.
36
+ */
37
+ export async function askReceiverIvaCondition(session, state, letter, configDefault) {
38
+ const receiver = await lookupReceiver(session, state);
39
+ const fromPadron = receiver?.ivaCondition && isIvaConditionAllowed(letter, receiver.ivaCondition) ? receiver.ivaCondition : undefined;
40
+ const choices = ivaConditionChoices(letter).map((choice) => choice.value === fromPadron ? { ...choice, name: `${choice.name} (según el padrón)` } : choice);
41
+ const ivaCondition = await chooseStep(receiver?.name ? `Condición frente al IVA de ${receiver.name}:` : 'Condición frente al IVA del receptor:', choices, fromPadron ?? configDefault);
42
+ return ivaCondition === BACK ? BACK : { ivaCondition, receiver };
43
+ }
44
+ /** Nombre, domicilio y origen del IVA para la entrada del CLI: el PDF y la vista previa los muestran. */
45
+ export function receiverInputFields(state) {
46
+ const receiver = state.documentType === 'cuit' && state.receiver?.cuit === state.documentNumber ? state.receiver : undefined;
47
+ return {
48
+ ivaConditionSource: receiver?.ivaCondition && receiver.ivaCondition === state.ivaCondition ? 'padron' : undefined,
49
+ receiverAddress: receiver?.address,
50
+ receiverName: receiver?.name,
51
+ };
52
+ }