@go-labs-sg/bb 2.35.0 → 2.37.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/README.md CHANGED
@@ -228,9 +228,19 @@ New sources are registered against an existing Typeform form ID and always start
228
228
  with processing disabled in `COLLECT_ONLY`; creating a source does not call any
229
229
  external provider.
230
230
 
231
- Deal-lifecycle retries require Slack and Asana to succeed. Google Calendar is
232
- attempted afterward; a Calendar failure is logged without failing the overall
233
- lifecycle operation.
231
+ Set `asanaCustomFields.bbLinkFieldId` in the automation configuration to the
232
+ Asana Deals project's text custom field **BB Link**. Keep the other configuration
233
+ values when saving. Project creation queues a retryable update of that field
234
+ with the BB project's `/budgets` URL; an unmapped field is left untouched.
235
+ Older inbound snapshots can use the current BB Link mapping for their original
236
+ source and Asana Deals project.
237
+
238
+ Project Calendar descriptions list `bb :`, `asana deal:`, and `slack:` links
239
+ when available. The `asana project:` line appears only after a win and an
240
+ operational Asana project exists. Persisting that Asana project queues a Calendar
241
+ refresh, including recovery paths. Inbound response identity is retained for
242
+ safe reconciliation. Calendar and configured Asana/Slack synchronization failures
243
+ remain retryable in the durable lifecycle outbox.
234
244
 
235
245
  ### Mutation safety
236
246
 
@@ -296,51 +306,31 @@ Bill creation determines its required permissions from the parsed input, for bot
296
306
 
297
307
  **Contact-person estimate email:** `bb budget estimate send --payload '<json>'` calls the same `email.sendEstimateToContactPerson` procedure as the web composer. The payload requires `budgetId`, `estimateId`, optional `estimateDocNumber`, `to`, `cc`, `replyTo`, `subject`, HTML `content`, and HTML `signature`. It durably queues worker delivery of the QuickBooks PDF, standard terms, and Budget Builder budget attachments, and returns the outbound-email and operation IDs immediately. Worker retries reuse one provider idempotency key; the budget becomes `ESTIMATE_SENT` only after Resend accepts the email. The command requires interactive `CONFIRM`; inspect the budget, recipients, and HTML first.
298
308
 
299
- ### Acceptance invoice splits and grouped sending
309
+ ### Invoice settings, due dates, and approval
300
310
 
301
- After `bb budget won mark` (or an accepted status update), the JSON result includes an `invoiceSetup` prompt for QuickBooks-backed estimates. Choose the split amounts and each split's contractual due date; invoice creation does not wait for those due dates. There is no separate split-approval request.
311
+ After accepting an estimate, configure the project's invoice settings (70/30, 100% upfront, or custom deposit/balance), then choose a due date for each invoice. Creation is immediate; a future due date is a payment deadline, not an issue schedule.
302
312
 
303
- 1. `bb customer-invoice splits <budgetId>` returns the current revision, row IDs, billing defaults, and invoice approval/delivery states.
304
- 2. `bb customer-invoice preview-splits --payload '<json>'` previews amounts including GST and due-date changes, without writes.
305
- 3. `bb customer-invoice save-splits --payload '<json>'` saves that setup only. It does not create QBO invoices or request invoice approval. Re-read `splits` for the new revision and instalment IDs.
306
- 4. `bb customer-invoice create-splits --payload '{"budgetId":"budget_1","expectedRevision":2,"instalmentIds":["row_1","row_2"]}'` creates selected ready invoices in QBO. Non-admin creation automatically requests admin approval **after creation**; admin creation auto-approves. No customer email is sent.
307
- 5. An admin uses the existing `bb customer-invoice approve <batchId>` action for each pending invoice batch. Approval does not send the invoice to the customer.
308
- 6. The user re-reads `splits`, then runs `bb customer-invoice send-group --payload '{"budgetId":"budget_1","expectedRevision":2,"instalmentIds":["row_1","row_2"]}'` to send approved invoices together in one email. Select one row for individual sending. Alternatively, use `--all-approved --payload '{"budgetId":"budget_1","expectedRevision":2}'` to select all approved, unsent invoices in that budget. Do not combine `--all-approved` with `instalmentIds`.
313
+ 1. Read `bb customer-invoice readiness check <budgetId>`.
314
+ 2. If needed, configure the project invoice settings in the web app, then re-check readiness.
315
+ 3. Run `bb customer-invoice create --payload '<json>'` with the setting-derived splits and an explicit due date for each. Existing active invoices count toward coverage and are not recreated.
316
+ 4. Non-admin creation automatically requests admin approval after QBO creation. Admin creation is auto-approved. Pending approval never sends invoices.
317
+ 5. Use the normal invoice detail/email or portal-upload actions after approval. Creation and approval do not automatically email the customer.
309
318
 
310
- Preview/save use this shape, populated from the current `splits` result and the signed terms (IDs, addresses, and dates below are examples only):
319
+ Example only, for a project configured as 70/30 with no existing invoices:
311
320
 
312
321
  ```json
313
322
  {
314
323
  "budgetId": "budget_1",
315
- "expectedRevision": 1,
316
- "scope": "BASE",
317
- "changeReason": "Confirmed invoice split and due dates from signed estimate",
318
- "definition": {
319
- "rows": [
320
- { "key": "deposit", "label": "Deposit", "amount": { "type": "PERCENTAGE", "value": 70 }, "due": { "type": "CONFIRMATION" }, "issue": { "type": "ACCEPTANCE" } },
321
- { "key": "balance", "label": "Balance", "amount": { "type": "PERCENTAGE", "value": 30 }, "due": { "type": "FIXED_DATE", "date": "2026-12-01" }, "issue": { "type": "ACCEPTANCE" } }
322
- ],
323
- "reminderLeadDays": 7,
324
- "billingRestriction": ""
325
- },
326
- "billing": {
327
- "legalEntityName": "Customer legal entity",
328
- "purchaseOrder": "PO-reference",
329
- "billingAddress": "Customer billing address",
330
- "to": "billing@example.invalid",
331
- "cc": [],
332
- "replyTo": "owner@example.invalid",
333
- "deliveryMethod": "EMAIL",
334
- "uploadUrl": null
335
- }
324
+ "splits": [
325
+ { "label": "Deposit", "percentage": 70, "dueDate": "2026-12-01" },
326
+ { "label": "Balance", "percentage": 30, "dueDate": "2026-12-15" }
327
+ ]
336
328
  }
337
329
  ```
338
330
 
339
- Use the exact current revision (or `null` only when no schedule exists). Fixed amounts use **pre-GST cents**; percentages use percentage points. Event-relative due rules are `EVENT_START` or `EVENT_END` with `offsetDays`. Preview and resolve missing dates, past-due review or unresolved amounts rather than inventing replacements.
340
-
341
- Non-interactive save requires `--allow-state-change`; creation requires `--allow-state-change --allow-financial-write --allow-external-write --allow-email` (approval-request email, not customer invoice delivery); grouped sending requires `--allow-state-change --allow-email --allow-external-write`. These flags acknowledge effects, not role permissions or user authorisation. Both ordinary users and admins still need server-granted project access. Pending/rejected invoices cannot be sent; a mixed selection is rejected rather than silently dropping invoices. Sending uses each issued invoice's original billing revision, not later edits. Invoices with different original billing instructions must be sent in separate groups. Do not blindly retry uncertain QBO or email outcomes.
331
+ Use actual agreed dates and the project's saved percentages, not the example values. Non-interactive creation requires `--allow-state-change --allow-financial-write --allow-external-write --allow-email` (internal approval notification, not customer delivery). Do not blindly retry an uncertain QBO outcome; review the existing batch first.
342
332
 
343
- These commands require the matching API deployment and a new CLI release; changing this repository does not publish the CLI or deploy production.
333
+ The former `splits`, `preview-splits`, `save-splits`, `create-splits`, and `send-group` schedule commands are retired. Update the CLI alongside the API. Existing schedule data and invoices are retained, and previously queued emails retain their delivery/reconciliation support; no new schedules or reminders are created.
344
334
 
345
335
  ### Quotation amounts and line allocations
346
336
 
@@ -3829,275 +3829,6 @@
3829
3829
  "effects": ["state-change", "financial-write"],
3830
3830
  "legacyTarget": "import-qbo-customer-invoice"
3831
3831
  },
3832
- {
3833
- "path": ["customer-invoice", "splits"],
3834
- "legacyAliases": [
3835
- "get-customer-invoice-splits",
3836
- "get_customer_invoice_splits"
3837
- ],
3838
- "summary": "Review acceptance invoice splits, due dates, approval states and saved billing details. Arguments: <budgetId>.",
3839
- "globalOptions": [
3840
- {
3841
- "name": "--help",
3842
- "description": "Show help for this command."
3843
- },
3844
- {
3845
- "name": "--quiet",
3846
- "description": "Suppress non-error diagnostics."
3847
- },
3848
- {
3849
- "name": "--debug",
3850
- "description": "Emit sanitized diagnostic traces."
3851
- },
3852
- {
3853
- "name": "--api-url",
3854
- "description": "Override the Budget Builder API base URL."
3855
- },
3856
- {
3857
- "name": "--no-browser",
3858
- "description": "Print the authorization URL without opening a browser."
3859
- },
3860
- {
3861
- "name": "--allow-state-change",
3862
- "description": "Allow a Budget Builder state change in non-interactive use."
3863
- },
3864
- {
3865
- "name": "--allow-email",
3866
- "description": "Allow sending email in non-interactive use."
3867
- },
3868
- {
3869
- "name": "--allow-external-write",
3870
- "description": "Allow writes to external systems in non-interactive use."
3871
- },
3872
- {
3873
- "name": "--allow-delete",
3874
- "description": "Allow deleting data in non-interactive use."
3875
- },
3876
- {
3877
- "name": "--allow-financial-write",
3878
- "description": "Allow financial-record changes in non-interactive use."
3879
- }
3880
- ],
3881
- "argumentMode": "legacy-passthrough",
3882
- "effects": [],
3883
- "legacyTarget": "get-customer-invoice-splits"
3884
- },
3885
- {
3886
- "path": ["customer-invoice", "preview-splits"],
3887
- "legacyAliases": [
3888
- "preview-customer-invoice-splits",
3889
- "preview_customer_invoice_splits"
3890
- ],
3891
- "summary": "Preview splits, GST totals and due-date changes without writes. Requires --payload with the schedule save input.",
3892
- "globalOptions": [
3893
- {
3894
- "name": "--help",
3895
- "description": "Show help for this command."
3896
- },
3897
- {
3898
- "name": "--quiet",
3899
- "description": "Suppress non-error diagnostics."
3900
- },
3901
- {
3902
- "name": "--debug",
3903
- "description": "Emit sanitized diagnostic traces."
3904
- },
3905
- {
3906
- "name": "--api-url",
3907
- "description": "Override the Budget Builder API base URL."
3908
- },
3909
- {
3910
- "name": "--no-browser",
3911
- "description": "Print the authorization URL without opening a browser."
3912
- },
3913
- {
3914
- "name": "--allow-state-change",
3915
- "description": "Allow a Budget Builder state change in non-interactive use."
3916
- },
3917
- {
3918
- "name": "--allow-email",
3919
- "description": "Allow sending email in non-interactive use."
3920
- },
3921
- {
3922
- "name": "--allow-external-write",
3923
- "description": "Allow writes to external systems in non-interactive use."
3924
- },
3925
- {
3926
- "name": "--allow-delete",
3927
- "description": "Allow deleting data in non-interactive use."
3928
- },
3929
- {
3930
- "name": "--allow-financial-write",
3931
- "description": "Allow financial-record changes in non-interactive use."
3932
- }
3933
- ],
3934
- "argumentMode": "legacy-passthrough",
3935
- "effects": [],
3936
- "legacyTarget": "preview-customer-invoice-splits"
3937
- },
3938
- {
3939
- "path": ["customer-invoice", "save-splits"],
3940
- "legacyAliases": [
3941
- "save-customer-invoice-splits",
3942
- "save_customer_invoice_splits"
3943
- ],
3944
- "summary": "Save split amounts and separate due dates after estimate acceptance. Requires --payload; does not create invoices or request approval.",
3945
- "globalOptions": [
3946
- {
3947
- "name": "--help",
3948
- "description": "Show help for this command."
3949
- },
3950
- {
3951
- "name": "--quiet",
3952
- "description": "Suppress non-error diagnostics."
3953
- },
3954
- {
3955
- "name": "--debug",
3956
- "description": "Emit sanitized diagnostic traces."
3957
- },
3958
- {
3959
- "name": "--api-url",
3960
- "description": "Override the Budget Builder API base URL."
3961
- },
3962
- {
3963
- "name": "--no-browser",
3964
- "description": "Print the authorization URL without opening a browser."
3965
- },
3966
- {
3967
- "name": "--allow-state-change",
3968
- "description": "Allow a Budget Builder state change in non-interactive use."
3969
- },
3970
- {
3971
- "name": "--allow-email",
3972
- "description": "Allow sending email in non-interactive use."
3973
- },
3974
- {
3975
- "name": "--allow-external-write",
3976
- "description": "Allow writes to external systems in non-interactive use."
3977
- },
3978
- {
3979
- "name": "--allow-delete",
3980
- "description": "Allow deleting data in non-interactive use."
3981
- },
3982
- {
3983
- "name": "--allow-financial-write",
3984
- "description": "Allow financial-record changes in non-interactive use."
3985
- }
3986
- ],
3987
- "argumentMode": "legacy-passthrough",
3988
- "effects": ["state-change"],
3989
- "legacyTarget": "save-customer-invoice-splits"
3990
- },
3991
- {
3992
- "path": ["customer-invoice", "create-splits"],
3993
- "legacyAliases": [
3994
- "create-customer-invoice-splits",
3995
- "create_customer_invoice_splits"
3996
- ],
3997
- "summary": "Create selected split invoices in QBO, then request admin approval for non-admin creators or auto-approve admin creators. Requires --payload with budgetId, expectedRevision, instalmentIds. Never sends customer invoices.",
3998
- "globalOptions": [
3999
- {
4000
- "name": "--help",
4001
- "description": "Show help for this command."
4002
- },
4003
- {
4004
- "name": "--quiet",
4005
- "description": "Suppress non-error diagnostics."
4006
- },
4007
- {
4008
- "name": "--debug",
4009
- "description": "Emit sanitized diagnostic traces."
4010
- },
4011
- {
4012
- "name": "--api-url",
4013
- "description": "Override the Budget Builder API base URL."
4014
- },
4015
- {
4016
- "name": "--no-browser",
4017
- "description": "Print the authorization URL without opening a browser."
4018
- },
4019
- {
4020
- "name": "--allow-state-change",
4021
- "description": "Allow a Budget Builder state change in non-interactive use."
4022
- },
4023
- {
4024
- "name": "--allow-email",
4025
- "description": "Allow sending email in non-interactive use."
4026
- },
4027
- {
4028
- "name": "--allow-external-write",
4029
- "description": "Allow writes to external systems in non-interactive use."
4030
- },
4031
- {
4032
- "name": "--allow-delete",
4033
- "description": "Allow deleting data in non-interactive use."
4034
- },
4035
- {
4036
- "name": "--allow-financial-write",
4037
- "description": "Allow financial-record changes in non-interactive use."
4038
- }
4039
- ],
4040
- "argumentMode": "legacy-passthrough",
4041
- "effects": ["state-change", "financial-write", "external-write", "email"],
4042
- "legacyTarget": "create-customer-invoice-splits"
4043
- },
4044
- {
4045
- "path": ["customer-invoice", "send-group"],
4046
- "legacyAliases": [
4047
- "send-customer-invoice-group",
4048
- "send_customer_invoice_group"
4049
- ],
4050
- "summary": "Send selected approved invoices together in one email. Requires --payload with budgetId, expectedRevision, instalmentIds, or --all-approved without instalmentIds. Pass one instalment for individual sending.",
4051
- "globalOptions": [
4052
- {
4053
- "name": "--help",
4054
- "description": "Show help for this command."
4055
- },
4056
- {
4057
- "name": "--quiet",
4058
- "description": "Suppress non-error diagnostics."
4059
- },
4060
- {
4061
- "name": "--debug",
4062
- "description": "Emit sanitized diagnostic traces."
4063
- },
4064
- {
4065
- "name": "--api-url",
4066
- "description": "Override the Budget Builder API base URL."
4067
- },
4068
- {
4069
- "name": "--no-browser",
4070
- "description": "Print the authorization URL without opening a browser."
4071
- },
4072
- {
4073
- "name": "--allow-state-change",
4074
- "description": "Allow a Budget Builder state change in non-interactive use."
4075
- },
4076
- {
4077
- "name": "--allow-email",
4078
- "description": "Allow sending email in non-interactive use."
4079
- },
4080
- {
4081
- "name": "--allow-external-write",
4082
- "description": "Allow writes to external systems in non-interactive use."
4083
- },
4084
- {
4085
- "name": "--allow-delete",
4086
- "description": "Allow deleting data in non-interactive use."
4087
- },
4088
- {
4089
- "name": "--allow-financial-write",
4090
- "description": "Allow financial-record changes in non-interactive use."
4091
- },
4092
- {
4093
- "name": "--all-approved",
4094
- "description": "Select all approved unsent invoices; payload must contain only budgetId and expectedRevision."
4095
- }
4096
- ],
4097
- "argumentMode": "legacy-passthrough",
4098
- "effects": ["state-change", "email", "external-write"],
4099
- "legacyTarget": "send-customer-invoice-group"
4100
- },
4101
3832
  {
4102
3833
  "path": ["customer-invoice", "create"],
4103
3834
  "legacyAliases": ["create-customer-invoice", "create_customer_invoice"],
@@ -617,46 +617,6 @@ Legacy aliases: `import-qbo-customer-invoice`, `import_qbo_customer_invoice`.
617
617
 
618
618
  Effects: state-change, financial-write.
619
619
 
620
- ## `bb customer-invoice splits`
621
-
622
- Review acceptance invoice splits, due dates, approval states and saved billing details. Arguments: <budgetId>.
623
-
624
- Legacy aliases: `get-customer-invoice-splits`, `get_customer_invoice_splits`.
625
-
626
- Effects: none.
627
-
628
- ## `bb customer-invoice preview-splits`
629
-
630
- Preview splits, GST totals and due-date changes without writes. Requires --payload with the schedule save input.
631
-
632
- Legacy aliases: `preview-customer-invoice-splits`, `preview_customer_invoice_splits`.
633
-
634
- Effects: none.
635
-
636
- ## `bb customer-invoice save-splits`
637
-
638
- Save split amounts and separate due dates after estimate acceptance. Requires --payload; does not create invoices or request approval.
639
-
640
- Legacy aliases: `save-customer-invoice-splits`, `save_customer_invoice_splits`.
641
-
642
- Effects: state-change.
643
-
644
- ## `bb customer-invoice create-splits`
645
-
646
- Create selected split invoices in QBO, then request admin approval for non-admin creators or auto-approve admin creators. Requires --payload with budgetId, expectedRevision, instalmentIds. Never sends customer invoices.
647
-
648
- Legacy aliases: `create-customer-invoice-splits`, `create_customer_invoice_splits`.
649
-
650
- Effects: state-change, financial-write, external-write, email.
651
-
652
- ## `bb customer-invoice send-group`
653
-
654
- Send selected approved invoices together in one email. Requires --payload with budgetId, expectedRevision, instalmentIds, or --all-approved without instalmentIds. Pass one instalment for individual sending.
655
-
656
- Legacy aliases: `send-customer-invoice-group`, `send_customer_invoice_group`.
657
-
658
- Effects: state-change, email, external-write.
659
-
660
620
  ## `bb customer-invoice create`
661
621
 
662
622
  Create Customer Invoice.