bonbox 0.1.0 → 0.3.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.
package/dist/cli.js CHANGED
@@ -38,9 +38,12 @@ var en_default = {
38
38
  cli_cmd_whoami: "Show the account you are signed in with",
39
39
  cli_cmd_customers: "Work with your customers",
40
40
  cli_cmd_customers_ls: "List your customers",
41
+ cli_cmd_customers_create: "Create a customer",
42
+ cli_cmd_customers_update: "Update a customer",
41
43
  cli_cmd_invoices: "Work with your invoices and quotes",
42
44
  cli_cmd_invoices_ls: "List invoices and quotes",
43
45
  cli_cmd_invoices_create: "Create an invoice or a quote",
46
+ cli_cmd_invoices_update: "Update an invoice or quote",
44
47
  cli_cmd_invoices_pdf: "Download the PDF of an invoice or quote",
45
48
  cli_cmd_invoices_paid: "Mark an invoice as paid",
46
49
  cli_cmd_invoices_unpaid: "Mark an invoice as unpaid again",
@@ -50,19 +53,27 @@ var en_default = {
50
53
  cli_cmd_receipts_scan: "Upload a receipt and let bonbox read it",
51
54
  cli_flag_json: "Print the raw API response as JSON",
52
55
  cli_flag_lang: "Output language (en, de, fr, it)",
53
- cli_flag_provider: "Sign-in provider: google or apple",
54
56
  cli_flag_archived: "Include archived customers",
55
57
  cli_flag_status: "Filter by status: created or paid",
56
58
  cli_flag_quotes: "Show quotes instead of invoices",
57
59
  cli_flag_customer_ref: "Customer name or ID",
60
+ cli_flag_name: "Customer name",
61
+ cli_flag_department: "Department",
62
+ cli_flag_address: "Street address",
63
+ cli_flag_postal_code: "Postal code",
64
+ cli_flag_city: "City",
65
+ cli_flag_country: "Country code, for example CH",
58
66
  cli_flag_item: "Line item as description:quantity:unitPrice[:discount%], can be repeated",
59
67
  cli_flag_quote: "Create a quote instead of an invoice",
60
68
  cli_flag_invoice_date: "Invoice date (YYYY-MM-DD), today by default",
69
+ cli_flag_invoice_date_update: "Invoice date (YYYY-MM-DD)",
61
70
  cli_flag_payment_days: "Payment term in days",
62
71
  cli_flag_currency: "Currency code, for example CHF",
63
72
  cli_flag_language: "Document language: de, en, fr or it",
64
73
  cli_flag_subtitle: "Subtitle shown on the document",
65
74
  cli_flag_reference: "Your reference for this document",
75
+ cli_flag_vat_rate: "VAT rate in percent, for example 8.1",
76
+ cli_flag_custom_notes: "Custom notes shown on the document",
66
77
  cli_flag_pdf: "Also save the PDF to this file",
67
78
  cli_flag_output: "Save the PDF to this file",
68
79
  cli_flag_paid_date: "Payment date (YYYY-MM-DD), today by default",
@@ -78,6 +89,7 @@ var en_default = {
78
89
  cli_flag_tax_category: "Tax category",
79
90
  cli_flag_booking_text: "Booking text",
80
91
  cli_arg_invoice_ref: "Invoice number or ID",
92
+ cli_arg_customer_ref: "Customer name or ID",
81
93
  cli_arg_scan_files: "Image or PDF files, all pages of one receipt",
82
94
  cli_error_unauthorized: "You are not signed in. Run: bonbox login",
83
95
  cli_error_pro_required: "This needs bonbox Pro. You can upgrade at %1$s",
@@ -88,6 +100,11 @@ var en_default = {
88
100
  cli_error_item_number: 'Invalid number in item "%1$s"',
89
101
  cli_error_items_required: "Add at least one line item with --item",
90
102
  cli_error_customer_required: "Name a customer with --customer",
103
+ cli_error_name_required: "Give a name with --name",
104
+ cli_error_address_required: "Give an address with --address",
105
+ cli_error_postal_code_required: "Give a postal code with --postal-code",
106
+ cli_error_city_required: "Give a city with --city",
107
+ cli_error_update_fields_required: "Give at least one field to update",
91
108
  cli_error_price_required: "Give an amount with --price",
92
109
  cli_error_seller_required: "Give a seller with --seller",
93
110
  cli_error_price_invalid: "Invalid amount: %1$s",
@@ -97,7 +114,7 @@ var en_default = {
97
114
  cli_error_customer_ambiguous: '"%1$s" matches several customers:',
98
115
  cli_error_files_required: "Name at least one file to scan",
99
116
  cli_error_file_missing: "File not found: %1$s",
100
- cli_login_opening: "Opening your browser to sign in ...",
117
+ cli_login_opening: "Opening the bonbox sign-in page in your browser ...",
101
118
  cli_login_manual: "If your browser does not open, visit:\n%1$s",
102
119
  cli_login_waiting: "Waiting for you to finish signing in ...",
103
120
  cli_login_success: "Signed in as %1$s",
@@ -137,9 +154,13 @@ var en_default = {
137
154
  cli_empty_invoices: "No invoices yet.",
138
155
  cli_empty_quotes: "No quotes yet.",
139
156
  cli_empty_receipts: "No receipts found.",
157
+ cli_customer_created: "Customer %1$s created.",
158
+ cli_customer_updated: "Customer %1$s updated.",
140
159
  cli_invoice_created: "Invoice %1$s created, %2$s",
141
160
  cli_quote_created: "Quote %1$s created, %2$s",
142
161
  cli_pdf_saved: "Saved to %1$s",
162
+ cli_invoice_updated: "Invoice %1$s updated.",
163
+ cli_quote_updated: "Quote %1$s updated.",
143
164
  cli_invoice_paid: "%1$s marked as paid.",
144
165
  cli_invoice_unpaid: "%1$s marked as unpaid.",
145
166
  cli_receipt_added: "Receipt saved: %1$s, %2$s",
@@ -155,9 +176,12 @@ var de_default = {
155
176
  cli_cmd_whoami: "Zeigt das angemeldete Konto",
156
177
  cli_cmd_customers: "Kunden verwalten",
157
178
  cli_cmd_customers_ls: "Kunden auflisten",
179
+ cli_cmd_customers_create: "Kunde erstellen",
180
+ cli_cmd_customers_update: "Kunde aktualisieren",
158
181
  cli_cmd_invoices: "Rechnungen und Offerten verwalten",
159
182
  cli_cmd_invoices_ls: "Rechnungen und Offerten auflisten",
160
183
  cli_cmd_invoices_create: "Rechnung oder Offerte erstellen",
184
+ cli_cmd_invoices_update: "Rechnung oder Offerte aktualisieren",
161
185
  cli_cmd_invoices_pdf: "PDF einer Rechnung oder Offerte herunterladen",
162
186
  cli_cmd_invoices_paid: "Rechnung als bezahlt markieren",
163
187
  cli_cmd_invoices_unpaid: "Rechnung wieder als offen markieren",
@@ -167,19 +191,27 @@ var de_default = {
167
191
  cli_cmd_receipts_scan: "Beleg hochladen und von bonbox auslesen lassen",
168
192
  cli_flag_json: "Antwort der API als reines JSON ausgeben",
169
193
  cli_flag_lang: "Sprache der Ausgabe (en, de, fr, it)",
170
- cli_flag_provider: "Anmeldung \xFCber google oder apple",
171
194
  cli_flag_archived: "Archivierte Kunden einschliessen",
172
195
  cli_flag_status: "Nach Status filtern: created oder paid",
173
196
  cli_flag_quotes: "Offerten statt Rechnungen anzeigen",
174
197
  cli_flag_customer_ref: "Kundenname oder Kunden-ID",
198
+ cli_flag_name: "Kundenname",
199
+ cli_flag_department: "Abteilung",
200
+ cli_flag_address: "Strasse und Hausnummer",
201
+ cli_flag_postal_code: "Postleitzahl",
202
+ cli_flag_city: "Ort",
203
+ cli_flag_country: "L\xE4ndercode, zum Beispiel CH",
175
204
  cli_flag_item: "Position als Beschreibung:Menge:Einzelpreis[:Rabatt%], mehrfach m\xF6glich",
176
205
  cli_flag_quote: "Offerte statt Rechnung erstellen",
177
206
  cli_flag_invoice_date: "Rechnungsdatum (JJJJ-MM-TT), standardm\xE4ssig heute",
207
+ cli_flag_invoice_date_update: "Rechnungsdatum (JJJJ-MM-TT)",
178
208
  cli_flag_payment_days: "Zahlungsfrist in Tagen",
179
209
  cli_flag_currency: "W\xE4hrung, zum Beispiel CHF",
180
210
  cli_flag_language: "Sprache des Dokuments: de, en, fr oder it",
181
211
  cli_flag_subtitle: "Untertitel auf dem Dokument",
182
212
  cli_flag_reference: "Ihre Referenz f\xFCr dieses Dokument",
213
+ cli_flag_vat_rate: "Mehrwertsteuersatz in Prozent, zum Beispiel 8.1",
214
+ cli_flag_custom_notes: "Eigene Notizen auf dem Dokument",
183
215
  cli_flag_pdf: "PDF zus\xE4tzlich in diese Datei speichern",
184
216
  cli_flag_output: "PDF in diese Datei speichern",
185
217
  cli_flag_paid_date: "Zahlungsdatum (JJJJ-MM-TT), standardm\xE4ssig heute",
@@ -195,6 +227,7 @@ var de_default = {
195
227
  cli_flag_tax_category: "Steuerkategorie",
196
228
  cli_flag_booking_text: "Buchungstext",
197
229
  cli_arg_invoice_ref: "Rechnungsnummer oder ID",
230
+ cli_arg_customer_ref: "Kundenname oder ID",
198
231
  cli_arg_scan_files: "Bild- oder PDF-Dateien, alle Seiten eines Belegs",
199
232
  cli_error_unauthorized: "Sie sind nicht angemeldet. F\xFChren Sie aus: bonbox login",
200
233
  cli_error_pro_required: "Daf\xFCr wird bonbox Pro ben\xF6tigt. Upgrade unter %1$s",
@@ -205,6 +238,11 @@ var de_default = {
205
238
  cli_error_item_number: 'Ung\xFCltige Zahl in Position "%1$s"',
206
239
  cli_error_items_required: "Erfassen Sie mindestens eine Position mit --item",
207
240
  cli_error_customer_required: "Geben Sie einen Kunden mit --customer an",
241
+ cli_error_name_required: "Geben Sie einen Namen mit --name an",
242
+ cli_error_address_required: "Geben Sie eine Adresse mit --address an",
243
+ cli_error_postal_code_required: "Geben Sie eine Postleitzahl mit --postal-code an",
244
+ cli_error_city_required: "Geben Sie einen Ort mit --city an",
245
+ cli_error_update_fields_required: "Geben Sie mindestens ein zu \xE4nderndes Feld an",
208
246
  cli_error_price_required: "Geben Sie einen Betrag mit --price an",
209
247
  cli_error_seller_required: "Geben Sie einen Anbieter mit --seller an",
210
248
  cli_error_price_invalid: "Ung\xFCltiger Betrag: %1$s",
@@ -214,7 +252,7 @@ var de_default = {
214
252
  cli_error_customer_ambiguous: '"%1$s" passt auf mehrere Kunden:',
215
253
  cli_error_files_required: "Geben Sie mindestens eine Datei zum Scannen an",
216
254
  cli_error_file_missing: "Datei nicht gefunden: %1$s",
217
- cli_login_opening: "Browser wird zur Anmeldung ge\xF6ffnet ...",
255
+ cli_login_opening: "Die bonbox-Anmeldeseite wird im Browser ge\xF6ffnet ...",
218
256
  cli_login_manual: "Falls sich der Browser nicht \xF6ffnet, rufen Sie auf:\n%1$s",
219
257
  cli_login_waiting: "Warten auf den Abschluss der Anmeldung ...",
220
258
  cli_login_success: "Angemeldet als %1$s",
@@ -254,9 +292,13 @@ var de_default = {
254
292
  cli_empty_invoices: "Noch keine Rechnungen.",
255
293
  cli_empty_quotes: "Noch keine Offerten.",
256
294
  cli_empty_receipts: "Keine Belege gefunden.",
295
+ cli_customer_created: "Kunde %1$s erstellt.",
296
+ cli_customer_updated: "Kunde %1$s aktualisiert.",
257
297
  cli_invoice_created: "Rechnung %1$s erstellt, %2$s",
258
298
  cli_quote_created: "Offerte %1$s erstellt, %2$s",
259
299
  cli_pdf_saved: "Gespeichert unter %1$s",
300
+ cli_invoice_updated: "Rechnung %1$s aktualisiert.",
301
+ cli_quote_updated: "Offerte %1$s aktualisiert.",
260
302
  cli_invoice_paid: "%1$s als bezahlt markiert.",
261
303
  cli_invoice_unpaid: "%1$s als offen markiert.",
262
304
  cli_receipt_added: "Beleg gespeichert: %1$s, %2$s",
@@ -272,9 +314,12 @@ var fr_default = {
272
314
  cli_cmd_whoami: "Afficher le compte connect\xE9",
273
315
  cli_cmd_customers: "G\xE9rer vos clients",
274
316
  cli_cmd_customers_ls: "Lister vos clients",
317
+ cli_cmd_customers_create: "Cr\xE9er un client",
318
+ cli_cmd_customers_update: "Mettre \xE0 jour un client",
275
319
  cli_cmd_invoices: "G\xE9rer vos factures et devis",
276
320
  cli_cmd_invoices_ls: "Lister les factures et devis",
277
321
  cli_cmd_invoices_create: "Cr\xE9er une facture ou un devis",
322
+ cli_cmd_invoices_update: "Mettre \xE0 jour une facture ou un devis",
278
323
  cli_cmd_invoices_pdf: "T\xE9l\xE9charger le PDF d'une facture ou d'un devis",
279
324
  cli_cmd_invoices_paid: "Marquer une facture comme pay\xE9e",
280
325
  cli_cmd_invoices_unpaid: "Remettre une facture en attente de paiement",
@@ -284,19 +329,27 @@ var fr_default = {
284
329
  cli_cmd_receipts_scan: "Envoyer un justificatif et le faire lire par bonbox",
285
330
  cli_flag_json: "Afficher la r\xE9ponse brute de l'API en JSON",
286
331
  cli_flag_lang: "Langue de l'affichage (en, de, fr, it)",
287
- cli_flag_provider: "Connexion via google ou apple",
288
332
  cli_flag_archived: "Inclure les clients archiv\xE9s",
289
333
  cli_flag_status: "Filtrer par statut : created ou paid",
290
334
  cli_flag_quotes: "Afficher les devis au lieu des factures",
291
335
  cli_flag_customer_ref: "Nom ou identifiant du client",
336
+ cli_flag_name: "Nom du client",
337
+ cli_flag_department: "Service",
338
+ cli_flag_address: "Adresse",
339
+ cli_flag_postal_code: "Code postal",
340
+ cli_flag_city: "Ville",
341
+ cli_flag_country: "Code pays, par exemple CH",
292
342
  cli_flag_item: "Poste au format description:quantit\xE9:prix unitaire[:remise%], r\xE9p\xE9table",
293
343
  cli_flag_quote: "Cr\xE9er un devis au lieu d'une facture",
294
344
  cli_flag_invoice_date: "Date de la facture (AAAA-MM-JJ), aujourd'hui par d\xE9faut",
345
+ cli_flag_invoice_date_update: "Date de la facture (AAAA-MM-JJ)",
295
346
  cli_flag_payment_days: "D\xE9lai de paiement en jours",
296
347
  cli_flag_currency: "Monnaie, par exemple CHF",
297
348
  cli_flag_language: "Langue du document : de, en, fr ou it",
298
349
  cli_flag_subtitle: "Sous-titre affich\xE9 sur le document",
299
350
  cli_flag_reference: "Votre r\xE9f\xE9rence pour ce document",
351
+ cli_flag_vat_rate: "Taux de TVA en pourcent, par exemple 8.1",
352
+ cli_flag_custom_notes: "Notes personnalis\xE9es affich\xE9es sur le document",
300
353
  cli_flag_pdf: "Enregistrer aussi le PDF dans ce fichier",
301
354
  cli_flag_output: "Enregistrer le PDF dans ce fichier",
302
355
  cli_flag_paid_date: "Date du paiement (AAAA-MM-JJ), aujourd'hui par d\xE9faut",
@@ -312,6 +365,7 @@ var fr_default = {
312
365
  cli_flag_tax_category: "Cat\xE9gorie fiscale",
313
366
  cli_flag_booking_text: "Libell\xE9 comptable",
314
367
  cli_arg_invoice_ref: "Num\xE9ro de facture ou identifiant",
368
+ cli_arg_customer_ref: "Nom ou identifiant du client",
315
369
  cli_arg_scan_files: "Fichiers image ou PDF, toutes les pages d'un justificatif",
316
370
  cli_error_unauthorized: "Vous n'\xEAtes pas connect\xE9. Ex\xE9cutez : bonbox login",
317
371
  cli_error_pro_required: "Cette action n\xE9cessite bonbox Pro. Passez \xE0 Pro sur %1$s",
@@ -322,6 +376,11 @@ var fr_default = {
322
376
  cli_error_item_number: 'Nombre invalide dans le poste "%1$s"',
323
377
  cli_error_items_required: "Ajoutez au moins un poste avec --item",
324
378
  cli_error_customer_required: "Indiquez un client avec --customer",
379
+ cli_error_name_required: "Indiquez un nom avec --name",
380
+ cli_error_address_required: "Indiquez une adresse avec --address",
381
+ cli_error_postal_code_required: "Indiquez un code postal avec --postal-code",
382
+ cli_error_city_required: "Indiquez une ville avec --city",
383
+ cli_error_update_fields_required: "Indiquez au moins un champ \xE0 mettre \xE0 jour",
325
384
  cli_error_price_required: "Indiquez un montant avec --price",
326
385
  cli_error_seller_required: "Indiquez un fournisseur avec --seller",
327
386
  cli_error_price_invalid: "Montant invalide : %1$s",
@@ -331,7 +390,7 @@ var fr_default = {
331
390
  cli_error_customer_ambiguous: '"%1$s" correspond \xE0 plusieurs clients :',
332
391
  cli_error_files_required: "Indiquez au moins un fichier \xE0 traiter",
333
392
  cli_error_file_missing: "Fichier introuvable : %1$s",
334
- cli_login_opening: "Ouverture du navigateur pour la connexion ...",
393
+ cli_login_opening: "Ouverture de la page de connexion bonbox dans votre navigateur ...",
335
394
  cli_login_manual: "Si le navigateur ne s'ouvre pas, rendez-vous sur :\n%1$s",
336
395
  cli_login_waiting: "En attente de la fin de la connexion ...",
337
396
  cli_login_success: "Connect\xE9 en tant que %1$s",
@@ -371,9 +430,13 @@ var fr_default = {
371
430
  cli_empty_invoices: "Aucune facture pour l'instant.",
372
431
  cli_empty_quotes: "Aucun devis pour l'instant.",
373
432
  cli_empty_receipts: "Aucun justificatif trouv\xE9.",
433
+ cli_customer_created: "Client %1$s cr\xE9\xE9.",
434
+ cli_customer_updated: "Client %1$s mis \xE0 jour.",
374
435
  cli_invoice_created: "Facture %1$s cr\xE9\xE9e, %2$s",
375
436
  cli_quote_created: "Devis %1$s cr\xE9\xE9, %2$s",
376
437
  cli_pdf_saved: "Enregistr\xE9 sous %1$s",
438
+ cli_invoice_updated: "Facture %1$s mise \xE0 jour.",
439
+ cli_quote_updated: "Devis %1$s mis \xE0 jour.",
377
440
  cli_invoice_paid: "%1$s marqu\xE9e comme pay\xE9e.",
378
441
  cli_invoice_unpaid: "%1$s remise en attente de paiement.",
379
442
  cli_receipt_added: "Justificatif enregistr\xE9 : %1$s, %2$s",
@@ -389,9 +452,12 @@ var it_default = {
389
452
  cli_cmd_whoami: "Mostra l'account con cui hai effettuato l'accesso",
390
453
  cli_cmd_customers: "Gestisci i tuoi clienti",
391
454
  cli_cmd_customers_ls: "Elenca i tuoi clienti",
455
+ cli_cmd_customers_create: "Crea un cliente",
456
+ cli_cmd_customers_update: "Aggiorna un cliente",
392
457
  cli_cmd_invoices: "Gestisci fatture e preventivi",
393
458
  cli_cmd_invoices_ls: "Elenca fatture e preventivi",
394
459
  cli_cmd_invoices_create: "Crea una fattura o un preventivo",
460
+ cli_cmd_invoices_update: "Aggiorna una fattura o un preventivo",
395
461
  cli_cmd_invoices_pdf: "Scarica il PDF di una fattura o di un preventivo",
396
462
  cli_cmd_invoices_paid: "Segna una fattura come pagata",
397
463
  cli_cmd_invoices_unpaid: "Riporta una fattura fra quelle aperte",
@@ -401,19 +467,27 @@ var it_default = {
401
467
  cli_cmd_receipts_scan: "Carica un giustificativo e lascia che bonbox lo legga",
402
468
  cli_flag_json: "Stampa la risposta dell'API come JSON grezzo",
403
469
  cli_flag_lang: "Lingua dell'output (en, de, fr, it)",
404
- cli_flag_provider: "Accesso tramite google o apple",
405
470
  cli_flag_archived: "Includi i clienti archiviati",
406
471
  cli_flag_status: "Filtra per stato: created o paid",
407
472
  cli_flag_quotes: "Mostra i preventivi invece delle fatture",
408
473
  cli_flag_customer_ref: "Nome o ID del cliente",
474
+ cli_flag_name: "Nome del cliente",
475
+ cli_flag_department: "Reparto",
476
+ cli_flag_address: "Indirizzo",
477
+ cli_flag_postal_code: "Codice postale",
478
+ cli_flag_city: "Citt\xE0",
479
+ cli_flag_country: "Codice paese, ad esempio CH",
409
480
  cli_flag_item: "Voce nel formato descrizione:quantit\xE0:prezzo unitario[:sconto%], ripetibile",
410
481
  cli_flag_quote: "Crea un preventivo invece di una fattura",
411
482
  cli_flag_invoice_date: "Data della fattura (AAAA-MM-GG), per impostazione predefinita oggi",
483
+ cli_flag_invoice_date_update: "Data della fattura (AAAA-MM-GG)",
412
484
  cli_flag_payment_days: "Termine di pagamento in giorni",
413
485
  cli_flag_currency: "Valuta, ad esempio CHF",
414
486
  cli_flag_language: "Lingua del documento: de, en, fr o it",
415
487
  cli_flag_subtitle: "Sottotitolo mostrato sul documento",
416
488
  cli_flag_reference: "Il tuo riferimento per questo documento",
489
+ cli_flag_vat_rate: "Aliquota IVA in percento, ad esempio 8.1",
490
+ cli_flag_custom_notes: "Note personalizzate mostrate sul documento",
417
491
  cli_flag_pdf: "Salva anche il PDF in questo file",
418
492
  cli_flag_output: "Salva il PDF in questo file",
419
493
  cli_flag_paid_date: "Data del pagamento (AAAA-MM-GG), per impostazione predefinita oggi",
@@ -429,6 +503,7 @@ var it_default = {
429
503
  cli_flag_tax_category: "Categoria fiscale",
430
504
  cli_flag_booking_text: "Testo di registrazione",
431
505
  cli_arg_invoice_ref: "Numero della fattura o ID",
506
+ cli_arg_customer_ref: "Nome o ID del cliente",
432
507
  cli_arg_scan_files: "File immagine o PDF, tutte le pagine di un giustificativo",
433
508
  cli_error_unauthorized: "Non hai effettuato l'accesso. Esegui: bonbox login",
434
509
  cli_error_pro_required: "Serve bonbox Pro. Puoi passare a Pro qui: %1$s",
@@ -439,6 +514,11 @@ var it_default = {
439
514
  cli_error_item_number: 'Numero non valido nella voce "%1$s"',
440
515
  cli_error_items_required: "Aggiungi almeno una voce con --item",
441
516
  cli_error_customer_required: "Indica un cliente con --customer",
517
+ cli_error_name_required: "Indica un nome con --name",
518
+ cli_error_address_required: "Indica un indirizzo con --address",
519
+ cli_error_postal_code_required: "Indica un codice postale con --postal-code",
520
+ cli_error_city_required: "Indica una citt\xE0 con --city",
521
+ cli_error_update_fields_required: "Indica almeno un campo da aggiornare",
442
522
  cli_error_price_required: "Indica un importo con --price",
443
523
  cli_error_seller_required: "Indica un fornitore con --seller",
444
524
  cli_error_price_invalid: "Importo non valido: %1$s",
@@ -448,7 +528,7 @@ var it_default = {
448
528
  cli_error_customer_ambiguous: '"%1$s" corrisponde a pi\xF9 clienti:',
449
529
  cli_error_files_required: "Indica almeno un file da elaborare",
450
530
  cli_error_file_missing: "File non trovato: %1$s",
451
- cli_login_opening: "Apertura del browser per l'accesso ...",
531
+ cli_login_opening: "Apertura della pagina di accesso bonbox nel browser ...",
452
532
  cli_login_manual: "Se il browser non si apre, visita:\n%1$s",
453
533
  cli_login_waiting: "In attesa del completamento dell'accesso ...",
454
534
  cli_login_success: "Accesso effettuato come %1$s",
@@ -488,9 +568,13 @@ var it_default = {
488
568
  cli_empty_invoices: "Ancora nessuna fattura.",
489
569
  cli_empty_quotes: "Ancora nessun preventivo.",
490
570
  cli_empty_receipts: "Nessun giustificativo trovato.",
571
+ cli_customer_created: "Cliente %1$s creato.",
572
+ cli_customer_updated: "Cliente %1$s aggiornato.",
491
573
  cli_invoice_created: "Fattura %1$s creata, %2$s",
492
574
  cli_quote_created: "Preventivo %1$s creato, %2$s",
493
575
  cli_pdf_saved: "Salvato in %1$s",
576
+ cli_invoice_updated: "Fattura %1$s aggiornata.",
577
+ cli_quote_updated: "Preventivo %1$s aggiornato.",
494
578
  cli_invoice_paid: "%1$s segnata come pagata.",
495
579
  cli_invoice_unpaid: "%1$s riportata fra quelle aperte.",
496
580
  cli_receipt_added: "Giustificativo salvato: %1$s, %2$s",
@@ -692,6 +776,14 @@ var ApiClient = class {
692
776
  });
693
777
  return await this.parseJson(response);
694
778
  }
779
+ async patch(path, body) {
780
+ const response = await this.send(path, {
781
+ method: "PATCH",
782
+ headers: { "Content-Type": "application/json" },
783
+ body: JSON.stringify(body ?? {})
784
+ });
785
+ return await this.parseJson(response);
786
+ }
695
787
  async postMultipart(path, form) {
696
788
  const response = await this.send(path, { method: "POST", body: form });
697
789
  return await this.parseJson(response);
@@ -822,53 +914,6 @@ function table(columns, rows) {
822
914
  return [render(columns.map((column) => column.header)), ...rows.map(render)].join("\n");
823
915
  }
824
916
 
825
- // src/commands/customers.ts
826
- function listCommand() {
827
- return defineCommand2({
828
- meta: { name: "ls", description: t("cli_cmd_customers_ls") },
829
- args: {
830
- ...commonArgs(),
831
- archived: { type: "boolean", description: t("cli_flag_archived"), default: false }
832
- },
833
- async run({ args }) {
834
- const items = await client().getAllPages("/customers", {
835
- includeArchived: args.archived ? "true" : void 0
836
- });
837
- if (args.json) {
838
- printJson({ items });
839
- return;
840
- }
841
- if (items.length === 0) {
842
- out(t("cli_empty_customers"));
843
- return;
844
- }
845
- const columns = [
846
- { header: t("cli_col_name") },
847
- { header: t("cli_col_city") },
848
- ...args.archived ? [{ header: t("cli_col_archived") }] : [],
849
- { header: t("cli_col_id") }
850
- ];
851
- const rows = items.map((customer) => [
852
- customer.name,
853
- [customer.postalCode, customer.city].filter(Boolean).join(" "),
854
- ...args.archived ? [customer.archived ? t("cli_yes") : t("cli_no")] : [],
855
- customer.id
856
- ]);
857
- out(table(columns, rows));
858
- }
859
- });
860
- }
861
- function customersCommand() {
862
- return defineCommand2({
863
- meta: { name: "customers", description: t("cli_cmd_customers") },
864
- subCommands: { ls: listCommand() }
865
- });
866
- }
867
-
868
- // src/commands/invoices.ts
869
- import { defineCommand as defineCommand3 } from "citty";
870
- import { writeFile } from "fs/promises";
871
-
872
917
  // src/lib/args.ts
873
918
  function toArray(value) {
874
919
  if (value === void 0 || value === null || value === false) return [];
@@ -881,6 +926,10 @@ function optional(value) {
881
926
  const text = String(value).trim();
882
927
  return text.length > 0 ? text : void 0;
883
928
  }
929
+ function providedValue(value) {
930
+ if (value === void 0 || value === null) return void 0;
931
+ return String(value).trim();
932
+ }
884
933
  function requireDate(value) {
885
934
  if (value === void 0) return void 0;
886
935
  if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
@@ -907,6 +956,10 @@ function monthRange(month) {
907
956
  }
908
957
 
909
958
  // src/lib/customers.ts
959
+ var UUID_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
960
+ function isUuid(value) {
961
+ return UUID_RE.test(value);
962
+ }
910
963
  function matchCustomer(reference, customers) {
911
964
  const needle = reference.trim().toLowerCase();
912
965
  if (!needle) return { kind: "none" };
@@ -933,6 +986,137 @@ ${list}`);
933
986
  throw new UsageError(t("cli_error_customer_not_found", reference));
934
987
  }
935
988
 
989
+ // src/commands/customers.ts
990
+ function customerFieldArgs() {
991
+ return {
992
+ name: { type: "string", description: t("cli_flag_name") },
993
+ department: { type: "string", description: t("cli_flag_department") },
994
+ address: { type: "string", description: t("cli_flag_address") },
995
+ "postal-code": { type: "string", description: t("cli_flag_postal_code") },
996
+ city: { type: "string", description: t("cli_flag_city") },
997
+ country: { type: "string", description: t("cli_flag_country") }
998
+ };
999
+ }
1000
+ function listCommand() {
1001
+ return defineCommand2({
1002
+ meta: { name: "ls", description: t("cli_cmd_customers_ls") },
1003
+ args: {
1004
+ ...commonArgs(),
1005
+ archived: { type: "boolean", description: t("cli_flag_archived"), default: false }
1006
+ },
1007
+ async run({ args }) {
1008
+ const items = await client().getAllPages("/customers", {
1009
+ includeArchived: args.archived ? "true" : void 0
1010
+ });
1011
+ if (args.json) {
1012
+ printJson({ items });
1013
+ return;
1014
+ }
1015
+ if (items.length === 0) {
1016
+ out(t("cli_empty_customers"));
1017
+ return;
1018
+ }
1019
+ const columns = [
1020
+ { header: t("cli_col_name") },
1021
+ { header: t("cli_col_city") },
1022
+ ...args.archived ? [{ header: t("cli_col_archived") }] : [],
1023
+ { header: t("cli_col_id") }
1024
+ ];
1025
+ const rows = items.map((customer) => [
1026
+ customer.name,
1027
+ [customer.postalCode, customer.city].filter(Boolean).join(" "),
1028
+ ...args.archived ? [customer.archived ? t("cli_yes") : t("cli_no")] : [],
1029
+ customer.id
1030
+ ]);
1031
+ out(table(columns, rows));
1032
+ }
1033
+ });
1034
+ }
1035
+ function buildCreateBody(fields) {
1036
+ const name = optional(fields.name);
1037
+ const address = optional(fields.address);
1038
+ const postalCode = optional(fields["postal-code"]);
1039
+ const city = optional(fields.city);
1040
+ if (!name) throw new UsageError(t("cli_error_name_required"));
1041
+ if (!address) throw new UsageError(t("cli_error_address_required"));
1042
+ if (!postalCode) throw new UsageError(t("cli_error_postal_code_required"));
1043
+ if (!city) throw new UsageError(t("cli_error_city_required"));
1044
+ return {
1045
+ name,
1046
+ address,
1047
+ postalCode,
1048
+ city,
1049
+ country: optional(fields.country),
1050
+ department: optional(fields.department)
1051
+ };
1052
+ }
1053
+ function createCommand() {
1054
+ return defineCommand2({
1055
+ meta: { name: "create", description: t("cli_cmd_customers_create") },
1056
+ args: {
1057
+ ...commonArgs(),
1058
+ ...customerFieldArgs()
1059
+ },
1060
+ async run({ args }) {
1061
+ const customer = await client().post("/customers", buildCreateBody(args));
1062
+ if (args.json) printJson(customer);
1063
+ else out(t("cli_customer_created", customer.name));
1064
+ }
1065
+ });
1066
+ }
1067
+ function updatePayload(fields) {
1068
+ const payload = {};
1069
+ const name = providedValue(fields.name);
1070
+ const address = providedValue(fields.address);
1071
+ const postalCode = providedValue(fields["postal-code"]);
1072
+ const city = providedValue(fields.city);
1073
+ const country = providedValue(fields.country);
1074
+ const department = providedValue(fields.department);
1075
+ if (name !== void 0) payload.name = name;
1076
+ if (address !== void 0) payload.address = address;
1077
+ if (postalCode !== void 0) payload.postalCode = postalCode;
1078
+ if (city !== void 0) payload.city = city;
1079
+ if (country !== void 0) payload.country = country;
1080
+ if (department !== void 0) payload.department = department;
1081
+ return payload;
1082
+ }
1083
+ function ensureUpdatePayload(fields) {
1084
+ const payload = updatePayload(fields);
1085
+ if (Object.keys(payload).length === 0) {
1086
+ throw new UsageError(t("cli_error_update_fields_required"));
1087
+ }
1088
+ return payload;
1089
+ }
1090
+ function updateCommand() {
1091
+ return defineCommand2({
1092
+ meta: { name: "update", description: t("cli_cmd_customers_update") },
1093
+ args: {
1094
+ customer: { type: "positional", description: t("cli_arg_customer_ref"), required: true },
1095
+ ...commonArgs(),
1096
+ ...customerFieldArgs()
1097
+ },
1098
+ async run({ args }) {
1099
+ const payload = ensureUpdatePayload(args);
1100
+ const ref = String(args.customer);
1101
+ const api = client();
1102
+ const customerId = isUuid(ref) ? ref : resolveCustomer(ref, await api.getAllPages("/customers")).id;
1103
+ const customer = await api.patch(`/customers/${customerId}`, payload);
1104
+ if (args.json) printJson(customer);
1105
+ else out(t("cli_customer_updated", customer.name));
1106
+ }
1107
+ });
1108
+ }
1109
+ function customersCommand() {
1110
+ return defineCommand2({
1111
+ meta: { name: "customers", description: t("cli_cmd_customers") },
1112
+ subCommands: { ls: listCommand(), create: createCommand(), update: updateCommand() }
1113
+ });
1114
+ }
1115
+
1116
+ // src/commands/invoices.ts
1117
+ import { defineCommand as defineCommand3 } from "citty";
1118
+ import { writeFile } from "fs/promises";
1119
+
936
1120
  // src/lib/items.ts
937
1121
  var NUMBER = /^-?\d+(?:[.,]\d+)?$/;
938
1122
  function toNumber(raw) {
@@ -1025,7 +1209,7 @@ async function savePdf(api, reference, target) {
1025
1209
  await writeFile(filename, pdf.data);
1026
1210
  return filename;
1027
1211
  }
1028
- function createCommand() {
1212
+ function createCommand2() {
1029
1213
  return defineCommand3({
1030
1214
  meta: { name: "create", description: t("cli_cmd_invoices_create") },
1031
1215
  args: {
@@ -1073,6 +1257,63 @@ function createCommand() {
1073
1257
  }
1074
1258
  });
1075
1259
  }
1260
+ function updateCommand2() {
1261
+ return defineCommand3({
1262
+ meta: { name: "update", description: t("cli_cmd_invoices_update") },
1263
+ args: {
1264
+ invoice: { type: "positional", description: t("cli_arg_invoice_ref"), required: true },
1265
+ ...commonArgs(),
1266
+ customer: { type: "string", description: t("cli_flag_customer_ref") },
1267
+ item: { type: "string", description: t("cli_flag_item") },
1268
+ date: { type: "string", description: t("cli_flag_invoice_date_update") },
1269
+ "payment-days": { type: "string", description: t("cli_flag_payment_days") },
1270
+ currency: { type: "string", description: t("cli_flag_currency") },
1271
+ language: { type: "string", description: t("cli_flag_language") },
1272
+ subtitle: { type: "string", description: t("cli_flag_subtitle") },
1273
+ reference: { type: "string", description: t("cli_flag_reference") },
1274
+ "vat-rate": { type: "string", description: t("cli_flag_vat_rate") },
1275
+ "custom-notes": { type: "string", description: t("cli_flag_custom_notes") }
1276
+ },
1277
+ async run({ args }) {
1278
+ const customerRef = optional(args.customer);
1279
+ const rawItems = toArray(args.item);
1280
+ const items = rawItems.length > 0 ? parseItems(rawItems) : void 0;
1281
+ const api = client();
1282
+ const customerId = customerRef ? resolveCustomer(customerRef, await api.getAllPages("/customers")).id : void 0;
1283
+ const payload = {};
1284
+ if (customerId !== void 0) payload.customerId = customerId;
1285
+ if (items !== void 0) payload.items = items;
1286
+ const date = requireDate(optional(args.date));
1287
+ if (date !== void 0) payload.date = date;
1288
+ const paymentDays = requireNumber(optional(args["payment-days"]), "cli_error_price_invalid");
1289
+ if (paymentDays !== void 0) payload.paymentDays = paymentDays;
1290
+ const currency = optional(args.currency);
1291
+ if (currency !== void 0) payload.currency = currency;
1292
+ const language = optional(args.language);
1293
+ if (language !== void 0) payload.language = language;
1294
+ const subtitle = providedValue(args.subtitle);
1295
+ if (subtitle !== void 0) payload.subtitle = subtitle;
1296
+ const reference = providedValue(args.reference);
1297
+ if (reference !== void 0) payload.reference = reference;
1298
+ const customNotes = providedValue(args["custom-notes"]);
1299
+ if (customNotes !== void 0) payload.customNotes = customNotes;
1300
+ const vatRateRaw = providedValue(args["vat-rate"]);
1301
+ if (vatRateRaw === "") payload.vatRate = "";
1302
+ else if (vatRateRaw !== void 0) {
1303
+ payload.vatRate = requireNumber(vatRateRaw, "cli_error_price_invalid");
1304
+ }
1305
+ if (Object.keys(payload).length === 0) {
1306
+ throw new UsageError(t("cli_error_update_fields_required"));
1307
+ }
1308
+ const invoice = await api.patch(
1309
+ `/invoices/${encodeURIComponent(String(args.invoice))}`,
1310
+ payload
1311
+ );
1312
+ if (args.json) printJson(invoice);
1313
+ else out(invoice.isQuote ? t("cli_quote_updated", invoice.invoiceNumber) : t("cli_invoice_updated", invoice.invoiceNumber));
1314
+ }
1315
+ });
1316
+ }
1076
1317
  function pdfCommand() {
1077
1318
  return defineCommand3({
1078
1319
  meta: { name: "pdf", description: t("cli_cmd_invoices_pdf") },
@@ -1131,7 +1372,8 @@ function invoicesCommand() {
1131
1372
  meta: { name: "invoices", description: t("cli_cmd_invoices") },
1132
1373
  subCommands: {
1133
1374
  ls: listCommand2(),
1134
- create: createCommand(),
1375
+ create: createCommand2(),
1376
+ update: updateCommand2(),
1135
1377
  pdf: pdfCommand(),
1136
1378
  paid: paidCommand(),
1137
1379
  unpaid: unpaidCommand()
@@ -1141,6 +1383,7 @@ function invoicesCommand() {
1141
1383
 
1142
1384
  // src/commands/login.ts
1143
1385
  import { defineCommand as defineCommand4 } from "citty";
1386
+ import { randomBytes } from "crypto";
1144
1387
  import { createServer } from "http";
1145
1388
  import open from "open";
1146
1389
  var TIMEOUT_MS = 5 * 60 * 1e3;
@@ -1154,6 +1397,19 @@ font:16px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:#111;
1154
1397
  <p style="margin:0;color:#555">${body}</p>
1155
1398
  </main></body></html>`;
1156
1399
  }
1400
+ function handleCallbackRequest(requestUrl, expectedState) {
1401
+ const url = new URL(requestUrl, "http://localhost");
1402
+ const state = url.searchParams.get("state");
1403
+ if (state !== expectedState) return { kind: "invalid" };
1404
+ const accessToken = url.searchParams.get("access_token");
1405
+ const refreshToken = url.searchParams.get("refresh_token");
1406
+ if (accessToken && refreshToken) {
1407
+ return { kind: "success", tokens: { accessToken, refreshToken } };
1408
+ }
1409
+ const errorMessage = url.searchParams.get("error_description") ?? url.searchParams.get("error");
1410
+ if (errorMessage) return { kind: "error", message: errorMessage };
1411
+ return { kind: "invalid" };
1412
+ }
1157
1413
  function listen(port) {
1158
1414
  return new Promise((resolve) => {
1159
1415
  const server = createServer();
@@ -1168,62 +1424,71 @@ async function openListener() {
1168
1424
  }
1169
1425
  throw new CliError(t("cli_login_no_port", CALLBACK_PORTS.join(", ")));
1170
1426
  }
1171
- function awaitCode(server) {
1427
+ function awaitTokens(server, state) {
1172
1428
  return new Promise((resolve, reject) => {
1173
1429
  const timer = setTimeout(() => {
1174
1430
  reject(new CliError(t("cli_login_timeout")));
1175
1431
  }, TIMEOUT_MS);
1176
1432
  server.on("request", (request, response) => {
1177
1433
  const url = new URL(request.url ?? "/", "http://localhost");
1434
+ if (url.pathname === "/done") {
1435
+ response.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
1436
+ response.end(page(t("cli_callback_heading"), t("cli_callback_body")));
1437
+ return;
1438
+ }
1439
+ if (url.pathname === "/error") {
1440
+ response.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
1441
+ response.end(page(t("cli_callback_error_heading"), t("cli_callback_error_body")));
1442
+ return;
1443
+ }
1178
1444
  if (!url.pathname.startsWith("/callback")) {
1179
1445
  response.writeHead(404).end();
1180
1446
  return;
1181
1447
  }
1182
- const code = url.searchParams.get("code");
1183
- const error = url.searchParams.get("error_description") ?? url.searchParams.get("error");
1184
- const html = code ? page(t("cli_callback_heading"), t("cli_callback_body")) : page(t("cli_callback_error_heading"), t("cli_callback_error_body"));
1185
- response.writeHead(code ? 200 : 400, { "Content-Type": "text/html; charset=utf-8" });
1186
- response.end(html);
1448
+ const result = handleCallbackRequest(request.url ?? "/", state);
1449
+ if (result.kind === "invalid") {
1450
+ response.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
1451
+ response.end(page(t("cli_callback_error_heading"), t("cli_callback_error_body")));
1452
+ return;
1453
+ }
1454
+ if (result.kind === "error") {
1455
+ response.writeHead(302, { Location: "/error" });
1456
+ response.end();
1457
+ clearTimeout(timer);
1458
+ reject(new CliError(t("cli_login_failed", result.message)));
1459
+ return;
1460
+ }
1461
+ response.writeHead(302, { Location: "/done" });
1462
+ response.end();
1187
1463
  clearTimeout(timer);
1188
- if (code) resolve(code);
1189
- else reject(new CliError(t("cli_login_failed", error ?? "")));
1464
+ resolve(result.tokens);
1190
1465
  });
1191
1466
  });
1192
1467
  }
1193
1468
  function loginCommand() {
1194
1469
  return defineCommand4({
1195
1470
  meta: { name: "login", description: t("cli_cmd_login") },
1196
- args: {
1197
- ...commonArgs(),
1198
- provider: { type: "string", description: t("cli_flag_provider"), default: "google" }
1199
- },
1471
+ args: commonArgs(),
1200
1472
  async run({ args }) {
1201
- const provider = String(args.provider);
1202
- if (provider !== "google" && provider !== "apple") {
1203
- throw new UsageError(t("cli_flag_provider"));
1204
- }
1205
1473
  const { server, port } = await openListener();
1206
1474
  try {
1207
- const supabase = getSupabase();
1208
- const { data, error } = await supabase.auth.signInWithOAuth({
1209
- provider,
1210
- options: {
1211
- redirectTo: `http://localhost:${port}/callback`,
1212
- skipBrowserRedirect: true
1213
- }
1214
- });
1215
- if (error || !data.url) throw new CliError(t("cli_login_failed", error?.message ?? ""));
1475
+ const state = randomBytes(16).toString("hex");
1476
+ const loginUrl = `${APP_URL}/login?cli_port=${port}&state=${state}`;
1216
1477
  if (!args.json) {
1217
1478
  out(t("cli_login_opening"));
1218
- out(t("cli_login_manual", data.url));
1479
+ out(t("cli_login_manual", loginUrl));
1219
1480
  out(t("cli_login_waiting"));
1220
1481
  }
1221
- await open(data.url).catch(() => void 0);
1222
- const code = await awaitCode(server);
1223
- const exchanged = await supabase.auth.exchangeCodeForSession(code);
1224
- if (exchanged.error) throw new CliError(t("cli_login_failed", exchanged.error.message));
1225
- const email = exchanged.data.user?.email ?? exchanged.data.user?.id ?? "";
1226
- if (args.json) printJson({ user: { id: exchanged.data.user?.id, email } });
1482
+ await open(loginUrl).catch(() => void 0);
1483
+ const { accessToken, refreshToken } = await awaitTokens(server, state);
1484
+ const supabase = getSupabase();
1485
+ const { data, error } = await supabase.auth.setSession({
1486
+ access_token: accessToken,
1487
+ refresh_token: refreshToken
1488
+ });
1489
+ if (error) throw new CliError(t("cli_login_failed", error.message));
1490
+ const email = data.user?.email ?? data.user?.id ?? "";
1491
+ if (args.json) printJson({ user: { id: data.user?.id, email } });
1227
1492
  else out(t("cli_login_success", email));
1228
1493
  } finally {
1229
1494
  server.close();
@@ -1380,7 +1645,7 @@ function receiptsCommand() {
1380
1645
  }
1381
1646
 
1382
1647
  // src/cli.ts
1383
- var VERSION = "0.1.0";
1648
+ var VERSION = "0.3.0";
1384
1649
  var argv = process.argv.slice(2);
1385
1650
  setLocale(resolveLocale(langFromArgv(argv)));
1386
1651
  function withoutLangFlag(rawArgs) {