@oanda/labs-order-book-widget 1.0.173 → 1.0.175

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 (99) hide show
  1. package/CHANGELOG.md +1372 -0
  2. package/dist/main/OrderBookWidget/ChartWithData.js +7 -6
  3. package/dist/main/OrderBookWidget/ChartWithData.js.map +1 -1
  4. package/dist/main/OrderBookWidget/Main.js +11 -11
  5. package/dist/main/OrderBookWidget/Main.js.map +1 -1
  6. package/dist/main/OrderBookWidget/OrderBookWidget.js +9 -9
  7. package/dist/main/OrderBookWidget/OrderBookWidget.js.map +1 -1
  8. package/dist/main/OrderBookWidget/components/Chart/Chart.js +14 -14
  9. package/dist/main/OrderBookWidget/components/Chart/Chart.js.map +1 -1
  10. package/dist/main/OrderBookWidget/components/Chart/formatters.js +3 -3
  11. package/dist/main/OrderBookWidget/components/Chart/formatters.js.map +1 -1
  12. package/dist/main/OrderBookWidget/components/Chart/getOption.js +10 -9
  13. package/dist/main/OrderBookWidget/components/Chart/getOption.js.map +1 -1
  14. package/dist/main/OrderBookWidget/components/Chart/types.js.map +1 -1
  15. package/dist/main/OrderBookWidget/config.js.map +1 -1
  16. package/dist/main/OrderBookWidget/render.js +9 -9
  17. package/dist/main/OrderBookWidget/render.js.map +1 -1
  18. package/dist/main/OrderBookWidget/types.js.map +1 -1
  19. package/dist/main/gql/getOrderPositionBooks.js +3 -18
  20. package/dist/main/gql/getOrderPositionBooks.js.map +1 -1
  21. package/dist/main/gql/types/fragment-masking.js +3 -2
  22. package/dist/main/gql/types/fragment-masking.js.map +1 -1
  23. package/dist/main/gql/types/gql.js +3 -2
  24. package/dist/main/gql/types/gql.js.map +1 -1
  25. package/dist/main/gql/types/graphql.js +114 -114
  26. package/dist/main/gql/types/graphql.js.map +1 -1
  27. package/dist/main/gql/types/index.js.map +1 -1
  28. package/dist/main/index.js +8 -8
  29. package/dist/main/index.js.map +1 -1
  30. package/dist/main/translations/index.js +1 -1
  31. package/dist/main/translations/index.js.map +1 -1
  32. package/dist/main/translations/translations.js.map +1 -1
  33. package/dist/module/OrderBookWidget/ChartWithData.js +7 -6
  34. package/dist/module/OrderBookWidget/ChartWithData.js.map +1 -1
  35. package/dist/module/OrderBookWidget/Main.js +10 -10
  36. package/dist/module/OrderBookWidget/Main.js.map +1 -1
  37. package/dist/module/OrderBookWidget/OrderBookWidget.js +9 -9
  38. package/dist/module/OrderBookWidget/OrderBookWidget.js.map +1 -1
  39. package/dist/module/OrderBookWidget/components/Chart/Chart.js +14 -14
  40. package/dist/module/OrderBookWidget/components/Chart/Chart.js.map +1 -1
  41. package/dist/module/OrderBookWidget/components/Chart/formatters.js +3 -3
  42. package/dist/module/OrderBookWidget/components/Chart/formatters.js.map +1 -1
  43. package/dist/module/OrderBookWidget/components/Chart/getOption.js +11 -10
  44. package/dist/module/OrderBookWidget/components/Chart/getOption.js.map +1 -1
  45. package/dist/module/OrderBookWidget/components/Chart/types.js.map +1 -1
  46. package/dist/module/OrderBookWidget/config.js +1 -1
  47. package/dist/module/OrderBookWidget/config.js.map +1 -1
  48. package/dist/module/OrderBookWidget/render.js +10 -10
  49. package/dist/module/OrderBookWidget/render.js.map +1 -1
  50. package/dist/module/OrderBookWidget/types.js.map +1 -1
  51. package/dist/module/gql/getOrderPositionBooks.js +3 -18
  52. package/dist/module/gql/getOrderPositionBooks.js.map +1 -1
  53. package/dist/module/gql/types/fragment-masking.js +3 -2
  54. package/dist/module/gql/types/fragment-masking.js.map +1 -1
  55. package/dist/module/gql/types/gql.js +3 -2
  56. package/dist/module/gql/types/gql.js.map +1 -1
  57. package/dist/module/gql/types/graphql.js +114 -114
  58. package/dist/module/gql/types/graphql.js.map +1 -1
  59. package/dist/module/gql/types/index.js +2 -2
  60. package/dist/module/gql/types/index.js.map +1 -1
  61. package/dist/module/index.js +1 -1
  62. package/dist/module/index.js.map +1 -1
  63. package/dist/module/translations/index.js +1 -1
  64. package/dist/module/translations/index.js.map +1 -1
  65. package/dist/module/translations/translations.js.map +1 -1
  66. package/dist/types/OrderBookWidget/ChartWithData.d.ts +2 -2
  67. package/dist/types/OrderBookWidget/Main.d.ts +1 -1
  68. package/dist/types/OrderBookWidget/OrderBookWidget.d.ts +1 -1
  69. package/dist/types/OrderBookWidget/components/Chart/Chart.d.ts +1 -1
  70. package/dist/types/OrderBookWidget/components/Chart/formatters.d.ts +1 -1
  71. package/dist/types/OrderBookWidget/components/Chart/getOption.d.ts +1 -1
  72. package/dist/types/OrderBookWidget/components/Chart/types.d.ts +2 -2
  73. package/dist/types/OrderBookWidget/config.d.ts +1 -1
  74. package/dist/types/OrderBookWidget/types.d.ts +2 -2
  75. package/dist/types/gql/types/gql.d.ts +2 -2
  76. package/dist/types/gql/types/index.d.ts +2 -2
  77. package/dist/types/index.d.ts +1 -1
  78. package/dist/types/translations/index.d.ts +2 -2
  79. package/package.json +3 -3
  80. package/src/OrderBookWidget/ChartWithData.tsx +40 -39
  81. package/src/OrderBookWidget/Main.tsx +48 -30
  82. package/src/OrderBookWidget/OrderBookWidget.tsx +8 -8
  83. package/src/OrderBookWidget/components/Chart/Chart.tsx +41 -29
  84. package/src/OrderBookWidget/components/Chart/formatters.ts +11 -4
  85. package/src/OrderBookWidget/components/Chart/getOption.ts +205 -188
  86. package/src/OrderBookWidget/components/Chart/types.ts +10 -13
  87. package/src/OrderBookWidget/config.ts +76 -53
  88. package/src/OrderBookWidget/render.tsx +81 -52
  89. package/src/OrderBookWidget/types.ts +3 -2
  90. package/src/gql/getOrderPositionBooks.ts +5 -1
  91. package/src/gql/types/fragment-masking.ts +41 -21
  92. package/src/gql/types/gql.ts +7 -3
  93. package/src/gql/types/graphql.ts +165 -44
  94. package/src/gql/types/index.ts +2 -2
  95. package/src/index.ts +1 -1
  96. package/src/translations/index.ts +4 -4
  97. package/src/translations/translations.ts +1 -3
  98. package/test/Main.test.tsx +12 -9
  99. package/test/chartOptions.test.ts +18 -12
@@ -2,18 +2,31 @@
2
2
  import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
3
3
  export type Maybe<T> = T | null;
4
4
  export type InputMaybe<T> = Maybe<T>;
5
- export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
6
- export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
7
- export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
8
- export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
9
- export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
5
+ export type Exact<T extends { [key: string]: unknown }> = {
6
+ [K in keyof T]: T[K];
7
+ };
8
+ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
9
+ [SubKey in K]?: Maybe<T[SubKey]>;
10
+ };
11
+ export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
12
+ [SubKey in K]: Maybe<T[SubKey]>;
13
+ };
14
+ export type MakeEmpty<
15
+ T extends { [key: string]: unknown },
16
+ K extends keyof T,
17
+ > = { [_ in K]?: never };
18
+ export type Incremental<T> =
19
+ | T
20
+ | {
21
+ [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never;
22
+ };
10
23
  /** All built-in and custom scalars, mapped to their actual values */
11
24
  export type Scalars = {
12
- ID: { input: string; output: string; }
13
- String: { input: string; output: string; }
14
- Boolean: { input: boolean; output: boolean; }
15
- Int: { input: number; output: number; }
16
- Float: { input: number; output: number; }
25
+ ID: { input: string; output: string };
26
+ String: { input: string; output: string };
27
+ Boolean: { input: boolean; output: boolean };
28
+ Int: { input: number; output: number };
29
+ Float: { input: number; output: number };
17
30
  };
18
31
 
19
32
  export type AssetClass = {
@@ -28,12 +41,12 @@ export enum AssetClassName {
28
41
  Currency = 'CURRENCY',
29
42
  EquityShares = 'EQUITY_SHARES',
30
43
  Indices = 'INDICES',
31
- Rates = 'RATES'
44
+ Rates = 'RATES',
32
45
  }
33
46
 
34
47
  export enum BookType {
35
48
  Order = 'ORDER',
36
- Position = 'POSITION'
49
+ Position = 'POSITION',
37
50
  }
38
51
 
39
52
  export type CorrelationHeatmap = {
@@ -56,7 +69,7 @@ export enum CorrelationTimeUnit {
56
69
  M3 = 'M3',
57
70
  M6 = 'M6',
58
71
  W1 = 'W1',
59
- Y1 = 'Y1'
72
+ Y1 = 'Y1',
60
73
  }
61
74
 
62
75
  export enum CurrencyName {
@@ -67,7 +80,7 @@ export enum CurrencyName {
67
80
  Gbp = 'GBP',
68
81
  Jpy = 'JPY',
69
82
  Nzd = 'NZD',
70
- Usd = 'USD'
83
+ Usd = 'USD',
71
84
  }
72
85
 
73
86
  export type CurrencyPower = {
@@ -92,7 +105,7 @@ export enum CurrencyPowerBalanceTimeUnit {
92
105
  M1 = 'M1',
93
106
  M3 = 'M3',
94
107
  PreviousDay = 'PREVIOUS_DAY',
95
- W1 = 'W1'
108
+ W1 = 'W1',
96
109
  }
97
110
 
98
111
  export type CurrencyStrength = {
@@ -104,7 +117,7 @@ export type CurrencyStrength = {
104
117
 
105
118
  export enum DataSource {
106
119
  Ny4 = 'NY4',
107
- Ty3 = 'TY3'
120
+ Ty3 = 'TY3',
108
121
  }
109
122
 
110
123
  export enum Division {
@@ -116,7 +129,7 @@ export enum Division {
116
129
  Ogm = 'OGM',
117
130
  Oj = 'OJ',
118
131
  Opt = 'OPT',
119
- Otms = 'OTMS'
132
+ Otms = 'OTMS',
120
133
  }
121
134
 
122
135
  export type Heatmap = {
@@ -182,36 +195,30 @@ export type Query = {
182
195
  volatilityChartAssetClasses?: Maybe<Array<AssetClass>>;
183
196
  };
184
197
 
185
-
186
198
  export type QueryAssetClassesArgs = {
187
199
  division: Division;
188
200
  };
189
201
 
190
-
191
202
  export type QueryCorrelationHeatmapArgs = {
192
203
  division: Division;
193
204
  instruments?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
194
205
  timeSpans?: InputMaybe<Array<InputMaybe<CorrelationTimeUnit>>>;
195
206
  };
196
207
 
197
-
198
208
  export type QueryCorrelationMatrixArgs = {
199
209
  division: Division;
200
210
  instruments?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
201
211
  };
202
212
 
203
-
204
213
  export type QueryCurrencyPowerBalanceArgs = {
205
214
  timeUnit: CurrencyPowerBalanceTimeUnit;
206
215
  };
207
216
 
208
-
209
217
  export type QueryMapInstrumentNamesArgs = {
210
218
  division?: InputMaybe<Division>;
211
219
  instruments: Array<InputMaybe<Scalars['String']['input']>>;
212
220
  };
213
221
 
214
-
215
222
  export type QueryOrderPositionBooksArgs = {
216
223
  bookType: BookType;
217
224
  dataSource?: InputMaybe<DataSource>;
@@ -220,19 +227,16 @@ export type QueryOrderPositionBooksArgs = {
220
227
  region?: InputMaybe<Region>;
221
228
  };
222
229
 
223
-
224
230
  export type QuerySentimentArgs = {
225
231
  division?: InputMaybe<Division>;
226
232
  name: Scalars['String']['input'];
227
233
  };
228
234
 
229
-
230
235
  export type QuerySentimentListArgs = {
231
236
  division?: InputMaybe<Division>;
232
237
  sort?: InputMaybe<Sort>;
233
238
  };
234
239
 
235
-
236
240
  export type QueryTopicalInstrumentsArgs = {
237
241
  assetClass?: InputMaybe<AssetClassName>;
238
242
  count?: InputMaybe<Scalars['Int']['input']>;
@@ -241,25 +245,21 @@ export type QueryTopicalInstrumentsArgs = {
241
245
  sort: TopicalSort;
242
246
  };
243
247
 
244
-
245
248
  export type QueryTopicalInstrumentsChartsArgs = {
246
249
  division?: InputMaybe<Division>;
247
250
  instruments?: InputMaybe<Array<Scalars['String']['input']>>;
248
251
  };
249
252
 
250
-
251
253
  export type QueryTopicalInstrumentsTotalCountArgs = {
252
254
  assetClass?: InputMaybe<AssetClassName>;
253
255
  division?: InputMaybe<Division>;
254
256
  sort: TopicalSort;
255
257
  };
256
258
 
257
-
258
259
  export type QueryValueAtRiskAssetClassesArgs = {
259
260
  division?: InputMaybe<Division>;
260
261
  };
261
262
 
262
-
263
263
  export type QueryValueAtRiskChartArgs = {
264
264
  bars: ValueAtRiskBars;
265
265
  division?: InputMaybe<Division>;
@@ -267,7 +267,6 @@ export type QueryValueAtRiskChartArgs = {
267
267
  instrument: Scalars['String']['input'];
268
268
  };
269
269
 
270
-
271
270
  export type QueryVolatilityChartArgs = {
272
271
  division?: InputMaybe<Division>;
273
272
  instrument: Scalars['String']['input'];
@@ -275,7 +274,6 @@ export type QueryVolatilityChartArgs = {
275
274
  timeUnit: VolatilityChartTimeUnit;
276
275
  };
277
276
 
278
-
279
277
  export type QueryVolatilityChartAssetClassesArgs = {
280
278
  division?: InputMaybe<Division>;
281
279
  };
@@ -283,7 +281,7 @@ export type QueryVolatilityChartAssetClassesArgs = {
283
281
  export enum Region {
284
282
  Amer = 'AMER',
285
283
  Apac = 'APAC',
286
- Emea = 'EMEA'
284
+ Emea = 'EMEA',
287
285
  }
288
286
 
289
287
  export type Sentiment = {
@@ -302,7 +300,7 @@ export type SentimentInstrument = {
302
300
 
303
301
  export enum Sort {
304
302
  Bearish = 'BEARISH',
305
- Bullish = 'BULLISH'
303
+ Bullish = 'BULLISH',
306
304
  }
307
305
 
308
306
  export type StrengthRelation = {
@@ -337,13 +335,13 @@ export enum TopicalSort {
337
335
  Bullish = 'BULLISH',
338
336
  Hot = 'HOT',
339
337
  Popular = 'POPULAR',
340
- Volatile = 'VOLATILE'
338
+ Volatile = 'VOLATILE',
341
339
  }
342
340
 
343
341
  export enum ValueAtRiskBars {
344
342
  C100 = 'C100',
345
343
  C200 = 'C200',
346
- C300 = 'C300'
344
+ C300 = 'C300',
347
345
  }
348
346
 
349
347
  export type ValueAtRiskChart = {
@@ -373,7 +371,7 @@ export enum ValueAtRiskDuration {
373
371
  C3 = 'C3',
374
372
  C4 = 'C4',
375
373
  C5 = 'C5',
376
- C10 = 'C10'
374
+ C10 = 'C10',
377
375
  }
378
376
 
379
377
  export type VolatilityChart = {
@@ -396,13 +394,13 @@ export enum VolatilityChartTimeSpan {
396
394
  /** Valid for: W */
397
395
  W5 = 'W5',
398
396
  /** Valid for: W */
399
- W10 = 'W10'
397
+ W10 = 'W10',
400
398
  }
401
399
 
402
400
  export enum VolatilityChartTimeUnit {
403
401
  D = 'D',
404
402
  H = 'H',
405
- W = 'W'
403
+ W = 'W',
406
404
  }
407
405
 
408
406
  export type GetOrderPositionBooksQueryVariables = Exact<{
@@ -411,8 +409,131 @@ export type GetOrderPositionBooksQueryVariables = Exact<{
411
409
  recentHours?: InputMaybe<Scalars['Int']['input']>;
412
410
  }>;
413
411
 
414
-
415
- export type GetOrderPositionBooksQuery = { __typename?: 'Query', orderPositionBooks: Array<{ __typename?: 'OrderPositionData', bucketWidth: number, price?: number | null, time: string, buckets: Array<{ __typename?: 'OrderPositionBucket', price: number, longCountPercent: number, shortCountPercent: number } | null> } | null> };
416
-
417
-
418
- export const GetOrderPositionBooksDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderPositionBooks"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"instrument"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"bookType"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"BookType"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"recentHours"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderPositionBooks"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"instrument"},"value":{"kind":"Variable","name":{"kind":"Name","value":"instrument"}}},{"kind":"Argument","name":{"kind":"Name","value":"bookType"},"value":{"kind":"Variable","name":{"kind":"Name","value":"bookType"}}},{"kind":"Argument","name":{"kind":"Name","value":"recentHours"},"value":{"kind":"Variable","name":{"kind":"Name","value":"recentHours"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"bucketWidth"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"buckets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"longCountPercent"}},{"kind":"Field","name":{"kind":"Name","value":"shortCountPercent"}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderPositionBooksQuery, GetOrderPositionBooksQueryVariables>;
412
+ export type GetOrderPositionBooksQuery = {
413
+ __typename?: 'Query';
414
+ orderPositionBooks: Array<{
415
+ __typename?: 'OrderPositionData';
416
+ bucketWidth: number;
417
+ price?: number | null;
418
+ time: string;
419
+ buckets: Array<{
420
+ __typename?: 'OrderPositionBucket';
421
+ price: number;
422
+ longCountPercent: number;
423
+ shortCountPercent: number;
424
+ } | null>;
425
+ } | null>;
426
+ };
427
+
428
+ export const GetOrderPositionBooksDocument = {
429
+ kind: 'Document',
430
+ definitions: [
431
+ {
432
+ kind: 'OperationDefinition',
433
+ operation: 'query',
434
+ name: { kind: 'Name', value: 'GetOrderPositionBooks' },
435
+ variableDefinitions: [
436
+ {
437
+ kind: 'VariableDefinition',
438
+ variable: {
439
+ kind: 'Variable',
440
+ name: { kind: 'Name', value: 'instrument' },
441
+ },
442
+ type: {
443
+ kind: 'NonNullType',
444
+ type: {
445
+ kind: 'NamedType',
446
+ name: { kind: 'Name', value: 'String' },
447
+ },
448
+ },
449
+ },
450
+ {
451
+ kind: 'VariableDefinition',
452
+ variable: {
453
+ kind: 'Variable',
454
+ name: { kind: 'Name', value: 'bookType' },
455
+ },
456
+ type: {
457
+ kind: 'NonNullType',
458
+ type: {
459
+ kind: 'NamedType',
460
+ name: { kind: 'Name', value: 'BookType' },
461
+ },
462
+ },
463
+ },
464
+ {
465
+ kind: 'VariableDefinition',
466
+ variable: {
467
+ kind: 'Variable',
468
+ name: { kind: 'Name', value: 'recentHours' },
469
+ },
470
+ type: { kind: 'NamedType', name: { kind: 'Name', value: 'Int' } },
471
+ },
472
+ ],
473
+ selectionSet: {
474
+ kind: 'SelectionSet',
475
+ selections: [
476
+ {
477
+ kind: 'Field',
478
+ name: { kind: 'Name', value: 'orderPositionBooks' },
479
+ arguments: [
480
+ {
481
+ kind: 'Argument',
482
+ name: { kind: 'Name', value: 'instrument' },
483
+ value: {
484
+ kind: 'Variable',
485
+ name: { kind: 'Name', value: 'instrument' },
486
+ },
487
+ },
488
+ {
489
+ kind: 'Argument',
490
+ name: { kind: 'Name', value: 'bookType' },
491
+ value: {
492
+ kind: 'Variable',
493
+ name: { kind: 'Name', value: 'bookType' },
494
+ },
495
+ },
496
+ {
497
+ kind: 'Argument',
498
+ name: { kind: 'Name', value: 'recentHours' },
499
+ value: {
500
+ kind: 'Variable',
501
+ name: { kind: 'Name', value: 'recentHours' },
502
+ },
503
+ },
504
+ ],
505
+ selectionSet: {
506
+ kind: 'SelectionSet',
507
+ selections: [
508
+ { kind: 'Field', name: { kind: 'Name', value: 'bucketWidth' } },
509
+ { kind: 'Field', name: { kind: 'Name', value: 'price' } },
510
+ { kind: 'Field', name: { kind: 'Name', value: 'time' } },
511
+ {
512
+ kind: 'Field',
513
+ name: { kind: 'Name', value: 'buckets' },
514
+ selectionSet: {
515
+ kind: 'SelectionSet',
516
+ selections: [
517
+ { kind: 'Field', name: { kind: 'Name', value: 'price' } },
518
+ {
519
+ kind: 'Field',
520
+ name: { kind: 'Name', value: 'longCountPercent' },
521
+ },
522
+ {
523
+ kind: 'Field',
524
+ name: { kind: 'Name', value: 'shortCountPercent' },
525
+ },
526
+ ],
527
+ },
528
+ },
529
+ ],
530
+ },
531
+ },
532
+ ],
533
+ },
534
+ },
535
+ ],
536
+ } as unknown as DocumentNode<
537
+ GetOrderPositionBooksQuery,
538
+ GetOrderPositionBooksQueryVariables
539
+ >;
@@ -1,2 +1,2 @@
1
- export * from "./fragment-masking";
2
- export * from "./gql";
1
+ export * from './fragment-masking';
2
+ export * from './gql';
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './OrderBookWidget/types';
2
1
  export * from './OrderBookWidget/OrderBookWidget';
2
+ export * from './OrderBookWidget/types';
@@ -1,11 +1,11 @@
1
- import { Locale, Translations } from '@oanda/mono-i18n';
1
+ import type { Translations } from '@oanda/mono-i18n';
2
+ import { Locale } from '@oanda/mono-i18n';
2
3
 
3
4
  import en from './sources/en.json';
4
- import zhTW from './sources/zh_TW.json';
5
5
  import es from './sources/es.json';
6
6
  import th from './sources/th.json';
7
-
8
- import { defaultTranslations } from './translations';
7
+ import zhTW from './sources/zh_TW.json';
8
+ import type { defaultTranslations } from './translations';
9
9
 
10
10
  export type TranslationKey = keyof typeof defaultTranslations;
11
11
 
@@ -1,3 +1 @@
1
- export const defaultTranslations = {
2
-
3
- };
1
+ export const defaultTranslations = {};
@@ -1,14 +1,15 @@
1
1
  /**
2
2
  * @jest-environment jsdom
3
3
  */
4
- import React from 'react';
5
- import { render } from '@testing-library/react';
6
4
  import { MockedProvider } from '@apollo/client/testing';
7
5
  import { MockLayoutProvider } from '@oanda/labs-widget-common';
8
- import { Main } from '../src/OrderBookWidget/Main';
6
+ import { render } from '@testing-library/react';
7
+ import React from 'react';
8
+
9
+ import { InstrumentId } from '../src';
9
10
  import { getOrderPositionBooks } from '../src/gql/getOrderPositionBooks';
10
11
  import { BookType, Division } from '../src/gql/types/graphql';
11
- import { InstrumentId } from '../src';
12
+ import { Main } from '../src/OrderBookWidget/Main';
12
13
 
13
14
  const mocks = [
14
15
  {
@@ -70,12 +71,14 @@ describe('Main component', () => {
70
71
  <MockLayoutProvider>
71
72
  <Main division={Division.Oc} />
72
73
  </MockLayoutProvider>
73
- </MockedProvider>,
74
+ </MockedProvider>
74
75
  );
75
76
 
76
77
  expect(await findByTestId('order-book-widget')).toBeInTheDocument();
77
- expect(await findByTestId('last-updated')).toHaveTextContent('last_updated: 10:30:00, today (UTC).');
78
- expect((await findByTestId('select'))).toBeInTheDocument();
78
+ expect(await findByTestId('last-updated')).toHaveTextContent(
79
+ 'last_updated: 10:30:00, today (UTC).'
80
+ );
81
+ expect(await findByTestId('select')).toBeInTheDocument();
79
82
  expect(await findByTestId('order-book-chart')).toBeInTheDocument();
80
83
  });
81
84
  it('should render widget component', async () => {
@@ -84,11 +87,11 @@ describe('Main component', () => {
84
87
  <MockLayoutProvider>
85
88
  <Main division={Division.Oc} instrument={InstrumentId.EUR_AUD} />
86
89
  </MockLayoutProvider>
87
- </MockedProvider>,
90
+ </MockedProvider>
88
91
  );
89
92
 
90
93
  expect(await findByTestId('order-book-widget')).toBeInTheDocument();
91
- expect((await queryAllByTestId('select')).length).toBe(0);
94
+ expect(queryAllByTestId('select').length).toBe(0);
92
95
  expect(await findByTestId('order-book-chart')).toBeInTheDocument();
93
96
  });
94
97
  });
@@ -2,19 +2,25 @@ import { tooltipFormatter } from '../src/OrderBookWidget/components/Chart/format
2
2
 
3
3
  describe('tooltipFormatter', () => {
4
4
  it('should display correct label on order book data', () => {
5
- expect(tooltipFormatter({
6
- data: [1.235, 0.023, -0.012],
7
- precision: 5,
8
- lang: (label) => label,
9
- isOrderBook: true,
10
- })).toEqual('price: 1.23500<br />buy: 0.023%<br />sell: 0.012%');
5
+ expect(
6
+ tooltipFormatter({
7
+ data: [1.235, 0.023, -0.012],
8
+ precision: 5,
9
+ lang: (label) => label,
10
+ isOrderBook: true,
11
+ })
12
+ ).toEqual('price: 1.23500<br />buy: 0.023%<br />sell: 0.012%');
11
13
  });
12
14
  it('should display correct label on position book data', () => {
13
- expect(tooltipFormatter({
14
- data: [1.235, 0.023, -0.012],
15
- precision: 5,
16
- lang: (label) => label,
17
- isOrderBook: false,
18
- })).toEqual('price: 1.23500<br />long_positions: 0.023%<br />short_positions: 0.012%');
15
+ expect(
16
+ tooltipFormatter({
17
+ data: [1.235, 0.023, -0.012],
18
+ precision: 5,
19
+ lang: (label) => label,
20
+ isOrderBook: false,
21
+ })
22
+ ).toEqual(
23
+ 'price: 1.23500<br />long_positions: 0.023%<br />short_positions: 0.012%'
24
+ );
19
25
  });
20
26
  });