@fleetless/contracts 15.5.0-next.2 → 15.6.0-next.1

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/CHANGELOG.md CHANGED
@@ -9,6 +9,25 @@ version.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ### Added
13
+
14
+ - **`plan_purchase_closed`, and `paid_plans` on the org's plan**
15
+ (fleetless/fleetless#1163). A cloud can sell paid plans only to the
16
+ organizations Fleetless has unlocked for them. A new `403` code,
17
+ `plan_purchase_closed`, is listed on the six routes that refuse an org
18
+ that is not unlocked: `POST /api/billing/checkout`,
19
+ `POST /api/billing/intents/:id/display` and `/confirm`,
20
+ `POST /api/billing/change`, and `POST /api/org/plan/change/prepare` and
21
+ `PUT /api/org/plan/change` when the target is not Basic. Cancel, resume,
22
+ the details, the payment method, invoices, charges, the documents, the
23
+ checkout poll and `DELETE /api/org/plan/change` never answer it.
24
+ - `orgPlan.paid_plans`, required, `open` or `closed`: `closed` exactly when
25
+ those routes answer `plan_purchase_closed` for this org. A consumer that
26
+ builds an `orgPlan` by hand adds the field; one that parses the cloud's
27
+ answer reads it.
28
+
29
+ ## [15.5.0] — 2026-11-14
30
+
12
31
  ### Changed
13
32
 
14
33
  - **The default app mails carry an HTML part with the app's brand**
@@ -9956,7 +9956,7 @@
9956
9956
  }
9957
9957
  },
9958
9958
  "default": {
9959
- "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `plan_limit`, `target_state_conflict`.",
9959
+ "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `plan_limit`, `target_state_conflict`, `plan_purchase_closed`.",
9960
9960
  "content": {
9961
9961
  "application/json": {
9962
9962
  "schema": {
@@ -10004,7 +10004,7 @@
10004
10004
  }
10005
10005
  },
10006
10006
  "default": {
10007
- "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `plan_limit`, `target_state_conflict`.",
10007
+ "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `plan_limit`, `target_state_conflict`, `plan_purchase_closed`.",
10008
10008
  "content": {
10009
10009
  "application/json": {
10010
10010
  "schema": {
@@ -10141,7 +10141,7 @@
10141
10141
  }
10142
10142
  }
10143
10143
  },
10144
- "description": "`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; plan-change prepare, resume, the details and the VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here."
10144
+ "description": "`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; plan-change prepare, resume, the details and the VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here. Where this cloud sells paid plans only to organizations Fleetless has unlocked, an org that is not unlocked reads `paid_plans: closed` there, and checkout, the decision display and confirm, `POST /api/billing/change`, and a plan-change prepare or final PUT whose target is not Basic answer `403 plan_purchase_closed`; this read, the checkout poll, cancel, resume, the details, the payment method, invoices and charges, the documents and a Basic target are never refused by it."
10145
10145
  }
10146
10146
  },
10147
10147
  "/api/billing/checkout": {
@@ -10169,7 +10169,7 @@
10169
10169
  }
10170
10170
  },
10171
10171
  "default": {
10172
- "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `plan_limit`, `target_state_conflict`, `rate_limited`, `billing_unavailable`, `payment_provider_unavailable`.",
10172
+ "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `plan_limit`, `target_state_conflict`, `rate_limited`, `plan_purchase_closed`, `billing_unavailable`, `payment_provider_unavailable`.",
10173
10173
  "content": {
10174
10174
  "application/json": {
10175
10175
  "schema": {
@@ -10304,7 +10304,7 @@
10304
10304
  }
10305
10305
  },
10306
10306
  "default": {
10307
- "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `not_found`, `target_state_conflict`.",
10307
+ "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `not_found`, `target_state_conflict`, `plan_purchase_closed`.",
10308
10308
  "content": {
10309
10309
  "application/json": {
10310
10310
  "schema": {
@@ -10362,7 +10362,7 @@
10362
10362
  }
10363
10363
  },
10364
10364
  "default": {
10365
- "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `not_found`, `target_state_conflict`, `plan_limit`, `rate_limited`, `billing_unavailable`, `payment_provider_unavailable`.",
10365
+ "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `not_found`, `target_state_conflict`, `plan_limit`, `rate_limited`, `plan_purchase_closed`, `billing_unavailable`, `payment_provider_unavailable`.",
10366
10366
  "content": {
10367
10367
  "application/json": {
10368
10368
  "schema": {
@@ -10554,7 +10554,7 @@
10554
10554
  }
10555
10555
  },
10556
10556
  "default": {
10557
- "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `plan_limit`, `target_state_conflict`, `billing_unavailable`, `payment_provider_unavailable`.",
10557
+ "description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `plan_limit`, `target_state_conflict`, `plan_purchase_closed`, `billing_unavailable`, `payment_provider_unavailable`.",
10558
10558
  "content": {
10559
10559
  "application/json": {
10560
10560
  "schema": {
@@ -39973,6 +39973,14 @@
39973
39973
  }
39974
39974
  ],
39975
39975
  "description": "Set only while the org is still on the beta; `null` for every other org."
39976
+ },
39977
+ "paid_plans": {
39978
+ "type": "string",
39979
+ "enum": [
39980
+ "open",
39981
+ "closed"
39982
+ ],
39983
+ "description": "Whether this org may buy a paid plan. `open` when this cloud sells paid plans to every org, or Fleetless has unlocked this one; `closed` otherwise, and then starting, displaying or confirming a purchase or a paid change, and a plan change to anything but Basic, answer `403 plan_purchase_closed`. The plans and their prices stay readable either way."
39976
39984
  }
39977
39985
  },
39978
39986
  "required": [
@@ -39985,7 +39993,8 @@
39985
39993
  "usage",
39986
39994
  "pending_change",
39987
39995
  "lock",
39988
- "switch"
39996
+ "switch",
39997
+ "paid_plans"
39989
39998
  ],
39990
39999
  "additionalProperties": false
39991
40000
  },
@@ -41371,6 +41380,14 @@
41371
41380
  }
41372
41381
  ],
41373
41382
  "description": "Set only while the org is still on the beta; `null` for every other org."
41383
+ },
41384
+ "paid_plans": {
41385
+ "type": "string",
41386
+ "enum": [
41387
+ "open",
41388
+ "closed"
41389
+ ],
41390
+ "description": "Whether this org may buy a paid plan. `open` when this cloud sells paid plans to every org, or Fleetless has unlocked this one; `closed` otherwise, and then starting, displaying or confirming a purchase or a paid change, and a plan change to anything but Basic, answer `403 plan_purchase_closed`. The plans and their prices stay readable either way."
41374
41391
  }
41375
41392
  },
41376
41393
  "required": [
@@ -41383,7 +41400,8 @@
41383
41400
  "usage",
41384
41401
  "pending_change",
41385
41402
  "lock",
41386
- "switch"
41403
+ "switch",
41404
+ "paid_plans"
41387
41405
  ],
41388
41406
  "additionalProperties": false
41389
41407
  }
@@ -6707,7 +6707,8 @@
6707
6707
  "tier_required",
6708
6708
  "validation_error",
6709
6709
  "plan_limit",
6710
- "target_state_conflict"
6710
+ "target_state_conflict",
6711
+ "plan_purchase_closed"
6711
6712
  ],
6712
6713
  "transport": "http",
6713
6714
  "notes": "Owner only. Persists a prepared change reference and a short-lived display, without mutating the plan, pending_change, or legal acceptance. A same-key, same-input retry while undecided returns the same change_id with a fresh display. A Basic cancellation reason belongs only in the final PUT."
@@ -6733,7 +6734,8 @@
6733
6734
  "tier_required",
6734
6735
  "validation_error",
6735
6736
  "plan_limit",
6736
- "target_state_conflict"
6737
+ "target_state_conflict",
6738
+ "plan_purchase_closed"
6737
6739
  ],
6738
6740
  "transport": "http",
6739
6741
  "notes": "Owner tier, and **downward only**: a prior prepare returns change_id and a displayed snapshot; this final PUT requires its confirmation_proof and the same operation_key, target_plan and keep. Only Basic permits cancellation_reason (at most 500 input characters). The reason is final idempotency metadata, not price or legal evidence. An exact replay returns the original result; a changed reason with the same key conflicts before effect. The decision and legal acceptance commit together. This route moves the org to a lower plan or cancels it outright to Basic. It never moves the org up — an upgrade or an add-on goes through the billing routes instead (`POST /api/billing/checkout`, `POST /api/billing/change`). `409 target_state_conflict` names `target_plan` with rule `not_lower` when the chosen plan is not below the org's current one; with rule `locked_basic_only` when the org is locked (`orgLock`) and the chosen plan is anything but Basic; and with rule `migration_basic_only` when the org is still on the beta, awaiting the switch to priced plans, and the chosen plan is anything but Basic — that choice is exactly what the org lands on at the switch. An owner is never named in `keep` and always stays, but still counts against the target plan's `seats`; `409 plan_limit` names `seats` when the owners alone already exceed it, and names whichever other limit `keep` still exceeds otherwise. `keep` is `null` when the org's current usage already fits the target plan outright and nothing is deleted; named, it lists exactly the robots, apps, app users and developers that stay. The choice is stored as `pending_change` and takes effect at `period_ends_at` — **everything of the chosen kind not named in `keep` is deleted at that instant, never before** — except a choice made while the org is locked, which takes effect at once, and a beta org's choice, which takes effect at the switch date instead. Anything created while the choice is pending is checked against the target plan too and, when it passes, is folded into `keep`, so exactly what the confirmation counted is what is actually deleted. Replacing a still-pending choice requires a new prepare and proof-bound final PUT."
@@ -6838,7 +6840,7 @@
6838
6840
  "tier_required"
6839
6841
  ],
6840
6842
  "transport": "http",
6841
- "notes": "`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; plan-change prepare, resume, the details and the VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here."
6843
+ "notes": "`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; plan-change prepare, resume, the details and the VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here. Where this cloud sells paid plans only to organizations Fleetless has unlocked, an org that is not unlocked reads `paid_plans: closed` there, and checkout, the decision display and confirm, `POST /api/billing/change`, and a plan-change prepare or final PUT whose target is not Basic answer `403 plan_purchase_closed`; this read, the checkout poll, cancel, resume, the details, the payment method, invoices and charges, the documents and a Basic target are never refused by it."
6842
6844
  },
6843
6845
  {
6844
6846
  "method": "POST",
@@ -6863,6 +6865,7 @@
6863
6865
  "plan_limit",
6864
6866
  "target_state_conflict",
6865
6867
  "rate_limited",
6868
+ "plan_purchase_closed",
6866
6869
  "billing_unavailable",
6867
6870
  "payment_provider_unavailable"
6868
6871
  ],
@@ -6920,7 +6923,8 @@
6920
6923
  "tier_required",
6921
6924
  "validation_error",
6922
6925
  "not_found",
6923
- "target_state_conflict"
6926
+ "target_state_conflict",
6927
+ "plan_purchase_closed"
6924
6928
  ],
6925
6929
  "transport": "http",
6926
6930
  "notes": "Owner only, Cache-Control: no-store. Cloud persists the snapshot and proof hash for an eligible current checkout or paid-change intent of this Owner and org. Pending, held, refused or accepted intents cannot mint a new proof. The proof never appears in lookup, billing views or logs."
@@ -6954,6 +6958,7 @@
6954
6958
  "target_state_conflict",
6955
6959
  "plan_limit",
6956
6960
  "rate_limited",
6961
+ "plan_purchase_closed",
6957
6962
  "billing_unavailable",
6958
6963
  "payment_provider_unavailable"
6959
6964
  ],
@@ -7061,6 +7066,7 @@
7061
7066
  "validation_error",
7062
7067
  "plan_limit",
7063
7068
  "target_state_conflict",
7069
+ "plan_purchase_closed",
7064
7070
  "billing_unavailable",
7065
7071
  "payment_provider_unavailable"
7066
7072
  ],
@@ -510,6 +510,14 @@
510
510
  }
511
511
  ],
512
512
  "description": "Set only while the org is still on the beta; `null` for every other org."
513
+ },
514
+ "paid_plans": {
515
+ "type": "string",
516
+ "enum": [
517
+ "open",
518
+ "closed"
519
+ ],
520
+ "description": "Whether this org may buy a paid plan. `open` when this cloud sells paid plans to every org, or Fleetless has unlocked this one; `closed` otherwise, and then starting, displaying or confirming a purchase or a paid change, and a plan change to anything but Basic, answer `403 plan_purchase_closed`. The plans and their prices stay readable either way."
513
521
  }
514
522
  },
515
523
  "required": [
@@ -522,7 +530,8 @@
522
530
  "usage",
523
531
  "pending_change",
524
532
  "lock",
525
- "switch"
533
+ "switch",
534
+ "paid_plans"
526
535
  ],
527
536
  "additionalProperties": false
528
537
  }
@@ -543,6 +543,14 @@
543
543
  }
544
544
  ],
545
545
  "description": "Set only while the org is still on the beta; `null` for every other org."
546
+ },
547
+ "paid_plans": {
548
+ "type": "string",
549
+ "enum": [
550
+ "open",
551
+ "closed"
552
+ ],
553
+ "description": "Whether this org may buy a paid plan. `open` when this cloud sells paid plans to every org, or Fleetless has unlocked this one; `closed` otherwise, and then starting, displaying or confirming a purchase or a paid change, and a plan change to anything but Basic, answer `403 plan_purchase_closed`. The plans and their prices stay readable either way."
546
554
  }
547
555
  },
548
556
  "required": [
@@ -555,7 +563,8 @@
555
563
  "usage",
556
564
  "pending_change",
557
565
  "lock",
558
- "switch"
566
+ "switch",
567
+ "paid_plans"
559
568
  ],
560
569
  "additionalProperties": false
561
570
  }
package/dist/billing.d.ts CHANGED
@@ -6326,8 +6326,8 @@ export declare const paymentMethod: z.ZodDiscriminatedUnion<[z.ZodObject<{
6326
6326
  export type PaymentMethod = z.infer<typeof paymentMethod>;
6327
6327
  /** An invoice's status: `open` until paid, `cancelled` after a cancellation, or `uncollectible` after an unpaid fallback. */
6328
6328
  export declare const invoiceStatus: z.ZodEnum<{
6329
- paid: "paid";
6330
6329
  open: "open";
6330
+ paid: "paid";
6331
6331
  uncollectible: "uncollectible";
6332
6332
  cancelled: "cancelled";
6333
6333
  }>;
@@ -6338,8 +6338,8 @@ export declare const billingInvoice: z.ZodObject<{
6338
6338
  number: z.ZodString;
6339
6339
  issued_at: z.ZodISODateTime;
6340
6340
  status: z.ZodEnum<{
6341
- paid: "paid";
6342
6341
  open: "open";
6342
+ paid: "paid";
6343
6343
  uncollectible: "uncollectible";
6344
6344
  cancelled: "cancelled";
6345
6345
  }>;
@@ -6641,8 +6641,8 @@ export declare const billingView: z.ZodObject<{
6641
6641
  number: z.ZodString;
6642
6642
  issued_at: z.ZodISODateTime;
6643
6643
  status: z.ZodEnum<{
6644
- paid: "paid";
6645
6644
  open: "open";
6645
+ paid: "paid";
6646
6646
  uncollectible: "uncollectible";
6647
6647
  cancelled: "cancelled";
6648
6648
  }>;
@@ -6705,8 +6705,8 @@ export declare const billingDocumentKind: z.ZodEnum<{
6705
6705
  export type BillingDocumentKind = z.infer<typeof billingDocumentKind>;
6706
6706
  /** A document's own status, read from the Lexware voucher as it stands today. */
6707
6707
  export declare const billingDocumentStatus: z.ZodEnum<{
6708
- paid: "paid";
6709
6708
  open: "open";
6709
+ paid: "paid";
6710
6710
  overdue: "overdue";
6711
6711
  paidoff: "paidoff";
6712
6712
  voided: "voided";
@@ -6744,8 +6744,8 @@ export declare const billingDocument: z.ZodObject<{
6744
6744
  bookkeeping_credit_note: "bookkeeping_credit_note";
6745
6745
  }>;
6746
6746
  status: z.ZodEnum<{
6747
- paid: "paid";
6748
6747
  open: "open";
6748
+ paid: "paid";
6749
6749
  overdue: "overdue";
6750
6750
  paidoff: "paidoff";
6751
6751
  voided: "voided";
@@ -6777,8 +6777,8 @@ export declare const billingDocumentList: z.ZodObject<{
6777
6777
  bookkeeping_credit_note: "bookkeeping_credit_note";
6778
6778
  }>;
6779
6779
  status: z.ZodEnum<{
6780
- paid: "paid";
6781
6780
  open: "open";
6781
+ paid: "paid";
6782
6782
  overdue: "overdue";
6783
6783
  paidoff: "paidoff";
6784
6784
  voided: "voided";
@@ -6814,8 +6814,8 @@ export declare const billingDocumentDetail: z.ZodObject<{
6814
6814
  bookkeeping_credit_note: "bookkeeping_credit_note";
6815
6815
  }>;
6816
6816
  status: z.ZodEnum<{
6817
- paid: "paid";
6818
6817
  open: "open";
6818
+ paid: "paid";
6819
6819
  overdue: "overdue";
6820
6820
  paidoff: "paidoff";
6821
6821
  voided: "voided";
@@ -7066,8 +7066,8 @@ export declare const billingChangeResponse: z.ZodUnion<readonly [z.ZodObject<{
7066
7066
  number: z.ZodString;
7067
7067
  issued_at: z.ZodISODateTime;
7068
7068
  status: z.ZodEnum<{
7069
- paid: "paid";
7070
7069
  open: "open";
7070
+ paid: "paid";
7071
7071
  uncollectible: "uncollectible";
7072
7072
  cancelled: "cancelled";
7073
7073
  }>;
@@ -7118,8 +7118,8 @@ export declare const billingChangeResponse: z.ZodUnion<readonly [z.ZodObject<{
7118
7118
  number: z.ZodString;
7119
7119
  issued_at: z.ZodISODateTime;
7120
7120
  status: z.ZodEnum<{
7121
- paid: "paid";
7122
7121
  open: "open";
7122
+ paid: "paid";
7123
7123
  uncollectible: "uncollectible";
7124
7124
  cancelled: "cancelled";
7125
7125
  }>;
@@ -7253,8 +7253,8 @@ export declare const billingChangeResponse: z.ZodUnion<readonly [z.ZodObject<{
7253
7253
  number: z.ZodString;
7254
7254
  issued_at: z.ZodISODateTime;
7255
7255
  status: z.ZodEnum<{
7256
- paid: "paid";
7257
7256
  open: "open";
7257
+ paid: "paid";
7258
7258
  uncollectible: "uncollectible";
7259
7259
  cancelled: "cancelled";
7260
7260
  }>;
@@ -7572,8 +7572,8 @@ export declare const purchaseIntentResponse: z.ZodUnion<readonly [z.ZodDiscrimin
7572
7572
  number: z.ZodString;
7573
7573
  issued_at: z.ZodISODateTime;
7574
7574
  status: z.ZodEnum<{
7575
- paid: "paid";
7576
7575
  open: "open";
7576
+ paid: "paid";
7577
7577
  uncollectible: "uncollectible";
7578
7578
  cancelled: "cancelled";
7579
7579
  }>;
@@ -7624,8 +7624,8 @@ export declare const purchaseIntentResponse: z.ZodUnion<readonly [z.ZodDiscrimin
7624
7624
  number: z.ZodString;
7625
7625
  issued_at: z.ZodISODateTime;
7626
7626
  status: z.ZodEnum<{
7627
- paid: "paid";
7628
7627
  open: "open";
7628
+ paid: "paid";
7629
7629
  uncollectible: "uncollectible";
7630
7630
  cancelled: "cancelled";
7631
7631
  }>;
@@ -7759,8 +7759,8 @@ export declare const purchaseIntentResponse: z.ZodUnion<readonly [z.ZodDiscrimin
7759
7759
  number: z.ZodString;
7760
7760
  issued_at: z.ZodISODateTime;
7761
7761
  status: z.ZodEnum<{
7762
- paid: "paid";
7763
7762
  open: "open";
7763
+ paid: "paid";
7764
7764
  uncollectible: "uncollectible";
7765
7765
  cancelled: "cancelled";
7766
7766
  }>;
package/dist/errors.d.ts CHANGED
@@ -304,5 +304,5 @@ export type RoleCycleDetails = z.infer<typeof roleCycleDetails>;
304
304
  * list is the shared vocabulary, not a closed set, so a new refusal never
305
305
  * needs a contracts release before it can be reported honestly.
306
306
  */
307
- export declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "bridge_too_old", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "cancel_rejected", "job_lost", "operator_verified_stopped", "job_unknown_to_bridge", "action_server_lost", "action_failed", "goal_rejected", "goal_send_failed", "result_failed", "goal_uncontrollable", "bridge_disconnected", "config_changed", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "role_cycle", "role_key_taken", "confirmation_required", "target_state_conflict", "job_state_conflict", "signup_closed", "draft_not_a_document", "internal_error", "not_cancellable", "unsupported_media_type", "wrong_browser", "invalid_yaml", "unstorable_yaml", "registration_closed", "domain_not_allowed", "email_unverified", "origin_not_allowed", "template_invalid", "provider_disabled", "provider_misconfigured", "invalid_redirect_uri", "interaction_expired", "invalid_code", "method_not_allowed", "plan_limit", "plan_required", "org_locked", "file_too_large", "billing_unavailable", "legal_offer_unavailable", "payment_provider_unavailable", "history_migrating", "billing_documents_unavailable", "support_read_only", "support_forbidden", "logo_draw_unavailable", "record_referenced", "record_changed", "collection_not_found", "collection_removed", "reference_invalid", "required_missing", "robot_not_attached"];
307
+ export declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "bridge_too_old", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "cancel_rejected", "job_lost", "operator_verified_stopped", "job_unknown_to_bridge", "action_server_lost", "action_failed", "goal_rejected", "goal_send_failed", "result_failed", "goal_uncontrollable", "bridge_disconnected", "config_changed", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "role_cycle", "role_key_taken", "confirmation_required", "target_state_conflict", "job_state_conflict", "signup_closed", "draft_not_a_document", "internal_error", "not_cancellable", "unsupported_media_type", "wrong_browser", "invalid_yaml", "unstorable_yaml", "registration_closed", "domain_not_allowed", "email_unverified", "origin_not_allowed", "template_invalid", "provider_disabled", "provider_misconfigured", "invalid_redirect_uri", "interaction_expired", "invalid_code", "method_not_allowed", "plan_limit", "plan_required", "org_locked", "file_too_large", "billing_unavailable", "legal_offer_unavailable", "payment_provider_unavailable", "history_migrating", "billing_documents_unavailable", "support_read_only", "support_forbidden", "logo_draw_unavailable", "plan_purchase_closed", "record_referenced", "record_changed", "collection_not_found", "collection_removed", "reference_invalid", "required_missing", "robot_not_attached"];
308
308
  export type ErrorCode = (typeof ERROR_CODES)[number];
package/dist/errors.js CHANGED
@@ -1230,6 +1230,19 @@ export const ERROR_CODES = [
1230
1230
  * that threw something unmapped.
1231
1231
  */
1232
1232
  'logo_draw_unavailable',
1233
+ // 2026-11-17 — open beta (fleetless/fleetless#1163). Before the collections,
1234
+ // whose codes a test holds to be the last of the list.
1235
+ /**
1236
+ * `403`: this cloud sells paid plans only to organizations Fleetless has
1237
+ * unlocked for them, and this one is not unlocked. Answered by the routes
1238
+ * that start, display or confirm a paid purchase or a paid change, and by a
1239
+ * plan change whose target is not Basic. Not `forbidden`: nothing about the
1240
+ * caller's role is refused, the Owner of this organization gets the same
1241
+ * answer. The message names the address to write to. `GET /api/org/plan`
1242
+ * says it in advance: `paid_plans` is `closed` exactly when these routes
1243
+ * answer this. Retrying does not help until the organization is unlocked.
1244
+ */
1245
+ 'plan_purchase_closed',
1233
1246
  // 2026-11-04 — app collections.
1234
1247
  /**
1235
1248
  * `409`: the record cannot be deleted, or an import cannot delete it,
@@ -28,8 +28,8 @@ export declare const legalOfferSummary: z.ZodDiscriminatedUnion<[z.ZodObject<{
28
28
  id: z.ZodUUID;
29
29
  revision: z.ZodUUID;
30
30
  decision_state: z.ZodEnum<{
31
- accepted: "accepted";
32
31
  open: "open";
32
+ accepted: "accepted";
33
33
  declined: "declined";
34
34
  withdrawn: "withdrawn";
35
35
  }>;
@@ -60,8 +60,8 @@ export declare const legalOfferSummary: z.ZodDiscriminatedUnion<[z.ZodObject<{
60
60
  id: z.ZodUUID;
61
61
  revision: z.ZodUUID;
62
62
  decision_state: z.ZodEnum<{
63
- accepted: "accepted";
64
63
  open: "open";
64
+ accepted: "accepted";
65
65
  declined: "declined";
66
66
  withdrawn: "withdrawn";
67
67
  }>;
@@ -93,8 +93,8 @@ export declare const legalOfferListResponse: z.ZodObject<{
93
93
  id: z.ZodUUID;
94
94
  revision: z.ZodUUID;
95
95
  decision_state: z.ZodEnum<{
96
- accepted: "accepted";
97
96
  open: "open";
97
+ accepted: "accepted";
98
98
  declined: "declined";
99
99
  withdrawn: "withdrawn";
100
100
  }>;
@@ -125,8 +125,8 @@ export declare const legalOfferListResponse: z.ZodObject<{
125
125
  id: z.ZodUUID;
126
126
  revision: z.ZodUUID;
127
127
  decision_state: z.ZodEnum<{
128
- accepted: "accepted";
129
128
  open: "open";
129
+ accepted: "accepted";
130
130
  declined: "declined";
131
131
  withdrawn: "withdrawn";
132
132
  }>;
package/dist/plans.d.ts CHANGED
@@ -427,6 +427,10 @@ export declare const orgPlan: z.ZodObject<{
427
427
  at: z.ZodNullable<z.ZodISODateTime>;
428
428
  needs_choice: z.ZodBoolean;
429
429
  }, z.core.$strip>>;
430
+ paid_plans: z.ZodEnum<{
431
+ open: "open";
432
+ closed: "closed";
433
+ }>;
430
434
  }, z.core.$strip>;
431
435
  export type OrgPlan = z.infer<typeof orgPlan>;
432
436
  /**
@@ -577,6 +581,10 @@ export declare const planChangeDecisionStatusResponse: z.ZodDiscriminatedUnion<[
577
581
  at: z.ZodNullable<z.ZodISODateTime>;
578
582
  needs_choice: z.ZodBoolean;
579
583
  }, z.core.$strip>>;
584
+ paid_plans: z.ZodEnum<{
585
+ open: "open";
586
+ closed: "closed";
587
+ }>;
580
588
  }, z.core.$strip>;
581
589
  }, z.core.$strict>], "state">;
582
590
  export type PlanChangeDecisionStatusResponse = z.infer<typeof planChangeDecisionStatusResponse>;
package/dist/plans.js CHANGED
@@ -458,6 +458,11 @@ export const orgPlan = z.object({
458
458
  })
459
459
  .nullable()
460
460
  .meta({ description: 'Set only while the org is still on the beta; `null` for every other org.' }),
461
+ paid_plans: z.enum(['open', 'closed']).meta({
462
+ description: 'Whether this org may buy a paid plan. `open` when this cloud sells paid plans to every org, or Fleetless has unlocked this ' +
463
+ 'one; `closed` otherwise, and then starting, displaying or confirming a purchase or a paid change, and a plan change to ' +
464
+ 'anything but Basic, answer `403 plan_purchase_closed`. The plans and their prices stay readable either way.',
465
+ }),
461
466
  });
462
467
  /**
463
468
  * What a developer may ask for on `PUT /api/org/plan/change` — **a downward
package/dist/routes.js CHANGED
@@ -3111,7 +3111,7 @@ export const ROUTES = [
3111
3111
  summary: 'Prepares a nonbinding downward-plan decision and its C.4 display.',
3112
3112
  audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
3113
3113
  params: [], query: null, request: planChangePrepareRequest, response: planChangePrepareResponse,
3114
- errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict'], transport: 'http',
3114
+ errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', 'plan_purchase_closed'], transport: 'http',
3115
3115
  notes: 'Owner only. Persists a prepared change reference and a short-lived display, without mutating the plan, pending_change, or legal acceptance. A same-key, same-input retry while undecided returns the same change_id with a fresh display. A Basic cancellation reason belongs only in the final PUT.',
3116
3116
  },
3117
3117
  {
@@ -3119,7 +3119,7 @@ export const ROUTES = [
3119
3119
  summary: "Confirms a prepared downward-plan decision with its C.4 proof.",
3120
3120
  audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
3121
3121
  params: [], query: null, request: planChangeRequest, response: orgPlan,
3122
- errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict'], transport: 'http',
3122
+ errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', 'plan_purchase_closed'], transport: 'http',
3123
3123
  notes: 'Owner tier, and **downward only**: a prior prepare returns change_id and a displayed snapshot; this final PUT requires its confirmation_proof and the same operation_key, target_plan and keep. Only Basic permits cancellation_reason (at most 500 input characters). The reason is final idempotency metadata, not price or legal evidence. An exact replay returns the original result; a changed reason with the same key conflicts before effect. The decision and legal acceptance commit together. This route moves the org to a lower plan or cancels it outright to Basic. It never moves the org ' +
3124
3124
  'up — an upgrade or an add-on goes through the billing routes instead (`POST /api/billing/checkout`, `POST /api/billing/change`). ' +
3125
3125
  '`409 target_state_conflict` names `target_plan` with rule `not_lower` when the ' +
@@ -3190,14 +3190,18 @@ export const ROUTES = [
3190
3190
  notes: '`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that ' +
3191
3191
  'charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; plan-change prepare, resume, the details and the ' +
3192
3192
  'VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan ' +
3193
- 'and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here.',
3193
+ 'and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here. ' +
3194
+ 'Where this cloud sells paid plans only to organizations Fleetless has unlocked, an org that is not unlocked reads ' +
3195
+ '`paid_plans: closed` there, and checkout, the decision display and confirm, `POST /api/billing/change`, and a plan-change ' +
3196
+ 'prepare or final PUT whose target is not Basic answer `403 plan_purchase_closed`; this read, the checkout poll, cancel, ' +
3197
+ 'resume, the details, the payment method, invoices and charges, the documents and a Basic target are never refused by it.',
3194
3198
  },
3195
3199
  {
3196
3200
  method: 'POST', path: '/api/billing/checkout', section: 'billing',
3197
3201
  summary: "Records a company purchase intent for the first paid plan.",
3198
3202
  audience: 'developer', auth: 'developer', rateLimited: true, ownerTier: true, status: 201,
3199
3203
  params: [], query: null, request: checkoutRequest, response: checkoutResponse,
3200
- errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
3204
+ errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', 'rate_limited', 'plan_purchase_closed', ...BILLING_OFF, ...MOLLIE],
3201
3205
  transport: 'http',
3202
3206
  notes: "Basic stays free for every payer. This start creates only a nonbinding draft; accept_terms is deprecated and cannot confirm an order. Current company, buyer, VIES and EUR quote checks still apply. Persist operation_key before POST; the same key and input return 200 with the existing intent (and its hosted checkout when payment_started), without another Mollie payment; changed input conflicts. A different operation_key while a first payment is open returns 409 target_state_conflict with rule checkout_open and details expires_at: null. An eligible Owner obtains a no-store C.4 display, then explicitly confirms with its proof. No payment or acceptance occurs at start. Hosted payment later offers card, PayPal or Apple Pay; its return is <console>/settings/billing?checkout=<checkout_id>. An active/past_due account uses billing/change.",
3203
3207
  },
@@ -3215,7 +3219,7 @@ export const ROUTES = [
3215
3219
  audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
3216
3220
  params: [{ name: 'id', description: 'The eligible intent ID returned by checkout or billing change.' }],
3217
3221
  query: null, request: billingDecisionDisplayRequest, response: billingDecisionDisplayResponse,
3218
- errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict'], transport: 'http',
3222
+ errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict', 'plan_purchase_closed'], transport: 'http',
3219
3223
  notes: 'Owner only, Cache-Control: no-store. Cloud persists the snapshot and proof hash for an eligible current checkout or paid-change intent of this Owner and org. Pending, held, refused or accepted intents cannot mint a new proof. The proof never appears in lookup, billing views or logs.',
3220
3224
  },
3221
3225
  {
@@ -3224,7 +3228,7 @@ export const ROUTES = [
3224
3228
  audience: 'developer', auth: 'developer', rateLimited: true, ownerTier: true, status: 200,
3225
3229
  params: [{ name: 'id', description: 'The intent ID returned by the start or lookup response.' }],
3226
3230
  query: null, request: purchaseIntentConfirmRequest, response: purchaseIntentResponse,
3227
- errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict', 'plan_limit', 'rate_limited', ...BILLING_OFF, ...MOLLIE], transport: 'http',
3231
+ errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict', 'plan_limit', 'rate_limited', 'plan_purchase_closed', ...BILLING_OFF, ...MOLLIE], transport: 'http',
3228
3232
  notes: 'Checkout and paid-change decisions require confirmation_proof along with the operation key, quote revision and buyer fingerprint shown in the persisted C.4 display. Cloud rechecks buyer, quote, selection, legal references, period and current state under the org lock; stale or spent proof conflicts without effect. One decision and one legal acceptance commit together. An exact same-key replay returns the original result without another payment or acceptance. A paid change can return 409 target_state_conflict with field billing and rule charge_in_progress while an earlier charge is unresolved; it does not start another charge. Foreign ownership answers 404 without disclosure; pending or held cannot charge.',
3229
3233
  },
3230
3234
  {
@@ -3260,7 +3264,7 @@ export const ROUTES = [
3260
3264
  summary: "Records a nonbinding paid-change intent for a plan, cycle or add-on target.",
3261
3265
  audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
3262
3266
  params: [], query: null, request: billingChangeRequest, response: billingChangeResponse,
3263
- errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', ...BILLING_OFF, ...MOLLIE],
3267
+ errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', 'plan_purchase_closed', ...BILLING_OFF, ...MOLLIE],
3264
3268
  transport: 'http',
3265
3269
  notes: "The request names an absolute plan/cycle/add-on target and a stable operation_key. Start is nonbinding for every change, including zero-charge, scheduled and formerly immediate decreases: it neither changes the plan nor writes legal acceptance. An eligible Owner obtains a C.4 display and explicitly confirms with its proof. Confirmation may return accepted_no_payment with charged: null and no provider payment or redirect, or payment_started for a charged change. Exact-key lookup recovers the accepted result. Existing no_account, past_due, no_valid_mandate and plan_limit conflicts remain. A later paid-change confirmation can return 409 target_state_conflict with field billing and rule charge_in_progress while an earlier charge is unresolved; no second charge starts.",
3266
3270
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetless/contracts",
3
- "version": "15.5.0-next.2",
3
+ "version": "15.6.0-next.1",
4
4
  "description": "Fleetless wire contracts: the bridge-cloud protocol, the REST API schemas and the error codes, as zod schemas with generated JSON Schema and OpenAPI artifacts.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Dehne Robotik GmbH",