@orangecharts/wrun-chart-host 0.7.1 → 0.9.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 (210) hide show
  1. package/README.md +27 -4
  2. package/dist/constants/feature-flags.constants.d.ts +5 -0
  3. package/dist/constants/feature-flags.constants.js +32 -0
  4. package/dist/constants/marketCapabilities.constants.d.ts +14 -9
  5. package/dist/constants/marketCapabilities.constants.js +36 -13
  6. package/dist/constants/opra-compliance.constants.d.ts +14 -0
  7. package/dist/constants/opra-compliance.constants.js +14 -0
  8. package/dist/constants/option-venues.constants.d.ts +29 -6
  9. package/dist/constants/option-venues.constants.js +19 -2
  10. package/dist/constants/venue-presets.constants.d.ts +17 -3
  11. package/dist/constants/venue-presets.constants.js +17 -3
  12. package/dist/host-env.d.ts +34 -4
  13. package/dist/host-env.js +21 -0
  14. package/dist/host-ports.types.d.ts +51 -3
  15. package/dist/index.d.ts +17 -0
  16. package/dist/index.js +17 -0
  17. package/dist/indicators/controls/tpo-session.util.d.ts +40 -11
  18. package/dist/indicators/controls/tpo-session.util.js +138 -14
  19. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  20. package/dist/interfaces/opra-realtime.interface.js +10 -10
  21. package/dist/interfaces/option-instrument.interface.d.ts +6 -0
  22. package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
  23. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +57 -10
  24. package/dist/kscript-data/controls/live-trades-merge.util.js +85 -16
  25. package/dist/market-data/billing.interface.d.ts +138 -17
  26. package/dist/market-data/billing.interface.js +25 -8
  27. package/dist/market-data/venues/index.d.ts +3 -3
  28. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  29. package/dist/market-data/venues/opra.d.ts +3 -3
  30. package/dist/market-data/venues/opra.js +5 -4
  31. package/dist/replay/replayLadder.js +3 -1
  32. package/dist/settings-templates/footprint-rows.d.ts +25 -0
  33. package/dist/settings-templates/footprint-rows.js +127 -0
  34. package/dist/settings-templates/form-rows.d.ts +56 -0
  35. package/dist/settings-templates/form-rows.js +19 -0
  36. package/dist/settings-templates/frvp-fields.js +14 -0
  37. package/dist/settings-templates/index.d.ts +10 -1
  38. package/dist/settings-templates/index.js +11 -2
  39. package/dist/settings-templates/indicator-fields.js +78 -0
  40. package/dist/settings-templates/tool-rules.d.ts +35 -9
  41. package/dist/settings-templates/tool-rules.js +42 -8
  42. package/dist/settings-templates/tool-tables.generated.js +13 -2
  43. package/dist/utility/chart/candle-volume-unit.leaf.d.ts +16 -0
  44. package/dist/utility/chart/candle-volume-unit.leaf.js +61 -0
  45. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  46. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  47. package/dist/utility/chart/footprint-columns.util.d.ts +74 -0
  48. package/dist/utility/chart/footprint-columns.util.js +106 -0
  49. package/dist/utility/chart/footprint-display-mode.util.d.ts +40 -0
  50. package/dist/utility/chart/footprint-display-mode.util.js +62 -0
  51. package/dist/utility/chart/footprint-sierra-look.util.d.ts +2 -0
  52. package/dist/utility/chart/footprint-sierra-look.util.js +37 -0
  53. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  54. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  55. package/dist/utility/chart/index-mode.util.js +23 -13
  56. package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
  57. package/dist/utility/chart/kscript-venue-policy.util.js +34 -26
  58. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  59. package/dist/utility/chart/marketKind.util.js +17 -7
  60. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  61. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  62. package/dist/utility/chart/om-panel.util.d.ts +11 -0
  63. package/dist/utility/chart/om-panel.util.js +65 -6
  64. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  65. package/dist/utility/chart/profile-block-size.util.js +7 -0
  66. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  67. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  68. package/dist/utility/chart/window-geometry.leaf.d.ts +23 -1
  69. package/dist/utility/chart/window-geometry.leaf.js +78 -6
  70. package/dist/utility/chart/window-owner.leaf.d.ts +13 -0
  71. package/dist/utility/chart/window-owner.leaf.js +5 -0
  72. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
  73. package/dist/utility/chart/wrun-run-result.util.js +4 -1
  74. package/dist/utility/common/transformations.util.d.ts +7 -0
  75. package/dist/utility/common/transformations.util.js +11 -0
  76. package/dist/utility/options/cme-options-root.util.d.ts +25 -0
  77. package/dist/utility/options/cme-options-root.util.js +40 -0
  78. package/dist/utility/options/option-book.util.d.ts +27 -0
  79. package/dist/utility/options/option-book.util.js +76 -0
  80. package/dist/utility/options/option-trade-date.util.d.ts +50 -0
  81. package/dist/utility/options/option-trade-date.util.js +120 -0
  82. package/dist/utility/options/option-venue.util.d.ts +3 -3
  83. package/dist/utility/options/option-venue.util.js +3 -3
  84. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
  85. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
  86. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  87. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  88. package/dist/utility/wrun/sources/host-grid-landing.d.ts +4 -2
  89. package/dist/utility/wrun/sources/host-grid-landing.js +8 -0
  90. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +40 -4
  91. package/dist/utility/wrun/sources/lanes/options_flow.js +115 -18
  92. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +12 -9
  93. package/dist/utility/wrun/sources/opra-option-lanes.util.js +10 -7
  94. package/dist/utility/wrun/sources/row-lane-registry.js +10 -5
  95. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  96. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +3 -2
  97. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +30 -5
  98. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  99. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
  100. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +25 -1
  101. package/dist/utility/wrun/sources/row-lanes/option_prints.js +161 -30
  102. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.d.ts +4 -0
  103. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +65 -0
  104. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -1
  105. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +83 -2
  106. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +17 -1
  107. package/dist/utility/wrun/sources/row-lanes/option_surface.js +33 -2
  108. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +7 -1
  109. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +51 -5
  110. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +136 -3
  111. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +42 -0
  112. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +146 -0
  113. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
  114. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +111 -20
  115. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +291 -48
  116. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  117. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  118. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  119. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  120. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  121. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  122. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  123. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
  124. package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
  125. package/dist/utility/wrun/wrun-cloud-record.leaf.d.ts +27 -0
  126. package/dist/utility/wrun/wrun-cloud-record.leaf.js +71 -0
  127. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +4 -21
  128. package/dist/utility/wrun/wrun-cloud-record.util.js +5 -65
  129. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  130. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  131. package/dist/utility/wrun/wrun-color-settings.util.d.ts +22 -9
  132. package/dist/utility/wrun/wrun-color-settings.util.js +57 -23
  133. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  134. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  135. package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
  136. package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
  137. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +10 -3
  138. package/dist/utility/wrun/wrun-draft-overlay.util.js +63 -6
  139. package/dist/utility/wrun/wrun-frames.js +5 -5
  140. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  141. package/dist/utility/wrun/wrun-hosted-wire-caps.js +11 -0
  142. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
  143. package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
  144. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +29 -3
  145. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +33 -3
  146. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  147. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  148. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  149. package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
  150. package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
  151. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -1
  152. package/dist/utility/wrun/wrun-live-tick.util.js +130 -44
  153. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  154. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  155. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +224 -0
  156. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +342 -0
  157. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +88 -0
  158. package/dist/utility/wrun/wrun-market-size-defaults.util.js +471 -0
  159. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +43 -8
  160. package/dist/utility/wrun/wrun-opra-flow.leaf.js +37 -6
  161. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +51 -10
  162. package/dist/utility/wrun/wrun-option-contract-flow.util.js +85 -33
  163. package/dist/utility/wrun/wrun-option-prints.util.d.ts +172 -3
  164. package/dist/utility/wrun/wrun-option-prints.util.js +394 -17
  165. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +99 -0
  166. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +218 -0
  167. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +365 -0
  168. package/dist/utility/wrun/wrun-option-strike-flow.util.js +797 -0
  169. package/dist/utility/wrun/wrun-option-views.util.d.ts +231 -7
  170. package/dist/utility/wrun/wrun-option-views.util.js +643 -23
  171. package/dist/utility/wrun/wrun-options-chain.util.d.ts +6 -4
  172. package/dist/utility/wrun/wrun-options-chain.util.js +8 -5
  173. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  174. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  175. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  176. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  177. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  178. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -1
  179. package/dist/utility/wrun/wrun-overlay-recovery.util.js +32 -3
  180. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  181. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  182. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
  183. package/dist/utility/wrun/wrun-overlay-run.util.js +527 -180
  184. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +15 -0
  185. package/dist/utility/wrun/wrun-pack-widths.leaf.js +22 -0
  186. package/dist/utility/wrun/wrun-pack.util.d.ts +13 -8
  187. package/dist/utility/wrun/wrun-pack.util.js +38 -21
  188. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +4 -0
  189. package/dist/utility/wrun/wrun-panel-mount.util.js +62 -22
  190. package/dist/utility/wrun/wrun-panel-style.util.d.ts +41 -14
  191. package/dist/utility/wrun/wrun-panel-style.util.js +86 -26
  192. package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
  193. package/dist/utility/wrun/wrun-param-map.util.js +8 -5
  194. package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
  195. package/dist/utility/wrun/wrun-param-values.util.js +2 -0
  196. package/dist/utility/wrun/wrun-pin-spelling.util.js +19 -10
  197. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  198. package/dist/utility/wrun/wrun-refusal.util.js +17 -2
  199. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +20 -0
  200. package/dist/utility/wrun/wrun-script-inputs.util.js +43 -0
  201. package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
  202. package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
  203. package/dist/utility/wrun/wrun-tape-source.util.d.ts +133 -48
  204. package/dist/utility/wrun/wrun-tape-source.util.js +205 -62
  205. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  206. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  207. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  208. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  209. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  210. package/package.json +11 -11
@@ -10,6 +10,10 @@
10
10
  * never re-priced), an EXPLICIT agreement acceptance (never inferred from a grant or a subscription), and pay first:
11
11
  * the declaration and the agreement bind real-time ACCESS, not the payment, so checkout needs neither and the server
12
12
  * serves real-time only once the account is both paid and qualified (delayed otherwise).
13
+ *
14
+ * The agreement itself is the server's (contracts K1 and K2 of the OPRA compliance round): `GET <basePath>/agreement`
15
+ * serves the complete populated text with its version and hash, the acceptance names that version and both hashes,
16
+ * and an acceptance counts only for the version the server presents now, never for a version a build carries.
13
17
  */
14
18
  import type { CancelFeedback } from '../interfaces/cancel-reason.interface.js';
15
19
  import type { MarketDataBillingInterval, MarketDataClassification, MarketDataVenue } from './venue.js';
@@ -38,8 +42,9 @@ export interface MarketDataAttestationRecordDto {
38
42
  attestedAt: string;
39
43
  formVersion: string;
40
44
  /**
41
- * ISO end of the declaration's validity (a year after it was made). Additive: a server that names none leaves the
42
- * record without a client-side expiry, and the checkout's refusal stays the authority.
45
+ * ISO end of the declaration's validity (a year after it was made). A non-professional record that names none reads
46
+ * lapsed (`isMarketDataAttestationLive`): status is reconfirmed every 12 months, and a record with no end can never be
47
+ * shown to be inside its year.
43
48
  */
44
49
  expiresAt?: string;
45
50
  }
@@ -54,15 +59,39 @@ export interface MarketDataCheckoutDto {
54
59
  }
55
60
  /**
56
61
  * POST <basePath>/checkout -> 200: a Stripe redirect, or a refusal. 'professional_unavailable' is terminal (the UI
57
- * shows "not available"). Pay first, the server no longer answers 'attestation_required' or 'agreement_required'; they
58
- * stay in the union and are handled defensively (the flow routes into that step).
62
+ * shows "not available"). 'review_held' and 'review_withdrawn': a review of the account's answers only an operator
63
+ * resolves, or one that withdrew real-time (the review card says which). Pay first, the server no longer answers
64
+ * 'attestation_required' or 'agreement_required'; they stay in the union and are handled defensively (the flow routes
65
+ * into that step).
59
66
  */
60
67
  export type MarketDataCheckoutResponseDto = {
61
68
  url: string;
62
69
  } | {
63
70
  refused: MarketDataPurchaseRefusalCode;
64
71
  };
65
- export type MarketDataPurchaseRefusalCode = 'professional_unavailable' | 'agreement_required' | 'attestation_required';
72
+ export type MarketDataPurchaseRefusalCode = 'professional_unavailable' | 'review_held' | 'review_withdrawn' | 'agreement_required' | 'attestation_required';
73
+ /**
74
+ * GET <basePath>/subscription `review`: the review of the account's answers that bears on real-time (Exhibit A Q19.2),
75
+ * or null. 'pending': an employer or occupation that suggests a financial firm or a registered person asks the
76
+ * subscriber to confirm the declaration before `deadline` (POST <basePath>/attestation/review/confirm); real-time runs
77
+ * until the deadline passes. 'held': an operator reviews the declaration and real-time waits. 'withdrawn': an operator
78
+ * withdrew real-time (`resolvedAt`); the way back is a new declaration.
79
+ */
80
+ export interface MarketDataReviewDto {
81
+ state: 'pending' | 'held' | 'withdrawn';
82
+ reason: string;
83
+ openedAt: string;
84
+ deadline: string | null;
85
+ resolvedAt: string | null;
86
+ }
87
+ /**
88
+ * POST <basePath>/attestation/review/confirm (no body) -> 200: the pending review confirmed; 409
89
+ * `<VENUE>_REVIEW_NOT_OPEN` when no review is pending (none, or one only an operator resolves).
90
+ */
91
+ export interface MarketDataReviewConfirmDto {
92
+ confirmed: boolean;
93
+ confirmedAt: string;
94
+ }
66
95
  /**
67
96
  * Why the server set a subscription to end at its period end on its own: 'unqualified', the account is paid but has
68
97
  * not completed the subscriber questions and the agreement.
@@ -85,6 +114,8 @@ export interface MarketDataSubscriptionDto {
85
114
  }
86
115
  export interface GetMarketDataSubscriptionResponseDto {
87
116
  subscription: MarketDataSubscriptionDto | null;
117
+ /** Additive (a server from before the review answers none). */
118
+ review?: MarketDataReviewDto | null;
88
119
  }
89
120
  /**
90
121
  * GET <basePath>/data-terms -> 200; POST <basePath>/data-terms -> 201. Acceptance is an explicit record of the
@@ -110,9 +141,65 @@ export interface MarketDataAttestationSubmitResult {
110
141
  attestationId: number;
111
142
  withdrawal: MarketDataAttestationWithdrawal | null;
112
143
  }
113
- /** POST <basePath>/data-terms request body: the agreement version the subscriber was shown and accepted. */
144
+ /**
145
+ * GET <basePath>/agreement -> 200 (signed in, any tier), contract K1: the subscriber agreement the server presents now.
146
+ * `text` is the complete populated agreement followed by its addendum (UTF-8, LF line ends, one blank line between
147
+ * paragraphs, no hard wraps): exactly the characters `sha256` hashes. `addendumOffset` is the character index where the
148
+ * addendum starts. The server is the single source of the text (the frontend never bundles a copy), and its `version`
149
+ * is the version an acceptance must name to count, never the version a build carries.
150
+ */
151
+ export interface MarketDataAgreementDocumentDto {
152
+ version: string;
153
+ sha256: string;
154
+ addendumVersion: string;
155
+ vendor: {
156
+ name: string;
157
+ address: string;
158
+ email: string;
159
+ };
160
+ text: string;
161
+ addendumOffset: number;
162
+ }
163
+ /**
164
+ * GET <basePath>/agreement/accepted -> 200, contract K1: the exact agreement text the caller accepted and how; 404
165
+ * `<VENUE>_AGREEMENT_NOT_ACCEPTED` when the caller accepted none.
166
+ */
167
+ export interface MarketDataAcceptedAgreementDto {
168
+ version: string;
169
+ sha256: string;
170
+ addendumVersion: string;
171
+ text: string;
172
+ acceptedAt: string;
173
+ manner: string;
174
+ attestationId: number | string | null;
175
+ }
176
+ /** The four addendum statements a subscriber confirms at assent: Addendum 1(a), 1(b), 1(c) and 2. */
177
+ export interface MarketDataAgreementRepresentations {
178
+ /** 1(a): a natural person or a qualifying trust, not an entity. */
179
+ naturalPerson: boolean;
180
+ /** 1(b): the data is used only for personal investment activities. */
181
+ personalUseOnly: boolean;
182
+ /** 1(c): not a Professional. */
183
+ notProfessional: boolean;
184
+ /** 2: notifies the vendor promptly when a statement of Section 1 stops being true. */
185
+ notifyOnChange: boolean;
186
+ }
187
+ /** The manner of assent an acceptance records: the click on the agreement's own "I AGREE" button. */
188
+ export declare const MARKET_DATA_ASSENT_MANNER = "click:i-agree";
189
+ /**
190
+ * POST <basePath>/data-terms request body, contract K2: the agreement the subscriber was shown (the K1 version, hash and
191
+ * addendum version, and the browser's own SHA-256 of the exact text it displayed), the manner of assent and the four
192
+ * addendum representations. The server records it only when all four are true, both versions are the ones it serves
193
+ * and both hashes equal its hash (else 409 `<VENUE>_AGREEMENT_STALE`), the account holds a current non-professional
194
+ * declaration (else 409 `<VENUE>_ATTESTATION_REQUIRED`) and its email is verified (else 403 `<VENUE>_EMAIL_UNVERIFIED`).
195
+ */
114
196
  export interface AcceptMarketDataDataTermsDto {
115
197
  agreementVersion: string;
198
+ agreementSha256: string;
199
+ addendumVersion: string;
200
+ manner: typeof MARKET_DATA_ASSENT_MANNER;
201
+ displayedTextSha256: string;
202
+ representations: MarketDataAgreementRepresentations;
116
203
  }
117
204
  /** POST <basePath>/subscription/cancel and DELETE <basePath>/subscription/cancel -> 200 body. */
118
205
  export interface MarketDataCancelResponseDto {
@@ -131,12 +218,23 @@ export interface MarketDataRegistration {
131
218
  }
132
219
  export type MarketDataAttestation = MarketDataAttestationRecordDto;
133
220
  export type MarketDataSubscription = MarketDataSubscriptionDto;
221
+ /** The review of the account's answers, as served (`MarketDataReviewDto`). */
222
+ export type MarketDataReview = MarketDataReviewDto;
223
+ /** GET <basePath>/subscription in the domain: the subscription and the review its answer carries, each or none. */
224
+ export interface MarketDataSubscriptionAnswer {
225
+ subscription: MarketDataSubscription | null;
226
+ review: MarketDataReview | null;
227
+ }
134
228
  /** The explicit agreement record: accepted, for which version, and when. */
135
229
  export interface MarketDataAgreement {
136
230
  accepted: boolean;
137
231
  agreementVersion: string;
138
232
  acceptedAt: string | null;
139
233
  }
234
+ /** The agreement the server presents now (K1), as the store holds it: the text, its version, hash and addendum. */
235
+ export type MarketDataAgreementDocument = MarketDataAgreementDocumentDto;
236
+ /** The exact agreement the account accepted (K1), as the subscription page and the notice reopen it. */
237
+ export type MarketDataAcceptedAgreement = MarketDataAcceptedAgreementDto;
140
238
  /** A form's answers, keyed by the venue's question ids. A missing answer never qualifies. */
141
239
  export type MarketDataQualificationAnswers = Partial<Record<string, boolean>>;
142
240
  /** Every question of the venue's questionnaire answered with its qualifying answer. */
@@ -144,21 +242,30 @@ export declare function isMarketDataNonProfessional(venue: MarketDataVenue, answ
144
242
  /**
145
243
  * A declaration on the venue's current form (a new question set means a new declaration) whose validity has not ended
146
244
  * at `now`, either classification. The client owns expiry: `now` is the caller's clock (the store's last evaluation),
147
- * never an implied Date.now(). A record without `expiresAt` never expires here; one whose `expiresAt` does not parse
148
- * reads expired (ask again rather than trust it).
245
+ * never an implied Date.now(). A record without `expiresAt` reads lapsed, as does one whose `expiresAt` does not parse
246
+ * (ask again rather than trust it): status is reconfirmed every 12 months (Exhibit A Q19.3), and a record that names
247
+ * no end can never be shown to be inside its year.
149
248
  */
150
249
  export declare function isMarketDataAttestationLive(venue: MarketDataVenue, attestation: MarketDataAttestation | null | undefined, now: number): boolean;
151
250
  /** A non-professional declaration on the current form, still valid at `now`: the account may buy real-time. */
152
251
  export declare function isMarketDataAttestationCurrent(venue: MarketDataVenue, attestation: MarketDataAttestation | null | undefined, now: number): boolean;
153
- /** A professional declaration on the current form, still valid at `now`: real-time is not sold to the account. */
252
+ /**
253
+ * A professional declaration on the current form, still valid at `now`: real-time is not sold to the account. A
254
+ * professional record that names no expiry still refuses: a missing field never lifts a refusal (only a new
255
+ * non-professional declaration the server records does).
256
+ */
154
257
  export declare function isMarketDataProfessionalDeclaration(venue: MarketDataVenue, attestation: MarketDataAttestation | null | undefined, now: number): boolean;
155
258
  /**
156
259
  * The expiry (ISO, as served) a still-current non-professional declaration must be renewed by, once `now` is inside
157
260
  * the venue's renewal window before it; null otherwise (no expiry named, further off, or already lapsed).
158
261
  */
159
262
  export declare function marketDataAttestationRenewBy(venue: MarketDataVenue, attestation: MarketDataAttestation | null | undefined, now: number): string | null;
160
- /** An acceptance counts only for the agreement version the venue presents, never for an older text. */
161
- export declare function isMarketDataAgreementCurrent(venue: MarketDataVenue, agreement: MarketDataAgreement | null | undefined): boolean;
263
+ /**
264
+ * An acceptance counts only for the agreement version the SERVER presents now (`current`: its K1 answer), never for an
265
+ * older text and never for the version a build carries (the venue card's `agreement.version` is the contract export's
266
+ * pin, not the current text). With no current agreement read, nothing counts.
267
+ */
268
+ export declare function isMarketDataAgreementCurrent(current: Pick<MarketDataAgreementDocument, 'version'> | null | undefined, agreement: MarketDataAgreement | null | undefined): boolean;
162
269
  /**
163
270
  * Normalized checkout outcome. 'redirect' = leave for Stripe. 'refused' = the server declined (or the store answered a
164
271
  * professional account itself); 'professional_unavailable' ends the purchase until a later non-professional declaration,
@@ -175,11 +282,15 @@ export type MarketDataCheckoutResult = {
175
282
  kind: 'busy';
176
283
  };
177
284
  /**
178
- * Transport-free failure surface for the billing calls. Unlike CME, a 403 is NOT an attestation gate (refusals ride the
179
- * 200 checkout body), so it never routes back into the declaration: it is a route the account may not use (the
180
- * register's suspended account included). 'invoice_owed' is the tagged 409 while Stripe still collects an invoice.
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).
181
292
  */
182
- export type MarketDataBillingErrorKind = 'conflict' | 'invoice_owed' | 'unauthorized' | 'forbidden' | 'network' | 'aborted' | 'server';
293
+ export type MarketDataBillingErrorKind = 'conflict' | 'invoice_owed' | 'agreement_stale' | 'attestation_required' | 'email_unverified' | 'review_not_open' | 'unauthorized' | 'forbidden' | 'network' | 'aborted' | 'server';
183
294
  export declare class MarketDataBillingError extends Error {
184
295
  readonly kind: MarketDataBillingErrorKind;
185
296
  readonly status: number | null;
@@ -197,7 +308,12 @@ export declare class MarketDataBillingError extends Error {
197
308
  export interface MarketDataBillingRepository {
198
309
  getAttestation(signal?: AbortSignal): Promise<MarketDataAttestation | null>;
199
310
  submitAttestation(body: MarketDataAttestationDto, signal?: AbortSignal): Promise<MarketDataAttestationSubmitResult>;
200
- getSubscription(signal?: AbortSignal): Promise<MarketDataSubscription | null>;
311
+ /** GET <basePath>/subscription: the subscription and the review of the account's answers, each or none. */
312
+ getSubscription(signal?: AbortSignal): Promise<MarketDataSubscriptionAnswer>;
313
+ /** POST <basePath>/attestation/review/confirm: the subscriber confirms a pending review (a typed refusal throws). */
314
+ confirmReview(signal?: AbortSignal): Promise<{
315
+ confirmedAt: string;
316
+ }>;
201
317
  /** Never resolves 'busy' (that is the store's own answer); a refusal resolves, a failure throws. */
202
318
  checkout(body: MarketDataCheckoutDto, options: {
203
319
  idempotencyId: string;
@@ -213,7 +329,12 @@ export interface MarketDataBillingRepository {
213
329
  message: string | null;
214
330
  }>;
215
331
  getDataTerms(signal?: AbortSignal): Promise<MarketDataAgreement>;
216
- acceptDataTerms(agreementVersion: string, signal?: AbortSignal): Promise<MarketDataAgreement>;
332
+ /** GET <basePath>/agreement (K1): the agreement the server presents now; a body that is not one throws 'server'. */
333
+ getAgreement(signal?: AbortSignal): Promise<MarketDataAgreementDocument>;
334
+ /** GET <basePath>/agreement/accepted (K1): the exact text the account accepted, or null on the 404 (none). */
335
+ getAcceptedAgreement(signal?: AbortSignal): Promise<MarketDataAcceptedAgreement | null>;
336
+ /** POST <basePath>/data-terms (K2): the assent; a typed refusal throws its kind. */
337
+ acceptDataTerms(body: AcceptMarketDataDataTermsDto, signal?: AbortSignal): Promise<MarketDataAgreement>;
217
338
  /** The free registration: resolves only on the confirmed 201 `{ registered: true }`; a failure throws (a 403 is
218
339
  * 'forbidden'). */
219
340
  register(signal?: AbortSignal): Promise<MarketDataRegistration>;
@@ -1,3 +1,5 @@
1
+ /** The manner of assent an acceptance records: the click on the agreement's own "I AGREE" button. */
2
+ export const MARKET_DATA_ASSENT_MANNER = 'click:i-agree';
1
3
  const DAY_MS = 86_400_000;
2
4
  /** Every question of the venue's questionnaire answered with its qualifying answer. */
3
5
  export function isMarketDataNonProfessional(venue, answers) {
@@ -6,14 +8,15 @@ export function isMarketDataNonProfessional(venue, answers) {
6
8
  /**
7
9
  * A declaration on the venue's current form (a new question set means a new declaration) whose validity has not ended
8
10
  * at `now`, either classification. The client owns expiry: `now` is the caller's clock (the store's last evaluation),
9
- * never an implied Date.now(). A record without `expiresAt` never expires here; one whose `expiresAt` does not parse
10
- * reads expired (ask again rather than trust it).
11
+ * never an implied Date.now(). A record without `expiresAt` reads lapsed, as does one whose `expiresAt` does not parse
12
+ * (ask again rather than trust it): status is reconfirmed every 12 months (Exhibit A Q19.3), and a record that names
13
+ * no end can never be shown to be inside its year.
11
14
  */
12
15
  export function isMarketDataAttestationLive(venue, attestation, now) {
13
16
  if (!attestation || attestation.formVersion !== venue.questionnaire.formVersion)
14
17
  return false;
15
18
  if (attestation.expiresAt === undefined)
16
- return true;
19
+ return false;
17
20
  const ends = Date.parse(attestation.expiresAt);
18
21
  return Number.isFinite(ends) && now < ends;
19
22
  }
@@ -21,9 +24,17 @@ export function isMarketDataAttestationLive(venue, attestation, now) {
21
24
  export function isMarketDataAttestationCurrent(venue, attestation, now) {
22
25
  return attestation?.classification === 'non_professional' && isMarketDataAttestationLive(venue, attestation, now);
23
26
  }
24
- /** A professional declaration on the current form, still valid at `now`: real-time is not sold to the account. */
27
+ /**
28
+ * A professional declaration on the current form, still valid at `now`: real-time is not sold to the account. A
29
+ * professional record that names no expiry still refuses: a missing field never lifts a refusal (only a new
30
+ * non-professional declaration the server records does).
31
+ */
25
32
  export function isMarketDataProfessionalDeclaration(venue, attestation, now) {
26
- return attestation?.classification === 'professional' && isMarketDataAttestationLive(venue, attestation, now);
33
+ if (attestation?.classification !== 'professional')
34
+ return false;
35
+ if (attestation.expiresAt === undefined)
36
+ return attestation.formVersion === venue.questionnaire.formVersion;
37
+ return isMarketDataAttestationLive(venue, attestation, now);
27
38
  }
28
39
  /**
29
40
  * The expiry (ISO, as served) a still-current non-professional declaration must be renewed by, once `now` is inside
@@ -36,9 +47,15 @@ export function marketDataAttestationRenewBy(venue, attestation, now) {
36
47
  ? attestation.expiresAt
37
48
  : null;
38
49
  }
39
- /** An acceptance counts only for the agreement version the venue presents, never for an older text. */
40
- export function isMarketDataAgreementCurrent(venue, agreement) {
41
- return agreement?.accepted === true && agreement.agreementVersion === venue.agreement.version;
50
+ /**
51
+ * An acceptance counts only for the agreement version the SERVER presents now (`current`: its K1 answer), never for an
52
+ * older text and never for the version a build carries (the venue card's `agreement.version` is the contract export's
53
+ * pin, not the current text). With no current agreement read, nothing counts.
54
+ */
55
+ export function isMarketDataAgreementCurrent(current, agreement) {
56
+ if (!current?.version)
57
+ return false;
58
+ return agreement?.accepted === true && agreement.agreementVersion === current.version;
42
59
  }
43
60
  export class MarketDataBillingError extends Error {
44
61
  kind;
@@ -61,8 +61,8 @@ export declare const MARKET_DATA_VENUES: readonly [{
61
61
  readonly renewalWindowDays: 30;
62
62
  };
63
63
  readonly agreement: {
64
- readonly version: "opra-subscriber-2026-10";
65
- readonly url: "https://www.opraplan.com/";
64
+ readonly version: "opra-b1-2026-10-22";
65
+ readonly url: "/api/v1/opra/agreement";
66
66
  readonly delayedRequiresAcceptance: false;
67
67
  };
68
68
  readonly delayMinutes: 15;
@@ -73,7 +73,7 @@ export declare const MARKET_DATA_VENUES: readonly [{
73
73
  readonly i18nNamespace: "opraRealtimeData";
74
74
  readonly storeId: "opraRealtime";
75
75
  readonly surfaces: readonly ["chain-page-subtitle", "chain-price-pill", "chain-table-marker", "chain-strike-preview", "chain-index-notice", "flow-tape", "terminal-options-tab", "options-overlay-legends", "indicator-legend-notes", "contract-chart-delay-chip", "contract-chart-delay-card", "chart-source-line", "watchlist-panel", "watchlist-cell-tooltip", "board", "purchase-live-price"];
76
- readonly contractRevision: "2026-10-20.1";
76
+ readonly contractRevision: "2026-10-22.1";
77
77
  }];
78
78
  /** A registered venue's key. */
79
79
  export type MarketDataVenueKey = (typeof MARKET_DATA_VENUES)[number]['key'];
@@ -1,5 +1,5 @@
1
1
  {
2
- "revision": "2026-10-20.1",
2
+ "revision": "2026-10-22.1",
3
3
  "key": "opra",
4
4
  "productGroups": ["OPRA"],
5
5
  "products": [
@@ -27,8 +27,10 @@
27
27
  ],
28
28
  "identityLimits": { "text": 200, "address": 300 },
29
29
  "agreement": {
30
- "version": "opra-subscriber-2026-10",
31
- "url": "https://www.opraplan.com/"
30
+ "version": "opra-b1-2026-10-22",
31
+ "sha256": "105d1b2d6a89cc9416f2d2ebb18e97bed7973e4d2c39353cc55315421b958814",
32
+ "addendumVersion": "opra-b1-addendum-2026-10-22",
33
+ "url": "/api/v1/opra/agreement"
32
34
  },
33
35
  "delaySeconds": 900,
34
36
  "basePath": "/opra"
@@ -54,8 +54,8 @@ export declare const OPRA_VENUE: {
54
54
  readonly renewalWindowDays: 30;
55
55
  };
56
56
  readonly agreement: {
57
- readonly version: "opra-subscriber-2026-10";
58
- readonly url: "https://www.opraplan.com/";
57
+ readonly version: "opra-b1-2026-10-22";
58
+ readonly url: "/api/v1/opra/agreement";
59
59
  readonly delayedRequiresAcceptance: false;
60
60
  };
61
61
  readonly delayMinutes: 15;
@@ -66,5 +66,5 @@ export declare const OPRA_VENUE: {
66
66
  readonly i18nNamespace: "opraRealtimeData";
67
67
  readonly storeId: "opraRealtime";
68
68
  readonly surfaces: readonly ["chain-page-subtitle", "chain-price-pill", "chain-table-marker", "chain-strike-preview", "chain-index-notice", "flow-tape", "terminal-options-tab", "options-overlay-legends", "indicator-legend-notes", "contract-chart-delay-chip", "contract-chart-delay-card", "chart-source-line", "watchlist-panel", "watchlist-cell-tooltip", "board", "purchase-live-price"];
69
- readonly contractRevision: "2026-10-20.1";
69
+ readonly contractRevision: "2026-10-22.1";
70
70
  };
@@ -41,9 +41,10 @@ export const OPRA_VENUE = {
41
41
  validityDays: 365,
42
42
  renewalWindowDays: 30,
43
43
  },
44
- // RELEASE BLOCKER (named, do not bury): the agreement text, its version id and the link need the compliance
45
- // sign-off before the `opra` flag is lit.
46
- agreement: { version: 'opra-subscriber-2026-10', url: 'https://www.opraplan.com/', delayedRequiresAcceptance: false },
44
+ // The agreement orange's export names (OPRA's B-1 and its addendum, populated): its text, hash and addendum are
45
+ // served by `url` (contract K1) and an assent names them (K2). The current version is always the server's answer,
46
+ // never this pin (isMarketDataAgreementCurrent).
47
+ agreement: { version: 'opra-b1-2026-10-22', url: '/api/v1/opra/agreement', delayedRequiresAcceptance: false },
47
48
  // OPRA defines delayed data as at least 15 minutes old; the gate's delayed window matches (900 s).
48
49
  delayMinutes: 15,
49
50
  // The Vendor Agreement's exact phrase (Exhibit A section 14): OPRA_DELAY_NOTICE in
@@ -70,5 +71,5 @@ export const OPRA_VENUE = {
70
71
  'board',
71
72
  'purchase-live-price',
72
73
  ],
73
- contractRevision: '2026-10-20.1',
74
+ contractRevision: '2026-10-22.1',
74
75
  };
@@ -1,6 +1,7 @@
1
1
  // Replay fidelity ladder: measured retention and request-shaping constants.
2
2
  import { RAIL_TFS, RAIL_TF_BOOK_EDGE_SEC, RAIL_TF_BUCKET_SEC, RAIL_TF_EDGE_SEC, REPLAY_LADDER_EDGES_SEC, REPLAY_STEP_TFS, REPLAY_STEP_TF_BOOK_EDGE_SEC, REPLAY_STEP_TF_BUCKET_SEC, REPLAY_STEP_TF_EDGE_SEC, } from '../constants/replay-ladder.leaf.js';
3
3
  import { FEATURE_LIMITS, GATEWAY_TIER_MAX_BARS } from '../constants/feature-limits.constants.js';
4
+ import { checkIsCryptoIndex } from '../utility/chart/crypto-index.leaf.js';
4
5
  import { checkIsBlockedOn1s } from '../utility/chart/index-mode.util.js';
5
6
  import { standardIntervalMsAtOrBelow } from '../utility/chart/interval-registry.util.js';
6
7
  const orderedCoveringTfs = ['1m', '5m', '15m', '1h', '1d'];
@@ -295,7 +296,8 @@ export function clampReplayReach(requestedMs, domain, resolution, maxBars, inten
295
296
  export function reconcileReplayResolution(ageSec, chartIntervalMs, exchange) {
296
297
  const age = Math.max(0, ageSec);
297
298
  const playbackTf = coarseRailTfForAge(age, chartIntervalMs);
298
- const tickAvailable = age <= REPLAY_LADDER_EDGES_SEC.tick && !checkIsBlockedOn1s(exchange);
299
+ // Tick replay steps through trades: a crypto index serves 1s candles but has no trades behind them.
300
+ const tickAvailable = age <= REPLAY_LADDER_EDGES_SEC.tick && !checkIsBlockedOn1s(exchange) && !checkIsCryptoIndex(exchange);
299
301
  const candidates = replayResolutionFallbackCandidatesForChartInterval(chartIntervalMs);
300
302
  const chartResolution = replayResolutionForChartInterval(chartIntervalMs);
301
303
  const available = candidates.filter((resolution) => resolution.kind === 'tick' ? tickAvailable : REPLAY_STEP_TF_EDGE_SEC[resolution.tf] >= age);
@@ -0,0 +1,25 @@
1
+ import type { SettingsFormModel, SettingsFormRow } from './form-rows.js';
2
+ /**
3
+ * The footprint's two one-click controls as rows a host's settings form draws (the row shape: ./form-rows.ts), one
4
+ * group per slot of both web footprint dialogs (footprintSettingsTabs: the General tab's Display group):
5
+ *
6
+ * - `sierra-look`: Classic Presets, one action row whose Apply writes withFootprintSierraLook. The UI calls it Classic
7
+ * Presets and never names Sierra Chart; the code name stays. Web: FootprintSierraLookRow.vue.
8
+ * - `footprint-columns`: the Columns picker. The Display Mode select comes first, in every mode (Columns is one of its
9
+ * options, and a pick writes withFootprintDisplayMode). In the Columns mode the four presets follow as chips, then
10
+ * one select per drawn column, left to right, and one more reading Off while there is room: column 4 shows once
11
+ * column 3 is on. Columns 1 and 2 offer no Off, so the layout never drops under two columns. Web: the dialogs'
12
+ * display mode row and FootprintColumnsPicker.vue. A host that draws this group draws its display mode through it,
13
+ * never beside it.
14
+ *
15
+ * Every word is the key web's rows print, and every key a row writes is a preference in the footprint's field table
16
+ * (./indicator-fields.ts), which the workspace row, a template and a saved default keep.
17
+ */
18
+ /** The groups a host draws, by the slot names of both web footprint dialogs. */
19
+ export declare const FOOTPRINT_FORM_SLOTS: readonly ["sierra-look", "footprint-columns"];
20
+ export type FootprintFormSlot = (typeof FOOTPRINT_FORM_SLOTS)[number];
21
+ /**
22
+ * The rows of one group for `model`, top to bottom: `sierra-look` is the Classic Presets row; `footprint-columns` is
23
+ * the Display Mode row, then, in the Columns mode, the presets and the column rows.
24
+ */
25
+ export declare function footprintFormRows(slot: FootprintFormSlot, model: SettingsFormModel): SettingsFormRow[];
@@ -0,0 +1,127 @@
1
+ import { FOOTPRINT_COLUMN_KINDS, FOOTPRINT_COLUMN_PRESETS, FOOTPRINT_COLUMNS_MAX, FOOTPRINT_COLUMNS_MIN, footprintColumnsPresetOf, footprintColumnsShown, isFootprintColumnsMode, withFootprintColumn, withFootprintColumnsPreset, } from '../utility/chart/footprint-columns.util.js';
2
+ import { FOOTPRINT_DISPLAY_MODES, footprintDisplayModeShown, withFootprintDisplayMode, } from '../utility/chart/footprint-display-mode.util.js';
3
+ import { withFootprintSierraLook } from '../utility/chart/footprint-sierra-look.util.js';
4
+ /**
5
+ * The footprint's two one-click controls as rows a host's settings form draws (the row shape: ./form-rows.ts), one
6
+ * group per slot of both web footprint dialogs (footprintSettingsTabs: the General tab's Display group):
7
+ *
8
+ * - `sierra-look`: Classic Presets, one action row whose Apply writes withFootprintSierraLook. The UI calls it Classic
9
+ * Presets and never names Sierra Chart; the code name stays. Web: FootprintSierraLookRow.vue.
10
+ * - `footprint-columns`: the Columns picker. The Display Mode select comes first, in every mode (Columns is one of its
11
+ * options, and a pick writes withFootprintDisplayMode). In the Columns mode the four presets follow as chips, then
12
+ * one select per drawn column, left to right, and one more reading Off while there is room: column 4 shows once
13
+ * column 3 is on. Columns 1 and 2 offer no Off, so the layout never drops under two columns. Web: the dialogs'
14
+ * display mode row and FootprintColumnsPicker.vue. A host that draws this group draws its display mode through it,
15
+ * never beside it.
16
+ *
17
+ * Every word is the key web's rows print, and every key a row writes is a preference in the footprint's field table
18
+ * (./indicator-fields.ts), which the workspace row, a template and a saved default keep.
19
+ */
20
+ /** The groups a host draws, by the slot names of both web footprint dialogs. */
21
+ export const FOOTPRINT_FORM_SLOTS = ['sierra-look', 'footprint-columns'];
22
+ const DISPLAY_MODE_WORDS = {
23
+ 'split-bar': 'indicators.settings.options.split',
24
+ 'stacked-bar-delta': 'indicators.settings.options.delta',
25
+ 'stacked-bar': 'indicators.settings.options.total',
26
+ cluster: 'indicators.settings.options.cluster',
27
+ 'imbalance-only': 'dialogs.overlayStylesSettings.displayModeImbalanceOnly',
28
+ ladder: 'dialogs.overlayStylesSettings.displayModeLadder',
29
+ columns: 'indicators.settings.footprintLook.columns.mode',
30
+ };
31
+ const PRESET_WORDS = {
32
+ bidAskDelta: 'indicators.settings.footprintLook.columns.presetBidAskDelta',
33
+ deltaVolumeBar: 'indicators.settings.footprintLook.columns.presetDeltaVolumeBar',
34
+ volumeDeltaBars: 'indicators.settings.footprintLook.columns.presetVolumeDeltaBars',
35
+ profileBars: 'indicators.settings.footprintLook.columns.presetProfileBars',
36
+ };
37
+ const KIND_WORDS = {
38
+ bidAsk: 'indicators.settings.footprintLook.columns.kinds.bidAsk',
39
+ delta: 'indicators.settings.footprintLook.columns.kinds.delta',
40
+ deltaColored: 'indicators.settings.footprintLook.columns.kinds.deltaColored',
41
+ diagonalDelta: 'indicators.settings.footprintLook.columns.kinds.diagonalDelta',
42
+ deltaPct: 'indicators.settings.footprintLook.columns.kinds.deltaPct',
43
+ volume: 'indicators.settings.footprintLook.columns.kinds.volume',
44
+ buy: 'indicators.settings.footprintLook.columns.kinds.buy',
45
+ sell: 'indicators.settings.footprintLook.columns.kinds.sell',
46
+ volumeBar: 'indicators.settings.footprintLook.columns.kinds.volumeBar',
47
+ deltaBar: 'indicators.settings.footprintLook.columns.kinds.deltaBar',
48
+ volumeBarLeading: 'indicators.settings.footprintLook.columns.kinds.volumeBarLeading',
49
+ splitBar: 'indicators.settings.footprintLook.columns.kinds.splitBar',
50
+ };
51
+ const OFF_WORDS = 'indicators.settings.options.off';
52
+ const words = (key, params) => params ? { key, params } : { key };
53
+ /**
54
+ * A choice row whose pick writes through `write`. Only an option is ever on (a saved value no option names, such as
55
+ * an unknown display mode, shows none) and only an option is ever written (a value no option names writes nothing).
56
+ */
57
+ function choiceRow(row, write) {
58
+ const offered = new Set(row.options.map((option) => option.value));
59
+ return {
60
+ kind: 'choice',
61
+ ...row,
62
+ value: row.value !== null && offered.has(row.value) ? row.value : null,
63
+ pick: (model, value) => (offered.has(value) ? write(model, value) : model),
64
+ };
65
+ }
66
+ function classicPresetsRow() {
67
+ return {
68
+ kind: 'action',
69
+ id: 'sierra-look',
70
+ label: words('indicators.settings.footprintLook.sierraLook'),
71
+ tooltip: words('indicators.settings.footprintLook.sierraLookTooltip'),
72
+ action: words('indicators.settings.footprintLook.sierraLookApply'),
73
+ apply: (model) => withFootprintSierraLook(model),
74
+ };
75
+ }
76
+ function displayModeRow(model) {
77
+ return choiceRow({
78
+ id: 'display-mode',
79
+ label: words('indicators.settings.displayMode'),
80
+ tooltip: words('dialogs.overlayStylesSettings.displayModeTooltip'),
81
+ look: 'select',
82
+ options: FOOTPRINT_DISPLAY_MODES.map((value) => ({ value, label: words(DISPLAY_MODE_WORDS[value]) })),
83
+ value: footprintDisplayModeShown(model),
84
+ }, (current, value) => withFootprintDisplayMode(current, value));
85
+ }
86
+ function columnsPresetsRow(model) {
87
+ return choiceRow({
88
+ id: 'columns-presets',
89
+ label: words('indicators.settings.footprintLook.columns.presets'),
90
+ tooltip: words('indicators.settings.footprintLook.columns.presetsTooltip'),
91
+ look: 'chips',
92
+ options: FOOTPRINT_COLUMN_PRESETS.map(({ id }) => ({ value: id, label: words(PRESET_WORDS[id]) })),
93
+ // None is lit for a layout of the user's own.
94
+ value: footprintColumnsPresetOf(model),
95
+ },
96
+ // A chip is a choice, not a switch: a pick of the lit one keeps it.
97
+ (current, value) => footprintColumnsPresetOf(current) === value
98
+ ? current
99
+ : withFootprintColumnsPreset(current, value));
100
+ }
101
+ /** One select per drawn column, and one more reading Off while there is room. */
102
+ function columnRows(model) {
103
+ const columns = footprintColumnsShown(model);
104
+ const kindOptions = () => FOOTPRINT_COLUMN_KINDS.map((kind) => ({ value: kind, label: words(KIND_WORDS[kind]) }));
105
+ return Array.from({ length: Math.min(FOOTPRINT_COLUMNS_MAX, columns.length + 1) }, (_, index) => choiceRow({
106
+ id: `column-${index + 1}`,
107
+ label: words('indicators.settings.footprintLook.columns.column', { n: index + 1 }),
108
+ tooltip: words('indicators.settings.footprintLook.columns.columnTooltip'),
109
+ look: 'select',
110
+ options: index < FOOTPRINT_COLUMNS_MIN ? kindOptions() : [{ value: 'off', label: words(OFF_WORDS) }, ...kindOptions()],
111
+ value: columns[index] ?? 'off',
112
+ }, (current, value) => withFootprintColumn(current, index, value)));
113
+ }
114
+ /**
115
+ * The rows of one group for `model`, top to bottom: `sierra-look` is the Classic Presets row; `footprint-columns` is
116
+ * the Display Mode row, then, in the Columns mode, the presets and the column rows.
117
+ */
118
+ export function footprintFormRows(slot, model) {
119
+ if (slot === 'sierra-look')
120
+ return [classicPresetsRow()];
121
+ if (slot !== 'footprint-columns')
122
+ return [];
123
+ const rows = [displayModeRow(model)];
124
+ if (isFootprintColumnsMode(model))
125
+ rows.push(columnsPresetsRow(model), ...columnRows(model));
126
+ return rows;
127
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The row shape a host's settings form draws for a control the package describes (the footprint's Classic Presets and
3
+ * Columns: ./footprint-rows.ts). The field tables beside it (./indicator-fields.ts) name which keys each lane keeps and
4
+ * cannot say what a row shows or writes, so a described control rides this shape. It is renderer-agnostic and holds
5
+ * no words: a row names its words as locale keys, which the host translates with its own dictionary (web's i18n, the
6
+ * phone's word table), says what it shows for the model it was built for, and answers the model a click or a pick
7
+ * writes. The host's control applies that model, as a web slot row hands its dialog the model to apply and confirm.
8
+ *
9
+ * - `action`: a label and one button (`action` words). `apply(model)` answers the model the click writes.
10
+ * - `choice`: one value among `options`, drawn as a drop-down (`select`) or as chips (`chips`: each chip is a choice,
11
+ * never a switch). `value` is the option that is on for the model the row was built for, or null when none is (a
12
+ * layout of the user's own lights no preset). `pick(model, value)` answers the model the pick writes, and the model
13
+ * itself (the same object) when the pick writes nothing (a value no option names, or the lit chip): the host then
14
+ * applies nothing.
15
+ *
16
+ * A row is built for one model. After an apply the host builds the rows again from the model it now holds, since their
17
+ * values, and which rows show, follow the model. `apply` and `pick` take the host's current model, never a copy.
18
+ */
19
+ /** Words a host prints: a locale key, and the params its text fills (`{n}`). */
20
+ export interface SettingsFormWords {
21
+ readonly key: string;
22
+ readonly params?: Readonly<Record<string, string | number>>;
23
+ }
24
+ /** One option of a choice row: the value a pick writes, and its words. */
25
+ export interface SettingsFormOption {
26
+ readonly value: string;
27
+ readonly label: SettingsFormWords;
28
+ }
29
+ /** The settings bag a row reads and writes (an overlay's settings). */
30
+ export type SettingsFormModel = Record<string, unknown>;
31
+ interface SettingsFormRowBase {
32
+ /** Unique among the rows of one build: the host's key, and the stem of its test id. */
33
+ readonly id: string;
34
+ readonly label: SettingsFormWords;
35
+ readonly tooltip?: SettingsFormWords;
36
+ }
37
+ /** A label and one button. */
38
+ export interface SettingsFormActionRow extends SettingsFormRowBase {
39
+ readonly kind: 'action';
40
+ /** The button's words. */
41
+ readonly action: SettingsFormWords;
42
+ /** The model the click writes. */
43
+ apply<M extends SettingsFormModel>(model: M): M;
44
+ }
45
+ /** One value among options. */
46
+ export interface SettingsFormChoiceRow extends SettingsFormRowBase {
47
+ readonly kind: 'choice';
48
+ readonly look: 'select' | 'chips';
49
+ readonly options: readonly SettingsFormOption[];
50
+ /** The option on for the model the row was built for; null when none is. */
51
+ readonly value: string | null;
52
+ /** The model the pick writes; the model itself when the pick writes nothing. */
53
+ pick<M extends SettingsFormModel>(model: M, value: string): M;
54
+ }
55
+ export type SettingsFormRow = SettingsFormActionRow | SettingsFormChoiceRow;
56
+ export {};