@orangecharts/wrun-chart-host 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/README.md +2 -0
  2. package/dist/constants/feature-flags.constants.d.ts +15 -1
  3. package/dist/constants/feature-flags.constants.js +130 -24
  4. package/dist/constants/governed-exchanges.constants.d.ts +12 -0
  5. package/dist/constants/governed-exchanges.constants.js +16 -0
  6. package/dist/constants/opra-compliance.constants.d.ts +3 -2
  7. package/dist/constants/opra-compliance.constants.js +3 -2
  8. package/dist/constants/option-venues.constants.d.ts +2 -2
  9. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
  10. package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
  11. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
  12. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
  13. package/dist/constants/venue-presets.constants.d.ts +20 -20
  14. package/dist/constants/venue-presets.constants.js +24 -26
  15. package/dist/host-env.d.ts +21 -5
  16. package/dist/host-env.js +6 -0
  17. package/dist/host-ports.types.d.ts +102 -19
  18. package/dist/index.d.ts +18 -0
  19. package/dist/index.js +18 -0
  20. package/dist/interfaces/cancel-reason.interface.d.ts +1 -1
  21. package/dist/interfaces/cme-realtime.interface.d.ts +16 -9
  22. package/dist/interfaces/cme-realtime.interface.js +6 -3
  23. package/dist/interfaces/kscript-diagnostics.interface.d.ts +12 -0
  24. package/dist/interfaces/opra-realtime.interface.d.ts +1 -5
  25. package/dist/interfaces/prediction-market.interface.d.ts +7 -0
  26. package/dist/interfaces/replay.interface.d.ts +8 -0
  27. package/dist/interfaces/stocks-realtime.interface.d.ts +57 -0
  28. package/dist/interfaces/stocks-realtime.interface.js +32 -0
  29. package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
  30. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +62 -94
  31. package/dist/kscript-data/controls/live-trades-merge.util.js +106 -171
  32. package/dist/market-data/billing.interface.d.ts +174 -36
  33. package/dist/market-data/billing.interface.js +58 -8
  34. package/dist/market-data/venue.d.ts +152 -7
  35. package/dist/market-data/venues/cme.contract.copy.json +66 -0
  36. package/dist/market-data/venues/cme.d.ts +126 -0
  37. package/dist/market-data/venues/cme.js +133 -0
  38. package/dist/market-data/venues/index.d.ts +294 -7
  39. package/dist/market-data/venues/index.js +49 -6
  40. package/dist/market-data/venues/opra.contract.copy.json +3 -2
  41. package/dist/market-data/venues/opra.d.ts +2 -2
  42. package/dist/market-data/venues/opra.js +5 -2
  43. package/dist/market-data/venues/stocks.contract.copy.json +64 -0
  44. package/dist/market-data/venues/stocks.d.ts +130 -0
  45. package/dist/market-data/venues/stocks.js +117 -0
  46. package/dist/settings-templates/footprint-rows.js +35 -2
  47. package/dist/settings-templates/form-rows.d.ts +2 -1
  48. package/dist/settings-templates/index.js +7 -3
  49. package/dist/settings-templates/indicator-fields.d.ts +5 -4
  50. package/dist/settings-templates/indicator-fields.js +79 -10
  51. package/dist/settings-templates/tool-rules.d.ts +32 -15
  52. package/dist/settings-templates/tool-rules.js +33 -11
  53. package/dist/settings-templates/tool-tables.generated.js +95 -31
  54. package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
  55. package/dist/utility/chart/book-live-bucket.util.js +47 -0
  56. package/dist/utility/chart/cme-cache-context.util.d.ts +5 -3
  57. package/dist/utility/chart/cme-cache-context.util.js +10 -6
  58. package/dist/utility/chart/cme-realtime.util.js +10 -0
  59. package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +83 -0
  60. package/dist/utility/chart/cme-user-scripts-gate.util.js +142 -0
  61. package/dist/utility/chart/effective-chart-session.util.d.ts +14 -0
  62. package/dist/utility/chart/effective-chart-session.util.js +39 -0
  63. package/dist/utility/chart/host-bar-placement.util.d.ts +28 -0
  64. package/dist/utility/chart/host-bar-placement.util.js +170 -30
  65. package/dist/utility/chart/index-host-tier.util.d.ts +3 -1
  66. package/dist/utility/chart/index-host-tier.util.js +7 -2
  67. package/dist/utility/chart/index-mode-admission.util.js +30 -3
  68. package/dist/utility/chart/kscript-apply-fingerprint.util.js +1 -1
  69. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
  70. package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
  71. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +9 -7
  72. package/dist/utility/chart/kscript-live-coalesce.util.js +13 -8
  73. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +9 -0
  74. package/dist/utility/chart/kscript-live-source-identity.util.js +10 -1
  75. package/dist/utility/chart/kscript-provenance-keys.util.js +13 -0
  76. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +5 -1
  77. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
  78. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
  79. package/dist/utility/chart/kscript-venue-policy.util.d.ts +156 -43
  80. package/dist/utility/chart/kscript-venue-policy.util.js +249 -59
  81. package/dist/utility/chart/live-bucket.util.d.ts +24 -8
  82. package/dist/utility/chart/live-bucket.util.js +85 -27
  83. package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
  84. package/dist/utility/chart/market-session-schedule.util.js +16 -0
  85. package/dist/utility/chart/marketKind.util.js +5 -0
  86. package/dist/utility/chart/mixed-mode.util.d.ts +7 -0
  87. package/dist/utility/chart/mixed-mode.util.js +14 -0
  88. package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
  89. package/dist/utility/chart/opra-read-access.leaf.js +5 -3
  90. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +11 -16
  91. package/dist/utility/chart/opra-user-scripts-gate.util.js +12 -28
  92. package/dist/utility/chart/rth-session.util.d.ts +12 -10
  93. package/dist/utility/chart/rth-session.util.js +25 -21
  94. package/dist/utility/chart/trading-day.util.d.ts +17 -0
  95. package/dist/utility/chart/trading-day.util.js +59 -0
  96. package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
  97. package/dist/utility/chart/window-geometry.leaf.js +22 -6
  98. package/dist/utility/chart/window-owner.leaf.d.ts +23 -2
  99. package/dist/utility/chart/window-owner.leaf.js +45 -3
  100. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +33 -15
  101. package/dist/utility/chart/wrun-bar-session-facts.util.js +70 -20
  102. package/dist/utility/chart/wrun-run-result.util.d.ts +12 -0
  103. package/dist/utility/chart/wrun-run-result.util.js +141 -6
  104. package/dist/utility/intl-locale.util.js +5 -0
  105. package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
  106. package/dist/utility/options/option-bar-anchor.util.js +340 -0
  107. package/dist/utility/options/option-venue.util.d.ts +18 -0
  108. package/dist/utility/options/option-venue.util.js +27 -0
  109. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +4 -0
  110. package/dist/utility/v2/gate-plane.util.d.ts +12 -3
  111. package/dist/utility/v2/gate-plane.util.js +30 -4
  112. package/dist/utility/v2/gate-session-latch.util.js +1 -1
  113. package/dist/utility/v2/stocks-governed.util.d.ts +16 -0
  114. package/dist/utility/v2/stocks-governed.util.js +34 -0
  115. package/dist/utility/wrun/derived-roots.leaf.d.ts +13 -0
  116. package/dist/utility/wrun/derived-roots.leaf.js +27 -0
  117. package/dist/utility/wrun/derived-roots.util.d.ts +205 -0
  118. package/dist/utility/wrun/derived-roots.util.js +451 -0
  119. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +43 -7
  120. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
  121. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
  122. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
  123. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -2
  124. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -2
  125. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +24 -3
  126. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +46 -10
  127. package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
  128. package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
  129. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
  130. package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
  131. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
  132. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +2 -1
  133. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +3 -0
  134. package/dist/utility/wrun/sources/row-lanes/option_prints.js +19 -4
  135. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
  136. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +52 -13
  137. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +88 -19
  138. package/dist/utility/wrun/sources/row-lanes/option_surface.js +2 -1
  139. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
  140. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +24 -9
  141. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +41 -10
  142. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +111 -0
  143. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +133 -0
  144. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +15 -3
  145. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +22 -3
  146. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -0
  147. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +197 -13
  148. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +761 -27
  149. package/dist/utility/wrun/wrun-browser-sources.leaf.js +1 -2
  150. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
  151. package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
  152. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +60 -16
  153. package/dist/utility/wrun/wrun-chart-market-facts.util.js +113 -61
  154. package/dist/utility/wrun/wrun-color-settings.util.d.ts +9 -0
  155. package/dist/utility/wrun/wrun-color-settings.util.js +33 -0
  156. package/dist/utility/wrun/wrun-download-meter.util.d.ts +15 -0
  157. package/dist/utility/wrun/wrun-download-meter.util.js +14 -2
  158. package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
  159. package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
  160. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
  161. package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
  162. package/dist/utility/wrun/wrun-frames.d.ts +27 -6
  163. package/dist/utility/wrun/wrun-frames.js +73 -10
  164. package/dist/utility/wrun/wrun-handles.util.d.ts +7 -3
  165. package/dist/utility/wrun/wrun-handles.util.js +9 -8
  166. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
  167. package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
  168. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +18 -4
  169. package/dist/utility/wrun/wrun-hud-looks.util.js +45 -13
  170. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +68 -0
  171. package/dist/utility/wrun/wrun-input-requirements.leaf.js +163 -7
  172. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
  173. package/dist/utility/wrun/wrun-leg-close.util.d.ts +59 -23
  174. package/dist/utility/wrun/wrun-leg-close.util.js +186 -28
  175. package/dist/utility/wrun/wrun-live-intake.util.d.ts +35 -15
  176. package/dist/utility/wrun/wrun-live-intake.util.js +243 -126
  177. package/dist/utility/wrun/wrun-live-tick.util.d.ts +13 -5
  178. package/dist/utility/wrun/wrun-live-tick.util.js +279 -99
  179. package/dist/utility/wrun/wrun-market-facts.util.d.ts +13 -3
  180. package/dist/utility/wrun/wrun-market-facts.util.js +13 -3
  181. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +60 -11
  182. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +70 -5
  183. package/dist/utility/wrun/wrun-market-size-defaults.util.js +31 -5
  184. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
  185. package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
  186. package/dist/utility/wrun/wrun-option-book-rows.util.d.ts +56 -0
  187. package/dist/utility/wrun/wrun-option-book-rows.util.js +96 -0
  188. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
  189. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
  190. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +23 -6
  191. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +47 -11
  192. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +86 -19
  193. package/dist/utility/wrun/wrun-option-strike-flow.util.js +168 -62
  194. package/dist/utility/wrun/wrun-option-views.util.d.ts +323 -28
  195. package/dist/utility/wrun/wrun-option-views.util.js +484 -71
  196. package/dist/utility/wrun/wrun-options-chain.util.d.ts +3 -3
  197. package/dist/utility/wrun/wrun-options-chain.util.js +2 -0
  198. package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
  199. package/dist/utility/wrun/wrun-output-style.util.js +20 -2
  200. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +32 -2
  201. package/dist/utility/wrun/wrun-overlay-drivers.util.js +13 -3
  202. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
  203. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
  204. package/dist/utility/wrun/wrun-overlay-recovery.util.js +3 -1
  205. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +160 -42
  206. package/dist/utility/wrun/wrun-overlay-run.util.js +1244 -209
  207. package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
  208. package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
  209. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
  210. package/dist/utility/wrun/wrun-panel-mount.util.js +114 -19
  211. package/dist/utility/wrun/wrun-panel-style.util.d.ts +10 -9
  212. package/dist/utility/wrun/wrun-panel-style.util.js +58 -9
  213. package/dist/utility/wrun/wrun-param-map.util.d.ts +14 -11
  214. package/dist/utility/wrun/wrun-param-map.util.js +10 -5
  215. package/dist/utility/wrun/wrun-param-values.util.d.ts +14 -4
  216. package/dist/utility/wrun/wrun-param-values.util.js +4 -0
  217. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +15 -2
  218. package/dist/utility/wrun/wrun-pin-spelling.util.js +39 -14
  219. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
  220. package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
  221. package/dist/utility/wrun/wrun-refusal.util.d.ts +3 -2
  222. package/dist/utility/wrun/wrun-refusal.util.js +22 -0
  223. package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
  224. package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
  225. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +26 -0
  226. package/dist/utility/wrun/wrun-registry-errors.util.js +34 -0
  227. package/dist/utility/wrun/wrun-replay-lane.util.js +3 -2
  228. package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
  229. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +20 -6
  230. package/dist/utility/wrun/wrun-run-interval-session.util.js +22 -7
  231. package/dist/utility/wrun/wrun-run-interval.util.d.ts +43 -9
  232. package/dist/utility/wrun/wrun-run-interval.util.js +58 -15
  233. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +45 -1
  234. package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
  235. package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
  236. package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
  237. package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
  238. package/dist/utility/wrun/wrun-socket-row-source.js +118 -8
  239. package/dist/utility/wrun/wrun-source-rows.util.d.ts +29 -18
  240. package/dist/utility/wrun/wrun-source-rows.util.js +61 -27
  241. package/dist/utility/wrun/wrun-style-words.util.js +6 -4
  242. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
  243. package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
  244. package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
  245. package/dist/utility/wrun/wrun-tape-per-order.util.js +7 -0
  246. package/dist/utility/wrun/wrun-tape-source.util.d.ts +17 -9
  247. package/dist/utility/wrun/wrun-tape-source.util.js +20 -12
  248. package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
  249. package/dist/utils/replay/replay-buffer-math.js +227 -20
  250. package/dist/workers/constants/socket-slots.d.ts +91 -6
  251. package/dist/workers/constants/socket-slots.js +85 -6
  252. package/package.json +5 -5
@@ -6,17 +6,27 @@
6
6
  * place (src/services/market-data.service.ts). Nothing here names a venue. Worker-safe: types, one error class and pure
7
7
  * helpers.
8
8
  *
9
- * Differences from CME are deliberate: one product per venue, no depth, a professional declaration refused (recorded,
10
- * never re-priced), an EXPLICIT agreement acceptance (never inferred from a grant or a subscription), and pay first:
11
- * the declaration and the agreement bind real-time ACCESS, not the payment, so checkout needs neither and the server
12
- * serves real-time only once the account is both paid and qualified (delayed otherwise).
9
+ * OPRA's card is the base shape: one product per venue, no depth, a professional declaration refused (recorded, never
10
+ * re-priced), an EXPLICIT agreement acceptance (never inferred from a grant or a subscription), and pay first: the
11
+ * declaration and the agreement bind real-time ACCESS, not the payment, so checkout needs neither and the server
12
+ * serves real-time only once the account is both paid and qualified (delayed otherwise). A card may ask for CME's
13
+ * policies instead (docs/features/market-data/plane.md, "CME on the plane"): several products in level order, a
14
+ * checkout and an in-place plan change that name the product (`level`), professionals sold, the declaration first,
15
+ * and the data terms recorded as the registration the venue's wall makes; the wire additions below are optional, and a
16
+ * server that sends none of them reads exactly as before.
13
17
  *
14
18
  * The agreement itself is the server's (contracts K1 and K2 of the OPRA compliance round): `GET <basePath>/agreement`
15
19
  * serves the complete populated text with its version and hash, the acceptance names that version and both hashes,
16
20
  * and an acceptance counts only for the version the server presents now, never for a version a build carries.
21
+ *
22
+ * A card that lists several agreements (`agreements`, US stocks: one per set of product groups) speaks the per-agreement
23
+ * routes instead (docs/features/market-data/plane.md, "Agreements per product group"): `GET <basePath>/agreements/<id>`
24
+ * serves each in K1's shape, `POST <basePath>/agreements/<id>/accept { version, sha256 }` records an assent, and the
25
+ * declaration on file carries every assent it holds (`assents`, by agreement id). Real time on a product group needs
26
+ * the assent to the agreement covering it, at the version the server presents now.
17
27
  */
18
28
  import type { CancelFeedback } from '../interfaces/cancel-reason.interface.js';
19
- import type { MarketDataBillingInterval, MarketDataClassification, MarketDataVenue } from './venue.js';
29
+ import type { MarketDataBillingInterval, MarketDataClassification, MarketDataListedAgreement, MarketDataProduct, MarketDataVenue } from './venue.js';
20
30
  /**
21
31
  * POST <basePath>/attestation request body (201 for both classifications). The server derives the classification from
22
32
  * `answers` and refuses a body whose `classification` disagrees, so the client sends the one
@@ -47,16 +57,41 @@ export interface MarketDataAttestationRecordDto {
47
57
  * shown to be inside its year.
48
58
  */
49
59
  expiresAt?: string;
60
+ /**
61
+ * A venue that lists several agreements (`agreements`): the assents this declaration holds, by agreement id, each the
62
+ * version assented to and when. An assent rides the declaration it was made on: a new declaration starts with none.
63
+ * Absent on every other venue's record.
64
+ */
65
+ assents?: Record<string, MarketDataAgreementAssentDto>;
66
+ }
67
+ /** One assent a declaration holds (`assents[<agreement id>]`): the agreement version assented to, and when (ISO). */
68
+ export interface MarketDataAgreementAssentDto {
69
+ version: string;
70
+ acceptedAt: string;
50
71
  }
51
72
  /** GET <basePath>/attestation -> 200 body. */
52
73
  export interface GetMarketDataAttestationResponseDto {
53
74
  attestation: MarketDataAttestationRecordDto | null;
54
75
  }
55
- /** POST <basePath>/checkout request body. */
76
+ /** POST <basePath>/checkout request body of a one-product venue (OPRA): the interval of its one plan. */
56
77
  export interface MarketDataCheckoutDto {
57
78
  interval: MarketDataBillingInterval;
58
79
  locale?: string;
59
80
  }
81
+ /**
82
+ * POST <basePath>/checkout request body of a venue that sells several products (CME, contract KB2): the product
83
+ * picked, by its key (`level`), and the Stripe page's language. The service adds the desktop app's `client` marker on
84
+ * the wire (the checkout then returns to the desktop return page).
85
+ */
86
+ export interface MarketDataProductCheckoutDto {
87
+ level: string;
88
+ /** The Stripe page's language; the service sends the app's when absent. */
89
+ locale?: string;
90
+ }
91
+ /** POST <basePath>/subscription/change-plan request body (contract KB2): the product the subscription moves to. */
92
+ export interface MarketDataChangePlanDto {
93
+ level: string;
94
+ }
60
95
  /**
61
96
  * POST <basePath>/checkout -> 200: a Stripe redirect, or a refusal. 'professional_unavailable' is terminal (the UI
62
97
  * shows "not available"). 'review_held' and 'review_withdrawn': a review of the account's answers only an operator
@@ -97,6 +132,12 @@ export interface MarketDataReviewConfirmDto {
97
132
  * not completed the subscriber questions and the agreement.
98
133
  */
99
134
  export type MarketDataSubscriptionHold = 'unqualified';
135
+ /** A downgrade the subscription carries to its period end (contract KB2): the product it moves to, and when. */
136
+ export interface MarketDataPendingDowngrade {
137
+ level: string;
138
+ /** ISO timestamp the downgrade takes effect (the current period end). */
139
+ at: string;
140
+ }
100
141
  /** Subscription as served by GET <basePath>/subscription. */
101
142
  export interface MarketDataSubscriptionDto {
102
143
  interval: MarketDataBillingInterval;
@@ -111,11 +152,31 @@ export interface MarketDataSubscriptionDto {
111
152
  * subscriber's own cancel or none: completing the status never reverses that cancel.
112
153
  */
113
154
  hold: MarketDataSubscriptionHold | null;
155
+ /** The product held now (its key; still the higher one while a downgrade is pending). A multi-product venue only. */
156
+ level?: string;
157
+ /** A downgrade scheduled for the period end, or null. A multi-product venue only. */
158
+ pendingDowngrade?: MarketDataPendingDowngrade | null;
159
+ /** The Stripe payment method the subscription charges, or null. Additive (a multi-product venue's DTO names it). */
160
+ paymentMethodId?: string | null;
161
+ }
162
+ /** `grant.steps`: the declaration and the agreement the release waits on, as orange judges the records now. */
163
+ export interface MarketDataOperatorGrantStepsDto {
164
+ declaration: 'current' | 'missing' | 'lapsed';
165
+ agreement: 'accepted' | 'missing' | 'superseded';
166
+ }
167
+ /** `grant`: an operator's real-time grant on the account (orange's `OperatorGrantDto`), null without one. */
168
+ export interface MarketDataOperatorGrantDto {
169
+ plan: string;
170
+ purpose: string;
171
+ endsAt: string | null;
172
+ steps: MarketDataOperatorGrantStepsDto;
114
173
  }
115
174
  export interface GetMarketDataSubscriptionResponseDto {
116
175
  subscription: MarketDataSubscriptionDto | null;
117
176
  /** Additive (a server from before the review answers none). */
118
177
  review?: MarketDataReviewDto | null;
178
+ /** Additive (a server from before operator grants on the answer answers none). */
179
+ grant?: MarketDataOperatorGrantDto | null;
119
180
  }
120
181
  /**
121
182
  * GET <basePath>/data-terms -> 200; POST <basePath>/data-terms -> 201. Acceptance is an explicit record of the
@@ -131,15 +192,37 @@ export interface MarketDataAttestationWithdrawal {
131
192
  subscriptionCancelled: boolean;
132
193
  refunded: boolean;
133
194
  }
134
- /** POST <basePath>/attestation -> 201 body; `withdrawal` only for a professional declaration. */
195
+ /**
196
+ * POST <basePath>/attestation -> 201 body; `withdrawal` only for a professional declaration a refusing venue recorded.
197
+ * `offer` (a venue that sells professionals, plan 12.6 A11): the declaration changed a live subscriber from
198
+ * non-professional to professional, so the server cancelled the subscription at once (no refund of the period) and
199
+ * offers the product the new classification may hold, by its key (CME: `depth_pro`).
200
+ */
135
201
  export interface SubmitMarketDataAttestationResponseDto {
136
202
  attestationId: number;
137
203
  withdrawal?: MarketDataAttestationWithdrawal;
204
+ offer?: string;
138
205
  }
139
- /** The submit's answer in the domain: the record id, and what a professional declaration withdrew (else null). */
206
+ /**
207
+ * The submit's answer in the domain: the record id, what a professional declaration withdrew (else null), and the
208
+ * product a classification change offers (present only when the server named one).
209
+ */
140
210
  export interface MarketDataAttestationSubmitResult {
141
211
  attestationId: number;
142
212
  withdrawal: MarketDataAttestationWithdrawal | null;
213
+ offer?: string;
214
+ }
215
+ /**
216
+ * A postal address as a declaration records it inside its answers (`questionnaire.postalAddress.answerId`; CME's
217
+ * `postal_address`): the optional lines left out, never sent empty, and the ISO 3166-1 alpha-2 country.
218
+ */
219
+ export interface MarketDataPostalAddress {
220
+ line1: string;
221
+ line2?: string;
222
+ city: string;
223
+ region?: string;
224
+ postalCode: string;
225
+ country: string;
143
226
  }
144
227
  /**
145
228
  * GET <basePath>/agreement -> 200 (signed in, any tier), contract K1: the subscriber agreement the server presents now.
@@ -201,29 +284,39 @@ export interface AcceptMarketDataDataTermsDto {
201
284
  displayedTextSha256: string;
202
285
  representations: MarketDataAgreementRepresentations;
203
286
  }
204
- /** POST <basePath>/subscription/cancel and DELETE <basePath>/subscription/cancel -> 200 body. */
205
- export interface MarketDataCancelResponseDto {
206
- message?: string;
207
- }
208
287
  /**
209
- * POST <basePath>/register (no body) -> 201 body, sent only once the gate confirmed the free registration (delayed
210
- * data); 403 for a suspended account. Idempotent on the server.
288
+ * POST <basePath>/agreements/<id>/accept request body (a venue that lists several agreements): the version of the
289
+ * agreement the subscriber was shown (its text route's answer) and `sha256`, the browser's own SHA-256 of the exact text
290
+ * it displayed (SubtleCrypto). The server records the assent on the account's current declaration only when the version
291
+ * is the one it presents for that agreement and the hash equals that version's (else 409 `<VENUE>_AGREEMENT_STALE`),
292
+ * the declaration is a current non-professional one (else 409 `<VENUE>_ATTESTATION_REQUIRED`) and the email is verified
293
+ * (else 403 `<VENUE>_EMAIL_UNVERIFIED`); an id the venue does not have answers 404.
211
294
  */
212
- export interface MarketDataRegisterResponseDto {
213
- registered: boolean;
295
+ export interface AcceptMarketDataListedAgreementDto {
296
+ version: string;
297
+ sha256: string;
214
298
  }
215
- /** The register's answer in the domain: it resolves only on the confirmed registration (anything else throws). */
216
- export interface MarketDataRegistration {
217
- registered: true;
299
+ /** POST <basePath>/agreements/<id>/accept -> 201 body: the assent recorded. */
300
+ export interface AcceptMarketDataListedAgreementResponseDto {
301
+ agreementId: string;
302
+ version: string;
303
+ acceptedAt: string;
304
+ }
305
+ /** POST <basePath>/subscription/cancel and DELETE <basePath>/subscription/cancel -> 200 body. */
306
+ export interface MarketDataCancelResponseDto {
307
+ message?: string;
218
308
  }
219
309
  export type MarketDataAttestation = MarketDataAttestationRecordDto;
220
310
  export type MarketDataSubscription = MarketDataSubscriptionDto;
221
311
  /** The review of the account's answers, as served (`MarketDataReviewDto`). */
222
312
  export type MarketDataReview = MarketDataReviewDto;
223
- /** GET <basePath>/subscription in the domain: the subscription and the review its answer carries, each or none. */
313
+ /** The operator's grant as the store holds it: no subscription, its steps release the grant at the gate. */
314
+ export type MarketDataOperatorGrant = MarketDataOperatorGrantDto;
315
+ /** GET <basePath>/subscription in the domain: the subscription, the review and the operator's grant, each or none. */
224
316
  export interface MarketDataSubscriptionAnswer {
225
317
  subscription: MarketDataSubscription | null;
226
318
  review: MarketDataReview | null;
319
+ grant: MarketDataOperatorGrant | null;
227
320
  }
228
321
  /** The explicit agreement record: accepted, for which version, and when. */
229
322
  export interface MarketDataAgreement {
@@ -235,10 +328,31 @@ export interface MarketDataAgreement {
235
328
  export type MarketDataAgreementDocument = MarketDataAgreementDocumentDto;
236
329
  /** The exact agreement the account accepted (K1), as the subscription page and the notice reopen it. */
237
330
  export type MarketDataAcceptedAgreement = MarketDataAcceptedAgreementDto;
331
+ /** One assent a declaration holds (a venue that lists several agreements), as served. */
332
+ export type MarketDataAgreementAssent = MarketDataAgreementAssentDto;
238
333
  /** A form's answers, keyed by the venue's question ids. A missing answer never qualifies. */
239
334
  export type MarketDataQualificationAnswers = Partial<Record<string, boolean>>;
240
335
  /** Every question of the venue's questionnaire answered with its qualifying answer. */
241
336
  export declare function isMarketDataNonProfessional(venue: MarketDataVenue, answers: MarketDataQualificationAnswers): boolean;
337
+ /** Whether a record's form version reads as the venue's current form (`acceptedFormVersions`, else the one version). */
338
+ export declare function isMarketDataFormVersionAccepted(venue: MarketDataVenue, formVersion: string): boolean;
339
+ /** The venue's products, in level order (a product without a level keeps its place in the card's list). */
340
+ export declare function marketDataProductsByLevel(venue: MarketDataVenue): readonly MarketDataProduct[];
341
+ /** The products a classification may hold, in level order (the plan picker's offer). */
342
+ export declare function marketDataProductsFor(venue: MarketDataVenue, classification: MarketDataClassification): readonly MarketDataProduct[];
343
+ /** The venue's product with this key (`level` on the wire), or null. */
344
+ export declare function marketDataProductByKey(venue: MarketDataVenue, key: string | null | undefined): MarketDataProduct | null;
345
+ /** The venue records its agreement as the registration its own wall makes (never a purchase step). */
346
+ export declare function isMarketDataRegistrationAgreement(venue: Pick<MarketDataVenue, 'agreement'>): boolean;
347
+ /** The venue's listed agreements (`agreements`, in the card's order), or none for a venue of one agreement. */
348
+ export declare function marketDataListedAgreements(venue: Pick<MarketDataVenue, 'agreements'>): readonly MarketDataListedAgreement[];
349
+ /** The listed agreement whose assent real time on `productGroup` needs (an exchange code as the gate names it), or null. */
350
+ export declare function marketDataAgreementForProductGroup(venue: Pick<MarketDataVenue, 'agreements'>, productGroup: string | null | undefined): MarketDataListedAgreement | null;
351
+ /**
352
+ * An assent counts only for the version the agreement's text route presents NOW (`current`, its K1-shaped answer),
353
+ * never for an older text and never for the card's pin. With no current text read, nothing counts.
354
+ */
355
+ export declare function isMarketDataListedAgreementCurrent(current: Pick<MarketDataAgreementDocument, 'version'> | null | undefined, assent: MarketDataAgreementAssent | null | undefined): boolean;
242
356
  /**
243
357
  * A declaration on the venue's current form (a new question set means a new declaration) whose validity has not ended
244
358
  * at `now`, either classification. The client owns expiry: `now` is the caller's clock (the store's last evaluation),
@@ -256,8 +370,10 @@ export declare function isMarketDataAttestationCurrent(venue: MarketDataVenue, a
256
370
  */
257
371
  export declare function isMarketDataProfessionalDeclaration(venue: MarketDataVenue, attestation: MarketDataAttestation | null | undefined, now: number): boolean;
258
372
  /**
259
- * The expiry (ISO, as served) a still-current non-professional declaration must be renewed by, once `now` is inside
260
- * the venue's renewal window before it; null otherwise (no expiry named, further off, or already lapsed).
373
+ * The expiry (ISO, as served) a declaration the venue sells to must be renewed by, once `now` is inside the venue's
374
+ * renewal window before it; null otherwise (no expiry named, further off, or already lapsed). A venue that refuses
375
+ * professionals sells to a non-professional declaration only; one that sells them (CME) to either classification, so
376
+ * a professional subscriber is told before its declaration lapses too.
261
377
  */
262
378
  export declare function marketDataAttestationRenewBy(venue: MarketDataVenue, attestation: MarketDataAttestation | null | undefined, now: number): string | null;
263
379
  /**
@@ -282,26 +398,30 @@ export type MarketDataCheckoutResult = {
282
398
  kind: 'busy';
283
399
  };
284
400
  /**
285
- * Transport-free failure surface for the billing calls. Unlike CME, a bare 403 is NOT an attestation gate (refusals ride
286
- * the 200 checkout body), so it never routes back into the declaration: it is a route the account may not use (the
287
- * register's suspended account included). 'invoice_owed' is the tagged 409 while Stripe still collects an invoice. The
288
- * agreement's typed refusals (K2), read from the body's tag: 'agreement_stale' (409 `<VENUE>_AGREEMENT_STALE`: the text
289
- * changed, read it again), 'attestation_required' (409 `<VENUE>_ATTESTATION_REQUIRED`: declare first) and
290
- * 'email_unverified' (403 `<VENUE>_EMAIL_UNVERIFIED`: verify the email first); the review's 'review_not_open' (409
291
- * `<VENUE>_REVIEW_NOT_OPEN`: no pending review to confirm, read the records again).
401
+ * Transport-free failure surface for the billing calls. The kind says what the store and the flow do next, never what a
402
+ * page says: the words for a refusal come from the purchase-refusal resolver (docs/features/billing/purchase-
403
+ * refusals.md), which reads `cause`, the failure as it arrived (the server's tagged answer, or the transport's).
404
+ * 'refused': the server answered and refused (any status but a 401, a 429 or a 5xx), so what the account holds may
405
+ * differ from what the page shows and the store reads the records again. The refusals a store acts on itself, read from
406
+ * the body's tag, are refusals too: 'agreement_stale' (409 `<VENUE>_AGREEMENT_STALE`: the text changed, read it
407
+ * again), 'attestation_required' (`<VENUE>_ATTESTATION_REQUIRED`: the declaration on file does not count),
408
+ * 'email_unverified' (403 `<VENUE>_EMAIL_UNVERIFIED`: the verify-email card opens) and 'review_not_open' (409
409
+ * `<VENUE>_REVIEW_NOT_OPEN`: read the records again). 'unauthorized': a 401 or an expired session. 'server': a 5xx or a
410
+ * rate limit, where a retry can succeed. 'network': no answer. 'aborted': the caller's own abort, no refusal at all.
292
411
  */
293
- export type MarketDataBillingErrorKind = 'conflict' | 'invoice_owed' | 'agreement_stale' | 'attestation_required' | 'email_unverified' | 'review_not_open' | 'unauthorized' | 'forbidden' | 'network' | 'aborted' | 'server';
412
+ export type MarketDataBillingErrorKind = 'refused' | 'agreement_stale' | 'attestation_required' | 'email_unverified' | 'review_not_open' | 'unauthorized' | 'network' | 'aborted' | 'server';
294
413
  export declare class MarketDataBillingError extends Error {
295
414
  readonly kind: MarketDataBillingErrorKind;
296
415
  readonly status: number | null;
297
- /** Raw backend message: diagnostic content only, never primary UI copy. */
416
+ /** Raw backend message: diagnostic content only, never UI copy. */
298
417
  readonly diagnosticMessage: string | null;
299
- /** Stripe's hosted invoice on an 'invoice_owed' refusal; null otherwise. */
418
+ /** Stripe's hosted invoice on the owed-invoice refusal (SUBSCRIPTION_INVOICE_OWED); null otherwise. */
300
419
  readonly invoiceUrl: string | null;
301
420
  constructor(kind: MarketDataBillingErrorKind, options?: {
302
421
  status?: number | null;
303
422
  diagnosticMessage?: string | null;
304
423
  invoiceUrl?: string | null;
424
+ cause?: unknown;
305
425
  });
306
426
  }
307
427
  /** A venue's live repository boundary (src/services/market-data.service.ts; specs substitute it per venue). */
@@ -315,12 +435,26 @@ export interface MarketDataBillingRepository {
315
435
  confirmedAt: string;
316
436
  }>;
317
437
  /** Never resolves 'busy' (that is the store's own answer); a refusal resolves, a failure throws. */
318
- checkout(body: MarketDataCheckoutDto, options: {
438
+ checkout(body: MarketDataCheckoutDto | MarketDataProductCheckoutDto, options: {
319
439
  idempotencyId: string;
320
440
  signal?: AbortSignal;
321
441
  }): Promise<Exclude<MarketDataCheckoutResult, {
322
442
  kind: 'busy';
323
443
  }>>;
444
+ /**
445
+ * POST <basePath>/subscription/change-plan (a venue with `planChanges`): the subscription moved to the product, as
446
+ * the server answers it (an upgrade now, a downgrade pending to the period end); a typed refusal throws. A venue with
447
+ * one plan has no such route, so its repository may leave this out.
448
+ */
449
+ changePlan?(body: MarketDataChangePlanDto, options: {
450
+ idempotencyId: string;
451
+ signal?: AbortSignal;
452
+ }): Promise<MarketDataSubscription | null>;
453
+ /** POST <basePath>/subscription/restore (a venue with `planChanges`): a pending downgrade or period-end cancel cleared. */
454
+ restorePlan?(options: {
455
+ idempotencyId: string;
456
+ signal?: AbortSignal;
457
+ }): Promise<MarketDataSubscription | null>;
324
458
  /** Cancels at period end (one classification is sold, so there is no immediate switch-cancel), with the reason. */
325
459
  cancelSubscription(signal?: AbortSignal, feedback?: CancelFeedback): Promise<{
326
460
  message: string | null;
@@ -335,7 +469,11 @@ export interface MarketDataBillingRepository {
335
469
  getAcceptedAgreement(signal?: AbortSignal): Promise<MarketDataAcceptedAgreement | null>;
336
470
  /** POST <basePath>/data-terms (K2): the assent; a typed refusal throws its kind. */
337
471
  acceptDataTerms(body: AcceptMarketDataDataTermsDto, signal?: AbortSignal): Promise<MarketDataAgreement>;
338
- /** The free registration: resolves only on the confirmed 201 `{ registered: true }`; a failure throws (a 403 is
339
- * 'forbidden'). */
340
- register(signal?: AbortSignal): Promise<MarketDataRegistration>;
472
+ /**
473
+ * GET <basePath>/agreements/<id> (a venue that lists several agreements): the agreement the server presents now, in
474
+ * K1's shape; a body that is not one throws 'server'. A venue of one agreement has no such route.
475
+ */
476
+ getListedAgreement?(agreementId: string, signal?: AbortSignal): Promise<MarketDataAgreementDocument>;
477
+ /** POST <basePath>/agreements/<id>/accept: the assent recorded; a typed refusal throws its kind. */
478
+ acceptListedAgreement?(agreementId: string, body: AcceptMarketDataListedAgreementDto, signal?: AbortSignal): Promise<MarketDataAgreementAssent>;
341
479
  }
@@ -5,6 +5,51 @@ const DAY_MS = 86_400_000;
5
5
  export function isMarketDataNonProfessional(venue, answers) {
6
6
  return venue.questionnaire.questions.every((question) => answers[question.id] === question.qualifying);
7
7
  }
8
+ /** Whether a record's form version reads as the venue's current form (`acceptedFormVersions`, else the one version). */
9
+ export function isMarketDataFormVersionAccepted(venue, formVersion) {
10
+ const accepted = venue.questionnaire.acceptedFormVersions ?? [venue.questionnaire.formVersion];
11
+ return accepted.includes(formVersion);
12
+ }
13
+ /** The venue's products, in level order (a product without a level keeps its place in the card's list). */
14
+ export function marketDataProductsByLevel(venue) {
15
+ return venue.products
16
+ .map((product, index) => ({ product, index }))
17
+ .sort((a, b) => (a.product.level ?? a.index) - (b.product.level ?? b.index) || a.index - b.index)
18
+ .map(({ product }) => product);
19
+ }
20
+ /** The products a classification may hold, in level order (the plan picker's offer). */
21
+ export function marketDataProductsFor(venue, classification) {
22
+ return marketDataProductsByLevel(venue).filter((product) => product.classifications.includes(classification));
23
+ }
24
+ /** The venue's product with this key (`level` on the wire), or null. */
25
+ export function marketDataProductByKey(venue, key) {
26
+ if (!key)
27
+ return null;
28
+ return venue.products.find((product) => product.key === key) ?? null;
29
+ }
30
+ /** The venue records its agreement as the registration its own wall makes (never a purchase step). */
31
+ export function isMarketDataRegistrationAgreement(venue) {
32
+ return venue.agreement?.recordedAs === 'registration';
33
+ }
34
+ /** The venue's listed agreements (`agreements`, in the card's order), or none for a venue of one agreement. */
35
+ export function marketDataListedAgreements(venue) {
36
+ return venue.agreements ?? [];
37
+ }
38
+ /** The listed agreement whose assent real time on `productGroup` needs (an exchange code as the gate names it), or null. */
39
+ export function marketDataAgreementForProductGroup(venue, productGroup) {
40
+ if (!productGroup)
41
+ return null;
42
+ return marketDataListedAgreements(venue).find((agreement) => agreement.productGroups.includes(productGroup)) ?? null;
43
+ }
44
+ /**
45
+ * An assent counts only for the version the agreement's text route presents NOW (`current`, its K1-shaped answer),
46
+ * never for an older text and never for the card's pin. With no current text read, nothing counts.
47
+ */
48
+ export function isMarketDataListedAgreementCurrent(current, assent) {
49
+ if (!current?.version)
50
+ return false;
51
+ return assent?.version === current.version;
52
+ }
8
53
  /**
9
54
  * A declaration on the venue's current form (a new question set means a new declaration) whose validity has not ended
10
55
  * at `now`, either classification. The client owns expiry: `now` is the caller's clock (the store's last evaluation),
@@ -13,7 +58,7 @@ export function isMarketDataNonProfessional(venue, answers) {
13
58
  * no end can never be shown to be inside its year.
14
59
  */
15
60
  export function isMarketDataAttestationLive(venue, attestation, now) {
16
- if (!attestation || attestation.formVersion !== venue.questionnaire.formVersion)
61
+ if (!attestation || !isMarketDataFormVersionAccepted(venue, attestation.formVersion))
17
62
  return false;
18
63
  if (attestation.expiresAt === undefined)
19
64
  return false;
@@ -33,15 +78,20 @@ export function isMarketDataProfessionalDeclaration(venue, attestation, now) {
33
78
  if (attestation?.classification !== 'professional')
34
79
  return false;
35
80
  if (attestation.expiresAt === undefined)
36
- return attestation.formVersion === venue.questionnaire.formVersion;
81
+ return isMarketDataFormVersionAccepted(venue, attestation.formVersion);
37
82
  return isMarketDataAttestationLive(venue, attestation, now);
38
83
  }
39
84
  /**
40
- * The expiry (ISO, as served) a still-current non-professional declaration must be renewed by, once `now` is inside
41
- * the venue's renewal window before it; null otherwise (no expiry named, further off, or already lapsed).
85
+ * The expiry (ISO, as served) a declaration the venue sells to must be renewed by, once `now` is inside the venue's
86
+ * renewal window before it; null otherwise (no expiry named, further off, or already lapsed). A venue that refuses
87
+ * professionals sells to a non-professional declaration only; one that sells them (CME) to either classification, so
88
+ * a professional subscriber is told before its declaration lapses too.
42
89
  */
43
90
  export function marketDataAttestationRenewBy(venue, attestation, now) {
44
- if (!isMarketDataAttestationCurrent(venue, attestation, now) || attestation?.expiresAt === undefined)
91
+ const sold = venue.professionalPolicy === 'sell'
92
+ ? isMarketDataAttestationLive(venue, attestation, now)
93
+ : isMarketDataAttestationCurrent(venue, attestation, now);
94
+ if (!sold || attestation?.expiresAt === undefined)
45
95
  return null;
46
96
  return Date.parse(attestation.expiresAt) - now <= venue.questionnaire.renewalWindowDays * DAY_MS
47
97
  ? attestation.expiresAt
@@ -60,12 +110,12 @@ export function isMarketDataAgreementCurrent(current, agreement) {
60
110
  export class MarketDataBillingError extends Error {
61
111
  kind;
62
112
  status;
63
- /** Raw backend message: diagnostic content only, never primary UI copy. */
113
+ /** Raw backend message: diagnostic content only, never UI copy. */
64
114
  diagnosticMessage;
65
- /** Stripe's hosted invoice on an 'invoice_owed' refusal; null otherwise. */
115
+ /** Stripe's hosted invoice on the owed-invoice refusal (SUBSCRIPTION_INVOICE_OWED); null otherwise. */
66
116
  invoiceUrl;
67
117
  constructor(kind, options) {
68
- super(`market data billing error: ${kind}`);
118
+ super(`market data billing error: ${kind}`, options?.cause === undefined ? undefined : { cause: options.cause });
69
119
  this.name = 'MarketDataBillingError';
70
120
  this.kind = kind;
71
121
  this.status = options?.status ?? null;