@oanda/labs-instruments-table-widget 1.0.27 → 1.0.29

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 (35) hide show
  1. package/CHANGELOG.md +236 -0
  2. package/dist/main/InstrumentsTableWidget/Main.js +13 -3
  3. package/dist/main/InstrumentsTableWidget/Main.js.map +1 -1
  4. package/dist/main/InstrumentsTableWidget/config.js +6 -1
  5. package/dist/main/InstrumentsTableWidget/config.js.map +1 -1
  6. package/dist/main/gql/resolveInstrumentsWithFilters.js +5 -0
  7. package/dist/main/gql/resolveInstrumentsWithFilters.js.map +1 -1
  8. package/dist/main/gql/types/gql.js +1 -1
  9. package/dist/main/gql/types/gql.js.map +1 -1
  10. package/dist/main/gql/types/graphql.js +115 -1
  11. package/dist/main/gql/types/graphql.js.map +1 -1
  12. package/dist/main/translations/sources/en.json +7 -6
  13. package/dist/module/InstrumentsTableWidget/Main.js +15 -5
  14. package/dist/module/InstrumentsTableWidget/Main.js.map +1 -1
  15. package/dist/module/InstrumentsTableWidget/config.js +7 -2
  16. package/dist/module/InstrumentsTableWidget/config.js.map +1 -1
  17. package/dist/module/gql/resolveInstrumentsWithFilters.js +5 -0
  18. package/dist/module/gql/resolveInstrumentsWithFilters.js.map +1 -1
  19. package/dist/module/gql/types/gql.js +1 -1
  20. package/dist/module/gql/types/gql.js.map +1 -1
  21. package/dist/module/gql/types/graphql.js +114 -0
  22. package/dist/module/gql/types/graphql.js.map +1 -1
  23. package/dist/module/translations/sources/en.json +7 -6
  24. package/dist/types/InstrumentsTableWidget/config.d.ts +3 -1
  25. package/dist/types/gql/types/gql.d.ts +4 -2
  26. package/dist/types/gql/types/graphql.d.ts +22 -2
  27. package/package.json +3 -3
  28. package/src/InstrumentsTableWidget/Main.tsx +28 -1
  29. package/src/InstrumentsTableWidget/config.ts +10 -2
  30. package/src/gql/resolveInstrumentsWithFilters.ts +5 -0
  31. package/src/gql/types/gql.ts +3 -3
  32. package/src/gql/types/graphql.ts +103 -2
  33. package/src/translations/sources/en.json +7 -6
  34. package/test/Main.test.tsx +22 -0
  35. package/test/mocks.ts +53 -1
@@ -133,6 +133,13 @@ export enum Division {
133
133
  Otms = 'OTMS',
134
134
  }
135
135
 
136
+ export type ExtendedInstrument = {
137
+ __typename?: 'ExtendedInstrument';
138
+ displayName: Scalars['String']['output'];
139
+ name: Scalars['String']['output'];
140
+ tradeMode: TradeMode;
141
+ };
142
+
136
143
  export type Heatmap = {
137
144
  __typename?: 'Heatmap';
138
145
  instrument: Instrument;
@@ -158,8 +165,9 @@ export enum InstrumentDataSource {
158
165
 
159
166
  export type InstrumentTableResult = {
160
167
  __typename?: 'InstrumentTableResult';
161
- instruments: Array<Instrument>;
168
+ instruments: Array<ExtendedInstrument>;
162
169
  totalCount: Scalars['Int']['output'];
170
+ updatedAt: Scalars['String']['output'];
163
171
  };
164
172
 
165
173
  export type Matrix = {
@@ -259,6 +267,7 @@ export type QueryResolveInstrumentsWithFiltersArgs = {
259
267
  instruments?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
260
268
  offset?: InputMaybe<Scalars['Int']['input']>;
261
269
  searchPattern?: InputMaybe<Scalars['String']['input']>;
270
+ tradeModes?: InputMaybe<Array<InputMaybe<TradeMode>>>;
262
271
  };
263
272
 
264
273
  export type QuerySentimentArgs = {
@@ -372,6 +381,15 @@ export enum TopicalSort {
372
381
  Volatile = 'VOLATILE',
373
382
  }
374
383
 
384
+ export enum TradeMode {
385
+ TradeCloseonly = 'TRADE_CLOSEONLY',
386
+ TradeDisabled = 'TRADE_DISABLED',
387
+ TradeFull = 'TRADE_FULL',
388
+ TradeLongonly = 'TRADE_LONGONLY',
389
+ TradeShortonly = 'TRADE_SHORTONLY',
390
+ TradeUndefined = 'TRADE_UNDEFINED',
391
+ }
392
+
375
393
  export enum ValueAtRiskBars {
376
394
  C100 = 'C100',
377
395
  C200 = 'C200',
@@ -448,8 +466,10 @@ export type ResolveInstrumentsWithFiltersQueryVariables = Exact<{
448
466
  | InputMaybe<Scalars['String']['input']>
449
467
  >;
450
468
  searchPattern?: InputMaybe<Scalars['String']['input']>;
469
+ tradeModes?: InputMaybe<Array<InputMaybe<TradeMode>> | InputMaybe<TradeMode>>;
451
470
  count?: InputMaybe<Scalars['Int']['input']>;
452
471
  offset?: InputMaybe<Scalars['Int']['input']>;
472
+ withTradingModes: Scalars['Boolean']['input'];
453
473
  }>;
454
474
 
455
475
  export type ResolveInstrumentsWithFiltersQuery = {
@@ -457,10 +477,12 @@ export type ResolveInstrumentsWithFiltersQuery = {
457
477
  resolveInstrumentsWithFilters?: {
458
478
  __typename?: 'InstrumentTableResult';
459
479
  totalCount: number;
480
+ updatedAt?: string;
460
481
  instruments: Array<{
461
- __typename?: 'Instrument';
482
+ __typename?: 'ExtendedInstrument';
462
483
  name: string;
463
484
  displayName: string;
485
+ tradeMode?: TradeMode;
464
486
  }>;
465
487
  } | null;
466
488
  };
@@ -534,6 +556,20 @@ export const ResolveInstrumentsWithFiltersDocument = {
534
556
  },
535
557
  type: { kind: 'NamedType', name: { kind: 'Name', value: 'String' } },
536
558
  },
559
+ {
560
+ kind: 'VariableDefinition',
561
+ variable: {
562
+ kind: 'Variable',
563
+ name: { kind: 'Name', value: 'tradeModes' },
564
+ },
565
+ type: {
566
+ kind: 'ListType',
567
+ type: {
568
+ kind: 'NamedType',
569
+ name: { kind: 'Name', value: 'TradeMode' },
570
+ },
571
+ },
572
+ },
537
573
  {
538
574
  kind: 'VariableDefinition',
539
575
  variable: {
@@ -550,6 +586,20 @@ export const ResolveInstrumentsWithFiltersDocument = {
550
586
  },
551
587
  type: { kind: 'NamedType', name: { kind: 'Name', value: 'Int' } },
552
588
  },
589
+ {
590
+ kind: 'VariableDefinition',
591
+ variable: {
592
+ kind: 'Variable',
593
+ name: { kind: 'Name', value: 'withTradingModes' },
594
+ },
595
+ type: {
596
+ kind: 'NonNullType',
597
+ type: {
598
+ kind: 'NamedType',
599
+ name: { kind: 'Name', value: 'Boolean' },
600
+ },
601
+ },
602
+ },
553
603
  ],
554
604
  selectionSet: {
555
605
  kind: 'SelectionSet',
@@ -614,6 +664,14 @@ export const ResolveInstrumentsWithFiltersDocument = {
614
664
  name: { kind: 'Name', value: 'offset' },
615
665
  },
616
666
  },
667
+ {
668
+ kind: 'Argument',
669
+ name: { kind: 'Name', value: 'tradeModes' },
670
+ value: {
671
+ kind: 'Variable',
672
+ name: { kind: 'Name', value: 'tradeModes' },
673
+ },
674
+ },
617
675
  ],
618
676
  selectionSet: {
619
677
  kind: 'SelectionSet',
@@ -629,10 +687,53 @@ export const ResolveInstrumentsWithFiltersDocument = {
629
687
  kind: 'Field',
630
688
  name: { kind: 'Name', value: 'displayName' },
631
689
  },
690
+ {
691
+ kind: 'Field',
692
+ name: { kind: 'Name', value: 'tradeMode' },
693
+ directives: [
694
+ {
695
+ kind: 'Directive',
696
+ name: { kind: 'Name', value: 'include' },
697
+ arguments: [
698
+ {
699
+ kind: 'Argument',
700
+ name: { kind: 'Name', value: 'if' },
701
+ value: {
702
+ kind: 'Variable',
703
+ name: {
704
+ kind: 'Name',
705
+ value: 'withTradingModes',
706
+ },
707
+ },
708
+ },
709
+ ],
710
+ },
711
+ ],
712
+ },
632
713
  ],
633
714
  },
634
715
  },
635
716
  { kind: 'Field', name: { kind: 'Name', value: 'totalCount' } },
717
+ {
718
+ kind: 'Field',
719
+ name: { kind: 'Name', value: 'updatedAt' },
720
+ directives: [
721
+ {
722
+ kind: 'Directive',
723
+ name: { kind: 'Name', value: 'include' },
724
+ arguments: [
725
+ {
726
+ kind: 'Argument',
727
+ name: { kind: 'Name', value: 'if' },
728
+ value: {
729
+ kind: 'Variable',
730
+ name: { kind: 'Name', value: 'withTradingModes' },
731
+ },
732
+ },
733
+ ],
734
+ },
735
+ ],
736
+ },
636
737
  ],
637
738
  },
638
739
  },
@@ -3,7 +3,7 @@
3
3
  "asset_class": "Asset class",
4
4
  "bond": "Bond",
5
5
  "buy": "Buy",
6
- "close_only": "Close Only",
6
+ "close_only": "Close only",
7
7
  "commodity": "Commodity",
8
8
  "crypto": "Crypto",
9
9
  "currency": "Currency",
@@ -13,16 +13,17 @@
13
13
  "index": "Index",
14
14
  "instrument": "Instrument",
15
15
  "instrument_name": "Instrument name",
16
- "long_only": "Long Only",
16
+ "long_only": "Long only",
17
17
  "no_matching_results": "No matching results",
18
18
  "pagination_entries_range": "{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries",
19
19
  "search": "Search",
20
20
  "sell": "Sell",
21
21
  "share_cfds": "Share CFDs",
22
- "short_only": "Short Only",
22
+ "short_only": "Short only",
23
23
  "spread": "Spread",
24
24
  "symbol": "Symbol",
25
- "today_high": "Today High",
26
- "today_low": "Today Low",
27
- "trade_mode": "Trade Mode"
25
+ "today_high": "Today high",
26
+ "today_low": "Today low",
27
+ "trade_mode": "Trade mode",
28
+ "last_updated": "Last updated"
28
29
  }
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { MockedProvider } from '@apollo/client/testing';
5
5
  import {
6
+ DataRecordType,
6
7
  LiveRatesProvider,
7
8
  MockLayoutProvider,
8
9
  } from '@oanda/labs-widget-common';
@@ -18,6 +19,7 @@ import { Main } from '../src/InstrumentsTableWidget/Main';
18
19
  import {
19
20
  mockErrorQuery,
20
21
  mockInitialQuery,
22
+ mockTradingModeQuery,
21
23
  mockWithAssetClasses,
22
24
  } from './mocks';
23
25
 
@@ -154,4 +156,24 @@ describe('Main component', () => {
154
156
  expect(table).toBeInTheDocument();
155
157
  });
156
158
  });
159
+
160
+ it('should show last updated label for trading mode', async () => {
161
+ const { findByTestId } = render(
162
+ <MockedProvider mocks={[mockTradingModeQuery]}>
163
+ <LiveRatesProvider url="oanda.com">
164
+ <MockLayoutProvider>
165
+ <Main
166
+ assetClasses={[AssetClassName.Etfs]}
167
+ columns={[DataRecordType.TRADE_MODE, DataRecordType.SYMBOL]}
168
+ dataSource={InstrumentDataSource.Mt5}
169
+ division={Division.Oel}
170
+ />
171
+ </MockLayoutProvider>
172
+ </LiveRatesProvider>
173
+ </MockedProvider>
174
+ );
175
+
176
+ const label = await findByTestId('last-updated');
177
+ expect(label).toBeInTheDocument();
178
+ });
157
179
  });
package/test/mocks.ts CHANGED
@@ -20,6 +20,8 @@ const baseQueryVariables = {
20
20
  searchPattern: '',
21
21
  count: 10,
22
22
  offset: 0,
23
+ withTradingModes: false,
24
+ tradeModes: undefined,
23
25
  };
24
26
 
25
27
  const mockErrorQuery = {
@@ -33,6 +35,51 @@ const mockErrorQuery = {
33
35
  error: new Error('An error occurred'),
34
36
  };
35
37
 
38
+ const mockTradingModeQuery = {
39
+ request: {
40
+ query: resolveInstrumentsWithFilters,
41
+ variables: {
42
+ ...baseQueryVariables,
43
+ count: undefined,
44
+ instruments: [],
45
+ division: 'OEL',
46
+ assetClass: ['ETFS'],
47
+ dataSource: 'MT5',
48
+ tradeModes: ['TRADE_LONGONLY', 'TRADE_SHORTONLY', 'TRADE_CLOSEONLY'],
49
+ withTradingModes: true,
50
+ },
51
+ },
52
+ result: {
53
+ data: {
54
+ resolveInstrumentsWithFilters: {
55
+ instruments: [
56
+ {
57
+ name: 'VXXB_CFD.ETF',
58
+ displayName: 'IPATH SERIES B S&P 500 VIX',
59
+ tradeMode: 'TRADE_LONGONLY',
60
+ __typename: 'ExtendedInstrument',
61
+ },
62
+ {
63
+ name: 'SSO_CFD.ETF',
64
+ displayName: 'PROSHARES ULTRA S&P500',
65
+ tradeMode: 'TRADE_LONGONLY',
66
+ __typename: 'ExtendedInstrument',
67
+ },
68
+ {
69
+ name: 'TBT_CFD.ETF',
70
+ displayName: 'PROSHARES ULTRASHORT 20+Y TR',
71
+ tradeMode: 'TRADE_LONGONLY',
72
+ __typename: 'ExtendedInstrument',
73
+ },
74
+ ],
75
+ totalCount: 3,
76
+ updatedAt: '2025-07-24T08:28:03.546282088Z',
77
+ __typename: 'InstrumentTableResult',
78
+ },
79
+ },
80
+ },
81
+ };
82
+
36
83
  const mockInitialQuery = {
37
84
  request: {
38
85
  query: resolveInstrumentsWithFilters,
@@ -71,4 +118,9 @@ const mockWithAssetClasses = {
71
118
  },
72
119
  };
73
120
 
74
- export { mockErrorQuery, mockInitialQuery, mockWithAssetClasses };
121
+ export {
122
+ mockErrorQuery,
123
+ mockInitialQuery,
124
+ mockTradingModeQuery,
125
+ mockWithAssetClasses,
126
+ };