@flarehr/apollo-super-selection 4.9.20170 → 4.10.22178
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/apollo-super-selection/apollo-super-selection.esm.js +1 -1
- package/dist/lib/apollo-super-selection/p-bdcfc026.system.js +1 -1
- package/dist/lib/apollo-super-selection/p-c7663dc0.system.entry.js +69 -0
- package/dist/lib/apollo-super-selection/{p-41ab9fa2.entry.js → p-c9778916.entry.js} +1 -1
- package/dist/lib/cjs/sss-button_29.cjs.entry.js +54 -36
- package/dist/lib/collection/components/super-selection-app/api/super-selection.api.js +13 -7
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/default-fund/default-fund.js +1 -1
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund-inputs.js +16 -8
- package/dist/lib/collection/components/super-selection-app/misc/dropdown-async.js +21 -6
- package/dist/lib/collection/components/super-selection-app/services/australian-fund-lookup.service.js +5 -16
- package/dist/lib/collection/components/super-selection-app/services/existing-super-choice-info.service.js +1 -1
- package/dist/lib/esm/sss-button_29.entry.js +54 -36
- package/dist/lib/esm-es5/sss-button_29.entry.js +3 -3
- package/dist/lib/types/components/super-selection-app/api/super-selection.api.d.ts +2 -5
- package/dist/lib/types/components/super-selection-app/api/super-selection.api.dto.d.ts +4 -1
- package/dist/lib/types/components/super-selection-app/misc/dropdown-async.d.ts +9 -1
- package/dist/lib/types/components/super-selection-app/services/australian-fund-lookup.service.d.ts +3 -4
- package/dist/lib/types/components.d.ts +3 -3
- package/package.json +2 -1
- package/dist/lib/apollo-super-selection/p-936e27f1.system.entry.js +0 -69
|
@@ -264,7 +264,7 @@ class TapSubscriber extends datoramaAkita.Subscriber {
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
const AppVersion = '4.
|
|
267
|
+
const AppVersion = '4.10.22178';
|
|
268
268
|
|
|
269
269
|
// -------------------------------------------------------------------------------------
|
|
270
270
|
// guards
|
|
@@ -3279,13 +3279,23 @@ function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCha
|
|
|
3279
3279
|
class SuperSelectionApi {
|
|
3280
3280
|
async getAustralianFundsAsync(searchFilter, includeInactive = false) {
|
|
3281
3281
|
return buildBackendApiClient()
|
|
3282
|
-
.url(`super-choice/australian-funds?${this.toQueryString(includeInactive, searchFilter)}`)
|
|
3282
|
+
.url(`super-choice/australian-funds-v2?${this.toQueryString(includeInactive, searchFilter)}`)
|
|
3283
3283
|
.get()
|
|
3284
3284
|
.notFound(() => {
|
|
3285
3285
|
throw new Error('Failed to fetch the list of australian super funds.');
|
|
3286
3286
|
})
|
|
3287
3287
|
.json();
|
|
3288
3288
|
}
|
|
3289
|
+
async getAustralianFundAsync(usi, includeInactive) {
|
|
3290
|
+
const queryStr = includeInactive ? '?includeInactive=true' : '';
|
|
3291
|
+
return buildBackendApiClient()
|
|
3292
|
+
.url(`super-choice/australian-funds/${usi}${queryStr}`)
|
|
3293
|
+
.get()
|
|
3294
|
+
.notFound(() => {
|
|
3295
|
+
throw new Error('Failed to fetch australian super fund.');
|
|
3296
|
+
})
|
|
3297
|
+
.json();
|
|
3298
|
+
}
|
|
3289
3299
|
async getAppStateAsync() {
|
|
3290
3300
|
return buildBackendApiClient()
|
|
3291
3301
|
.url('client-app-state')
|
|
@@ -3296,12 +3306,8 @@ class SuperSelectionApi {
|
|
|
3296
3306
|
.json();
|
|
3297
3307
|
}
|
|
3298
3308
|
toSearchFilterQueryString(searchFilter) {
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
return `search=${searchFilter.searchString}&maxRecordCount=${searchFilter.maxRecordCount}`;
|
|
3302
|
-
case 'usiMatch':
|
|
3303
|
-
return `usi=${searchFilter.usi}`;
|
|
3304
|
-
}
|
|
3309
|
+
return (`search=${searchFilter.searchString}` +
|
|
3310
|
+
(searchFilter.maxRecordCount > 0 ? '&maxRecordCount=' + searchFilter.maxRecordCount : ''));
|
|
3305
3311
|
}
|
|
3306
3312
|
toQueryString(includeInactive, searchFilter) {
|
|
3307
3313
|
const search = this.toSearchFilterQueryString(searchFilter);
|
|
@@ -3727,26 +3733,15 @@ const CustomFund = class {
|
|
|
3727
3733
|
injectHistory(CustomFund);
|
|
3728
3734
|
|
|
3729
3735
|
class AustralianFundLookupService {
|
|
3730
|
-
searchFundsAsync(searchString, maxRecordCount) {
|
|
3736
|
+
async searchFundsAsync(searchString, maxRecordCount) {
|
|
3731
3737
|
return superSelectionApi.getAustralianFundsAsync({
|
|
3732
|
-
type: 'partialMatch',
|
|
3733
3738
|
searchString,
|
|
3734
3739
|
maxRecordCount
|
|
3735
3740
|
});
|
|
3736
3741
|
}
|
|
3737
|
-
async
|
|
3738
|
-
const
|
|
3739
|
-
|
|
3740
|
-
return Option.some(results[0]);
|
|
3741
|
-
}
|
|
3742
|
-
return Option.none;
|
|
3743
|
-
}
|
|
3744
|
-
async getFundByUsiAsync(usi) {
|
|
3745
|
-
const results = await superSelectionApi.getAustralianFundsAsync({ type: 'usiMatch', usi }, true);
|
|
3746
|
-
if (results.length === 1) {
|
|
3747
|
-
return Option.some(results[0]);
|
|
3748
|
-
}
|
|
3749
|
-
return Option.none;
|
|
3742
|
+
async getFundAsync(usi, includeInactive) {
|
|
3743
|
+
const result = await superSelectionApi.getAustralianFundAsync(usi, includeInactive);
|
|
3744
|
+
return Option.some(result);
|
|
3750
3745
|
}
|
|
3751
3746
|
}
|
|
3752
3747
|
const australianFundLookupService = new AustralianFundLookupService();
|
|
@@ -3804,7 +3799,7 @@ const DefaultFund = class {
|
|
|
3804
3799
|
return;
|
|
3805
3800
|
}
|
|
3806
3801
|
this.isDefaultFundExists = true;
|
|
3807
|
-
const defaultFundSearchResult = await australianFundLookupService.
|
|
3802
|
+
const defaultFundSearchResult = await australianFundLookupService.getFundAsync(defaultFundUsi.value, true);
|
|
3808
3803
|
if (Option.isNone(defaultFundSearchResult)) {
|
|
3809
3804
|
this.isInvalidDefaultFund = true;
|
|
3810
3805
|
return;
|
|
@@ -3863,10 +3858,22 @@ const SelectInputAsync = class {
|
|
|
3863
3858
|
this.inputValue = searchQuery;
|
|
3864
3859
|
this.searchState = 'in progress';
|
|
3865
3860
|
};
|
|
3866
|
-
this.onCompleteSearch = (
|
|
3867
|
-
this.filteredOptions = results;
|
|
3861
|
+
this.onCompleteSearch = (result) => {
|
|
3868
3862
|
this.highlightedOptionIndex = undefined;
|
|
3869
|
-
|
|
3863
|
+
switch (result.kind) {
|
|
3864
|
+
case 'too-many-results':
|
|
3865
|
+
this.searchState = 'too many results';
|
|
3866
|
+
this.filteredOptions = [];
|
|
3867
|
+
break;
|
|
3868
|
+
case 'success':
|
|
3869
|
+
this.searchState = 'done';
|
|
3870
|
+
this.filteredOptions = result.value;
|
|
3871
|
+
break;
|
|
3872
|
+
default:
|
|
3873
|
+
this.searchState = 'done';
|
|
3874
|
+
this.filteredOptions = [];
|
|
3875
|
+
break;
|
|
3876
|
+
}
|
|
3870
3877
|
};
|
|
3871
3878
|
this.renderFilteredResults = () => {
|
|
3872
3879
|
if (this.searchState === 'pristine') {
|
|
@@ -3875,6 +3882,9 @@ const SelectInputAsync = class {
|
|
|
3875
3882
|
if (this.searchState === 'in progress') {
|
|
3876
3883
|
return index.h("span", { class: "cursor-pointer text-gray-500 py-1.5 pl-4" }, "Searching...");
|
|
3877
3884
|
}
|
|
3885
|
+
if (this.searchState === 'too many results') {
|
|
3886
|
+
return (index.h("span", { class: "cursor-pointer text-gray-500 py-1.5 pl-4" }, "Keep typing to narrow down your search."));
|
|
3887
|
+
}
|
|
3878
3888
|
if (this.filteredOptions.length === 0) {
|
|
3879
3889
|
return (index.h("span", { class: "cursor-pointer text-gray-500 py-1.5 pl-4" }, "No items match your search"));
|
|
3880
3890
|
}
|
|
@@ -4283,7 +4293,7 @@ class ExistingFundService {
|
|
|
4283
4293
|
.text();
|
|
4284
4294
|
}
|
|
4285
4295
|
getFundByUsiAsync(usi) {
|
|
4286
|
-
return australianFundLookupService.
|
|
4296
|
+
return australianFundLookupService.getFundAsync(usi, true);
|
|
4287
4297
|
}
|
|
4288
4298
|
toFundValidState(fund) {
|
|
4289
4299
|
if (isSome(fund)) {
|
|
@@ -4496,15 +4506,23 @@ const MyOwnFundInputs = class {
|
|
|
4496
4506
|
index.registerInstance(this, hostRef);
|
|
4497
4507
|
this.formChanged = index.createEvent(this, "formChanged", 7);
|
|
4498
4508
|
this.MIN_SEARCH_STRING_LENGTH = 3;
|
|
4499
|
-
this.MAX_RECORD_COUNT =
|
|
4509
|
+
this.MAX_RECORD_COUNT = 25;
|
|
4500
4510
|
this.searchFundsAsync = async (searchBy) => {
|
|
4501
|
-
const
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4511
|
+
const response = await australianFundLookupService.searchFundsAsync(searchBy, this.MAX_RECORD_COUNT);
|
|
4512
|
+
switch (response.result) {
|
|
4513
|
+
case 'TooManyResults': {
|
|
4514
|
+
return { kind: 'too-many-results' };
|
|
4515
|
+
}
|
|
4516
|
+
default: {
|
|
4517
|
+
const funds = response.data
|
|
4518
|
+
.sort((a, b) => a.productName.localeCompare(b.productName))
|
|
4519
|
+
.map((fund) => ({
|
|
4520
|
+
label: `${fund.productName} (${fund.usi})`,
|
|
4521
|
+
value: fund.usi
|
|
4522
|
+
}));
|
|
4523
|
+
return { kind: 'success', value: funds };
|
|
4524
|
+
}
|
|
4525
|
+
}
|
|
4508
4526
|
};
|
|
4509
4527
|
}
|
|
4510
4528
|
render() {
|
|
@@ -2,13 +2,23 @@ import { buildBackendApiClient } from './api-client';
|
|
|
2
2
|
export class SuperSelectionApi {
|
|
3
3
|
async getAustralianFundsAsync(searchFilter, includeInactive = false) {
|
|
4
4
|
return buildBackendApiClient()
|
|
5
|
-
.url(`super-choice/australian-funds?${this.toQueryString(includeInactive, searchFilter)}`)
|
|
5
|
+
.url(`super-choice/australian-funds-v2?${this.toQueryString(includeInactive, searchFilter)}`)
|
|
6
6
|
.get()
|
|
7
7
|
.notFound(() => {
|
|
8
8
|
throw new Error('Failed to fetch the list of australian super funds.');
|
|
9
9
|
})
|
|
10
10
|
.json();
|
|
11
11
|
}
|
|
12
|
+
async getAustralianFundAsync(usi, includeInactive) {
|
|
13
|
+
const queryStr = includeInactive ? '?includeInactive=true' : '';
|
|
14
|
+
return buildBackendApiClient()
|
|
15
|
+
.url(`super-choice/australian-funds/${usi}${queryStr}`)
|
|
16
|
+
.get()
|
|
17
|
+
.notFound(() => {
|
|
18
|
+
throw new Error('Failed to fetch australian super fund.');
|
|
19
|
+
})
|
|
20
|
+
.json();
|
|
21
|
+
}
|
|
12
22
|
async getAppStateAsync() {
|
|
13
23
|
return buildBackendApiClient()
|
|
14
24
|
.url('client-app-state')
|
|
@@ -19,12 +29,8 @@ export class SuperSelectionApi {
|
|
|
19
29
|
.json();
|
|
20
30
|
}
|
|
21
31
|
toSearchFilterQueryString(searchFilter) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return `search=${searchFilter.searchString}&maxRecordCount=${searchFilter.maxRecordCount}`;
|
|
25
|
-
case 'usiMatch':
|
|
26
|
-
return `usi=${searchFilter.usi}`;
|
|
27
|
-
}
|
|
32
|
+
return (`search=${searchFilter.searchString}` +
|
|
33
|
+
(searchFilter.maxRecordCount > 0 ? '&maxRecordCount=' + searchFilter.maxRecordCount : ''));
|
|
28
34
|
}
|
|
29
35
|
toQueryString(includeInactive, searchFilter) {
|
|
30
36
|
const search = this.toSearchFilterQueryString(searchFilter);
|
|
@@ -17,7 +17,7 @@ export class DefaultFund {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
this.isDefaultFundExists = true;
|
|
20
|
-
const defaultFundSearchResult = await australianFundLookupService.
|
|
20
|
+
const defaultFundSearchResult = await australianFundLookupService.getFundAsync(defaultFundUsi.value, true);
|
|
21
21
|
if (O.isNone(defaultFundSearchResult)) {
|
|
22
22
|
this.isInvalidDefaultFund = true;
|
|
23
23
|
return;
|
|
@@ -5,15 +5,23 @@ import customFundState from '../custom-fund.store';
|
|
|
5
5
|
export class MyOwnFundInputs {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.MIN_SEARCH_STRING_LENGTH = 3;
|
|
8
|
-
this.MAX_RECORD_COUNT =
|
|
8
|
+
this.MAX_RECORD_COUNT = 25;
|
|
9
9
|
this.searchFundsAsync = async (searchBy) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
const response = await australianFundLookupService.searchFundsAsync(searchBy, this.MAX_RECORD_COUNT);
|
|
11
|
+
switch (response.result) {
|
|
12
|
+
case 'TooManyResults': {
|
|
13
|
+
return { kind: 'too-many-results' };
|
|
14
|
+
}
|
|
15
|
+
default: {
|
|
16
|
+
const funds = response.data
|
|
17
|
+
.sort((a, b) => a.productName.localeCompare(b.productName))
|
|
18
|
+
.map((fund) => ({
|
|
19
|
+
label: `${fund.productName} (${fund.usi})`,
|
|
20
|
+
value: fund.usi
|
|
21
|
+
}));
|
|
22
|
+
return { kind: 'success', value: funds };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
17
25
|
};
|
|
18
26
|
}
|
|
19
27
|
render() {
|
|
@@ -22,10 +22,22 @@ export class SelectInputAsync {
|
|
|
22
22
|
this.inputValue = searchQuery;
|
|
23
23
|
this.searchState = 'in progress';
|
|
24
24
|
};
|
|
25
|
-
this.onCompleteSearch = (
|
|
26
|
-
this.filteredOptions = results;
|
|
25
|
+
this.onCompleteSearch = (result) => {
|
|
27
26
|
this.highlightedOptionIndex = undefined;
|
|
28
|
-
|
|
27
|
+
switch (result.kind) {
|
|
28
|
+
case 'too-many-results':
|
|
29
|
+
this.searchState = 'too many results';
|
|
30
|
+
this.filteredOptions = [];
|
|
31
|
+
break;
|
|
32
|
+
case 'success':
|
|
33
|
+
this.searchState = 'done';
|
|
34
|
+
this.filteredOptions = result.value;
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
this.searchState = 'done';
|
|
38
|
+
this.filteredOptions = [];
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
29
41
|
};
|
|
30
42
|
this.renderFilteredResults = () => {
|
|
31
43
|
if (this.searchState === 'pristine') {
|
|
@@ -34,6 +46,9 @@ export class SelectInputAsync {
|
|
|
34
46
|
if (this.searchState === 'in progress') {
|
|
35
47
|
return h("span", { class: "cursor-pointer text-gray-500 py-1.5 pl-4" }, "Searching...");
|
|
36
48
|
}
|
|
49
|
+
if (this.searchState === 'too many results') {
|
|
50
|
+
return (h("span", { class: "cursor-pointer text-gray-500 py-1.5 pl-4" }, "Keep typing to narrow down your search."));
|
|
51
|
+
}
|
|
37
52
|
if (this.filteredOptions.length === 0) {
|
|
38
53
|
return (h("span", { class: "cursor-pointer text-gray-500 py-1.5 pl-4" }, "No items match your search"));
|
|
39
54
|
}
|
|
@@ -179,13 +194,13 @@ export class SelectInputAsync {
|
|
|
179
194
|
"type": "unknown",
|
|
180
195
|
"mutable": false,
|
|
181
196
|
"complexType": {
|
|
182
|
-
"original": "(query: string) => Promise<
|
|
183
|
-
"resolved": "((query: string) => Promise<
|
|
197
|
+
"original": "(query: string) => Promise<SearchResult<unknown>>",
|
|
198
|
+
"resolved": "((query: string) => Promise<SearchResult<unknown>>) | undefined",
|
|
184
199
|
"references": {
|
|
185
200
|
"Promise": {
|
|
186
201
|
"location": "global"
|
|
187
202
|
},
|
|
188
|
-
"
|
|
203
|
+
"SearchResult": {
|
|
189
204
|
"location": "local"
|
|
190
205
|
}
|
|
191
206
|
}
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { some } from 'fp-ts/lib/Option';
|
|
2
2
|
import superSelectionApi from '../api/super-selection.api';
|
|
3
3
|
export class AustralianFundLookupService {
|
|
4
|
-
searchFundsAsync(searchString, maxRecordCount) {
|
|
4
|
+
async searchFundsAsync(searchString, maxRecordCount) {
|
|
5
5
|
return superSelectionApi.getAustralianFundsAsync({
|
|
6
|
-
type: 'partialMatch',
|
|
7
6
|
searchString,
|
|
8
7
|
maxRecordCount
|
|
9
8
|
});
|
|
10
9
|
}
|
|
11
|
-
async
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
return some(results[0]);
|
|
15
|
-
}
|
|
16
|
-
return none;
|
|
17
|
-
}
|
|
18
|
-
async getFundByUsiAsync(usi) {
|
|
19
|
-
const results = await superSelectionApi.getAustralianFundsAsync({ type: 'usiMatch', usi }, true);
|
|
20
|
-
if (results.length === 1) {
|
|
21
|
-
return some(results[0]);
|
|
22
|
-
}
|
|
23
|
-
return none;
|
|
10
|
+
async getFundAsync(usi, includeInactive) {
|
|
11
|
+
const result = await superSelectionApi.getAustralianFundAsync(usi, includeInactive);
|
|
12
|
+
return some(result);
|
|
24
13
|
}
|
|
25
14
|
}
|
|
26
15
|
export default new AustralianFundLookupService();
|
|
@@ -81,7 +81,7 @@ export class ExistingFundService {
|
|
|
81
81
|
.text();
|
|
82
82
|
}
|
|
83
83
|
getFundByUsiAsync(usi) {
|
|
84
|
-
return australianFundLookupService.
|
|
84
|
+
return australianFundLookupService.getFundAsync(usi, true);
|
|
85
85
|
}
|
|
86
86
|
toFundValidState(fund) {
|
|
87
87
|
if (isSome(fund)) {
|
|
@@ -260,7 +260,7 @@ class TapSubscriber extends Subscriber {
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
const AppVersion = '4.
|
|
263
|
+
const AppVersion = '4.10.22178';
|
|
264
264
|
|
|
265
265
|
// -------------------------------------------------------------------------------------
|
|
266
266
|
// guards
|
|
@@ -3275,13 +3275,23 @@ function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCha
|
|
|
3275
3275
|
class SuperSelectionApi {
|
|
3276
3276
|
async getAustralianFundsAsync(searchFilter, includeInactive = false) {
|
|
3277
3277
|
return buildBackendApiClient()
|
|
3278
|
-
.url(`super-choice/australian-funds?${this.toQueryString(includeInactive, searchFilter)}`)
|
|
3278
|
+
.url(`super-choice/australian-funds-v2?${this.toQueryString(includeInactive, searchFilter)}`)
|
|
3279
3279
|
.get()
|
|
3280
3280
|
.notFound(() => {
|
|
3281
3281
|
throw new Error('Failed to fetch the list of australian super funds.');
|
|
3282
3282
|
})
|
|
3283
3283
|
.json();
|
|
3284
3284
|
}
|
|
3285
|
+
async getAustralianFundAsync(usi, includeInactive) {
|
|
3286
|
+
const queryStr = includeInactive ? '?includeInactive=true' : '';
|
|
3287
|
+
return buildBackendApiClient()
|
|
3288
|
+
.url(`super-choice/australian-funds/${usi}${queryStr}`)
|
|
3289
|
+
.get()
|
|
3290
|
+
.notFound(() => {
|
|
3291
|
+
throw new Error('Failed to fetch australian super fund.');
|
|
3292
|
+
})
|
|
3293
|
+
.json();
|
|
3294
|
+
}
|
|
3285
3295
|
async getAppStateAsync() {
|
|
3286
3296
|
return buildBackendApiClient()
|
|
3287
3297
|
.url('client-app-state')
|
|
@@ -3292,12 +3302,8 @@ class SuperSelectionApi {
|
|
|
3292
3302
|
.json();
|
|
3293
3303
|
}
|
|
3294
3304
|
toSearchFilterQueryString(searchFilter) {
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
return `search=${searchFilter.searchString}&maxRecordCount=${searchFilter.maxRecordCount}`;
|
|
3298
|
-
case 'usiMatch':
|
|
3299
|
-
return `usi=${searchFilter.usi}`;
|
|
3300
|
-
}
|
|
3305
|
+
return (`search=${searchFilter.searchString}` +
|
|
3306
|
+
(searchFilter.maxRecordCount > 0 ? '&maxRecordCount=' + searchFilter.maxRecordCount : ''));
|
|
3301
3307
|
}
|
|
3302
3308
|
toQueryString(includeInactive, searchFilter) {
|
|
3303
3309
|
const search = this.toSearchFilterQueryString(searchFilter);
|
|
@@ -3723,26 +3729,15 @@ const CustomFund = class {
|
|
|
3723
3729
|
injectHistory(CustomFund);
|
|
3724
3730
|
|
|
3725
3731
|
class AustralianFundLookupService {
|
|
3726
|
-
searchFundsAsync(searchString, maxRecordCount) {
|
|
3732
|
+
async searchFundsAsync(searchString, maxRecordCount) {
|
|
3727
3733
|
return superSelectionApi.getAustralianFundsAsync({
|
|
3728
|
-
type: 'partialMatch',
|
|
3729
3734
|
searchString,
|
|
3730
3735
|
maxRecordCount
|
|
3731
3736
|
});
|
|
3732
3737
|
}
|
|
3733
|
-
async
|
|
3734
|
-
const
|
|
3735
|
-
|
|
3736
|
-
return Option.some(results[0]);
|
|
3737
|
-
}
|
|
3738
|
-
return Option.none;
|
|
3739
|
-
}
|
|
3740
|
-
async getFundByUsiAsync(usi) {
|
|
3741
|
-
const results = await superSelectionApi.getAustralianFundsAsync({ type: 'usiMatch', usi }, true);
|
|
3742
|
-
if (results.length === 1) {
|
|
3743
|
-
return Option.some(results[0]);
|
|
3744
|
-
}
|
|
3745
|
-
return Option.none;
|
|
3738
|
+
async getFundAsync(usi, includeInactive) {
|
|
3739
|
+
const result = await superSelectionApi.getAustralianFundAsync(usi, includeInactive);
|
|
3740
|
+
return Option.some(result);
|
|
3746
3741
|
}
|
|
3747
3742
|
}
|
|
3748
3743
|
const australianFundLookupService = new AustralianFundLookupService();
|
|
@@ -3800,7 +3795,7 @@ const DefaultFund = class {
|
|
|
3800
3795
|
return;
|
|
3801
3796
|
}
|
|
3802
3797
|
this.isDefaultFundExists = true;
|
|
3803
|
-
const defaultFundSearchResult = await australianFundLookupService.
|
|
3798
|
+
const defaultFundSearchResult = await australianFundLookupService.getFundAsync(defaultFundUsi.value, true);
|
|
3804
3799
|
if (Option.isNone(defaultFundSearchResult)) {
|
|
3805
3800
|
this.isInvalidDefaultFund = true;
|
|
3806
3801
|
return;
|
|
@@ -3859,10 +3854,22 @@ const SelectInputAsync = class {
|
|
|
3859
3854
|
this.inputValue = searchQuery;
|
|
3860
3855
|
this.searchState = 'in progress';
|
|
3861
3856
|
};
|
|
3862
|
-
this.onCompleteSearch = (
|
|
3863
|
-
this.filteredOptions = results;
|
|
3857
|
+
this.onCompleteSearch = (result) => {
|
|
3864
3858
|
this.highlightedOptionIndex = undefined;
|
|
3865
|
-
|
|
3859
|
+
switch (result.kind) {
|
|
3860
|
+
case 'too-many-results':
|
|
3861
|
+
this.searchState = 'too many results';
|
|
3862
|
+
this.filteredOptions = [];
|
|
3863
|
+
break;
|
|
3864
|
+
case 'success':
|
|
3865
|
+
this.searchState = 'done';
|
|
3866
|
+
this.filteredOptions = result.value;
|
|
3867
|
+
break;
|
|
3868
|
+
default:
|
|
3869
|
+
this.searchState = 'done';
|
|
3870
|
+
this.filteredOptions = [];
|
|
3871
|
+
break;
|
|
3872
|
+
}
|
|
3866
3873
|
};
|
|
3867
3874
|
this.renderFilteredResults = () => {
|
|
3868
3875
|
if (this.searchState === 'pristine') {
|
|
@@ -3871,6 +3878,9 @@ const SelectInputAsync = class {
|
|
|
3871
3878
|
if (this.searchState === 'in progress') {
|
|
3872
3879
|
return h("span", { class: "cursor-pointer text-gray-500 py-1.5 pl-4" }, "Searching...");
|
|
3873
3880
|
}
|
|
3881
|
+
if (this.searchState === 'too many results') {
|
|
3882
|
+
return (h("span", { class: "cursor-pointer text-gray-500 py-1.5 pl-4" }, "Keep typing to narrow down your search."));
|
|
3883
|
+
}
|
|
3874
3884
|
if (this.filteredOptions.length === 0) {
|
|
3875
3885
|
return (h("span", { class: "cursor-pointer text-gray-500 py-1.5 pl-4" }, "No items match your search"));
|
|
3876
3886
|
}
|
|
@@ -4279,7 +4289,7 @@ class ExistingFundService {
|
|
|
4279
4289
|
.text();
|
|
4280
4290
|
}
|
|
4281
4291
|
getFundByUsiAsync(usi) {
|
|
4282
|
-
return australianFundLookupService.
|
|
4292
|
+
return australianFundLookupService.getFundAsync(usi, true);
|
|
4283
4293
|
}
|
|
4284
4294
|
toFundValidState(fund) {
|
|
4285
4295
|
if (isSome(fund)) {
|
|
@@ -4492,15 +4502,23 @@ const MyOwnFundInputs = class {
|
|
|
4492
4502
|
registerInstance(this, hostRef);
|
|
4493
4503
|
this.formChanged = createEvent(this, "formChanged", 7);
|
|
4494
4504
|
this.MIN_SEARCH_STRING_LENGTH = 3;
|
|
4495
|
-
this.MAX_RECORD_COUNT =
|
|
4505
|
+
this.MAX_RECORD_COUNT = 25;
|
|
4496
4506
|
this.searchFundsAsync = async (searchBy) => {
|
|
4497
|
-
const
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4507
|
+
const response = await australianFundLookupService.searchFundsAsync(searchBy, this.MAX_RECORD_COUNT);
|
|
4508
|
+
switch (response.result) {
|
|
4509
|
+
case 'TooManyResults': {
|
|
4510
|
+
return { kind: 'too-many-results' };
|
|
4511
|
+
}
|
|
4512
|
+
default: {
|
|
4513
|
+
const funds = response.data
|
|
4514
|
+
.sort((a, b) => a.productName.localeCompare(b.productName))
|
|
4515
|
+
.map((fund) => ({
|
|
4516
|
+
label: `${fund.productName} (${fund.usi})`,
|
|
4517
|
+
value: fund.usi
|
|
4518
|
+
}));
|
|
4519
|
+
return { kind: 'success', value: funds };
|
|
4520
|
+
}
|
|
4521
|
+
}
|
|
4504
4522
|
};
|
|
4505
4523
|
}
|
|
4506
4524
|
render() {
|