@flarehr/apollo-super-selection 5.54.16008 → 5.55.16332
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.css +1 -1
- package/dist/lib/apollo-super-selection/apollo-super-selection.esm.js +1 -1
- package/dist/lib/apollo-super-selection/apollo-super-selection.js +1 -1
- package/dist/lib/apollo-super-selection/p-1596c9a2.system.entry.js +69 -0
- package/dist/lib/apollo-super-selection/{p-ef3afa00.system.entry.js → p-22939048.system.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/p-2590548f.system.js +1 -0
- package/dist/lib/apollo-super-selection/{p-02f24922.system.entry.js → p-2b42304a.system.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/{p-9c855634.entry.js → p-33eca162.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/p-4e871154.entry.js +1 -0
- package/dist/lib/apollo-super-selection/{p-6ac8791e.system.entry.js → p-53b231f0.system.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/{p-b89b68db.entry.js → p-5c73c587.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/p-645755ee.system.entry.js +1 -0
- package/dist/lib/apollo-super-selection/{p-fcb4050d.entry.js → p-69bbf1dd.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/p-6b03f1b2.entry.js +1 -0
- package/dist/lib/apollo-super-selection/{p-44bec843.system.js → p-71ca4cf8.system.js} +1 -1
- package/dist/lib/apollo-super-selection/p-8f3cc4bf.entry.js +14 -0
- package/dist/lib/apollo-super-selection/p-97188c78.system.js +1 -0
- package/dist/lib/apollo-super-selection/p-99266549.js +1 -0
- package/dist/lib/apollo-super-selection/{p-23cfdd82.entry.js → p-9d2a7c0e.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/p-bd6e6a8f.system.js +1 -0
- package/dist/lib/apollo-super-selection/p-c775c0e4.system.entry.js +1 -0
- package/dist/lib/apollo-super-selection/{p-51c6dd08.js → p-db0bded8.js} +1 -1
- package/dist/lib/apollo-super-selection/{p-f29066b9.system.entry.js → p-e957b393.system.entry.js} +1 -1
- package/dist/lib/apollo-super-selection/{p-7a89efaf.js → p-fdadb647.js} +1 -1
- package/dist/lib/cjs/apollo-super-selection.cjs.js +1 -1
- package/dist/lib/cjs/custom-fund-choice.api-713823d3.js +3043 -0
- package/dist/lib/cjs/loader.cjs.js +1 -1
- package/dist/lib/cjs/{sss-button_33.cjs.entry.js → sss-button_31.cjs.entry.js} +395 -3566
- package/dist/lib/cjs/sss-super-byof-host.cjs.entry.js +94 -0
- package/dist/lib/collection/apollo-super-selection.css +1 -1
- package/dist/lib/collection/collection-manifest.json +1 -4
- package/dist/lib/collection/components/super-byof/super-byof-types.js +1 -0
- package/dist/lib/collection/components/super-byof/super-byof.form.js +1 -0
- package/dist/lib/collection/components/super-byof/super-byof.js +120 -0
- package/dist/lib/collection/components/super-selection-app/services/super-selection-app.routes.js +1 -1
- package/dist/lib/esm/{active-router-5e40c0f8.js → active-router-d18b36fb.js} +1 -1
- package/dist/lib/esm/apollo-super-selection.js +2 -2
- package/dist/lib/esm/context-consumer.entry.js +1 -1
- package/dist/lib/esm/custom-fund-choice.api-45fa478c.js +3022 -0
- package/dist/lib/esm/{index-189b2180.js → index-107d7c24.js} +1 -1
- package/dist/lib/esm/loader.js +2 -2
- package/dist/lib/esm/{sss-button_33.entry.js → sss-button_31.entry.js} +142 -3311
- package/dist/lib/esm/sss-super-byof-host.entry.js +90 -0
- package/dist/lib/esm/stencil-async-content.entry.js +1 -1
- package/dist/lib/esm/stencil-route-title.entry.js +2 -2
- package/dist/lib/esm/stencil-router-prompt.entry.js +2 -2
- package/dist/lib/esm/stencil-router-redirect.entry.js +2 -2
- package/dist/lib/esm-es5/{active-router-5e40c0f8.js → active-router-d18b36fb.js} +1 -1
- package/dist/lib/esm-es5/apollo-super-selection.js +1 -1
- package/dist/lib/esm-es5/context-consumer.entry.js +1 -1
- package/dist/lib/esm-es5/custom-fund-choice.api-45fa478c.js +1 -0
- package/dist/lib/esm-es5/{index-189b2180.js → index-107d7c24.js} +1 -1
- package/dist/lib/esm-es5/loader.js +1 -1
- package/dist/lib/esm-es5/sss-button_31.entry.js +69 -0
- package/dist/lib/esm-es5/sss-super-byof-host.entry.js +1 -0
- package/dist/lib/esm-es5/stencil-async-content.entry.js +1 -1
- package/dist/lib/esm-es5/stencil-route-title.entry.js +1 -1
- package/dist/lib/esm-es5/stencil-router-prompt.entry.js +1 -1
- package/dist/lib/esm-es5/stencil-router-redirect.entry.js +1 -1
- package/dist/lib/types/components/super-byof/super-byof-types.d.ts +26 -0
- package/dist/lib/types/components/super-byof/super-byof.d.ts +18 -0
- package/dist/lib/types/components/super-byof/super-byof.form.d.ts +6 -0
- package/dist/lib/types/components.d.ts +15 -34
- package/package.json +2 -1
- package/dist/lib/apollo-super-selection/p-071b8545.entry.js +0 -1
- package/dist/lib/apollo-super-selection/p-2298df79.system.entry.js +0 -69
- package/dist/lib/apollo-super-selection/p-51aefdb1.system.entry.js +0 -1
- package/dist/lib/apollo-super-selection/p-80178f87.system.js +0 -1
- package/dist/lib/apollo-super-selection/p-bdcfc026.system.js +0 -1
- package/dist/lib/apollo-super-selection/p-d7dbf362.entry.js +0 -14
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund-inputs.js +0 -143
- package/dist/lib/collection/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund.js +0 -123
- package/dist/lib/esm-es5/sss-button_33.entry.js +0 -69
- package/dist/lib/types/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund-inputs.d.ts +0 -16
- package/dist/lib/types/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund.d.ts +0 -13
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-eb4f212f.js');
|
|
6
6
|
const datoramaAkita = require('./datorama-akita-6c9cb8fb.js');
|
|
7
|
+
const customFundChoice_api = require('./custom-fund-choice.api-713823d3.js');
|
|
7
8
|
const activeRouter = require('./active-router-1f555f75.js');
|
|
8
9
|
|
|
9
10
|
function _interopNamespace(e) {
|
|
@@ -284,144 +285,19 @@ class TapSubscriber extends datoramaAkita.Subscriber {
|
|
|
284
285
|
}
|
|
285
286
|
}
|
|
286
287
|
|
|
287
|
-
const AppVersion = '5.
|
|
288
|
-
|
|
289
|
-
// -------------------------------------------------------------------------------------
|
|
290
|
-
// guards
|
|
291
|
-
// -------------------------------------------------------------------------------------
|
|
292
|
-
/**
|
|
293
|
-
* Returns `true` if the option is an instance of `Some`, `false` otherwise.
|
|
294
|
-
*
|
|
295
|
-
* @example
|
|
296
|
-
* import { some, none, isSome } from 'fp-ts/Option'
|
|
297
|
-
*
|
|
298
|
-
* assert.strictEqual(isSome(some(1)), true)
|
|
299
|
-
* assert.strictEqual(isSome(none), false)
|
|
300
|
-
*
|
|
301
|
-
* @category guards
|
|
302
|
-
* @since 2.0.0
|
|
303
|
-
*/
|
|
304
|
-
var isSome = function (fa) { return fa._tag === 'Some'; };
|
|
305
|
-
/**
|
|
306
|
-
* Returns `true` if the option is `None`, `false` otherwise.
|
|
307
|
-
*
|
|
308
|
-
* @example
|
|
309
|
-
* import { some, none, isNone } from 'fp-ts/Option'
|
|
310
|
-
*
|
|
311
|
-
* assert.strictEqual(isNone(some(1)), false)
|
|
312
|
-
* assert.strictEqual(isNone(none), true)
|
|
313
|
-
*
|
|
314
|
-
* @category guards
|
|
315
|
-
* @since 2.0.0
|
|
316
|
-
*/
|
|
317
|
-
var isNone = function (fa) { return fa._tag === 'None'; };
|
|
318
|
-
// -------------------------------------------------------------------------------------
|
|
319
|
-
// constructors
|
|
320
|
-
// -------------------------------------------------------------------------------------
|
|
321
|
-
/**
|
|
322
|
-
* `None` doesn't have a constructor, instead you can use it directly as a value. Represents a missing value.
|
|
323
|
-
*
|
|
324
|
-
* @category constructors
|
|
325
|
-
* @since 2.0.0
|
|
326
|
-
*/
|
|
327
|
-
var none = { _tag: 'None' };
|
|
328
|
-
/**
|
|
329
|
-
* Constructs a `Some`. Represents an optional value that exists.
|
|
330
|
-
*
|
|
331
|
-
* @category constructors
|
|
332
|
-
* @since 2.0.0
|
|
333
|
-
*/
|
|
334
|
-
var some = function (a) { return ({ _tag: 'Some', value: a }); };
|
|
335
|
-
/**
|
|
336
|
-
* Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise
|
|
337
|
-
* returns the value wrapped in a `Some`.
|
|
338
|
-
*
|
|
339
|
-
* @example
|
|
340
|
-
* import { none, some, fromNullable } from 'fp-ts/Option'
|
|
341
|
-
*
|
|
342
|
-
* assert.deepStrictEqual(fromNullable(undefined), none)
|
|
343
|
-
* assert.deepStrictEqual(fromNullable(null), none)
|
|
344
|
-
* assert.deepStrictEqual(fromNullable(1), some(1))
|
|
345
|
-
*
|
|
346
|
-
* @category constructors
|
|
347
|
-
* @since 2.0.0
|
|
348
|
-
*/
|
|
349
|
-
function fromNullable(a) {
|
|
350
|
-
return a == null ? none : some(a);
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Extracts the value out of the structure, if it exists. Otherwise returns `undefined`.
|
|
354
|
-
*
|
|
355
|
-
* @example
|
|
356
|
-
* import { some, none, toUndefined } from 'fp-ts/Option'
|
|
357
|
-
* import { pipe } from 'fp-ts/function'
|
|
358
|
-
*
|
|
359
|
-
* assert.strictEqual(
|
|
360
|
-
* pipe(
|
|
361
|
-
* some(1),
|
|
362
|
-
* toUndefined
|
|
363
|
-
* ),
|
|
364
|
-
* 1
|
|
365
|
-
* )
|
|
366
|
-
* assert.strictEqual(
|
|
367
|
-
* pipe(
|
|
368
|
-
* none,
|
|
369
|
-
* toUndefined
|
|
370
|
-
* ),
|
|
371
|
-
* undefined
|
|
372
|
-
* )
|
|
373
|
-
*
|
|
374
|
-
* @category destructors
|
|
375
|
-
* @since 2.0.0
|
|
376
|
-
*/
|
|
377
|
-
function toUndefined(ma) {
|
|
378
|
-
return isNone(ma) ? undefined : ma.value;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Less strict version of [`getOrElse`](#getOrElse).
|
|
382
|
-
*
|
|
383
|
-
* @category destructors
|
|
384
|
-
* @since 2.6.0
|
|
385
|
-
*/
|
|
386
|
-
var getOrElseW = function (onNone) { return function (ma) { return (isNone(ma) ? onNone() : ma.value); }; };
|
|
387
|
-
/**
|
|
388
|
-
* Extracts the value out of the structure, if it exists. Otherwise returns the given default value
|
|
389
|
-
*
|
|
390
|
-
* @example
|
|
391
|
-
* import { some, none, getOrElse } from 'fp-ts/Option'
|
|
392
|
-
* import { pipe } from 'fp-ts/function'
|
|
393
|
-
*
|
|
394
|
-
* assert.strictEqual(
|
|
395
|
-
* pipe(
|
|
396
|
-
* some(1),
|
|
397
|
-
* getOrElse(() => 0)
|
|
398
|
-
* ),
|
|
399
|
-
* 1
|
|
400
|
-
* )
|
|
401
|
-
* assert.strictEqual(
|
|
402
|
-
* pipe(
|
|
403
|
-
* none,
|
|
404
|
-
* getOrElse(() => 0)
|
|
405
|
-
* ),
|
|
406
|
-
* 0
|
|
407
|
-
* )
|
|
408
|
-
*
|
|
409
|
-
* @category destructors
|
|
410
|
-
* @since 2.0.0
|
|
411
|
-
*/
|
|
412
|
-
var getOrElse = getOrElseW;
|
|
288
|
+
const AppVersion = '5.55.16332';
|
|
413
289
|
|
|
414
290
|
class Lazy {
|
|
415
291
|
constructor(factory) {
|
|
416
292
|
this.factory = factory;
|
|
417
|
-
this._value = none;
|
|
293
|
+
this._value = customFundChoice_api.none;
|
|
418
294
|
}
|
|
419
295
|
get value() {
|
|
420
|
-
if (isSome(this._value)) {
|
|
296
|
+
if (customFundChoice_api.isSome(this._value)) {
|
|
421
297
|
return this._value.value;
|
|
422
298
|
}
|
|
423
299
|
const lazyValue = this.factory();
|
|
424
|
-
this._value = some(lazyValue);
|
|
300
|
+
this._value = customFundChoice_api.some(lazyValue);
|
|
425
301
|
return lazyValue;
|
|
426
302
|
}
|
|
427
303
|
}
|
|
@@ -433,10 +309,6 @@ function addSlashToUrl() {
|
|
|
433
309
|
}
|
|
434
310
|
}
|
|
435
311
|
|
|
436
|
-
function injectHistory(Component) {
|
|
437
|
-
activeRouter.ActiveRouter.injectProps(Component, ['history', 'location']);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
312
|
/**
|
|
441
313
|
* TS adaption of https://github.com/pillarjs/path-to-regexp/blob/master/index.js
|
|
442
314
|
*/
|
|
@@ -850,3032 +722,160 @@ const createLocation = (path, state, key, currentLocation) => {
|
|
|
850
722
|
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' +
|
|
851
723
|
'This is likely caused by an invalid percent-encoding.');
|
|
852
724
|
}
|
|
853
|
-
else {
|
|
854
|
-
throw e;
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
location.key = key;
|
|
858
|
-
if (currentLocation) {
|
|
859
|
-
// Resolve incomplete/relative pathname relative to current location.
|
|
860
|
-
if (!location.pathname) {
|
|
861
|
-
location.pathname = currentLocation.pathname;
|
|
862
|
-
}
|
|
863
|
-
else if (location.pathname.charAt(0) !== '/') {
|
|
864
|
-
location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
else {
|
|
868
|
-
// When there is no prior location and pathname is empty, set it to /
|
|
869
|
-
if (!location.pathname) {
|
|
870
|
-
location.pathname = '/';
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
location.query = parseQueryString(location.search || '');
|
|
874
|
-
return location;
|
|
875
|
-
};
|
|
876
|
-
|
|
877
|
-
let cacheCount = 0;
|
|
878
|
-
const patternCache = {};
|
|
879
|
-
const cacheLimit = 10000;
|
|
880
|
-
// Memoized function for creating the path match regex
|
|
881
|
-
const compilePath = (pattern, options) => {
|
|
882
|
-
const cacheKey = `${options.end}${options.strict}`;
|
|
883
|
-
const cache = patternCache[cacheKey] || (patternCache[cacheKey] = {});
|
|
884
|
-
const cachePattern = JSON.stringify(pattern);
|
|
885
|
-
if (cache[cachePattern]) {
|
|
886
|
-
return cache[cachePattern];
|
|
887
|
-
}
|
|
888
|
-
const keys = [];
|
|
889
|
-
const re = pathToRegexp(pattern, keys, options);
|
|
890
|
-
const compiledPattern = { re, keys };
|
|
891
|
-
if (cacheCount < cacheLimit) {
|
|
892
|
-
cache[cachePattern] = compiledPattern;
|
|
893
|
-
cacheCount += 1;
|
|
894
|
-
}
|
|
895
|
-
return compiledPattern;
|
|
896
|
-
};
|
|
897
|
-
/**
|
|
898
|
-
* Public API for matching a URL pathname to a path pattern.
|
|
899
|
-
*/
|
|
900
|
-
const matchPath = (pathname, options = {}) => {
|
|
901
|
-
if (typeof options === 'string') {
|
|
902
|
-
options = { path: options };
|
|
903
|
-
}
|
|
904
|
-
const { path = '/', exact = false, strict = false } = options;
|
|
905
|
-
const { re, keys } = compilePath(path, { end: exact, strict });
|
|
906
|
-
const match = re.exec(pathname);
|
|
907
|
-
if (!match) {
|
|
908
|
-
return null;
|
|
909
|
-
}
|
|
910
|
-
const [url, ...values] = match;
|
|
911
|
-
const isExact = pathname === url;
|
|
912
|
-
if (exact && !isExact) {
|
|
913
|
-
return null;
|
|
914
|
-
}
|
|
915
|
-
return {
|
|
916
|
-
path,
|
|
917
|
-
url: path === '/' && url === '' ? '/' : url,
|
|
918
|
-
isExact,
|
|
919
|
-
params: keys.reduce((memo, key, index) => {
|
|
920
|
-
memo[key.name] = values[index];
|
|
921
|
-
return memo;
|
|
922
|
-
}, {})
|
|
923
|
-
};
|
|
924
|
-
};
|
|
925
|
-
const matchesAreEqual = (a, b) => {
|
|
926
|
-
if (a == null && b == null) {
|
|
927
|
-
return true;
|
|
928
|
-
}
|
|
929
|
-
if (b == null) {
|
|
930
|
-
return false;
|
|
931
|
-
}
|
|
932
|
-
return a && b &&
|
|
933
|
-
a.path === b.path &&
|
|
934
|
-
a.url === b.url &&
|
|
935
|
-
valueEqual(a.params, b.params);
|
|
936
|
-
};
|
|
937
|
-
|
|
938
|
-
var PromiseButtonState;
|
|
939
|
-
(function (PromiseButtonState) {
|
|
940
|
-
PromiseButtonState[PromiseButtonState["Available"] = 0] = "Available";
|
|
941
|
-
PromiseButtonState[PromiseButtonState["Pending"] = 1] = "Pending";
|
|
942
|
-
PromiseButtonState[PromiseButtonState["Error"] = 2] = "Error";
|
|
943
|
-
})(PromiseButtonState || (PromiseButtonState = {}));
|
|
944
|
-
const Button = class {
|
|
945
|
-
constructor(hostRef) {
|
|
946
|
-
index.registerInstance(this, hostRef);
|
|
947
|
-
this.fillWidth = false;
|
|
948
|
-
this.fillWidthOnMobile = false;
|
|
949
|
-
this.disabled = false;
|
|
950
|
-
this.variant = 'primary';
|
|
951
|
-
this.size = 'base';
|
|
952
|
-
this.promiseFn = () => Promise.resolve();
|
|
953
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
954
|
-
this.state = PromiseButtonState.Available;
|
|
955
|
-
}
|
|
956
|
-
render() {
|
|
957
|
-
const sizeCss = {
|
|
958
|
-
xs: 'px-2.5 py-1.5 text-xs',
|
|
959
|
-
base: 'px-4 py-2 text-base',
|
|
960
|
-
xl: 'px-6 py-3 text-base'
|
|
961
|
-
};
|
|
962
|
-
return (index.h("button", { "data-testid": this.testid, class: {
|
|
963
|
-
[sizeCss[this.size]]: true,
|
|
964
|
-
'inline-flex items-center justify-center border font-medium': true,
|
|
965
|
-
'rounded-md shadow-sm focus:outline-none focus:ring-2': true,
|
|
966
|
-
'focus:ring-offset-2 focus:ring-primary-focus pointer-events-auto': true,
|
|
967
|
-
'disabled:pointer-events-none disabled:border-gray-300 disabled:bg-gray-100 disabled:text-gray-400': true,
|
|
968
|
-
'border-transparent text-white bg-primary-base hover:bg-primary-hover': this.variant === 'primary',
|
|
969
|
-
'border-gray-300 text-gray-700 bg-white hover:bg-gray-50': this.variant === 'secondary',
|
|
970
|
-
'border-transparent bg-primary-light hover:bg-primary-base text-primary-dark hover:text-white': this.variant === 'light',
|
|
971
|
-
'w-full': this.fillWidth || this.fillWidthOnMobile,
|
|
972
|
-
'sm:w-auto': this.fillWidthOnMobile
|
|
973
|
-
}, disabled: this.disabled, onClick: () => this.clicked() }, this.state === PromiseButtonState.Pending && (index.h("sss-loading-indicator", { theme: this.variant === 'primary' ? 'light' : 'primary', size: 16 })), index.h("div", { class: { hidden: this.state === PromiseButtonState.Pending } }, index.h("slot", null))));
|
|
974
|
-
}
|
|
975
|
-
async clicked() {
|
|
976
|
-
if (!this.promiseFn || this.state === PromiseButtonState.Pending)
|
|
977
|
-
return;
|
|
978
|
-
try {
|
|
979
|
-
this.state = PromiseButtonState.Pending;
|
|
980
|
-
await this.promiseFn();
|
|
981
|
-
this.state = PromiseButtonState.Available;
|
|
982
|
-
}
|
|
983
|
-
catch (err) {
|
|
984
|
-
this.state = PromiseButtonState.Error;
|
|
985
|
-
throw err;
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
};
|
|
989
|
-
|
|
990
|
-
function appReady() {
|
|
991
|
-
postMessage({
|
|
992
|
-
type: 'appReady'
|
|
993
|
-
});
|
|
994
|
-
}
|
|
995
|
-
function postMessage(message, origin) {
|
|
996
|
-
if (origin === undefined)
|
|
997
|
-
origin = '*';
|
|
998
|
-
message.sender = 'flare';
|
|
999
|
-
window.parent.postMessage(message, origin);
|
|
1000
|
-
}
|
|
1001
|
-
function resize(height, width) {
|
|
1002
|
-
postMessage({
|
|
1003
|
-
type: 'contentResized',
|
|
1004
|
-
height,
|
|
1005
|
-
width
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
|
-
function navigation(url) {
|
|
1009
|
-
postMessage({
|
|
1010
|
-
type: 'pageNavigated',
|
|
1011
|
-
url
|
|
1012
|
-
});
|
|
1013
|
-
}
|
|
1014
|
-
function complete() {
|
|
1015
|
-
postMessage({ type: 'complete' });
|
|
1016
|
-
}
|
|
1017
|
-
function submitSuccess() {
|
|
1018
|
-
postMessage({
|
|
1019
|
-
type: 'submitSuccess'
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
|
-
const iframe = { appReady, resize, navigation, complete, submitSuccess };
|
|
1023
|
-
|
|
1024
|
-
const appendToMap = (map, propName, value) => {
|
|
1025
|
-
const items = map.get(propName);
|
|
1026
|
-
if (!items) {
|
|
1027
|
-
map.set(propName, [value]);
|
|
1028
|
-
}
|
|
1029
|
-
else if (!items.includes(value)) {
|
|
1030
|
-
items.push(value);
|
|
1031
|
-
}
|
|
1032
|
-
};
|
|
1033
|
-
const debounce = (fn, ms) => {
|
|
1034
|
-
let timeoutId;
|
|
1035
|
-
return (...args) => {
|
|
1036
|
-
if (timeoutId) {
|
|
1037
|
-
clearTimeout(timeoutId);
|
|
1038
|
-
}
|
|
1039
|
-
timeoutId = setTimeout(() => {
|
|
1040
|
-
timeoutId = 0;
|
|
1041
|
-
fn(...args);
|
|
1042
|
-
}, ms);
|
|
1043
|
-
};
|
|
1044
|
-
};
|
|
1045
|
-
|
|
1046
|
-
/**
|
|
1047
|
-
* Check if a possible element isConnected.
|
|
1048
|
-
* The property might not be there, so we check for it.
|
|
1049
|
-
*
|
|
1050
|
-
* We want it to return true if isConnected is not a property,
|
|
1051
|
-
* otherwise we would remove these elements and would not update.
|
|
1052
|
-
*
|
|
1053
|
-
* Better leak in Edge than to be useless.
|
|
1054
|
-
*/
|
|
1055
|
-
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
1056
|
-
const cleanupElements = debounce((map) => {
|
|
1057
|
-
for (let key of map.keys()) {
|
|
1058
|
-
map.set(key, map.get(key).filter(isConnected));
|
|
1059
|
-
}
|
|
1060
|
-
}, 2000);
|
|
1061
|
-
const stencilSubscription = ({ on }) => {
|
|
1062
|
-
const elmsToUpdate = new Map();
|
|
1063
|
-
if (typeof index.getRenderingRef === 'function') {
|
|
1064
|
-
// If we are not in a stencil project, we do nothing.
|
|
1065
|
-
// This function is not really exported by @stencil/core.
|
|
1066
|
-
on('dispose', () => {
|
|
1067
|
-
elmsToUpdate.clear();
|
|
1068
|
-
});
|
|
1069
|
-
on('get', (propName) => {
|
|
1070
|
-
const elm = index.getRenderingRef();
|
|
1071
|
-
if (elm) {
|
|
1072
|
-
appendToMap(elmsToUpdate, propName, elm);
|
|
1073
|
-
}
|
|
1074
|
-
});
|
|
1075
|
-
on('set', (propName) => {
|
|
1076
|
-
const elements = elmsToUpdate.get(propName);
|
|
1077
|
-
if (elements) {
|
|
1078
|
-
elmsToUpdate.set(propName, elements.filter(index.forceUpdate));
|
|
1079
|
-
}
|
|
1080
|
-
cleanupElements(elmsToUpdate);
|
|
1081
|
-
});
|
|
1082
|
-
on('reset', () => {
|
|
1083
|
-
elmsToUpdate.forEach((elms) => elms.forEach(index.forceUpdate));
|
|
1084
|
-
cleanupElements(elmsToUpdate);
|
|
1085
|
-
});
|
|
1086
|
-
}
|
|
1087
|
-
};
|
|
1088
|
-
|
|
1089
|
-
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
1090
|
-
let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
1091
|
-
const handlers = {
|
|
1092
|
-
dispose: [],
|
|
1093
|
-
get: [],
|
|
1094
|
-
set: [],
|
|
1095
|
-
reset: [],
|
|
1096
|
-
};
|
|
1097
|
-
const reset = () => {
|
|
1098
|
-
states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
1099
|
-
handlers.reset.forEach((cb) => cb());
|
|
1100
|
-
};
|
|
1101
|
-
const dispose = () => {
|
|
1102
|
-
// Call first dispose as resetting the state would
|
|
1103
|
-
// cause less updates ;)
|
|
1104
|
-
handlers.dispose.forEach((cb) => cb());
|
|
1105
|
-
reset();
|
|
1106
|
-
};
|
|
1107
|
-
const get = (propName) => {
|
|
1108
|
-
handlers.get.forEach((cb) => cb(propName));
|
|
1109
|
-
return states.get(propName);
|
|
1110
|
-
};
|
|
1111
|
-
const set = (propName, value) => {
|
|
1112
|
-
const oldValue = states.get(propName);
|
|
1113
|
-
if (shouldUpdate(value, oldValue, propName)) {
|
|
1114
|
-
states.set(propName, value);
|
|
1115
|
-
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
1116
|
-
}
|
|
1117
|
-
};
|
|
1118
|
-
const state = (typeof Proxy === 'undefined'
|
|
1119
|
-
? {}
|
|
1120
|
-
: new Proxy(defaultState, {
|
|
1121
|
-
get(_, propName) {
|
|
1122
|
-
return get(propName);
|
|
1123
|
-
},
|
|
1124
|
-
ownKeys(_) {
|
|
1125
|
-
return Array.from(states.keys());
|
|
1126
|
-
},
|
|
1127
|
-
getOwnPropertyDescriptor() {
|
|
1128
|
-
return {
|
|
1129
|
-
enumerable: true,
|
|
1130
|
-
configurable: true,
|
|
1131
|
-
};
|
|
1132
|
-
},
|
|
1133
|
-
has(_, propName) {
|
|
1134
|
-
return states.has(propName);
|
|
1135
|
-
},
|
|
1136
|
-
set(_, propName, value) {
|
|
1137
|
-
set(propName, value);
|
|
1138
|
-
return true;
|
|
1139
|
-
},
|
|
1140
|
-
}));
|
|
1141
|
-
const on = (eventName, callback) => {
|
|
1142
|
-
handlers[eventName].push(callback);
|
|
1143
|
-
return () => {
|
|
1144
|
-
removeFromArray(handlers[eventName], callback);
|
|
1145
|
-
};
|
|
1146
|
-
};
|
|
1147
|
-
const onChange = (propName, cb) => {
|
|
1148
|
-
const unSet = on('set', (key, newValue) => {
|
|
1149
|
-
if (key === propName) {
|
|
1150
|
-
cb(newValue);
|
|
1151
|
-
}
|
|
1152
|
-
});
|
|
1153
|
-
const unReset = on('reset', () => cb(defaultState[propName]));
|
|
1154
|
-
return () => {
|
|
1155
|
-
unSet();
|
|
1156
|
-
unReset();
|
|
1157
|
-
};
|
|
1158
|
-
};
|
|
1159
|
-
const use = (...subscriptions) => subscriptions.forEach((subscription) => {
|
|
1160
|
-
if (subscription.set) {
|
|
1161
|
-
on('set', subscription.set);
|
|
1162
|
-
}
|
|
1163
|
-
if (subscription.get) {
|
|
1164
|
-
on('get', subscription.get);
|
|
1165
|
-
}
|
|
1166
|
-
if (subscription.reset) {
|
|
1167
|
-
on('reset', subscription.reset);
|
|
1168
|
-
}
|
|
1169
|
-
});
|
|
1170
|
-
return {
|
|
1171
|
-
state,
|
|
1172
|
-
get,
|
|
1173
|
-
set,
|
|
1174
|
-
on,
|
|
1175
|
-
onChange,
|
|
1176
|
-
use,
|
|
1177
|
-
dispose,
|
|
1178
|
-
reset,
|
|
1179
|
-
};
|
|
1180
|
-
};
|
|
1181
|
-
const removeFromArray = (array, item) => {
|
|
1182
|
-
const index = array.indexOf(item);
|
|
1183
|
-
if (index >= 0) {
|
|
1184
|
-
array[index] = array[array.length - 1];
|
|
1185
|
-
array.length--;
|
|
1186
|
-
}
|
|
1187
|
-
};
|
|
1188
|
-
|
|
1189
|
-
const createStore = (defaultState, shouldUpdate) => {
|
|
1190
|
-
const map = createObservableMap(defaultState, shouldUpdate);
|
|
1191
|
-
stencilSubscription(map);
|
|
1192
|
-
return map;
|
|
1193
|
-
};
|
|
1194
|
-
|
|
1195
|
-
const initial = {
|
|
1196
|
-
handleSubmitFn: async function () {
|
|
1197
|
-
return;
|
|
1198
|
-
},
|
|
1199
|
-
fundName: '',
|
|
1200
|
-
fundDetails: { type: 'null' },
|
|
1201
|
-
promotedFundId: undefined
|
|
1202
|
-
};
|
|
1203
|
-
const { state } = createStore(initial);
|
|
1204
|
-
|
|
1205
|
-
var SuperSelectionAppRoutes;
|
|
1206
|
-
(function (SuperSelectionAppRoutes) {
|
|
1207
|
-
SuperSelectionAppRoutes["ExistingChoicePage"] = "/existing";
|
|
1208
|
-
SuperSelectionAppRoutes["SuperCampaign"] = "/super-campaign";
|
|
1209
|
-
SuperSelectionAppRoutes["ChoicePage"] = "/";
|
|
1210
|
-
SuperSelectionAppRoutes["MyOwnFund"] = "/super-choice/my-own-fund/";
|
|
1211
|
-
SuperSelectionAppRoutes["MyOwnFundEngagementStep"] = "/super-choice/my-own-fund-engagement/";
|
|
1212
|
-
SuperSelectionAppRoutes["Prefill"] = "/super-choice/prefill/";
|
|
1213
|
-
SuperSelectionAppRoutes["PrefillInvalidMyOwnFundPage"] = "/super-choice/sss-prefill-invalid-my-own-fund/";
|
|
1214
|
-
SuperSelectionAppRoutes["PrefillMyOwnFundPage"] = "/super-choice/prefill-my-own-fund/";
|
|
1215
|
-
SuperSelectionAppRoutes["PrefillSMSFPage"] = "/super-choice/prefill-smsf/";
|
|
1216
|
-
SuperSelectionAppRoutes["PrefillInvalidSMSFPage"] = "/super-choice/prefill-invalid-smsf/";
|
|
1217
|
-
SuperSelectionAppRoutes["SelfManagedFund"] = "/super-choice/smsf/";
|
|
1218
|
-
SuperSelectionAppRoutes["DefaultFund"] = "/super-choice/default/";
|
|
1219
|
-
SuperSelectionAppRoutes["FeaturedFunds"] = "/super-choice/featured-funds/";
|
|
1220
|
-
SuperSelectionAppRoutes["StandardChoice"] = "/standard-choice/";
|
|
1221
|
-
SuperSelectionAppRoutes["Success"] = "/success/";
|
|
1222
|
-
})(SuperSelectionAppRoutes || (SuperSelectionAppRoutes = {}));
|
|
1223
|
-
const superSelectionAppStencilRoutes = [
|
|
1224
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.ExistingChoicePage, component: "sss-existing-choice-page" }),
|
|
1225
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.SuperCampaign, component: "sss-super-campaign-host" }),
|
|
1226
|
-
index.h("stencil-route", { exact: true, url: SuperSelectionAppRoutes.ChoicePage, component: "sss-choice-router" }),
|
|
1227
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.MyOwnFund, component: "sss-my-own-fund" }),
|
|
1228
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.MyOwnFundEngagementStep, component: "sss-my-own-fund-engagement-step-host" }),
|
|
1229
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.PrefillInvalidMyOwnFundPage, component: "sss-prefill-invalid-my-own-fund" }),
|
|
1230
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.Prefill, component: "sss-prefill" }),
|
|
1231
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.PrefillMyOwnFundPage, component: "sss-prefill-my-own-fund" }),
|
|
1232
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.PrefillSMSFPage, component: "sss-prefill-smsf" }),
|
|
1233
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.PrefillInvalidSMSFPage, component: "sss-prefill-invalid-smsf" }),
|
|
1234
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.SelfManagedFund, component: "sss-super-smsf-host" }),
|
|
1235
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.DefaultFund, component: "sss-default-fund" }),
|
|
1236
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.FeaturedFunds, component: "sss-super-campaign-featured-funds" }),
|
|
1237
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.StandardChoice, component: "sss-standard-choice-form" }),
|
|
1238
|
-
index.h("stencil-route", { url: SuperSelectionAppRoutes.Success, component: "sss-success" })
|
|
1239
|
-
];
|
|
1240
|
-
|
|
1241
|
-
function createCommonjsModule(fn, basedir, module) {
|
|
1242
|
-
return module = {
|
|
1243
|
-
path: basedir,
|
|
1244
|
-
exports: {},
|
|
1245
|
-
require: function (path, base) {
|
|
1246
|
-
return commonjsRequire();
|
|
1247
|
-
}
|
|
1248
|
-
}, fn(module, module.exports), module.exports;
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
function commonjsRequire () {
|
|
1252
|
-
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
var _function = createCommonjsModule(function (module, exports) {
|
|
1256
|
-
/**
|
|
1257
|
-
* @since 2.0.0
|
|
1258
|
-
*/
|
|
1259
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1260
|
-
exports.bindTo_ = exports.bind_ = exports.hole = exports.pipe = exports.untupled = exports.tupled = exports.absurd = exports.decrement = exports.increment = exports.tuple = exports.flow = exports.flip = exports.constVoid = exports.constUndefined = exports.constNull = exports.constFalse = exports.constTrue = exports.constant = exports.not = exports.unsafeCoerce = exports.identity = void 0;
|
|
1261
|
-
/**
|
|
1262
|
-
* @since 2.0.0
|
|
1263
|
-
*/
|
|
1264
|
-
function identity(a) {
|
|
1265
|
-
return a;
|
|
1266
|
-
}
|
|
1267
|
-
exports.identity = identity;
|
|
1268
|
-
/**
|
|
1269
|
-
* @since 2.0.0
|
|
1270
|
-
*/
|
|
1271
|
-
exports.unsafeCoerce = identity;
|
|
1272
|
-
/**
|
|
1273
|
-
* @since 2.0.0
|
|
1274
|
-
*/
|
|
1275
|
-
function not(predicate) {
|
|
1276
|
-
return function (a) { return !predicate(a); };
|
|
1277
|
-
}
|
|
1278
|
-
exports.not = not;
|
|
1279
|
-
/**
|
|
1280
|
-
* @since 2.0.0
|
|
1281
|
-
*/
|
|
1282
|
-
function constant(a) {
|
|
1283
|
-
return function () { return a; };
|
|
1284
|
-
}
|
|
1285
|
-
exports.constant = constant;
|
|
1286
|
-
/**
|
|
1287
|
-
* A thunk that returns always `true`.
|
|
1288
|
-
*
|
|
1289
|
-
* @since 2.0.0
|
|
1290
|
-
*/
|
|
1291
|
-
exports.constTrue =
|
|
1292
|
-
/*#__PURE__*/
|
|
1293
|
-
constant(true);
|
|
1294
|
-
/**
|
|
1295
|
-
* A thunk that returns always `false`.
|
|
1296
|
-
*
|
|
1297
|
-
* @since 2.0.0
|
|
1298
|
-
*/
|
|
1299
|
-
exports.constFalse =
|
|
1300
|
-
/*#__PURE__*/
|
|
1301
|
-
constant(false);
|
|
1302
|
-
/**
|
|
1303
|
-
* A thunk that returns always `null`.
|
|
1304
|
-
*
|
|
1305
|
-
* @since 2.0.0
|
|
1306
|
-
*/
|
|
1307
|
-
exports.constNull =
|
|
1308
|
-
/*#__PURE__*/
|
|
1309
|
-
constant(null);
|
|
1310
|
-
/**
|
|
1311
|
-
* A thunk that returns always `undefined`.
|
|
1312
|
-
*
|
|
1313
|
-
* @since 2.0.0
|
|
1314
|
-
*/
|
|
1315
|
-
exports.constUndefined =
|
|
1316
|
-
/*#__PURE__*/
|
|
1317
|
-
constant(undefined);
|
|
1318
|
-
/**
|
|
1319
|
-
* A thunk that returns always `void`.
|
|
1320
|
-
*
|
|
1321
|
-
* @since 2.0.0
|
|
1322
|
-
*/
|
|
1323
|
-
exports.constVoid = exports.constUndefined;
|
|
1324
|
-
// TODO: remove in v3
|
|
1325
|
-
/**
|
|
1326
|
-
* Flips the order of the arguments of a function of two arguments.
|
|
1327
|
-
*
|
|
1328
|
-
* @since 2.0.0
|
|
1329
|
-
*/
|
|
1330
|
-
function flip(f) {
|
|
1331
|
-
return function (b, a) { return f(a, b); };
|
|
1332
|
-
}
|
|
1333
|
-
exports.flip = flip;
|
|
1334
|
-
function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
|
|
1335
|
-
switch (arguments.length) {
|
|
1336
|
-
case 1:
|
|
1337
|
-
return ab;
|
|
1338
|
-
case 2:
|
|
1339
|
-
return function () {
|
|
1340
|
-
return bc(ab.apply(this, arguments));
|
|
1341
|
-
};
|
|
1342
|
-
case 3:
|
|
1343
|
-
return function () {
|
|
1344
|
-
return cd(bc(ab.apply(this, arguments)));
|
|
1345
|
-
};
|
|
1346
|
-
case 4:
|
|
1347
|
-
return function () {
|
|
1348
|
-
return de(cd(bc(ab.apply(this, arguments))));
|
|
1349
|
-
};
|
|
1350
|
-
case 5:
|
|
1351
|
-
return function () {
|
|
1352
|
-
return ef(de(cd(bc(ab.apply(this, arguments)))));
|
|
1353
|
-
};
|
|
1354
|
-
case 6:
|
|
1355
|
-
return function () {
|
|
1356
|
-
return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
|
|
1357
|
-
};
|
|
1358
|
-
case 7:
|
|
1359
|
-
return function () {
|
|
1360
|
-
return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
|
|
1361
|
-
};
|
|
1362
|
-
case 8:
|
|
1363
|
-
return function () {
|
|
1364
|
-
return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
|
|
1365
|
-
};
|
|
1366
|
-
case 9:
|
|
1367
|
-
return function () {
|
|
1368
|
-
return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
|
|
1369
|
-
};
|
|
1370
|
-
}
|
|
1371
|
-
return;
|
|
1372
|
-
}
|
|
1373
|
-
exports.flow = flow;
|
|
1374
|
-
/**
|
|
1375
|
-
* @since 2.0.0
|
|
1376
|
-
*/
|
|
1377
|
-
function tuple() {
|
|
1378
|
-
var t = [];
|
|
1379
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1380
|
-
t[_i] = arguments[_i];
|
|
1381
|
-
}
|
|
1382
|
-
return t;
|
|
1383
|
-
}
|
|
1384
|
-
exports.tuple = tuple;
|
|
1385
|
-
/**
|
|
1386
|
-
* @since 2.0.0
|
|
1387
|
-
*/
|
|
1388
|
-
function increment(n) {
|
|
1389
|
-
return n + 1;
|
|
1390
|
-
}
|
|
1391
|
-
exports.increment = increment;
|
|
1392
|
-
/**
|
|
1393
|
-
* @since 2.0.0
|
|
1394
|
-
*/
|
|
1395
|
-
function decrement(n) {
|
|
1396
|
-
return n - 1;
|
|
1397
|
-
}
|
|
1398
|
-
exports.decrement = decrement;
|
|
1399
|
-
/**
|
|
1400
|
-
* @since 2.0.0
|
|
1401
|
-
*/
|
|
1402
|
-
function absurd(_) {
|
|
1403
|
-
throw new Error('Called `absurd` function which should be uncallable');
|
|
1404
|
-
}
|
|
1405
|
-
exports.absurd = absurd;
|
|
1406
|
-
/**
|
|
1407
|
-
* Creates a tupled version of this function: instead of `n` arguments, it accepts a single tuple argument.
|
|
1408
|
-
*
|
|
1409
|
-
* @example
|
|
1410
|
-
* import { tupled } from 'fp-ts/function'
|
|
1411
|
-
*
|
|
1412
|
-
* const add = tupled((x: number, y: number): number => x + y)
|
|
1413
|
-
*
|
|
1414
|
-
* assert.strictEqual(add([1, 2]), 3)
|
|
1415
|
-
*
|
|
1416
|
-
* @since 2.4.0
|
|
1417
|
-
*/
|
|
1418
|
-
function tupled(f) {
|
|
1419
|
-
return function (a) { return f.apply(void 0, a); };
|
|
1420
|
-
}
|
|
1421
|
-
exports.tupled = tupled;
|
|
1422
|
-
/**
|
|
1423
|
-
* Inverse function of `tupled`
|
|
1424
|
-
*
|
|
1425
|
-
* @since 2.4.0
|
|
1426
|
-
*/
|
|
1427
|
-
function untupled(f) {
|
|
1428
|
-
return function () {
|
|
1429
|
-
var a = [];
|
|
1430
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1431
|
-
a[_i] = arguments[_i];
|
|
1432
|
-
}
|
|
1433
|
-
return f(a);
|
|
1434
|
-
};
|
|
1435
|
-
}
|
|
1436
|
-
exports.untupled = untupled;
|
|
1437
|
-
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi, ij, jk, kl, lm, mn, no, op, pq, qr, rs, st) {
|
|
1438
|
-
switch (arguments.length) {
|
|
1439
|
-
case 1:
|
|
1440
|
-
return a;
|
|
1441
|
-
case 2:
|
|
1442
|
-
return ab(a);
|
|
1443
|
-
case 3:
|
|
1444
|
-
return bc(ab(a));
|
|
1445
|
-
case 4:
|
|
1446
|
-
return cd(bc(ab(a)));
|
|
1447
|
-
case 5:
|
|
1448
|
-
return de(cd(bc(ab(a))));
|
|
1449
|
-
case 6:
|
|
1450
|
-
return ef(de(cd(bc(ab(a)))));
|
|
1451
|
-
case 7:
|
|
1452
|
-
return fg(ef(de(cd(bc(ab(a))))));
|
|
1453
|
-
case 8:
|
|
1454
|
-
return gh(fg(ef(de(cd(bc(ab(a)))))));
|
|
1455
|
-
case 9:
|
|
1456
|
-
return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
|
|
1457
|
-
case 10:
|
|
1458
|
-
return ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))));
|
|
1459
|
-
case 11:
|
|
1460
|
-
return jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))));
|
|
1461
|
-
case 12:
|
|
1462
|
-
return kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))));
|
|
1463
|
-
case 13:
|
|
1464
|
-
return lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))));
|
|
1465
|
-
case 14:
|
|
1466
|
-
return mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))));
|
|
1467
|
-
case 15:
|
|
1468
|
-
return no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))));
|
|
1469
|
-
case 16:
|
|
1470
|
-
return op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))));
|
|
1471
|
-
case 17:
|
|
1472
|
-
return pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))));
|
|
1473
|
-
case 18:
|
|
1474
|
-
return qr(pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))));
|
|
1475
|
-
case 19:
|
|
1476
|
-
return rs(qr(pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))))));
|
|
1477
|
-
case 20:
|
|
1478
|
-
return st(rs(qr(pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))))));
|
|
1479
|
-
}
|
|
1480
|
-
return;
|
|
1481
|
-
}
|
|
1482
|
-
exports.pipe = pipe;
|
|
1483
|
-
/**
|
|
1484
|
-
* Type hole simulation
|
|
1485
|
-
*
|
|
1486
|
-
* @since 2.7.0
|
|
1487
|
-
*/
|
|
1488
|
-
exports.hole = absurd;
|
|
1489
|
-
/**
|
|
1490
|
-
* @internal
|
|
1491
|
-
*/
|
|
1492
|
-
var bind_ = function (a, name, b) {
|
|
1493
|
-
var _a;
|
|
1494
|
-
return Object.assign({}, a, (_a = {}, _a[name] = b, _a));
|
|
1495
|
-
};
|
|
1496
|
-
exports.bind_ = bind_;
|
|
1497
|
-
/**
|
|
1498
|
-
* @internal
|
|
1499
|
-
*/
|
|
1500
|
-
var bindTo_ = function (name) { return function (b) {
|
|
1501
|
-
var _a;
|
|
1502
|
-
return (_a = {}, _a[name] = b, _a);
|
|
1503
|
-
}; };
|
|
1504
|
-
exports.bindTo_ = bindTo_;
|
|
1505
|
-
});
|
|
1506
|
-
|
|
1507
|
-
var Option = createCommonjsModule(function (module, exports) {
|
|
1508
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1509
|
-
exports.getApplySemigroup = exports.getOrd = exports.getEq = exports.getShow = exports.URI = exports.wilt = exports.wither = exports.sequence = exports.traverse = exports.partitionMap = exports.partition = exports.filterMap = exports.filter = exports.separate = exports.compact = exports.reduceRight = exports.foldMap = exports.reduce = exports.duplicate = exports.extend = exports.throwError = exports.zero = exports.alt = exports.altW = exports.flatten = exports.chainFirst = exports.chain = exports.of = exports.apSecond = exports.apFirst = exports.ap = exports.map = exports.chainNullableK = exports.mapNullable = exports.fromNullableK = exports.getOrElse = exports.getOrElseW = exports.toUndefined = exports.toNullable = exports.fold = exports.fromEither = exports.getRight = exports.getLeft = exports.tryCatch = exports.fromPredicate = exports.fromNullable = exports.some = exports.none = exports.isNone = exports.isSome = void 0;
|
|
1510
|
-
exports.sequenceArray = exports.traverseArray = exports.traverseArrayWithIndex = exports.apS = exports.bind = exports.bindTo = exports.Do = exports.getRefinement = exports.exists = exports.elem = exports.option = exports.MonadThrow = exports.Witherable = exports.Traversable = exports.Filterable = exports.Compactable = exports.Extend = exports.Alternative = exports.Alt = exports.Foldable = exports.Monad = exports.Applicative = exports.Functor = exports.getMonoid = exports.getLastMonoid = exports.getFirstMonoid = exports.getApplyMonoid = void 0;
|
|
1511
|
-
|
|
1512
|
-
// -------------------------------------------------------------------------------------
|
|
1513
|
-
// guards
|
|
1514
|
-
// -------------------------------------------------------------------------------------
|
|
1515
|
-
/**
|
|
1516
|
-
* Returns `true` if the option is an instance of `Some`, `false` otherwise.
|
|
1517
|
-
*
|
|
1518
|
-
* @example
|
|
1519
|
-
* import { some, none, isSome } from 'fp-ts/Option'
|
|
1520
|
-
*
|
|
1521
|
-
* assert.strictEqual(isSome(some(1)), true)
|
|
1522
|
-
* assert.strictEqual(isSome(none), false)
|
|
1523
|
-
*
|
|
1524
|
-
* @category guards
|
|
1525
|
-
* @since 2.0.0
|
|
1526
|
-
*/
|
|
1527
|
-
var isSome = function (fa) { return fa._tag === 'Some'; };
|
|
1528
|
-
exports.isSome = isSome;
|
|
1529
|
-
/**
|
|
1530
|
-
* Returns `true` if the option is `None`, `false` otherwise.
|
|
1531
|
-
*
|
|
1532
|
-
* @example
|
|
1533
|
-
* import { some, none, isNone } from 'fp-ts/Option'
|
|
1534
|
-
*
|
|
1535
|
-
* assert.strictEqual(isNone(some(1)), false)
|
|
1536
|
-
* assert.strictEqual(isNone(none), true)
|
|
1537
|
-
*
|
|
1538
|
-
* @category guards
|
|
1539
|
-
* @since 2.0.0
|
|
1540
|
-
*/
|
|
1541
|
-
var isNone = function (fa) { return fa._tag === 'None'; };
|
|
1542
|
-
exports.isNone = isNone;
|
|
1543
|
-
// -------------------------------------------------------------------------------------
|
|
1544
|
-
// constructors
|
|
1545
|
-
// -------------------------------------------------------------------------------------
|
|
1546
|
-
/**
|
|
1547
|
-
* `None` doesn't have a constructor, instead you can use it directly as a value. Represents a missing value.
|
|
1548
|
-
*
|
|
1549
|
-
* @category constructors
|
|
1550
|
-
* @since 2.0.0
|
|
1551
|
-
*/
|
|
1552
|
-
exports.none = { _tag: 'None' };
|
|
1553
|
-
/**
|
|
1554
|
-
* Constructs a `Some`. Represents an optional value that exists.
|
|
1555
|
-
*
|
|
1556
|
-
* @category constructors
|
|
1557
|
-
* @since 2.0.0
|
|
1558
|
-
*/
|
|
1559
|
-
var some = function (a) { return ({ _tag: 'Some', value: a }); };
|
|
1560
|
-
exports.some = some;
|
|
1561
|
-
/**
|
|
1562
|
-
* Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise
|
|
1563
|
-
* returns the value wrapped in a `Some`.
|
|
1564
|
-
*
|
|
1565
|
-
* @example
|
|
1566
|
-
* import { none, some, fromNullable } from 'fp-ts/Option'
|
|
1567
|
-
*
|
|
1568
|
-
* assert.deepStrictEqual(fromNullable(undefined), none)
|
|
1569
|
-
* assert.deepStrictEqual(fromNullable(null), none)
|
|
1570
|
-
* assert.deepStrictEqual(fromNullable(1), some(1))
|
|
1571
|
-
*
|
|
1572
|
-
* @category constructors
|
|
1573
|
-
* @since 2.0.0
|
|
1574
|
-
*/
|
|
1575
|
-
function fromNullable(a) {
|
|
1576
|
-
return a == null ? exports.none : exports.some(a);
|
|
1577
|
-
}
|
|
1578
|
-
exports.fromNullable = fromNullable;
|
|
1579
|
-
function fromPredicate(predicate) {
|
|
1580
|
-
return function (a) { return (predicate(a) ? exports.some(a) : exports.none); };
|
|
1581
|
-
}
|
|
1582
|
-
exports.fromPredicate = fromPredicate;
|
|
1583
|
-
/**
|
|
1584
|
-
* Transforms an exception into an `Option`. If `f` throws, returns `None`, otherwise returns the output wrapped in a
|
|
1585
|
-
* `Some`.
|
|
1586
|
-
*
|
|
1587
|
-
* @example
|
|
1588
|
-
* import { none, some, tryCatch } from 'fp-ts/Option'
|
|
1589
|
-
*
|
|
1590
|
-
* assert.deepStrictEqual(
|
|
1591
|
-
* tryCatch(() => {
|
|
1592
|
-
* throw new Error()
|
|
1593
|
-
* }),
|
|
1594
|
-
* none
|
|
1595
|
-
* )
|
|
1596
|
-
* assert.deepStrictEqual(tryCatch(() => 1), some(1))
|
|
1597
|
-
*
|
|
1598
|
-
* @category constructors
|
|
1599
|
-
* @since 2.0.0
|
|
1600
|
-
*/
|
|
1601
|
-
function tryCatch(f) {
|
|
1602
|
-
try {
|
|
1603
|
-
return exports.some(f());
|
|
1604
|
-
}
|
|
1605
|
-
catch (e) {
|
|
1606
|
-
return exports.none;
|
|
1607
|
-
}
|
|
1608
|
-
}
|
|
1609
|
-
exports.tryCatch = tryCatch;
|
|
1610
|
-
/**
|
|
1611
|
-
* Returns the `Left` value of an `Either` if possible.
|
|
1612
|
-
*
|
|
1613
|
-
* @example
|
|
1614
|
-
* import { getLeft, none, some } from 'fp-ts/Option'
|
|
1615
|
-
* import { right, left } from 'fp-ts/Either'
|
|
1616
|
-
*
|
|
1617
|
-
* assert.deepStrictEqual(getLeft(right(1)), none)
|
|
1618
|
-
* assert.deepStrictEqual(getLeft(left('a')), some('a'))
|
|
1619
|
-
*
|
|
1620
|
-
* @category constructors
|
|
1621
|
-
* @since 2.0.0
|
|
1622
|
-
*/
|
|
1623
|
-
function getLeft(ma) {
|
|
1624
|
-
return ma._tag === 'Right' ? exports.none : exports.some(ma.left);
|
|
1625
|
-
}
|
|
1626
|
-
exports.getLeft = getLeft;
|
|
1627
|
-
/**
|
|
1628
|
-
* Returns the `Right` value of an `Either` if possible.
|
|
1629
|
-
*
|
|
1630
|
-
* @example
|
|
1631
|
-
* import { getRight, none, some } from 'fp-ts/Option'
|
|
1632
|
-
* import { right, left } from 'fp-ts/Either'
|
|
1633
|
-
*
|
|
1634
|
-
* assert.deepStrictEqual(getRight(right(1)), some(1))
|
|
1635
|
-
* assert.deepStrictEqual(getRight(left('a')), none)
|
|
1636
|
-
*
|
|
1637
|
-
* @category constructors
|
|
1638
|
-
* @since 2.0.0
|
|
1639
|
-
*/
|
|
1640
|
-
function getRight(ma) {
|
|
1641
|
-
return ma._tag === 'Left' ? exports.none : exports.some(ma.right);
|
|
1642
|
-
}
|
|
1643
|
-
exports.getRight = getRight;
|
|
1644
|
-
/**
|
|
1645
|
-
* Transforms an `Either` to an `Option` discarding the error.
|
|
1646
|
-
*
|
|
1647
|
-
* Alias of [getRight](#getRight)
|
|
1648
|
-
*
|
|
1649
|
-
* Derivable from `MonadThrow`.
|
|
1650
|
-
*
|
|
1651
|
-
* @category constructors
|
|
1652
|
-
* @since 2.0.0
|
|
1653
|
-
*/
|
|
1654
|
-
exports.fromEither = getRight;
|
|
1655
|
-
// -------------------------------------------------------------------------------------
|
|
1656
|
-
// destructors
|
|
1657
|
-
// -------------------------------------------------------------------------------------
|
|
1658
|
-
/**
|
|
1659
|
-
* Takes a (lazy) default value, a function, and an `Option` value, if the `Option` value is `None` the default value is
|
|
1660
|
-
* returned, otherwise the function is applied to the value inside the `Some` and the result is returned.
|
|
1661
|
-
*
|
|
1662
|
-
* @example
|
|
1663
|
-
* import { some, none, fold } from 'fp-ts/Option'
|
|
1664
|
-
* import { pipe } from 'fp-ts/function'
|
|
1665
|
-
*
|
|
1666
|
-
* assert.strictEqual(
|
|
1667
|
-
* pipe(
|
|
1668
|
-
* some(1),
|
|
1669
|
-
* fold(() => 'a none', a => `a some containing ${a}`)
|
|
1670
|
-
* ),
|
|
1671
|
-
* 'a some containing 1'
|
|
1672
|
-
* )
|
|
1673
|
-
*
|
|
1674
|
-
* assert.strictEqual(
|
|
1675
|
-
* pipe(
|
|
1676
|
-
* none,
|
|
1677
|
-
* fold(() => 'a none', a => `a some containing ${a}`)
|
|
1678
|
-
* ),
|
|
1679
|
-
* 'a none'
|
|
1680
|
-
* )
|
|
1681
|
-
*
|
|
1682
|
-
* @category destructors
|
|
1683
|
-
* @since 2.0.0
|
|
1684
|
-
*/
|
|
1685
|
-
function fold(onNone, onSome) {
|
|
1686
|
-
return function (ma) { return (exports.isNone(ma) ? onNone() : onSome(ma.value)); };
|
|
1687
|
-
}
|
|
1688
|
-
exports.fold = fold;
|
|
1689
|
-
/**
|
|
1690
|
-
* Extracts the value out of the structure, if it exists. Otherwise returns `null`.
|
|
1691
|
-
*
|
|
1692
|
-
* @example
|
|
1693
|
-
* import { some, none, toNullable } from 'fp-ts/Option'
|
|
1694
|
-
* import { pipe } from 'fp-ts/function'
|
|
1695
|
-
*
|
|
1696
|
-
* assert.strictEqual(
|
|
1697
|
-
* pipe(
|
|
1698
|
-
* some(1),
|
|
1699
|
-
* toNullable
|
|
1700
|
-
* ),
|
|
1701
|
-
* 1
|
|
1702
|
-
* )
|
|
1703
|
-
* assert.strictEqual(
|
|
1704
|
-
* pipe(
|
|
1705
|
-
* none,
|
|
1706
|
-
* toNullable
|
|
1707
|
-
* ),
|
|
1708
|
-
* null
|
|
1709
|
-
* )
|
|
1710
|
-
*
|
|
1711
|
-
* @category destructors
|
|
1712
|
-
* @since 2.0.0
|
|
1713
|
-
*/
|
|
1714
|
-
function toNullable(ma) {
|
|
1715
|
-
return exports.isNone(ma) ? null : ma.value;
|
|
1716
|
-
}
|
|
1717
|
-
exports.toNullable = toNullable;
|
|
1718
|
-
/**
|
|
1719
|
-
* Extracts the value out of the structure, if it exists. Otherwise returns `undefined`.
|
|
1720
|
-
*
|
|
1721
|
-
* @example
|
|
1722
|
-
* import { some, none, toUndefined } from 'fp-ts/Option'
|
|
1723
|
-
* import { pipe } from 'fp-ts/function'
|
|
1724
|
-
*
|
|
1725
|
-
* assert.strictEqual(
|
|
1726
|
-
* pipe(
|
|
1727
|
-
* some(1),
|
|
1728
|
-
* toUndefined
|
|
1729
|
-
* ),
|
|
1730
|
-
* 1
|
|
1731
|
-
* )
|
|
1732
|
-
* assert.strictEqual(
|
|
1733
|
-
* pipe(
|
|
1734
|
-
* none,
|
|
1735
|
-
* toUndefined
|
|
1736
|
-
* ),
|
|
1737
|
-
* undefined
|
|
1738
|
-
* )
|
|
1739
|
-
*
|
|
1740
|
-
* @category destructors
|
|
1741
|
-
* @since 2.0.0
|
|
1742
|
-
*/
|
|
1743
|
-
function toUndefined(ma) {
|
|
1744
|
-
return exports.isNone(ma) ? undefined : ma.value;
|
|
1745
|
-
}
|
|
1746
|
-
exports.toUndefined = toUndefined;
|
|
1747
|
-
/**
|
|
1748
|
-
* Less strict version of [`getOrElse`](#getOrElse).
|
|
1749
|
-
*
|
|
1750
|
-
* @category destructors
|
|
1751
|
-
* @since 2.6.0
|
|
1752
|
-
*/
|
|
1753
|
-
var getOrElseW = function (onNone) { return function (ma) { return (exports.isNone(ma) ? onNone() : ma.value); }; };
|
|
1754
|
-
exports.getOrElseW = getOrElseW;
|
|
1755
|
-
/**
|
|
1756
|
-
* Extracts the value out of the structure, if it exists. Otherwise returns the given default value
|
|
1757
|
-
*
|
|
1758
|
-
* @example
|
|
1759
|
-
* import { some, none, getOrElse } from 'fp-ts/Option'
|
|
1760
|
-
* import { pipe } from 'fp-ts/function'
|
|
1761
|
-
*
|
|
1762
|
-
* assert.strictEqual(
|
|
1763
|
-
* pipe(
|
|
1764
|
-
* some(1),
|
|
1765
|
-
* getOrElse(() => 0)
|
|
1766
|
-
* ),
|
|
1767
|
-
* 1
|
|
1768
|
-
* )
|
|
1769
|
-
* assert.strictEqual(
|
|
1770
|
-
* pipe(
|
|
1771
|
-
* none,
|
|
1772
|
-
* getOrElse(() => 0)
|
|
1773
|
-
* ),
|
|
1774
|
-
* 0
|
|
1775
|
-
* )
|
|
1776
|
-
*
|
|
1777
|
-
* @category destructors
|
|
1778
|
-
* @since 2.0.0
|
|
1779
|
-
*/
|
|
1780
|
-
exports.getOrElse = exports.getOrElseW;
|
|
1781
|
-
// -------------------------------------------------------------------------------------
|
|
1782
|
-
// combinators
|
|
1783
|
-
// -------------------------------------------------------------------------------------
|
|
1784
|
-
/**
|
|
1785
|
-
* Returns a *smart constructor* from a function that returns a nullable value.
|
|
1786
|
-
*
|
|
1787
|
-
* @example
|
|
1788
|
-
* import { fromNullableK, none, some } from 'fp-ts/Option'
|
|
1789
|
-
*
|
|
1790
|
-
* const f = (s: string): number | undefined => {
|
|
1791
|
-
* const n = parseFloat(s)
|
|
1792
|
-
* return isNaN(n) ? undefined : n
|
|
1793
|
-
* }
|
|
1794
|
-
*
|
|
1795
|
-
* const g = fromNullableK(f)
|
|
1796
|
-
*
|
|
1797
|
-
* assert.deepStrictEqual(g('1'), some(1))
|
|
1798
|
-
* assert.deepStrictEqual(g('a'), none)
|
|
1799
|
-
*
|
|
1800
|
-
* @category combinators
|
|
1801
|
-
* @since 2.9.0
|
|
1802
|
-
*/
|
|
1803
|
-
function fromNullableK(f) {
|
|
1804
|
-
return function () {
|
|
1805
|
-
var a = [];
|
|
1806
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1807
|
-
a[_i] = arguments[_i];
|
|
1808
|
-
}
|
|
1809
|
-
return fromNullable(f.apply(void 0, a));
|
|
1810
|
-
};
|
|
1811
|
-
}
|
|
1812
|
-
exports.fromNullableK = fromNullableK;
|
|
1813
|
-
/**
|
|
1814
|
-
* @category combinators
|
|
1815
|
-
* @since 2.0.0
|
|
1816
|
-
* @deprecated
|
|
1817
|
-
*/
|
|
1818
|
-
exports.mapNullable = chainNullableK;
|
|
1819
|
-
/**
|
|
1820
|
-
* This is `chain` + `fromNullable`, useful when working with optional values.
|
|
1821
|
-
*
|
|
1822
|
-
* @example
|
|
1823
|
-
* import { some, none, fromNullable, chainNullableK } from 'fp-ts/Option'
|
|
1824
|
-
* import { pipe } from 'fp-ts/function'
|
|
1825
|
-
*
|
|
1826
|
-
* interface Employee {
|
|
1827
|
-
* company?: {
|
|
1828
|
-
* address?: {
|
|
1829
|
-
* street?: {
|
|
1830
|
-
* name?: string
|
|
1831
|
-
* }
|
|
1832
|
-
* }
|
|
1833
|
-
* }
|
|
1834
|
-
* }
|
|
1835
|
-
*
|
|
1836
|
-
* const employee1: Employee = { company: { address: { street: { name: 'high street' } } } }
|
|
1837
|
-
*
|
|
1838
|
-
* assert.deepStrictEqual(
|
|
1839
|
-
* pipe(
|
|
1840
|
-
* fromNullable(employee1.company),
|
|
1841
|
-
* chainNullableK(company => company.address),
|
|
1842
|
-
* chainNullableK(address => address.street),
|
|
1843
|
-
* chainNullableK(street => street.name)
|
|
1844
|
-
* ),
|
|
1845
|
-
* some('high street')
|
|
1846
|
-
* )
|
|
1847
|
-
*
|
|
1848
|
-
* const employee2: Employee = { company: { address: { street: {} } } }
|
|
1849
|
-
*
|
|
1850
|
-
* assert.deepStrictEqual(
|
|
1851
|
-
* pipe(
|
|
1852
|
-
* fromNullable(employee2.company),
|
|
1853
|
-
* chainNullableK(company => company.address),
|
|
1854
|
-
* chainNullableK(address => address.street),
|
|
1855
|
-
* chainNullableK(street => street.name)
|
|
1856
|
-
* ),
|
|
1857
|
-
* none
|
|
1858
|
-
* )
|
|
1859
|
-
*
|
|
1860
|
-
* @category combinators
|
|
1861
|
-
* @since 2.9.0
|
|
1862
|
-
*/
|
|
1863
|
-
function chainNullableK(f) {
|
|
1864
|
-
return function (ma) { return (exports.isNone(ma) ? exports.none : fromNullable(f(ma.value))); };
|
|
1865
|
-
}
|
|
1866
|
-
exports.chainNullableK = chainNullableK;
|
|
1867
|
-
// -------------------------------------------------------------------------------------
|
|
1868
|
-
// non-pipeables
|
|
1869
|
-
// -------------------------------------------------------------------------------------
|
|
1870
|
-
var map_ = function (fa, f) { return _function.pipe(fa, exports.map(f)); };
|
|
1871
|
-
var ap_ = function (fab, fa) { return _function.pipe(fab, exports.ap(fa)); };
|
|
1872
|
-
var chain_ = function (ma, f) { return _function.pipe(ma, exports.chain(f)); };
|
|
1873
|
-
var reduce_ = function (fa, b, f) { return _function.pipe(fa, exports.reduce(b, f)); };
|
|
1874
|
-
var foldMap_ = function (M) {
|
|
1875
|
-
var foldMapM = exports.foldMap(M);
|
|
1876
|
-
return function (fa, f) { return _function.pipe(fa, foldMapM(f)); };
|
|
1877
|
-
};
|
|
1878
|
-
var reduceRight_ = function (fa, b, f) { return _function.pipe(fa, exports.reduceRight(b, f)); };
|
|
1879
|
-
var traverse_ = function (F) {
|
|
1880
|
-
var traverseF = exports.traverse(F);
|
|
1881
|
-
return function (ta, f) { return _function.pipe(ta, traverseF(f)); };
|
|
1882
|
-
};
|
|
1883
|
-
/* istanbul ignore next */
|
|
1884
|
-
var alt_ = function (fa, that) { return _function.pipe(fa, exports.alt(that)); };
|
|
1885
|
-
var filter_ = function (fa, predicate) {
|
|
1886
|
-
return _function.pipe(fa, exports.filter(predicate));
|
|
1887
|
-
};
|
|
1888
|
-
/* istanbul ignore next */
|
|
1889
|
-
var filterMap_ = function (fa, f) { return _function.pipe(fa, exports.filterMap(f)); };
|
|
1890
|
-
/* istanbul ignore next */
|
|
1891
|
-
var extend_ = function (wa, f) { return _function.pipe(wa, exports.extend(f)); };
|
|
1892
|
-
/* istanbul ignore next */
|
|
1893
|
-
var partition_ = function (fa, predicate) { return _function.pipe(fa, exports.partition(predicate)); };
|
|
1894
|
-
/* istanbul ignore next */
|
|
1895
|
-
var partitionMap_ = function (fa, f) { return _function.pipe(fa, exports.partitionMap(f)); };
|
|
1896
|
-
/* istanbul ignore next */
|
|
1897
|
-
var wither_ = function (F) {
|
|
1898
|
-
var witherF = exports.wither(F);
|
|
1899
|
-
return function (fa, f) { return _function.pipe(fa, witherF(f)); };
|
|
1900
|
-
};
|
|
1901
|
-
/* istanbul ignore next */
|
|
1902
|
-
var wilt_ = function (F) {
|
|
1903
|
-
var wiltF = exports.wilt(F);
|
|
1904
|
-
return function (fa, f) { return _function.pipe(fa, wiltF(f)); };
|
|
1905
|
-
};
|
|
1906
|
-
// -------------------------------------------------------------------------------------
|
|
1907
|
-
// pipeables
|
|
1908
|
-
// -------------------------------------------------------------------------------------
|
|
1909
|
-
/**
|
|
1910
|
-
* `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
|
|
1911
|
-
* use the type constructor `F` to represent some computational context.
|
|
1912
|
-
*
|
|
1913
|
-
* @category Functor
|
|
1914
|
-
* @since 2.0.0
|
|
1915
|
-
*/
|
|
1916
|
-
var map = function (f) { return function (fa) {
|
|
1917
|
-
return exports.isNone(fa) ? exports.none : exports.some(f(fa.value));
|
|
1918
|
-
}; };
|
|
1919
|
-
exports.map = map;
|
|
1920
|
-
/**
|
|
1921
|
-
* Apply a function to an argument under a type constructor.
|
|
1922
|
-
*
|
|
1923
|
-
* @category Apply
|
|
1924
|
-
* @since 2.0.0
|
|
1925
|
-
*/
|
|
1926
|
-
var ap = function (fa) { return function (fab) {
|
|
1927
|
-
return exports.isNone(fab) ? exports.none : exports.isNone(fa) ? exports.none : exports.some(fab.value(fa.value));
|
|
1928
|
-
}; };
|
|
1929
|
-
exports.ap = ap;
|
|
1930
|
-
/**
|
|
1931
|
-
* Combine two effectful actions, keeping only the result of the first.
|
|
1932
|
-
*
|
|
1933
|
-
* Derivable from `Apply`.
|
|
1934
|
-
*
|
|
1935
|
-
* @category combinators
|
|
1936
|
-
* @since 2.0.0
|
|
1937
|
-
*/
|
|
1938
|
-
var apFirst = function (fb) {
|
|
1939
|
-
return _function.flow(exports.map(function (a) { return function () { return a; }; }), exports.ap(fb));
|
|
1940
|
-
};
|
|
1941
|
-
exports.apFirst = apFirst;
|
|
1942
|
-
/**
|
|
1943
|
-
* Combine two effectful actions, keeping only the result of the second.
|
|
1944
|
-
*
|
|
1945
|
-
* Derivable from `Apply`.
|
|
1946
|
-
*
|
|
1947
|
-
* @category combinators
|
|
1948
|
-
* @since 2.0.0
|
|
1949
|
-
*/
|
|
1950
|
-
var apSecond = function (fb) {
|
|
1951
|
-
return _function.flow(exports.map(function () { return function (b) { return b; }; }), exports.ap(fb));
|
|
1952
|
-
};
|
|
1953
|
-
exports.apSecond = apSecond;
|
|
1954
|
-
/**
|
|
1955
|
-
* Wrap a value into the type constructor.
|
|
1956
|
-
*
|
|
1957
|
-
* @category Applicative
|
|
1958
|
-
* @since 2.7.0
|
|
1959
|
-
*/
|
|
1960
|
-
exports.of = exports.some;
|
|
1961
|
-
/**
|
|
1962
|
-
* Composes computations in sequence, using the return value of one computation to determine the next computation.
|
|
1963
|
-
*
|
|
1964
|
-
* @category Monad
|
|
1965
|
-
* @since 2.0.0
|
|
1966
|
-
*/
|
|
1967
|
-
var chain = function (f) { return function (ma) {
|
|
1968
|
-
return exports.isNone(ma) ? exports.none : f(ma.value);
|
|
1969
|
-
}; };
|
|
1970
|
-
exports.chain = chain;
|
|
1971
|
-
/**
|
|
1972
|
-
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
|
1973
|
-
* keeping only the result of the first.
|
|
1974
|
-
*
|
|
1975
|
-
* Derivable from `Monad`.
|
|
1976
|
-
*
|
|
1977
|
-
* @category combinators
|
|
1978
|
-
* @since 2.0.0
|
|
1979
|
-
*/
|
|
1980
|
-
var chainFirst = function (f) {
|
|
1981
|
-
return exports.chain(function (a) {
|
|
1982
|
-
return _function.pipe(f(a), exports.map(function () { return a; }));
|
|
1983
|
-
});
|
|
1984
|
-
};
|
|
1985
|
-
exports.chainFirst = chainFirst;
|
|
1986
|
-
/**
|
|
1987
|
-
* Derivable from `Monad`.
|
|
1988
|
-
*
|
|
1989
|
-
* @category combinators
|
|
1990
|
-
* @since 2.0.0
|
|
1991
|
-
*/
|
|
1992
|
-
exports.flatten =
|
|
1993
|
-
/*#__PURE__*/
|
|
1994
|
-
exports.chain(_function.identity);
|
|
1995
|
-
/**
|
|
1996
|
-
* Less strict version of [`alt`](#alt).
|
|
1997
|
-
*
|
|
1998
|
-
* @category Alt
|
|
1999
|
-
* @since 2.9.0
|
|
2000
|
-
*/
|
|
2001
|
-
var altW = function (that) { return function (fa) {
|
|
2002
|
-
return exports.isNone(fa) ? that() : fa;
|
|
2003
|
-
}; };
|
|
2004
|
-
exports.altW = altW;
|
|
2005
|
-
/**
|
|
2006
|
-
* Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
|
|
2007
|
-
* types of kind `* -> *`.
|
|
2008
|
-
*
|
|
2009
|
-
* In case of `Option` returns the left-most non-`None` value.
|
|
2010
|
-
*
|
|
2011
|
-
* @example
|
|
2012
|
-
* import * as O from 'fp-ts/Option'
|
|
2013
|
-
* import { pipe } from 'fp-ts/function'
|
|
2014
|
-
*
|
|
2015
|
-
* assert.deepStrictEqual(
|
|
2016
|
-
* pipe(
|
|
2017
|
-
* O.some('a'),
|
|
2018
|
-
* O.alt(() => O.some('b'))
|
|
2019
|
-
* ),
|
|
2020
|
-
* O.some('a')
|
|
2021
|
-
* )
|
|
2022
|
-
* assert.deepStrictEqual(
|
|
2023
|
-
* pipe(
|
|
2024
|
-
* O.none,
|
|
2025
|
-
* O.alt(() => O.some('b'))
|
|
2026
|
-
* ),
|
|
2027
|
-
* O.some('b')
|
|
2028
|
-
* )
|
|
2029
|
-
*
|
|
2030
|
-
* @category Alt
|
|
2031
|
-
* @since 2.0.0
|
|
2032
|
-
*/
|
|
2033
|
-
exports.alt = exports.altW;
|
|
2034
|
-
/**
|
|
2035
|
-
* @category Alternative
|
|
2036
|
-
* @since 2.7.0
|
|
2037
|
-
*/
|
|
2038
|
-
var zero = function () { return exports.none; };
|
|
2039
|
-
exports.zero = zero;
|
|
2040
|
-
/**
|
|
2041
|
-
* @category MonadThrow
|
|
2042
|
-
* @since 2.7.0
|
|
2043
|
-
*/
|
|
2044
|
-
var throwError = function () { return exports.none; };
|
|
2045
|
-
exports.throwError = throwError;
|
|
2046
|
-
/**
|
|
2047
|
-
* @category Extend
|
|
2048
|
-
* @since 2.0.0
|
|
2049
|
-
*/
|
|
2050
|
-
var extend = function (f) { return function (wa) {
|
|
2051
|
-
return exports.isNone(wa) ? exports.none : exports.some(f(wa));
|
|
2052
|
-
}; };
|
|
2053
|
-
exports.extend = extend;
|
|
2054
|
-
/**
|
|
2055
|
-
* Derivable from `Extend`.
|
|
2056
|
-
*
|
|
2057
|
-
* @category combinators
|
|
2058
|
-
* @since 2.0.0
|
|
2059
|
-
*/
|
|
2060
|
-
exports.duplicate =
|
|
2061
|
-
/*#__PURE__*/
|
|
2062
|
-
exports.extend(_function.identity);
|
|
2063
|
-
/**
|
|
2064
|
-
* @category Foldable
|
|
2065
|
-
* @since 2.0.0
|
|
2066
|
-
*/
|
|
2067
|
-
var reduce = function (b, f) { return function (fa) {
|
|
2068
|
-
return exports.isNone(fa) ? b : f(b, fa.value);
|
|
2069
|
-
}; };
|
|
2070
|
-
exports.reduce = reduce;
|
|
2071
|
-
/**
|
|
2072
|
-
* @category Foldable
|
|
2073
|
-
* @since 2.0.0
|
|
2074
|
-
*/
|
|
2075
|
-
var foldMap = function (M) { return function (f) { return function (fa) {
|
|
2076
|
-
return exports.isNone(fa) ? M.empty : f(fa.value);
|
|
2077
|
-
}; }; };
|
|
2078
|
-
exports.foldMap = foldMap;
|
|
2079
|
-
/**
|
|
2080
|
-
* @category Foldable
|
|
2081
|
-
* @since 2.0.0
|
|
2082
|
-
*/
|
|
2083
|
-
var reduceRight = function (b, f) { return function (fa) {
|
|
2084
|
-
return exports.isNone(fa) ? b : f(fa.value, b);
|
|
2085
|
-
}; };
|
|
2086
|
-
exports.reduceRight = reduceRight;
|
|
2087
|
-
/**
|
|
2088
|
-
* @category Compactable
|
|
2089
|
-
* @since 2.0.0
|
|
2090
|
-
*/
|
|
2091
|
-
exports.compact = exports.flatten;
|
|
2092
|
-
var defaultSeparate = { left: exports.none, right: exports.none };
|
|
2093
|
-
/**
|
|
2094
|
-
* @category Compactable
|
|
2095
|
-
* @since 2.0.0
|
|
2096
|
-
*/
|
|
2097
|
-
var separate = function (ma) {
|
|
2098
|
-
var o = _function.pipe(ma, exports.map(function (e) { return ({
|
|
2099
|
-
left: getLeft(e),
|
|
2100
|
-
right: getRight(e)
|
|
2101
|
-
}); }));
|
|
2102
|
-
return exports.isNone(o) ? defaultSeparate : o.value;
|
|
2103
|
-
};
|
|
2104
|
-
exports.separate = separate;
|
|
2105
|
-
/**
|
|
2106
|
-
* @category Filterable
|
|
2107
|
-
* @since 2.0.0
|
|
2108
|
-
*/
|
|
2109
|
-
var filter = function (predicate) { return function (fa) { return (exports.isNone(fa) ? exports.none : predicate(fa.value) ? fa : exports.none); }; };
|
|
2110
|
-
exports.filter = filter;
|
|
2111
|
-
/**
|
|
2112
|
-
* @category Filterable
|
|
2113
|
-
* @since 2.0.0
|
|
2114
|
-
*/
|
|
2115
|
-
var filterMap = function (f) { return function (fa) {
|
|
2116
|
-
return exports.isNone(fa) ? exports.none : f(fa.value);
|
|
2117
|
-
}; };
|
|
2118
|
-
exports.filterMap = filterMap;
|
|
2119
|
-
/**
|
|
2120
|
-
* @category Filterable
|
|
2121
|
-
* @since 2.0.0
|
|
2122
|
-
*/
|
|
2123
|
-
var partition = function (predicate) { return function (fa) {
|
|
2124
|
-
return {
|
|
2125
|
-
left: filter_(fa, function (a) { return !predicate(a); }),
|
|
2126
|
-
right: filter_(fa, predicate)
|
|
2127
|
-
};
|
|
2128
|
-
}; };
|
|
2129
|
-
exports.partition = partition;
|
|
2130
|
-
/**
|
|
2131
|
-
* @category Filterable
|
|
2132
|
-
* @since 2.0.0
|
|
2133
|
-
*/
|
|
2134
|
-
var partitionMap = function (f) { return _function.flow(exports.map(f), exports.separate); };
|
|
2135
|
-
exports.partitionMap = partitionMap;
|
|
2136
|
-
/**
|
|
2137
|
-
* @category Traversable
|
|
2138
|
-
* @since 2.6.3
|
|
2139
|
-
*/
|
|
2140
|
-
var traverse = function (F) { return function (f) { return function (ta) { return (exports.isNone(ta) ? F.of(exports.none) : F.map(f(ta.value), exports.some)); }; }; };
|
|
2141
|
-
exports.traverse = traverse;
|
|
2142
|
-
/**
|
|
2143
|
-
* @category Traversable
|
|
2144
|
-
* @since 2.6.3
|
|
2145
|
-
*/
|
|
2146
|
-
var sequence = function (F) { return function (ta) { return (exports.isNone(ta) ? F.of(exports.none) : F.map(ta.value, exports.some)); }; };
|
|
2147
|
-
exports.sequence = sequence;
|
|
2148
|
-
/**
|
|
2149
|
-
* @category Witherable
|
|
2150
|
-
* @since 2.6.5
|
|
2151
|
-
*/
|
|
2152
|
-
var wither = function (F) { return function (f) { return function (fa) { return (exports.isNone(fa) ? F.of(exports.none) : f(fa.value)); }; }; };
|
|
2153
|
-
exports.wither = wither;
|
|
2154
|
-
/**
|
|
2155
|
-
* @category Witherable
|
|
2156
|
-
* @since 2.6.5
|
|
2157
|
-
*/
|
|
2158
|
-
var wilt = function (F) { return function (f) { return function (fa) {
|
|
2159
|
-
return exports.isNone(fa)
|
|
2160
|
-
? F.of({
|
|
2161
|
-
left: exports.none,
|
|
2162
|
-
right: exports.none
|
|
2163
|
-
})
|
|
2164
|
-
: F.map(f(fa.value), function (e) { return ({
|
|
2165
|
-
left: getLeft(e),
|
|
2166
|
-
right: getRight(e)
|
|
2167
|
-
}); });
|
|
2168
|
-
}; }; };
|
|
2169
|
-
exports.wilt = wilt;
|
|
2170
|
-
// -------------------------------------------------------------------------------------
|
|
2171
|
-
// instances
|
|
2172
|
-
// -------------------------------------------------------------------------------------
|
|
2173
|
-
/**
|
|
2174
|
-
* @category instances
|
|
2175
|
-
* @since 2.0.0
|
|
2176
|
-
*/
|
|
2177
|
-
exports.URI = 'Option';
|
|
2178
|
-
/**
|
|
2179
|
-
* @category instances
|
|
2180
|
-
* @since 2.0.0
|
|
2181
|
-
*/
|
|
2182
|
-
function getShow(S) {
|
|
2183
|
-
return {
|
|
2184
|
-
show: function (ma) { return (exports.isNone(ma) ? 'none' : "some(" + S.show(ma.value) + ")"); }
|
|
2185
|
-
};
|
|
2186
|
-
}
|
|
2187
|
-
exports.getShow = getShow;
|
|
2188
|
-
/**
|
|
2189
|
-
* @example
|
|
2190
|
-
* import { none, some, getEq } from 'fp-ts/Option'
|
|
2191
|
-
* import { eqNumber } from 'fp-ts/Eq'
|
|
2192
|
-
*
|
|
2193
|
-
* const E = getEq(eqNumber)
|
|
2194
|
-
* assert.strictEqual(E.equals(none, none), true)
|
|
2195
|
-
* assert.strictEqual(E.equals(none, some(1)), false)
|
|
2196
|
-
* assert.strictEqual(E.equals(some(1), none), false)
|
|
2197
|
-
* assert.strictEqual(E.equals(some(1), some(2)), false)
|
|
2198
|
-
* assert.strictEqual(E.equals(some(1), some(1)), true)
|
|
2199
|
-
*
|
|
2200
|
-
* @category instances
|
|
2201
|
-
* @since 2.0.0
|
|
2202
|
-
*/
|
|
2203
|
-
function getEq(E) {
|
|
2204
|
-
return {
|
|
2205
|
-
equals: function (x, y) { return x === y || (exports.isNone(x) ? exports.isNone(y) : exports.isNone(y) ? false : E.equals(x.value, y.value)); }
|
|
2206
|
-
};
|
|
2207
|
-
}
|
|
2208
|
-
exports.getEq = getEq;
|
|
2209
|
-
/**
|
|
2210
|
-
* The `Ord` instance allows `Option` values to be compared with
|
|
2211
|
-
* `compare`, whenever there is an `Ord` instance for
|
|
2212
|
-
* the type the `Option` contains.
|
|
2213
|
-
*
|
|
2214
|
-
* `None` is considered to be less than any `Some` value.
|
|
2215
|
-
*
|
|
2216
|
-
*
|
|
2217
|
-
* @example
|
|
2218
|
-
* import { none, some, getOrd } from 'fp-ts/Option'
|
|
2219
|
-
* import { ordNumber } from 'fp-ts/Ord'
|
|
2220
|
-
*
|
|
2221
|
-
* const O = getOrd(ordNumber)
|
|
2222
|
-
* assert.strictEqual(O.compare(none, none), 0)
|
|
2223
|
-
* assert.strictEqual(O.compare(none, some(1)), -1)
|
|
2224
|
-
* assert.strictEqual(O.compare(some(1), none), 1)
|
|
2225
|
-
* assert.strictEqual(O.compare(some(1), some(2)), -1)
|
|
2226
|
-
* assert.strictEqual(O.compare(some(1), some(1)), 0)
|
|
2227
|
-
*
|
|
2228
|
-
* @category instances
|
|
2229
|
-
* @since 2.0.0
|
|
2230
|
-
*/
|
|
2231
|
-
function getOrd(O) {
|
|
2232
|
-
return {
|
|
2233
|
-
equals: getEq(O).equals,
|
|
2234
|
-
compare: function (x, y) { return (x === y ? 0 : exports.isSome(x) ? (exports.isSome(y) ? O.compare(x.value, y.value) : 1) : -1); }
|
|
2235
|
-
};
|
|
2236
|
-
}
|
|
2237
|
-
exports.getOrd = getOrd;
|
|
2238
|
-
/**
|
|
2239
|
-
* `Apply` semigroup
|
|
2240
|
-
*
|
|
2241
|
-
* | x | y | concat(x, y) |
|
|
2242
|
-
* | ------- | ------- | ------------------ |
|
|
2243
|
-
* | none | none | none |
|
|
2244
|
-
* | some(a) | none | none |
|
|
2245
|
-
* | none | some(a) | none |
|
|
2246
|
-
* | some(a) | some(b) | some(concat(a, b)) |
|
|
2247
|
-
*
|
|
2248
|
-
* @example
|
|
2249
|
-
* import { getApplySemigroup, some, none } from 'fp-ts/Option'
|
|
2250
|
-
* import { semigroupSum } from 'fp-ts/Semigroup'
|
|
2251
|
-
*
|
|
2252
|
-
* const S = getApplySemigroup(semigroupSum)
|
|
2253
|
-
* assert.deepStrictEqual(S.concat(none, none), none)
|
|
2254
|
-
* assert.deepStrictEqual(S.concat(some(1), none), none)
|
|
2255
|
-
* assert.deepStrictEqual(S.concat(none, some(1)), none)
|
|
2256
|
-
* assert.deepStrictEqual(S.concat(some(1), some(2)), some(3))
|
|
2257
|
-
*
|
|
2258
|
-
* @category instances
|
|
2259
|
-
* @since 2.0.0
|
|
2260
|
-
*/
|
|
2261
|
-
function getApplySemigroup(S) {
|
|
2262
|
-
return {
|
|
2263
|
-
concat: function (x, y) { return (exports.isSome(x) && exports.isSome(y) ? exports.some(S.concat(x.value, y.value)) : exports.none); }
|
|
2264
|
-
};
|
|
2265
|
-
}
|
|
2266
|
-
exports.getApplySemigroup = getApplySemigroup;
|
|
2267
|
-
/**
|
|
2268
|
-
* @category instances
|
|
2269
|
-
* @since 2.0.0
|
|
2270
|
-
*/
|
|
2271
|
-
function getApplyMonoid(M) {
|
|
2272
|
-
return {
|
|
2273
|
-
concat: getApplySemigroup(M).concat,
|
|
2274
|
-
empty: exports.some(M.empty)
|
|
2275
|
-
};
|
|
2276
|
-
}
|
|
2277
|
-
exports.getApplyMonoid = getApplyMonoid;
|
|
2278
|
-
/**
|
|
2279
|
-
* Monoid returning the left-most non-`None` value
|
|
2280
|
-
*
|
|
2281
|
-
* | x | y | concat(x, y) |
|
|
2282
|
-
* | ------- | ------- | ------------ |
|
|
2283
|
-
* | none | none | none |
|
|
2284
|
-
* | some(a) | none | some(a) |
|
|
2285
|
-
* | none | some(a) | some(a) |
|
|
2286
|
-
* | some(a) | some(b) | some(a) |
|
|
2287
|
-
*
|
|
2288
|
-
* @example
|
|
2289
|
-
* import { getFirstMonoid, some, none } from 'fp-ts/Option'
|
|
2290
|
-
*
|
|
2291
|
-
* const M = getFirstMonoid<number>()
|
|
2292
|
-
* assert.deepStrictEqual(M.concat(none, none), none)
|
|
2293
|
-
* assert.deepStrictEqual(M.concat(some(1), none), some(1))
|
|
2294
|
-
* assert.deepStrictEqual(M.concat(none, some(1)), some(1))
|
|
2295
|
-
* assert.deepStrictEqual(M.concat(some(1), some(2)), some(1))
|
|
2296
|
-
*
|
|
2297
|
-
* @category instances
|
|
2298
|
-
* @since 2.0.0
|
|
2299
|
-
*/
|
|
2300
|
-
function getFirstMonoid() {
|
|
2301
|
-
return {
|
|
2302
|
-
concat: function (x, y) { return (exports.isNone(x) ? y : x); },
|
|
2303
|
-
empty: exports.none
|
|
2304
|
-
};
|
|
2305
|
-
}
|
|
2306
|
-
exports.getFirstMonoid = getFirstMonoid;
|
|
2307
|
-
/**
|
|
2308
|
-
* Monoid returning the right-most non-`None` value
|
|
2309
|
-
*
|
|
2310
|
-
* | x | y | concat(x, y) |
|
|
2311
|
-
* | ------- | ------- | ------------ |
|
|
2312
|
-
* | none | none | none |
|
|
2313
|
-
* | some(a) | none | some(a) |
|
|
2314
|
-
* | none | some(a) | some(a) |
|
|
2315
|
-
* | some(a) | some(b) | some(b) |
|
|
2316
|
-
*
|
|
2317
|
-
* @example
|
|
2318
|
-
* import { getLastMonoid, some, none } from 'fp-ts/Option'
|
|
2319
|
-
*
|
|
2320
|
-
* const M = getLastMonoid<number>()
|
|
2321
|
-
* assert.deepStrictEqual(M.concat(none, none), none)
|
|
2322
|
-
* assert.deepStrictEqual(M.concat(some(1), none), some(1))
|
|
2323
|
-
* assert.deepStrictEqual(M.concat(none, some(1)), some(1))
|
|
2324
|
-
* assert.deepStrictEqual(M.concat(some(1), some(2)), some(2))
|
|
2325
|
-
*
|
|
2326
|
-
* @category instances
|
|
2327
|
-
* @since 2.0.0
|
|
2328
|
-
*/
|
|
2329
|
-
function getLastMonoid() {
|
|
2330
|
-
return {
|
|
2331
|
-
concat: function (x, y) { return (exports.isNone(y) ? x : y); },
|
|
2332
|
-
empty: exports.none
|
|
2333
|
-
};
|
|
2334
|
-
}
|
|
2335
|
-
exports.getLastMonoid = getLastMonoid;
|
|
2336
|
-
/**
|
|
2337
|
-
* Monoid returning the left-most non-`None` value. If both operands are `Some`s then the inner values are
|
|
2338
|
-
* concatenated using the provided `Semigroup`
|
|
2339
|
-
*
|
|
2340
|
-
* | x | y | concat(x, y) |
|
|
2341
|
-
* | ------- | ------- | ------------------ |
|
|
2342
|
-
* | none | none | none |
|
|
2343
|
-
* | some(a) | none | some(a) |
|
|
2344
|
-
* | none | some(a) | some(a) |
|
|
2345
|
-
* | some(a) | some(b) | some(concat(a, b)) |
|
|
2346
|
-
*
|
|
2347
|
-
* @example
|
|
2348
|
-
* import { getMonoid, some, none } from 'fp-ts/Option'
|
|
2349
|
-
* import { semigroupSum } from 'fp-ts/Semigroup'
|
|
2350
|
-
*
|
|
2351
|
-
* const M = getMonoid(semigroupSum)
|
|
2352
|
-
* assert.deepStrictEqual(M.concat(none, none), none)
|
|
2353
|
-
* assert.deepStrictEqual(M.concat(some(1), none), some(1))
|
|
2354
|
-
* assert.deepStrictEqual(M.concat(none, some(1)), some(1))
|
|
2355
|
-
* assert.deepStrictEqual(M.concat(some(1), some(2)), some(3))
|
|
2356
|
-
*
|
|
2357
|
-
* @category instances
|
|
2358
|
-
* @since 2.0.0
|
|
2359
|
-
*/
|
|
2360
|
-
function getMonoid(S) {
|
|
2361
|
-
return {
|
|
2362
|
-
concat: function (x, y) { return (exports.isNone(x) ? y : exports.isNone(y) ? x : exports.some(S.concat(x.value, y.value))); },
|
|
2363
|
-
empty: exports.none
|
|
2364
|
-
};
|
|
2365
|
-
}
|
|
2366
|
-
exports.getMonoid = getMonoid;
|
|
2367
|
-
/**
|
|
2368
|
-
* @category instances
|
|
2369
|
-
* @since 2.7.0
|
|
2370
|
-
*/
|
|
2371
|
-
exports.Functor = {
|
|
2372
|
-
URI: exports.URI,
|
|
2373
|
-
map: map_
|
|
2374
|
-
};
|
|
2375
|
-
/**
|
|
2376
|
-
* @category instances
|
|
2377
|
-
* @since 2.7.0
|
|
2378
|
-
*/
|
|
2379
|
-
exports.Applicative = {
|
|
2380
|
-
URI: exports.URI,
|
|
2381
|
-
map: map_,
|
|
2382
|
-
ap: ap_,
|
|
2383
|
-
of: exports.of
|
|
2384
|
-
};
|
|
2385
|
-
/**
|
|
2386
|
-
* @category instances
|
|
2387
|
-
* @since 2.7.0
|
|
2388
|
-
*/
|
|
2389
|
-
exports.Monad = {
|
|
2390
|
-
URI: exports.URI,
|
|
2391
|
-
map: map_,
|
|
2392
|
-
ap: ap_,
|
|
2393
|
-
of: exports.of,
|
|
2394
|
-
chain: chain_
|
|
2395
|
-
};
|
|
2396
|
-
/**
|
|
2397
|
-
* @category instances
|
|
2398
|
-
* @since 2.7.0
|
|
2399
|
-
*/
|
|
2400
|
-
exports.Foldable = {
|
|
2401
|
-
URI: exports.URI,
|
|
2402
|
-
reduce: reduce_,
|
|
2403
|
-
foldMap: foldMap_,
|
|
2404
|
-
reduceRight: reduceRight_
|
|
2405
|
-
};
|
|
2406
|
-
/**
|
|
2407
|
-
* @category instances
|
|
2408
|
-
* @since 2.7.0
|
|
2409
|
-
*/
|
|
2410
|
-
exports.Alt = {
|
|
2411
|
-
URI: exports.URI,
|
|
2412
|
-
map: map_,
|
|
2413
|
-
alt: alt_
|
|
2414
|
-
};
|
|
2415
|
-
/**
|
|
2416
|
-
* @category instances
|
|
2417
|
-
* @since 2.7.0
|
|
2418
|
-
*/
|
|
2419
|
-
exports.Alternative = {
|
|
2420
|
-
URI: exports.URI,
|
|
2421
|
-
map: map_,
|
|
2422
|
-
ap: ap_,
|
|
2423
|
-
of: exports.of,
|
|
2424
|
-
alt: alt_,
|
|
2425
|
-
zero: exports.zero
|
|
2426
|
-
};
|
|
2427
|
-
/**
|
|
2428
|
-
* @category instances
|
|
2429
|
-
* @since 2.7.0
|
|
2430
|
-
*/
|
|
2431
|
-
exports.Extend = {
|
|
2432
|
-
URI: exports.URI,
|
|
2433
|
-
map: map_,
|
|
2434
|
-
extend: extend_
|
|
2435
|
-
};
|
|
2436
|
-
/**
|
|
2437
|
-
* @category instances
|
|
2438
|
-
* @since 2.7.0
|
|
2439
|
-
*/
|
|
2440
|
-
exports.Compactable = {
|
|
2441
|
-
URI: exports.URI,
|
|
2442
|
-
compact: exports.compact,
|
|
2443
|
-
separate: exports.separate
|
|
2444
|
-
};
|
|
2445
|
-
/**
|
|
2446
|
-
* @category instances
|
|
2447
|
-
* @since 2.7.0
|
|
2448
|
-
*/
|
|
2449
|
-
exports.Filterable = {
|
|
2450
|
-
URI: exports.URI,
|
|
2451
|
-
map: map_,
|
|
2452
|
-
compact: exports.compact,
|
|
2453
|
-
separate: exports.separate,
|
|
2454
|
-
filter: filter_,
|
|
2455
|
-
filterMap: filterMap_,
|
|
2456
|
-
partition: partition_,
|
|
2457
|
-
partitionMap: partitionMap_
|
|
2458
|
-
};
|
|
2459
|
-
/**
|
|
2460
|
-
* @category instances
|
|
2461
|
-
* @since 2.7.0
|
|
2462
|
-
*/
|
|
2463
|
-
exports.Traversable = {
|
|
2464
|
-
URI: exports.URI,
|
|
2465
|
-
map: map_,
|
|
2466
|
-
reduce: reduce_,
|
|
2467
|
-
foldMap: foldMap_,
|
|
2468
|
-
reduceRight: reduceRight_,
|
|
2469
|
-
traverse: traverse_,
|
|
2470
|
-
sequence: exports.sequence
|
|
2471
|
-
};
|
|
2472
|
-
/**
|
|
2473
|
-
* @category instances
|
|
2474
|
-
* @since 2.7.0
|
|
2475
|
-
*/
|
|
2476
|
-
exports.Witherable = {
|
|
2477
|
-
URI: exports.URI,
|
|
2478
|
-
map: map_,
|
|
2479
|
-
reduce: reduce_,
|
|
2480
|
-
foldMap: foldMap_,
|
|
2481
|
-
reduceRight: reduceRight_,
|
|
2482
|
-
traverse: traverse_,
|
|
2483
|
-
sequence: exports.sequence,
|
|
2484
|
-
compact: exports.compact,
|
|
2485
|
-
separate: exports.separate,
|
|
2486
|
-
filter: filter_,
|
|
2487
|
-
filterMap: filterMap_,
|
|
2488
|
-
partition: partition_,
|
|
2489
|
-
partitionMap: partitionMap_,
|
|
2490
|
-
wither: wither_,
|
|
2491
|
-
wilt: wilt_
|
|
2492
|
-
};
|
|
2493
|
-
/**
|
|
2494
|
-
* @category instances
|
|
2495
|
-
* @since 2.7.0
|
|
2496
|
-
*/
|
|
2497
|
-
exports.MonadThrow = {
|
|
2498
|
-
URI: exports.URI,
|
|
2499
|
-
map: map_,
|
|
2500
|
-
ap: ap_,
|
|
2501
|
-
of: exports.of,
|
|
2502
|
-
chain: chain_,
|
|
2503
|
-
throwError: exports.throwError
|
|
2504
|
-
};
|
|
2505
|
-
// TODO: remove in v3
|
|
2506
|
-
/**
|
|
2507
|
-
* @category instances
|
|
2508
|
-
* @since 2.0.0
|
|
2509
|
-
*/
|
|
2510
|
-
exports.option = {
|
|
2511
|
-
URI: exports.URI,
|
|
2512
|
-
map: map_,
|
|
2513
|
-
of: exports.of,
|
|
2514
|
-
ap: ap_,
|
|
2515
|
-
chain: chain_,
|
|
2516
|
-
reduce: reduce_,
|
|
2517
|
-
foldMap: foldMap_,
|
|
2518
|
-
reduceRight: reduceRight_,
|
|
2519
|
-
traverse: traverse_,
|
|
2520
|
-
sequence: exports.sequence,
|
|
2521
|
-
zero: exports.zero,
|
|
2522
|
-
alt: alt_,
|
|
2523
|
-
extend: extend_,
|
|
2524
|
-
compact: exports.compact,
|
|
2525
|
-
separate: exports.separate,
|
|
2526
|
-
filter: filter_,
|
|
2527
|
-
filterMap: filterMap_,
|
|
2528
|
-
partition: partition_,
|
|
2529
|
-
partitionMap: partitionMap_,
|
|
2530
|
-
wither: wither_,
|
|
2531
|
-
wilt: wilt_,
|
|
2532
|
-
throwError: exports.throwError
|
|
2533
|
-
};
|
|
2534
|
-
// -------------------------------------------------------------------------------------
|
|
2535
|
-
// utils
|
|
2536
|
-
// -------------------------------------------------------------------------------------
|
|
2537
|
-
/**
|
|
2538
|
-
* Returns `true` if `ma` contains `a`
|
|
2539
|
-
*
|
|
2540
|
-
* @example
|
|
2541
|
-
* import { some, none, elem } from 'fp-ts/Option'
|
|
2542
|
-
* import { eqNumber } from 'fp-ts/Eq'
|
|
2543
|
-
*
|
|
2544
|
-
* assert.strictEqual(elem(eqNumber)(1, some(1)), true)
|
|
2545
|
-
* assert.strictEqual(elem(eqNumber)(2, some(1)), false)
|
|
2546
|
-
* assert.strictEqual(elem(eqNumber)(1, none), false)
|
|
2547
|
-
*
|
|
2548
|
-
* @since 2.0.0
|
|
2549
|
-
*/
|
|
2550
|
-
function elem(E) {
|
|
2551
|
-
return function (a, ma) { return (exports.isNone(ma) ? false : E.equals(a, ma.value)); };
|
|
2552
|
-
}
|
|
2553
|
-
exports.elem = elem;
|
|
2554
|
-
/**
|
|
2555
|
-
* Returns `true` if the predicate is satisfied by the wrapped value
|
|
2556
|
-
*
|
|
2557
|
-
* @example
|
|
2558
|
-
* import { some, none, exists } from 'fp-ts/Option'
|
|
2559
|
-
* import { pipe } from 'fp-ts/function'
|
|
2560
|
-
*
|
|
2561
|
-
* assert.strictEqual(
|
|
2562
|
-
* pipe(
|
|
2563
|
-
* some(1),
|
|
2564
|
-
* exists(n => n > 0)
|
|
2565
|
-
* ),
|
|
2566
|
-
* true
|
|
2567
|
-
* )
|
|
2568
|
-
* assert.strictEqual(
|
|
2569
|
-
* pipe(
|
|
2570
|
-
* some(1),
|
|
2571
|
-
* exists(n => n > 1)
|
|
2572
|
-
* ),
|
|
2573
|
-
* false
|
|
2574
|
-
* )
|
|
2575
|
-
* assert.strictEqual(
|
|
2576
|
-
* pipe(
|
|
2577
|
-
* none,
|
|
2578
|
-
* exists(n => n > 0)
|
|
2579
|
-
* ),
|
|
2580
|
-
* false
|
|
2581
|
-
* )
|
|
2582
|
-
*
|
|
2583
|
-
* @since 2.0.0
|
|
2584
|
-
*/
|
|
2585
|
-
function exists(predicate) {
|
|
2586
|
-
return function (ma) { return (exports.isNone(ma) ? false : predicate(ma.value)); };
|
|
2587
|
-
}
|
|
2588
|
-
exports.exists = exists;
|
|
2589
|
-
/**
|
|
2590
|
-
* Returns a `Refinement` (i.e. a custom type guard) from a `Option` returning function.
|
|
2591
|
-
* This function ensures that a custom type guard definition is type-safe.
|
|
2592
|
-
*
|
|
2593
|
-
* ```ts
|
|
2594
|
-
* import { some, none, getRefinement } from 'fp-ts/Option'
|
|
2595
|
-
*
|
|
2596
|
-
* type A = { type: 'A' }
|
|
2597
|
-
* type B = { type: 'B' }
|
|
2598
|
-
* type C = A | B
|
|
2599
|
-
*
|
|
2600
|
-
* const isA = (c: C): c is A => c.type === 'B' // <= typo but typescript doesn't complain
|
|
2601
|
-
* const isA = getRefinement<C, A>(c => (c.type === 'B' ? some(c) : none)) // static error: Type '"B"' is not assignable to type '"A"'
|
|
2602
|
-
* ```
|
|
2603
|
-
*
|
|
2604
|
-
* @since 2.0.0
|
|
2605
|
-
*/
|
|
2606
|
-
function getRefinement(getOption) {
|
|
2607
|
-
return function (a) { return exports.isSome(getOption(a)); };
|
|
2608
|
-
}
|
|
2609
|
-
exports.getRefinement = getRefinement;
|
|
2610
|
-
// -------------------------------------------------------------------------------------
|
|
2611
|
-
// do notation
|
|
2612
|
-
// -------------------------------------------------------------------------------------
|
|
2613
|
-
/**
|
|
2614
|
-
* @since 2.9.0
|
|
2615
|
-
*/
|
|
2616
|
-
exports.Do =
|
|
2617
|
-
/*#__PURE__*/
|
|
2618
|
-
exports.of({});
|
|
2619
|
-
/**
|
|
2620
|
-
* @since 2.8.0
|
|
2621
|
-
*/
|
|
2622
|
-
var bindTo = function (name) { return exports.map(_function.bindTo_(name)); };
|
|
2623
|
-
exports.bindTo = bindTo;
|
|
2624
|
-
/**
|
|
2625
|
-
* @since 2.8.0
|
|
2626
|
-
*/
|
|
2627
|
-
var bind = function (name, f) {
|
|
2628
|
-
return exports.chain(function (a) {
|
|
2629
|
-
return _function.pipe(f(a), exports.map(function (b) { return _function.bind_(a, name, b); }));
|
|
2630
|
-
});
|
|
2631
|
-
};
|
|
2632
|
-
exports.bind = bind;
|
|
2633
|
-
// -------------------------------------------------------------------------------------
|
|
2634
|
-
// pipeable sequence S
|
|
2635
|
-
// -------------------------------------------------------------------------------------
|
|
2636
|
-
/**
|
|
2637
|
-
* @since 2.8.0
|
|
2638
|
-
*/
|
|
2639
|
-
var apS = function (name, fb) {
|
|
2640
|
-
return _function.flow(exports.map(function (a) { return function (b) { return _function.bind_(a, name, b); }; }), exports.ap(fb));
|
|
2641
|
-
};
|
|
2642
|
-
exports.apS = apS;
|
|
2643
|
-
// -------------------------------------------------------------------------------------
|
|
2644
|
-
// array utils
|
|
2645
|
-
// -------------------------------------------------------------------------------------
|
|
2646
|
-
/**
|
|
2647
|
-
*
|
|
2648
|
-
* @since 2.9.0
|
|
2649
|
-
*/
|
|
2650
|
-
var traverseArrayWithIndex = function (f) { return function (arr) {
|
|
2651
|
-
// tslint:disable-next-line: readonly-array
|
|
2652
|
-
var result = [];
|
|
2653
|
-
for (var i = 0; i < arr.length; i++) {
|
|
2654
|
-
var b = f(i, arr[i]);
|
|
2655
|
-
if (exports.isNone(b)) {
|
|
2656
|
-
return exports.none;
|
|
2657
|
-
}
|
|
2658
|
-
result.push(b.value);
|
|
2659
|
-
}
|
|
2660
|
-
return exports.some(result);
|
|
2661
|
-
}; };
|
|
2662
|
-
exports.traverseArrayWithIndex = traverseArrayWithIndex;
|
|
2663
|
-
/**
|
|
2664
|
-
* Runs an action for every element in array and accumulates the results in option
|
|
2665
|
-
*
|
|
2666
|
-
* this function have the same behavior of `A.sequence(O.option)` but it's optimized and perform better
|
|
2667
|
-
*
|
|
2668
|
-
* @example
|
|
2669
|
-
*
|
|
2670
|
-
* import * as A from 'fp-ts/Array'
|
|
2671
|
-
* import { traverseArray, some, fromPredicate, none } from 'fp-ts/Option'
|
|
2672
|
-
* import { pipe } from 'fp-ts/function'
|
|
2673
|
-
*
|
|
2674
|
-
* const arr = A.range(0, 10)
|
|
2675
|
-
* assert.deepStrictEqual(pipe(arr, traverseArray(some)), some(arr))
|
|
2676
|
-
* assert.deepStrictEqual(pipe(arr, traverseArray(fromPredicate((x) => x > 5))), none)
|
|
2677
|
-
*
|
|
2678
|
-
* @since 2.9.0
|
|
2679
|
-
*/
|
|
2680
|
-
var traverseArray = function (f) { return exports.traverseArrayWithIndex(function (_, a) { return f(a); }); };
|
|
2681
|
-
exports.traverseArray = traverseArray;
|
|
2682
|
-
/**
|
|
2683
|
-
* get an array of option and convert it to option of array
|
|
2684
|
-
*
|
|
2685
|
-
* this function have the same behavior of `A.sequence(O.option)` but it's optimized and perform better
|
|
2686
|
-
*
|
|
2687
|
-
* @example
|
|
2688
|
-
*
|
|
2689
|
-
* import * as A from 'fp-ts/Array'
|
|
2690
|
-
* import { sequenceArray, some, none, fromPredicate } from 'fp-ts/Option'
|
|
2691
|
-
* import { pipe } from 'fp-ts/function'
|
|
2692
|
-
*
|
|
2693
|
-
* const arr = A.range(0, 10)
|
|
2694
|
-
* assert.deepStrictEqual(pipe(arr, A.map(some), sequenceArray), some(arr))
|
|
2695
|
-
* assert.deepStrictEqual(pipe(arr, A.map(fromPredicate(x => x > 8)), sequenceArray), none)
|
|
2696
|
-
*
|
|
2697
|
-
* @since 2.9.0
|
|
2698
|
-
*/
|
|
2699
|
-
exports.sequenceArray =
|
|
2700
|
-
/*#__PURE__*/
|
|
2701
|
-
exports.traverseArray(_function.identity);
|
|
2702
|
-
});
|
|
2703
|
-
|
|
2704
|
-
function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r(t)}}function n(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n("Invalid token specified");var o=!0===(r=r||{}).header?0:1;try{return JSON.parse(t(e.split(".")[o]))}catch(e){throw new n("Invalid token specified: "+e.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";
|
|
2705
|
-
|
|
2706
|
-
var __assign$1 = (undefined && undefined.__assign) || function () {
|
|
2707
|
-
__assign$1 = Object.assign || function(t) {
|
|
2708
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2709
|
-
s = arguments[i];
|
|
2710
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
2711
|
-
t[p] = s[p];
|
|
2712
|
-
}
|
|
2713
|
-
return t;
|
|
2714
|
-
};
|
|
2715
|
-
return __assign$1.apply(this, arguments);
|
|
2716
|
-
};
|
|
2717
|
-
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
2718
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
2719
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
2720
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
2721
|
-
r[k] = a[j];
|
|
2722
|
-
return r;
|
|
2723
|
-
};
|
|
2724
|
-
var mix = function (one, two, mergeArrays) {
|
|
2725
|
-
if (mergeArrays === void 0) { mergeArrays = false; }
|
|
2726
|
-
if (!one || !two || typeof one !== "object" || typeof two !== "object")
|
|
2727
|
-
return one;
|
|
2728
|
-
var clone = __assign$1({}, one);
|
|
2729
|
-
for (var prop in two) {
|
|
2730
|
-
if (two.hasOwnProperty(prop)) {
|
|
2731
|
-
if (two[prop] instanceof Array && one[prop] instanceof Array) {
|
|
2732
|
-
clone[prop] = mergeArrays ? __spreadArrays(one[prop], two[prop]) : two[prop];
|
|
2733
|
-
}
|
|
2734
|
-
else if (typeof two[prop] === "object" && typeof one[prop] === "object") {
|
|
2735
|
-
clone[prop] = mix(one[prop], two[prop], mergeArrays);
|
|
2736
|
-
}
|
|
2737
|
-
else {
|
|
2738
|
-
clone[prop] = two[prop];
|
|
2739
|
-
}
|
|
2740
|
-
}
|
|
2741
|
-
}
|
|
2742
|
-
return clone;
|
|
2743
|
-
};
|
|
2744
|
-
|
|
2745
|
-
var __spreadArrays$1 = (undefined && undefined.__spreadArrays) || function () {
|
|
2746
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
2747
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
2748
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
2749
|
-
r[k] = a[j];
|
|
2750
|
-
return r;
|
|
2751
|
-
};
|
|
2752
|
-
var config = {
|
|
2753
|
-
// Default options
|
|
2754
|
-
defaults: {},
|
|
2755
|
-
// Error type
|
|
2756
|
-
errorType: null,
|
|
2757
|
-
// Polyfills
|
|
2758
|
-
polyfills: {
|
|
2759
|
-
fetch: null,
|
|
2760
|
-
FormData: null,
|
|
2761
|
-
URLSearchParams: null,
|
|
2762
|
-
performance: null,
|
|
2763
|
-
PerformanceObserver: null,
|
|
2764
|
-
AbortController: null
|
|
2765
|
-
},
|
|
2766
|
-
polyfill: function (p, _a) {
|
|
2767
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.doThrow, doThrow = _c === void 0 ? true : _c, _d = _b.instance, instance = _d === void 0 ? false : _d;
|
|
2768
|
-
var args = [];
|
|
2769
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
2770
|
-
args[_i - 2] = arguments[_i];
|
|
2771
|
-
}
|
|
2772
|
-
var res = this.polyfills[p] ||
|
|
2773
|
-
(typeof self !== "undefined" ? self[p] : null) ||
|
|
2774
|
-
(typeof global !== "undefined" ? global[p] : null);
|
|
2775
|
-
if (doThrow && !res)
|
|
2776
|
-
throw new Error(p + " is not defined");
|
|
2777
|
-
return instance && res ? new (res.bind.apply(res, __spreadArrays$1([void 0], args)))() : res;
|
|
2778
|
-
}
|
|
2779
|
-
};
|
|
2780
|
-
|
|
2781
|
-
var onMatch = function (entries, name, callback, _performance) {
|
|
2782
|
-
if (!entries.getEntriesByName)
|
|
2783
|
-
return false;
|
|
2784
|
-
var matches = entries.getEntriesByName(name);
|
|
2785
|
-
if (matches && matches.length > 0) {
|
|
2786
|
-
callback(matches.reverse()[0]);
|
|
2787
|
-
if (_performance.clearMeasures)
|
|
2788
|
-
_performance.clearMeasures(name);
|
|
2789
|
-
perfs.callbacks.delete(name);
|
|
2790
|
-
if (perfs.callbacks.size < 1) {
|
|
2791
|
-
perfs.observer.disconnect();
|
|
2792
|
-
if (_performance.clearResourceTimings) {
|
|
2793
|
-
_performance.clearResourceTimings();
|
|
2794
|
-
}
|
|
2795
|
-
}
|
|
2796
|
-
return true;
|
|
2797
|
-
}
|
|
2798
|
-
return false;
|
|
2799
|
-
};
|
|
2800
|
-
var lazyObserver = function (_performance, _observer) {
|
|
2801
|
-
if (!perfs.observer && _performance && _observer) {
|
|
2802
|
-
perfs.observer = new _observer(function (entries) {
|
|
2803
|
-
perfs.callbacks.forEach(function (callback, name) {
|
|
2804
|
-
onMatch(entries, name, callback, _performance);
|
|
2805
|
-
});
|
|
2806
|
-
});
|
|
2807
|
-
if (_performance.clearResourceTimings)
|
|
2808
|
-
_performance.clearResourceTimings();
|
|
2809
|
-
}
|
|
2810
|
-
return perfs.observer;
|
|
2811
|
-
};
|
|
2812
|
-
var perfs = {
|
|
2813
|
-
callbacks: new Map(),
|
|
2814
|
-
observer: null,
|
|
2815
|
-
observe: function (name, callback) {
|
|
2816
|
-
if (!name || !callback)
|
|
2817
|
-
return;
|
|
2818
|
-
var _performance = config.polyfill("performance", { doThrow: false });
|
|
2819
|
-
var _observer = config.polyfill("PerformanceObserver", { doThrow: false });
|
|
2820
|
-
if (!lazyObserver(_performance, _observer))
|
|
2821
|
-
return;
|
|
2822
|
-
if (!onMatch(_performance, name, callback, _performance)) {
|
|
2823
|
-
if (perfs.callbacks.size < 1)
|
|
2824
|
-
perfs.observer.observe({ entryTypes: ["resource", "measure"] });
|
|
2825
|
-
perfs.callbacks.set(name, callback);
|
|
2826
|
-
}
|
|
2827
|
-
}
|
|
2828
|
-
};
|
|
2829
|
-
|
|
2830
|
-
var middlewareHelper = function (middlewares) { return function (fetchFunction) {
|
|
2831
|
-
return (middlewares.length === 0 ?
|
|
2832
|
-
fetchFunction :
|
|
2833
|
-
middlewares.length === 1 ?
|
|
2834
|
-
middlewares[0](fetchFunction) :
|
|
2835
|
-
middlewares.reduceRight(function (acc, curr, idx) {
|
|
2836
|
-
return (idx === middlewares.length - 2) ? curr(acc(fetchFunction)) : curr(acc);
|
|
2837
|
-
}));
|
|
2838
|
-
}; };
|
|
2839
|
-
|
|
2840
|
-
var WretchErrorWrapper = /** @class */ (function () {
|
|
2841
|
-
function WretchErrorWrapper(error) {
|
|
2842
|
-
this.error = error;
|
|
2843
|
-
}
|
|
2844
|
-
return WretchErrorWrapper;
|
|
2845
|
-
}());
|
|
2846
|
-
var resolver = function (wretcher) {
|
|
2847
|
-
var url = wretcher._url, _catchers = wretcher._catchers, resolvers = wretcher._resolvers, middlewares = wretcher._middlewares, opts = wretcher._options;
|
|
2848
|
-
var catchers = new Map(_catchers);
|
|
2849
|
-
var finalOptions = mix(config.defaults, opts);
|
|
2850
|
-
var fetchController = config.polyfill("AbortController", { doThrow: false, instance: true });
|
|
2851
|
-
if (!finalOptions["signal"] && fetchController) {
|
|
2852
|
-
finalOptions["signal"] = fetchController.signal;
|
|
2853
|
-
}
|
|
2854
|
-
// Request timeout
|
|
2855
|
-
var timeout = {
|
|
2856
|
-
ref: null,
|
|
2857
|
-
clear: function () {
|
|
2858
|
-
if (timeout.ref) {
|
|
2859
|
-
clearTimeout(timeout.ref);
|
|
2860
|
-
timeout.ref = null;
|
|
2861
|
-
}
|
|
2862
|
-
}
|
|
2863
|
-
};
|
|
2864
|
-
// The generated fetch request
|
|
2865
|
-
var fetchRequest = middlewareHelper(middlewares)(config.polyfill("fetch"))(url, finalOptions);
|
|
2866
|
-
// Throws on an http error
|
|
2867
|
-
var throwingPromise = fetchRequest
|
|
2868
|
-
.catch(function (error) {
|
|
2869
|
-
throw new WretchErrorWrapper(error);
|
|
2870
|
-
})
|
|
2871
|
-
.then(function (response) {
|
|
2872
|
-
timeout.clear();
|
|
2873
|
-
if (!response.ok) {
|
|
2874
|
-
return response[config.errorType || "text"]().then(function (msg) {
|
|
2875
|
-
// Enhances the error object
|
|
2876
|
-
var err = new Error(msg);
|
|
2877
|
-
err[config.errorType || "text"] = msg;
|
|
2878
|
-
err["status"] = response.status;
|
|
2879
|
-
err["response"] = response;
|
|
2880
|
-
throw err;
|
|
2881
|
-
});
|
|
2882
|
-
}
|
|
2883
|
-
return response;
|
|
2884
|
-
});
|
|
2885
|
-
// Wraps the Promise in order to dispatch the error to a matching catcher
|
|
2886
|
-
var catchersWrapper = function (promise) {
|
|
2887
|
-
return promise.catch(function (err) {
|
|
2888
|
-
timeout.clear();
|
|
2889
|
-
var error = err instanceof WretchErrorWrapper ? err.error : err;
|
|
2890
|
-
if (err instanceof WretchErrorWrapper && catchers.has("__fromFetch"))
|
|
2891
|
-
return catchers.get("__fromFetch")(error, wretcher);
|
|
2892
|
-
else if (catchers.has(error.status))
|
|
2893
|
-
return catchers.get(error.status)(error, wretcher);
|
|
2894
|
-
else if (catchers.has(error.name))
|
|
2895
|
-
return catchers.get(error.name)(error, wretcher);
|
|
2896
|
-
else
|
|
2897
|
-
throw error;
|
|
2898
|
-
});
|
|
2899
|
-
};
|
|
2900
|
-
var bodyParser = function (funName) { return function (cb) { return funName ?
|
|
2901
|
-
// If a callback is provided, then callback with the body result otherwise return the parsed body itself.
|
|
2902
|
-
catchersWrapper(throwingPromise.then(function (_) { return _ && _[funName](); }).then(function (_) { return cb ? cb(_) : _; })) :
|
|
2903
|
-
// No body parsing method - return the response
|
|
2904
|
-
catchersWrapper(throwingPromise.then(function (_) { return cb ? cb(_) : _; })); }; };
|
|
2905
|
-
var responseChain = {
|
|
2906
|
-
/**
|
|
2907
|
-
* Retrieves the raw result as a promise.
|
|
2908
|
-
*/
|
|
2909
|
-
res: bodyParser(null),
|
|
2910
|
-
/**
|
|
2911
|
-
* Retrieves the result as a parsed JSON object.
|
|
2912
|
-
*/
|
|
2913
|
-
json: bodyParser("json"),
|
|
2914
|
-
/**
|
|
2915
|
-
* Retrieves the result as a Blob object.
|
|
2916
|
-
*/
|
|
2917
|
-
blob: bodyParser("blob"),
|
|
2918
|
-
/**
|
|
2919
|
-
* Retrieves the result as a FormData object.
|
|
2920
|
-
*/
|
|
2921
|
-
formData: bodyParser("formData"),
|
|
2922
|
-
/**
|
|
2923
|
-
* Retrieves the result as an ArrayBuffer object.
|
|
2924
|
-
*/
|
|
2925
|
-
arrayBuffer: bodyParser("arrayBuffer"),
|
|
2926
|
-
/**
|
|
2927
|
-
* Retrieves the result as a string.
|
|
2928
|
-
*/
|
|
2929
|
-
text: bodyParser("text"),
|
|
2930
|
-
/**
|
|
2931
|
-
* Performs a callback on the API performance timings of the request.
|
|
2932
|
-
*
|
|
2933
|
-
* Warning: Still experimental on browsers and node.js
|
|
2934
|
-
*/
|
|
2935
|
-
perfs: function (cb) {
|
|
2936
|
-
fetchRequest.then(function (res) { return perfs.observe(res.url, cb); });
|
|
2937
|
-
return responseChain;
|
|
2938
|
-
},
|
|
2939
|
-
/**
|
|
2940
|
-
* Aborts the request after a fixed time.
|
|
2941
|
-
*
|
|
2942
|
-
* @param time Time in milliseconds
|
|
2943
|
-
* @param controller A custom controller
|
|
2944
|
-
*/
|
|
2945
|
-
setTimeout: function (time, controller) {
|
|
2946
|
-
if (controller === void 0) { controller = fetchController; }
|
|
2947
|
-
timeout.clear();
|
|
2948
|
-
timeout.ref = setTimeout(function () { return controller.abort(); }, time);
|
|
2949
|
-
return responseChain;
|
|
2950
|
-
},
|
|
2951
|
-
/**
|
|
2952
|
-
* Returns the automatically generated AbortController alongside the current wretch response as a pair.
|
|
2953
|
-
*/
|
|
2954
|
-
controller: function () { return [fetchController, responseChain]; },
|
|
2955
|
-
/**
|
|
2956
|
-
* Catches an http response with a specific error code or name and performs a callback.
|
|
2957
|
-
*/
|
|
2958
|
-
error: function (errorId, cb) {
|
|
2959
|
-
catchers.set(errorId, cb);
|
|
2960
|
-
return responseChain;
|
|
2961
|
-
},
|
|
2962
|
-
/**
|
|
2963
|
-
* Catches a bad request (http code 400) and performs a callback.
|
|
2964
|
-
*/
|
|
2965
|
-
badRequest: function (cb) { return responseChain.error(400, cb); },
|
|
2966
|
-
/**
|
|
2967
|
-
* Catches an unauthorized request (http code 401) and performs a callback.
|
|
2968
|
-
*/
|
|
2969
|
-
unauthorized: function (cb) { return responseChain.error(401, cb); },
|
|
2970
|
-
/**
|
|
2971
|
-
* Catches a forbidden request (http code 403) and performs a callback.
|
|
2972
|
-
*/
|
|
2973
|
-
forbidden: function (cb) { return responseChain.error(403, cb); },
|
|
2974
|
-
/**
|
|
2975
|
-
* Catches a "not found" request (http code 404) and performs a callback.
|
|
2976
|
-
*/
|
|
2977
|
-
notFound: function (cb) { return responseChain.error(404, cb); },
|
|
2978
|
-
/**
|
|
2979
|
-
* Catches a timeout (http code 408) and performs a callback.
|
|
2980
|
-
*/
|
|
2981
|
-
timeout: function (cb) { return responseChain.error(408, cb); },
|
|
2982
|
-
/**
|
|
2983
|
-
* Catches an internal server error (http code 500) and performs a callback.
|
|
2984
|
-
*/
|
|
2985
|
-
internalError: function (cb) { return responseChain.error(500, cb); },
|
|
2986
|
-
/**
|
|
2987
|
-
* Catches errors thrown when calling the fetch function and performs a callback.
|
|
2988
|
-
*/
|
|
2989
|
-
fetchError: function (cb) { return responseChain.error("__fromFetch", cb); },
|
|
2990
|
-
/**
|
|
2991
|
-
* Catches an AbortError and performs a callback.
|
|
2992
|
-
*/
|
|
2993
|
-
onAbort: function (cb) { return responseChain.error("AbortError", cb); }
|
|
2994
|
-
};
|
|
2995
|
-
return resolvers.reduce(function (chain, r) { return r(chain, wretcher); }, responseChain);
|
|
2996
|
-
};
|
|
2997
|
-
|
|
2998
|
-
var __assign$2 = (undefined && undefined.__assign) || function () {
|
|
2999
|
-
__assign$2 = Object.assign || function(t) {
|
|
3000
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
3001
|
-
s = arguments[i];
|
|
3002
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
3003
|
-
t[p] = s[p];
|
|
3004
|
-
}
|
|
3005
|
-
return t;
|
|
3006
|
-
};
|
|
3007
|
-
return __assign$2.apply(this, arguments);
|
|
3008
|
-
};
|
|
3009
|
-
var __spreadArrays$2 = (undefined && undefined.__spreadArrays) || function () {
|
|
3010
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
3011
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
3012
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
3013
|
-
r[k] = a[j];
|
|
3014
|
-
return r;
|
|
3015
|
-
};
|
|
3016
|
-
var JSON_MIME = "application/json";
|
|
3017
|
-
var CONTENT_TYPE_HEADER = "Content-Type";
|
|
3018
|
-
/**
|
|
3019
|
-
* The Wretcher class used to perform easy fetch requests.
|
|
3020
|
-
*
|
|
3021
|
-
* Immutability : almost every method of this class return a fresh Wretcher object.
|
|
3022
|
-
*/
|
|
3023
|
-
var Wretcher = /** @class */ (function () {
|
|
3024
|
-
function Wretcher(_url, _options, _catchers, _resolvers, _middlewares, _deferredChain) {
|
|
3025
|
-
if (_catchers === void 0) { _catchers = new Map(); }
|
|
3026
|
-
if (_resolvers === void 0) { _resolvers = []; }
|
|
3027
|
-
if (_middlewares === void 0) { _middlewares = []; }
|
|
3028
|
-
if (_deferredChain === void 0) { _deferredChain = []; }
|
|
3029
|
-
this._url = _url;
|
|
3030
|
-
this._options = _options;
|
|
3031
|
-
this._catchers = _catchers;
|
|
3032
|
-
this._resolvers = _resolvers;
|
|
3033
|
-
this._middlewares = _middlewares;
|
|
3034
|
-
this._deferredChain = _deferredChain;
|
|
3035
|
-
}
|
|
3036
|
-
Wretcher.factory = function (url, options) {
|
|
3037
|
-
if (url === void 0) { url = ""; }
|
|
3038
|
-
if (options === void 0) { options = {}; }
|
|
3039
|
-
return new Wretcher(url, options);
|
|
3040
|
-
};
|
|
3041
|
-
Wretcher.prototype.selfFactory = function (_a) {
|
|
3042
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.url, url = _c === void 0 ? this._url : _c, _d = _b.options, options = _d === void 0 ? this._options : _d, _e = _b.catchers, catchers = _e === void 0 ? this._catchers : _e, _f = _b.resolvers, resolvers = _f === void 0 ? this._resolvers : _f, _g = _b.middlewares, middlewares = _g === void 0 ? this._middlewares : _g, _h = _b.deferredChain, deferredChain = _h === void 0 ? this._deferredChain : _h;
|
|
3043
|
-
return new Wretcher(url, __assign$2({}, options), new Map(catchers), __spreadArrays$2(resolvers), __spreadArrays$2(middlewares), __spreadArrays$2(deferredChain));
|
|
3044
|
-
};
|
|
3045
|
-
/**
|
|
3046
|
-
* Sets the default fetch options used for every subsequent fetch call.
|
|
3047
|
-
* @param options New default options
|
|
3048
|
-
* @param mixin If true, mixes in instead of replacing the existing options
|
|
3049
|
-
*/
|
|
3050
|
-
Wretcher.prototype.defaults = function (options, mixin) {
|
|
3051
|
-
if (mixin === void 0) { mixin = false; }
|
|
3052
|
-
config.defaults = mixin ? mix(config.defaults, options) : options;
|
|
3053
|
-
return this;
|
|
3054
|
-
};
|
|
3055
|
-
/**
|
|
3056
|
-
* Sets the method (text, json ...) used to parse the data contained in the response body in case of an HTTP error.
|
|
3057
|
-
*
|
|
3058
|
-
* Persists for every subsequent requests.
|
|
3059
|
-
*
|
|
3060
|
-
* Default is "text".
|
|
3061
|
-
*/
|
|
3062
|
-
Wretcher.prototype.errorType = function (method) {
|
|
3063
|
-
config.errorType = method;
|
|
3064
|
-
return this;
|
|
3065
|
-
};
|
|
3066
|
-
/**
|
|
3067
|
-
* Sets the non-global polyfills which will be used for every subsequent calls.
|
|
3068
|
-
*
|
|
3069
|
-
* Needed for libraries like [fetch-ponyfill](https://github.com/qubyte/fetch-ponyfill).
|
|
3070
|
-
*
|
|
3071
|
-
* @param polyfills An object containing the polyfills.
|
|
3072
|
-
*/
|
|
3073
|
-
Wretcher.prototype.polyfills = function (polyfills) {
|
|
3074
|
-
config.polyfills = __assign$2(__assign$2({}, config.polyfills), polyfills);
|
|
3075
|
-
return this;
|
|
3076
|
-
};
|
|
3077
|
-
/**
|
|
3078
|
-
* Returns a new Wretcher object with the argument url appended and the same options.
|
|
3079
|
-
* @param url String url
|
|
3080
|
-
* @param replace Boolean If true, replaces the current url instead of appending
|
|
3081
|
-
*/
|
|
3082
|
-
Wretcher.prototype.url = function (url, replace) {
|
|
3083
|
-
if (replace === void 0) { replace = false; }
|
|
3084
|
-
if (replace)
|
|
3085
|
-
return this.selfFactory({ url: url });
|
|
3086
|
-
var split = this._url.split("?");
|
|
3087
|
-
return this.selfFactory({
|
|
3088
|
-
url: split.length > 1 ?
|
|
3089
|
-
split[0] + url + "?" + split[1] :
|
|
3090
|
-
this._url + url
|
|
3091
|
-
});
|
|
3092
|
-
};
|
|
3093
|
-
/**
|
|
3094
|
-
* Returns a new Wretcher object with the same url and new options.
|
|
3095
|
-
* @param options New options
|
|
3096
|
-
* @param mixin If true, mixes in instead of replacing the existing options
|
|
3097
|
-
*/
|
|
3098
|
-
Wretcher.prototype.options = function (options, mixin) {
|
|
3099
|
-
if (mixin === void 0) { mixin = true; }
|
|
3100
|
-
return this.selfFactory({ options: mixin ? mix(this._options, options) : options });
|
|
3101
|
-
};
|
|
3102
|
-
/**
|
|
3103
|
-
* Converts a javascript object to query parameters,
|
|
3104
|
-
* then appends this query string to the current url.
|
|
3105
|
-
*
|
|
3106
|
-
* If given a string, use the string as the query verbatim.
|
|
3107
|
-
*
|
|
3108
|
-
* ```
|
|
3109
|
-
* let w = wretch("http://example.com") // url is http://example.com
|
|
3110
|
-
*
|
|
3111
|
-
* // Chain query calls
|
|
3112
|
-
* w = w.query({ a: 1, b : 2 }) // url is now http://example.com?a=1&b=2
|
|
3113
|
-
* w = w.query("foo-bar-baz-woz") // url is now http://example.com?a=1&b=2&foo-bar-baz-woz
|
|
3114
|
-
*
|
|
3115
|
-
* // Pass true as the second argument to replace existing query parameters
|
|
3116
|
-
* w = w.query("c=3&d=4", true) // url is now http://example.com?c=3&d=4
|
|
3117
|
-
* ```
|
|
3118
|
-
*
|
|
3119
|
-
* @param qp An object which will be converted, or a string which will be used verbatim.
|
|
3120
|
-
*/
|
|
3121
|
-
Wretcher.prototype.query = function (qp, replace) {
|
|
3122
|
-
if (replace === void 0) { replace = false; }
|
|
3123
|
-
return this.selfFactory({ url: appendQueryParams(this._url, qp, replace) });
|
|
3124
|
-
};
|
|
3125
|
-
/**
|
|
3126
|
-
* Set request headers.
|
|
3127
|
-
* @param headerValues An object containing header keys and values
|
|
3128
|
-
*/
|
|
3129
|
-
Wretcher.prototype.headers = function (headerValues) {
|
|
3130
|
-
return this.selfFactory({ options: mix(this._options, { headers: headerValues || {} }) });
|
|
3131
|
-
};
|
|
3132
|
-
/**
|
|
3133
|
-
* Shortcut to set the "Accept" header.
|
|
3134
|
-
* @param headerValue Header value
|
|
3135
|
-
*/
|
|
3136
|
-
Wretcher.prototype.accept = function (headerValue) {
|
|
3137
|
-
return this.headers({ Accept: headerValue });
|
|
3138
|
-
};
|
|
3139
|
-
/**
|
|
3140
|
-
* Shortcut to set the "Content-Type" header.
|
|
3141
|
-
* @param headerValue Header value
|
|
3142
|
-
*/
|
|
3143
|
-
Wretcher.prototype.content = function (headerValue) {
|
|
3144
|
-
var _a;
|
|
3145
|
-
return this.headers((_a = {}, _a[CONTENT_TYPE_HEADER] = headerValue, _a));
|
|
3146
|
-
};
|
|
3147
|
-
/**
|
|
3148
|
-
* Shortcut to set the "Authorization" header.
|
|
3149
|
-
* @param headerValue Header value
|
|
3150
|
-
*/
|
|
3151
|
-
Wretcher.prototype.auth = function (headerValue) {
|
|
3152
|
-
return this.headers({ Authorization: headerValue });
|
|
3153
|
-
};
|
|
3154
|
-
/**
|
|
3155
|
-
* Adds a default catcher which will be called on every subsequent request error when the error code matches.
|
|
3156
|
-
* @param errorId Error code or name
|
|
3157
|
-
* @param catcher: The catcher method
|
|
3158
|
-
*/
|
|
3159
|
-
Wretcher.prototype.catcher = function (errorId, catcher) {
|
|
3160
|
-
var newMap = new Map(this._catchers);
|
|
3161
|
-
newMap.set(errorId, catcher);
|
|
3162
|
-
return this.selfFactory({ catchers: newMap });
|
|
3163
|
-
};
|
|
3164
|
-
/**
|
|
3165
|
-
* Associates a custom signal with the request.
|
|
3166
|
-
* @param controller : An AbortController
|
|
3167
|
-
*/
|
|
3168
|
-
Wretcher.prototype.signal = function (controller) {
|
|
3169
|
-
return this.selfFactory({ options: __assign$2(__assign$2({}, this._options), { signal: controller.signal }) });
|
|
3170
|
-
};
|
|
3171
|
-
/**
|
|
3172
|
-
* Program a resolver to perform response chain tasks automatically.
|
|
3173
|
-
* @param doResolve : Resolver callback
|
|
3174
|
-
*/
|
|
3175
|
-
Wretcher.prototype.resolve = function (doResolve, clear) {
|
|
3176
|
-
if (clear === void 0) { clear = false; }
|
|
3177
|
-
return this.selfFactory({ resolvers: clear ? [doResolve] : __spreadArrays$2(this._resolvers, [doResolve]) });
|
|
3178
|
-
};
|
|
3179
|
-
/**
|
|
3180
|
-
* Defer wretcher methods that will be chained and called just before the request is performed.
|
|
3181
|
-
*/
|
|
3182
|
-
Wretcher.prototype.defer = function (callback, clear) {
|
|
3183
|
-
if (clear === void 0) { clear = false; }
|
|
3184
|
-
return this.selfFactory({
|
|
3185
|
-
deferredChain: clear ? [callback] : __spreadArrays$2(this._deferredChain, [callback])
|
|
3186
|
-
});
|
|
3187
|
-
};
|
|
3188
|
-
/**
|
|
3189
|
-
* Add middlewares to intercept a request before being sent.
|
|
3190
|
-
*/
|
|
3191
|
-
Wretcher.prototype.middlewares = function (middlewares, clear) {
|
|
3192
|
-
if (clear === void 0) { clear = false; }
|
|
3193
|
-
return this.selfFactory({
|
|
3194
|
-
middlewares: clear ? middlewares : __spreadArrays$2(this._middlewares, middlewares)
|
|
3195
|
-
});
|
|
3196
|
-
};
|
|
3197
|
-
Wretcher.prototype.method = function (method, options, body) {
|
|
3198
|
-
if (options === void 0) { options = {}; }
|
|
3199
|
-
if (body === void 0) { body = null; }
|
|
3200
|
-
var headers = this._options.headers;
|
|
3201
|
-
var baseWretcher = !body ? this :
|
|
3202
|
-
typeof body === "object" && (!headers ||
|
|
3203
|
-
Object.entries(headers).every(function (_a) {
|
|
3204
|
-
var k = _a[0], v = _a[1];
|
|
3205
|
-
return k.toLowerCase() !== CONTENT_TYPE_HEADER.toLowerCase() ||
|
|
3206
|
-
v.startsWith(JSON_MIME);
|
|
3207
|
-
})) ? this.json(body) :
|
|
3208
|
-
this.body(body);
|
|
3209
|
-
baseWretcher = baseWretcher.options(__assign$2(__assign$2({}, options), { method: method }));
|
|
3210
|
-
var deferredWretcher = baseWretcher._deferredChain.reduce(function (acc, curr) { return curr(acc, acc._url, acc._options); }, baseWretcher);
|
|
3211
|
-
return resolver(deferredWretcher);
|
|
3212
|
-
};
|
|
3213
|
-
/**
|
|
3214
|
-
* Performs a get request.
|
|
3215
|
-
*/
|
|
3216
|
-
Wretcher.prototype.get = function (options) {
|
|
3217
|
-
return this.method("GET", options);
|
|
3218
|
-
};
|
|
3219
|
-
/**
|
|
3220
|
-
* Performs a delete request.
|
|
3221
|
-
*/
|
|
3222
|
-
Wretcher.prototype.delete = function (options) {
|
|
3223
|
-
return this.method("DELETE", options);
|
|
3224
|
-
};
|
|
3225
|
-
/**
|
|
3226
|
-
* Performs a put request.
|
|
3227
|
-
*/
|
|
3228
|
-
Wretcher.prototype.put = function (body, options) {
|
|
3229
|
-
return this.method("PUT", options, body);
|
|
3230
|
-
};
|
|
3231
|
-
/**
|
|
3232
|
-
* Performs a post request.
|
|
3233
|
-
*/
|
|
3234
|
-
Wretcher.prototype.post = function (body, options) {
|
|
3235
|
-
return this.method("POST", options, body);
|
|
3236
|
-
};
|
|
3237
|
-
/**
|
|
3238
|
-
* Performs a patch request.
|
|
3239
|
-
*/
|
|
3240
|
-
Wretcher.prototype.patch = function (body, options) {
|
|
3241
|
-
return this.method("PATCH", options, body);
|
|
3242
|
-
};
|
|
3243
|
-
/**
|
|
3244
|
-
* Performs a head request.
|
|
3245
|
-
*/
|
|
3246
|
-
Wretcher.prototype.head = function (options) {
|
|
3247
|
-
return this.method("HEAD", options);
|
|
3248
|
-
};
|
|
3249
|
-
/**
|
|
3250
|
-
* Performs an options request
|
|
3251
|
-
*/
|
|
3252
|
-
Wretcher.prototype.opts = function (options) {
|
|
3253
|
-
return this.method("OPTIONS", options);
|
|
3254
|
-
};
|
|
3255
|
-
/**
|
|
3256
|
-
* Replay a request.
|
|
3257
|
-
*/
|
|
3258
|
-
Wretcher.prototype.replay = function (options) {
|
|
3259
|
-
return this.method(this._options.method, options);
|
|
3260
|
-
};
|
|
3261
|
-
/**
|
|
3262
|
-
* Sets the request body with any content.
|
|
3263
|
-
* @param contents The body contents
|
|
3264
|
-
*/
|
|
3265
|
-
Wretcher.prototype.body = function (contents) {
|
|
3266
|
-
return this.selfFactory({ options: __assign$2(__assign$2({}, this._options), { body: contents }) });
|
|
3267
|
-
};
|
|
3268
|
-
/**
|
|
3269
|
-
* Sets the content type header, stringifies an object and sets the request body.
|
|
3270
|
-
* @param jsObject An object which will be serialized into a JSON
|
|
3271
|
-
*/
|
|
3272
|
-
Wretcher.prototype.json = function (jsObject) {
|
|
3273
|
-
var _a;
|
|
3274
|
-
var preservedContentType = (_a = Object.entries(this._options.headers || {}).find(function (_a) {
|
|
3275
|
-
var k = _a[0], v = _a[1];
|
|
3276
|
-
return k.toLowerCase() === CONTENT_TYPE_HEADER.toLowerCase() && v.startsWith(JSON_MIME);
|
|
3277
|
-
})) === null || _a === void 0 ? void 0 : _a[1];
|
|
3278
|
-
return this.content(preservedContentType || JSON_MIME).body(JSON.stringify(jsObject));
|
|
3279
|
-
};
|
|
3280
|
-
/**
|
|
3281
|
-
* Converts the javascript object to a FormData and sets the request body.
|
|
3282
|
-
* @param formObject An object which will be converted to a FormData
|
|
3283
|
-
* @param recursive If `true`, will recurse through all nested objects
|
|
3284
|
-
* Can be set as an array of string to exclude specific keys.
|
|
3285
|
-
* See https://github.com/elbywan/wretch/issues/68 for more details.
|
|
3286
|
-
*/
|
|
3287
|
-
Wretcher.prototype.formData = function (formObject, recursive) {
|
|
3288
|
-
if (recursive === void 0) { recursive = false; }
|
|
3289
|
-
return this.body(convertFormData(formObject, recursive));
|
|
3290
|
-
};
|
|
3291
|
-
/**
|
|
3292
|
-
* Converts the input to an url encoded string and sets the content-type header and body.
|
|
3293
|
-
* If the input argument is already a string, skips the conversion part.
|
|
3294
|
-
*
|
|
3295
|
-
* @param input An object to convert into an url encoded string or an already encoded string
|
|
3296
|
-
*/
|
|
3297
|
-
Wretcher.prototype.formUrl = function (input) {
|
|
3298
|
-
return this
|
|
3299
|
-
.body(typeof input === "string" ? input : convertFormUrl(input))
|
|
3300
|
-
.content("application/x-www-form-urlencoded");
|
|
3301
|
-
};
|
|
3302
|
-
return Wretcher;
|
|
3303
|
-
}());
|
|
3304
|
-
// Internal helpers
|
|
3305
|
-
var appendQueryParams = function (url, qp, replace) {
|
|
3306
|
-
var queryString;
|
|
3307
|
-
if (typeof qp === "string") {
|
|
3308
|
-
queryString = qp;
|
|
3309
|
-
}
|
|
3310
|
-
else {
|
|
3311
|
-
var usp = config.polyfill("URLSearchParams", { instance: true });
|
|
3312
|
-
for (var key in qp) {
|
|
3313
|
-
if (qp[key] instanceof Array) {
|
|
3314
|
-
for (var _i = 0, _a = qp[key]; _i < _a.length; _i++) {
|
|
3315
|
-
var val = _a[_i];
|
|
3316
|
-
usp.append(key, val);
|
|
3317
|
-
}
|
|
3318
|
-
}
|
|
3319
|
-
else {
|
|
3320
|
-
usp.append(key, qp[key]);
|
|
3321
|
-
}
|
|
3322
|
-
}
|
|
3323
|
-
queryString = usp.toString();
|
|
3324
|
-
}
|
|
3325
|
-
var split = url.split("?");
|
|
3326
|
-
if (replace || split.length < 2)
|
|
3327
|
-
return split[0] + "?" + queryString;
|
|
3328
|
-
return url + "&" + queryString;
|
|
3329
|
-
};
|
|
3330
|
-
function convertFormData(formObject, recursive, formData, ancestors) {
|
|
3331
|
-
if (recursive === void 0) { recursive = false; }
|
|
3332
|
-
if (formData === void 0) { formData = config.polyfill("FormData", { instance: true }); }
|
|
3333
|
-
if (ancestors === void 0) { ancestors = []; }
|
|
3334
|
-
Object.entries(formObject).forEach(function (_a) {
|
|
3335
|
-
var key = _a[0], value = _a[1];
|
|
3336
|
-
var formKey = ancestors.reduce(function (acc, ancestor) { return (acc ? acc + "[" + ancestor + "]" : ancestor); }, null);
|
|
3337
|
-
formKey = formKey ? formKey + "[" + key + "]" : key;
|
|
3338
|
-
if (value instanceof Array) {
|
|
3339
|
-
for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
|
|
3340
|
-
var item = value_1[_i];
|
|
3341
|
-
formData.append(formKey + "[]", item);
|
|
3342
|
-
}
|
|
3343
|
-
}
|
|
3344
|
-
else if (recursive &&
|
|
3345
|
-
typeof value === "object" &&
|
|
3346
|
-
(!(recursive instanceof Array) ||
|
|
3347
|
-
!recursive.includes(key))) {
|
|
3348
|
-
if (value !== null) {
|
|
3349
|
-
convertFormData(value, recursive, formData, __spreadArrays$2(ancestors, [key]));
|
|
3350
|
-
}
|
|
3351
|
-
}
|
|
3352
|
-
else {
|
|
3353
|
-
formData.append(formKey, value);
|
|
3354
|
-
}
|
|
3355
|
-
});
|
|
3356
|
-
return formData;
|
|
3357
|
-
}
|
|
3358
|
-
function encodeQueryValue(key, value) {
|
|
3359
|
-
return encodeURIComponent(key) +
|
|
3360
|
-
"=" +
|
|
3361
|
-
encodeURIComponent(typeof value === "object" ?
|
|
3362
|
-
JSON.stringify(value) :
|
|
3363
|
-
"" + value);
|
|
3364
|
-
}
|
|
3365
|
-
function convertFormUrl(formObject) {
|
|
3366
|
-
return Object.keys(formObject)
|
|
3367
|
-
.map(function (key) {
|
|
3368
|
-
var value = formObject[key];
|
|
3369
|
-
if (value instanceof Array) {
|
|
3370
|
-
return value.map(function (v) { return encodeQueryValue(key, v); }).join("&");
|
|
3371
|
-
}
|
|
3372
|
-
return encodeQueryValue(key, value);
|
|
3373
|
-
})
|
|
3374
|
-
.join("&");
|
|
3375
|
-
}
|
|
3376
|
-
|
|
3377
|
-
var factory = Wretcher.factory;
|
|
3378
|
-
factory["default"] = Wretcher.factory;
|
|
3379
|
-
|
|
3380
|
-
function buildBackendApiClient() {
|
|
3381
|
-
const jwt = superSelectionAppService.jwt;
|
|
3382
|
-
const profileId = superSelectionAppService.profileId;
|
|
3383
|
-
const accountId = superSelectionAppService.accountIdOrDefault;
|
|
3384
|
-
const partnerId = superSelectionAppService.partnerIdOrDefault;
|
|
3385
|
-
return factory(superSelectionAppService.apiBaseUrl).headers({
|
|
3386
|
-
Authorization: `Bearer ${jwt}`,
|
|
3387
|
-
'X-PROFILE-ID': profileId,
|
|
3388
|
-
'X-PARTNER-ID': partnerId,
|
|
3389
|
-
'X-ACCOUNT-ID': accountId
|
|
3390
|
-
});
|
|
3391
|
-
}
|
|
3392
|
-
|
|
3393
|
-
const slate = {
|
|
3394
|
-
fundId: 'slate',
|
|
3395
|
-
usi: '32367272075001'
|
|
3396
|
-
};
|
|
3397
|
-
|
|
3398
|
-
function hydratePromotedFundChoiceDtoKind(dto) {
|
|
3399
|
-
if ('slate' in dto) {
|
|
3400
|
-
dto.kind = 'slate';
|
|
3401
|
-
}
|
|
3402
|
-
else if ('australianRetirementTrust' in dto) {
|
|
3403
|
-
dto.kind = 'australianRetirementTrust';
|
|
3404
|
-
}
|
|
3405
|
-
else if ('aware' in dto) {
|
|
3406
|
-
dto.kind = 'aware';
|
|
3407
|
-
}
|
|
3408
|
-
else if ('active' in dto) {
|
|
3409
|
-
dto.kind = 'active';
|
|
3410
|
-
}
|
|
3411
|
-
else if ('australianEthical' in dto) {
|
|
3412
|
-
dto.kind = 'australianEthical';
|
|
3413
|
-
}
|
|
3414
|
-
else if ('virgin' in dto) {
|
|
3415
|
-
dto.kind = 'virgin';
|
|
3416
|
-
}
|
|
3417
|
-
else if ('spirit' in dto) {
|
|
3418
|
-
dto.kind = 'spirit';
|
|
3419
|
-
}
|
|
3420
|
-
else if ('firstSuper' in dto) {
|
|
3421
|
-
dto.kind = 'firstSuper';
|
|
3422
|
-
}
|
|
3423
|
-
else if ('mercerMyChoice' in dto) {
|
|
3424
|
-
dto.kind = 'mercerMyChoice';
|
|
3425
|
-
}
|
|
3426
|
-
else if ('generic' in dto) {
|
|
3427
|
-
dto.kind = 'generic';
|
|
3428
|
-
}
|
|
3429
|
-
}
|
|
3430
|
-
function getPromotedFundUsi(dto) {
|
|
3431
|
-
switch (dto.kind) {
|
|
3432
|
-
case 'slate':
|
|
3433
|
-
return slate.usi;
|
|
3434
|
-
case 'australianRetirementTrust':
|
|
3435
|
-
return dto.australianRetirementTrust.usi;
|
|
3436
|
-
case 'aware':
|
|
3437
|
-
return dto.aware.usi;
|
|
3438
|
-
case 'active':
|
|
3439
|
-
return dto.active.usi;
|
|
3440
|
-
case 'australianEthical':
|
|
3441
|
-
return dto.australianEthical.usi;
|
|
3442
|
-
case 'virgin':
|
|
3443
|
-
return dto.virgin.usi;
|
|
3444
|
-
case 'spirit':
|
|
3445
|
-
return dto.spirit.usi;
|
|
3446
|
-
case 'firstSuper':
|
|
3447
|
-
return dto.firstSuper.usi;
|
|
3448
|
-
case 'mercerMyChoice':
|
|
3449
|
-
return dto.mercerMyChoice.usi;
|
|
3450
|
-
case 'generic':
|
|
3451
|
-
return dto.generic.usi;
|
|
3452
|
-
default:
|
|
3453
|
-
return '';
|
|
3454
|
-
}
|
|
3455
|
-
}
|
|
3456
|
-
function getPromotedFundId(dto) {
|
|
3457
|
-
switch (dto.kind) {
|
|
3458
|
-
case 'slate':
|
|
3459
|
-
return slate.fundId;
|
|
3460
|
-
case 'australianRetirementTrust':
|
|
3461
|
-
return 'australian-retirement-trust';
|
|
3462
|
-
case 'aware':
|
|
3463
|
-
return 'aware';
|
|
3464
|
-
case 'active':
|
|
3465
|
-
return 'active';
|
|
3466
|
-
case 'australianEthical':
|
|
3467
|
-
return 'australian-ethical';
|
|
3468
|
-
case 'virgin':
|
|
3469
|
-
return 'virgin';
|
|
3470
|
-
case 'spirit':
|
|
3471
|
-
return 'spirit';
|
|
3472
|
-
case 'firstSuper':
|
|
3473
|
-
return 'first-super';
|
|
3474
|
-
case 'mercerMyChoice':
|
|
3475
|
-
return 'mercermychoice';
|
|
3476
|
-
case 'generic':
|
|
3477
|
-
return dto.generic.fundId;
|
|
3478
|
-
default:
|
|
3479
|
-
return '';
|
|
3480
|
-
}
|
|
3481
|
-
}
|
|
3482
|
-
function getSuperChoiceUsi(dto) {
|
|
3483
|
-
switch (dto.kind) {
|
|
3484
|
-
case 'Promoted':
|
|
3485
|
-
return some(getPromotedFundUsi(dto.promoted));
|
|
3486
|
-
case 'MyOwnFund':
|
|
3487
|
-
return some(dto.myOwnFund.usi);
|
|
3488
|
-
case 'SMSF':
|
|
3489
|
-
return none;
|
|
3490
|
-
case 'Default':
|
|
3491
|
-
return some(dto.default.usi);
|
|
3492
|
-
case 'PromotedDefault':
|
|
3493
|
-
return some(dto.promotedDefault.usi);
|
|
3494
|
-
case 'DefinedBenefits':
|
|
3495
|
-
return some(dto.definedBenefits.usi);
|
|
3496
|
-
case 'PromotedDefaultWithJoin':
|
|
3497
|
-
return some(dto.promotedDefaultWithJoin.usi);
|
|
3498
|
-
default:
|
|
3499
|
-
return none;
|
|
3500
|
-
}
|
|
3501
|
-
}
|
|
3502
|
-
function getPromotedFundMemberNumber(dto) {
|
|
3503
|
-
switch (dto.kind) {
|
|
3504
|
-
case 'slate':
|
|
3505
|
-
return dto.slate.memberNumber;
|
|
3506
|
-
case 'australianRetirementTrust':
|
|
3507
|
-
return dto.australianRetirementTrust.memberNumber;
|
|
3508
|
-
case 'aware':
|
|
3509
|
-
return dto.aware.memberNumber;
|
|
3510
|
-
case 'active':
|
|
3511
|
-
return dto.active.memberNumber;
|
|
3512
|
-
case 'australianEthical':
|
|
3513
|
-
return dto.australianEthical.memberNumber;
|
|
3514
|
-
case 'virgin':
|
|
3515
|
-
return dto.virgin.memberNumber;
|
|
3516
|
-
case 'spirit':
|
|
3517
|
-
return dto.spirit.memberNumber;
|
|
3518
|
-
case 'firstSuper':
|
|
3519
|
-
return dto.firstSuper.memberNumber;
|
|
3520
|
-
case 'mercerMyChoice':
|
|
3521
|
-
return dto.mercerMyChoice.memberNumber;
|
|
3522
|
-
case 'generic':
|
|
3523
|
-
return dto.generic.memberNumber;
|
|
3524
|
-
default:
|
|
3525
|
-
return '';
|
|
3526
|
-
}
|
|
3527
|
-
}
|
|
3528
|
-
function getSuperChoiceMemberNumber(dto) {
|
|
3529
|
-
switch (dto.kind) {
|
|
3530
|
-
case 'Promoted':
|
|
3531
|
-
return some(getPromotedFundMemberNumber(dto.promoted));
|
|
3532
|
-
case 'MyOwnFund':
|
|
3533
|
-
return some(dto.myOwnFund.memberNumber);
|
|
3534
|
-
case 'DefinedBenefits':
|
|
3535
|
-
return some(dto.definedBenefits.memberNumber);
|
|
3536
|
-
case 'PromotedDefaultWithJoin':
|
|
3537
|
-
return some(dto.promotedDefaultWithJoin.memberNumber);
|
|
3538
|
-
case 'SMSF':
|
|
3539
|
-
case 'Default':
|
|
3540
|
-
case 'PromotedDefault':
|
|
3541
|
-
return none;
|
|
3542
|
-
default:
|
|
3543
|
-
return none;
|
|
3544
|
-
}
|
|
3545
|
-
}
|
|
3546
|
-
function hydrateSuperChoiceDetailsDtoKind(dto) {
|
|
3547
|
-
if ('promoted' in dto) {
|
|
3548
|
-
dto.kind = 'Promoted';
|
|
3549
|
-
}
|
|
3550
|
-
else if ('myOwnFund' in dto) {
|
|
3551
|
-
dto.kind = 'MyOwnFund';
|
|
3552
|
-
}
|
|
3553
|
-
else if ('smsf' in dto) {
|
|
3554
|
-
dto.kind = 'SMSF';
|
|
3555
|
-
}
|
|
3556
|
-
else if ('default' in dto) {
|
|
3557
|
-
dto.kind = 'Default';
|
|
3558
|
-
}
|
|
3559
|
-
else if ('promotedDefault' in dto) {
|
|
3560
|
-
dto.kind = 'PromotedDefault';
|
|
3561
|
-
}
|
|
3562
|
-
else if ('definedBenefits' in dto) {
|
|
3563
|
-
dto.kind = 'DefinedBenefits';
|
|
3564
|
-
}
|
|
3565
|
-
else if ('promotedDefaultWithJoin' in dto) {
|
|
3566
|
-
dto.kind = 'PromotedDefaultWithJoin';
|
|
3567
|
-
}
|
|
3568
|
-
}
|
|
3569
|
-
|
|
3570
|
-
class SuperSelectionApi {
|
|
3571
|
-
async getAustralianFundsAsync(searchFilter, includeInactive = false) {
|
|
3572
|
-
return buildBackendApiClient()
|
|
3573
|
-
.url(`super-choice/australian-funds-v2?${this.toQueryString(includeInactive, searchFilter)}`)
|
|
3574
|
-
.get()
|
|
3575
|
-
.notFound(() => {
|
|
3576
|
-
throw new Error('Failed to fetch the list of australian super funds.');
|
|
3577
|
-
})
|
|
3578
|
-
.json();
|
|
3579
|
-
}
|
|
3580
|
-
async getAustralianFundAsync(usi, includeInactive) {
|
|
3581
|
-
const queryStr = includeInactive ? '?includeInactive=true' : '';
|
|
3582
|
-
return buildBackendApiClient()
|
|
3583
|
-
.url(`super-choice/australian-funds/${usi}${queryStr}`)
|
|
3584
|
-
.get()
|
|
3585
|
-
.notFound(() => {
|
|
3586
|
-
throw new Error('Failed to fetch australian super fund.');
|
|
3587
|
-
})
|
|
3588
|
-
.json();
|
|
3589
|
-
}
|
|
3590
|
-
async getAppStateAsync() {
|
|
3591
|
-
var _a;
|
|
3592
|
-
const response = await buildBackendApiClient()
|
|
3593
|
-
.url('client-app-state')
|
|
3594
|
-
.get()
|
|
3595
|
-
.notFound(() => {
|
|
3596
|
-
throw new Error('Failed to fetch application configuration.');
|
|
3597
|
-
})
|
|
3598
|
-
.json();
|
|
3599
|
-
if ((_a = response.superBuyer.superChoice) === null || _a === void 0 ? void 0 : _a.choiceDetails) {
|
|
3600
|
-
hydrateSuperChoiceDetailsDtoKind(response.superBuyer.superChoice.choiceDetails);
|
|
3601
|
-
switch (response.superBuyer.superChoice.choiceDetails.kind) {
|
|
3602
|
-
case 'Promoted':
|
|
3603
|
-
hydratePromotedFundChoiceDtoKind(response.superBuyer.superChoice.choiceDetails.promoted);
|
|
3604
|
-
break;
|
|
3605
|
-
}
|
|
3606
|
-
}
|
|
3607
|
-
return response;
|
|
3608
|
-
}
|
|
3609
|
-
async clickPromotedTileAsync(payload) {
|
|
3610
|
-
return buildBackendApiClient().url('click-promoted-tile').post(payload).res();
|
|
3611
|
-
}
|
|
3612
|
-
async viewSuperFundPanelAsync(payload) {
|
|
3613
|
-
return buildBackendApiClient().url('view-super-fund-panel').post(payload).res();
|
|
3614
|
-
}
|
|
3615
|
-
toSearchFilterQueryString(searchFilter) {
|
|
3616
|
-
return (`search=${searchFilter.searchString}` +
|
|
3617
|
-
(searchFilter.maxRecordCount > 0 ? '&maxRecordCount=' + searchFilter.maxRecordCount : ''));
|
|
3618
|
-
}
|
|
3619
|
-
toQueryString(includeInactive, searchFilter) {
|
|
3620
|
-
const search = this.toSearchFilterQueryString(searchFilter);
|
|
3621
|
-
const inactive = includeInactive ? 'includeInactive=true' : '';
|
|
3622
|
-
const isNotEmpty = (s) => s && s.length;
|
|
3623
|
-
return [search, inactive].filter(isNotEmpty).join('&');
|
|
3624
|
-
}
|
|
3625
|
-
}
|
|
3626
|
-
const superSelectionApi = new SuperSelectionApi();
|
|
725
|
+
else {
|
|
726
|
+
throw e;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
location.key = key;
|
|
730
|
+
if (currentLocation) {
|
|
731
|
+
// Resolve incomplete/relative pathname relative to current location.
|
|
732
|
+
if (!location.pathname) {
|
|
733
|
+
location.pathname = currentLocation.pathname;
|
|
734
|
+
}
|
|
735
|
+
else if (location.pathname.charAt(0) !== '/') {
|
|
736
|
+
location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
else {
|
|
740
|
+
// When there is no prior location and pathname is empty, set it to /
|
|
741
|
+
if (!location.pathname) {
|
|
742
|
+
location.pathname = '/';
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
location.query = parseQueryString(location.search || '');
|
|
746
|
+
return location;
|
|
747
|
+
};
|
|
3627
748
|
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
const
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
749
|
+
let cacheCount = 0;
|
|
750
|
+
const patternCache = {};
|
|
751
|
+
const cacheLimit = 10000;
|
|
752
|
+
// Memoized function for creating the path match regex
|
|
753
|
+
const compilePath = (pattern, options) => {
|
|
754
|
+
const cacheKey = `${options.end}${options.strict}`;
|
|
755
|
+
const cache = patternCache[cacheKey] || (patternCache[cacheKey] = {});
|
|
756
|
+
const cachePattern = JSON.stringify(pattern);
|
|
757
|
+
if (cache[cachePattern]) {
|
|
758
|
+
return cache[cachePattern];
|
|
759
|
+
}
|
|
760
|
+
const keys = [];
|
|
761
|
+
const re = pathToRegexp(pattern, keys, options);
|
|
762
|
+
const compiledPattern = { re, keys };
|
|
763
|
+
if (cacheCount < cacheLimit) {
|
|
764
|
+
cache[cachePattern] = compiledPattern;
|
|
765
|
+
cacheCount += 1;
|
|
766
|
+
}
|
|
767
|
+
return compiledPattern;
|
|
768
|
+
};
|
|
769
|
+
/**
|
|
770
|
+
* Public API for matching a URL pathname to a path pattern.
|
|
771
|
+
*/
|
|
772
|
+
const matchPath = (pathname, options = {}) => {
|
|
773
|
+
if (typeof options === 'string') {
|
|
774
|
+
options = { path: options };
|
|
775
|
+
}
|
|
776
|
+
const { path = '/', exact = false, strict = false } = options;
|
|
777
|
+
const { re, keys } = compilePath(path, { end: exact, strict });
|
|
778
|
+
const match = re.exec(pathname);
|
|
779
|
+
if (!match) {
|
|
780
|
+
return null;
|
|
781
|
+
}
|
|
782
|
+
const [url, ...values] = match;
|
|
783
|
+
const isExact = pathname === url;
|
|
784
|
+
if (exact && !isExact) {
|
|
785
|
+
return null;
|
|
786
|
+
}
|
|
787
|
+
return {
|
|
788
|
+
path,
|
|
789
|
+
url: path === '/' && url === '' ? '/' : url,
|
|
790
|
+
isExact,
|
|
791
|
+
params: keys.reduce((memo, key, index) => {
|
|
792
|
+
memo[key.name] = values[index];
|
|
793
|
+
return memo;
|
|
794
|
+
}, {})
|
|
795
|
+
};
|
|
796
|
+
};
|
|
797
|
+
const matchesAreEqual = (a, b) => {
|
|
798
|
+
if (a == null && b == null) {
|
|
799
|
+
return true;
|
|
800
|
+
}
|
|
801
|
+
if (b == null) {
|
|
802
|
+
return false;
|
|
803
|
+
}
|
|
804
|
+
return a && b &&
|
|
805
|
+
a.path === b.path &&
|
|
806
|
+
a.url === b.url &&
|
|
807
|
+
valueEqual(a.params, b.params);
|
|
3670
808
|
};
|
|
3671
809
|
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
throw Error('User information is not set');
|
|
3690
|
-
}
|
|
3691
|
-
return this._state.superBuyer.value;
|
|
3692
|
-
}
|
|
3693
|
-
get apiBaseUrl() {
|
|
3694
|
-
if (Option.isNone(this._state.apiBaseUrl)) {
|
|
3695
|
-
throw Error('API base URL is not set');
|
|
3696
|
-
}
|
|
3697
|
-
return this._state.apiBaseUrl.value;
|
|
3698
|
-
}
|
|
3699
|
-
get appBaseUrl() {
|
|
3700
|
-
if (Option.isNone(this._state.appBaseUrl)) {
|
|
3701
|
-
throw Error('App base URL is not set');
|
|
3702
|
-
}
|
|
3703
|
-
return this._state.appBaseUrl.value;
|
|
3704
|
-
}
|
|
3705
|
-
get promotedFunds() {
|
|
3706
|
-
if (this.state.superCampaignEnabled && this.superCampaignState !== undefined) {
|
|
3707
|
-
return this.superCampaignState.PromotedFundIds;
|
|
3708
|
-
}
|
|
3709
|
-
if (Option.isNone(this._state.promotedFunds)) {
|
|
3710
|
-
throw Error('Promoted Funds is not set');
|
|
3711
|
-
}
|
|
3712
|
-
return this._state.promotedFunds.value;
|
|
3713
|
-
}
|
|
3714
|
-
get promotedDefaultFundPosition() {
|
|
3715
|
-
if (this.state.superCampaignEnabled && this.superCampaignState !== undefined) {
|
|
3716
|
-
return Option.fromNullable(this.superCampaignState.DefaultFundPosition);
|
|
3717
|
-
}
|
|
3718
|
-
return Option.none;
|
|
810
|
+
var PromiseButtonState;
|
|
811
|
+
(function (PromiseButtonState) {
|
|
812
|
+
PromiseButtonState[PromiseButtonState["Available"] = 0] = "Available";
|
|
813
|
+
PromiseButtonState[PromiseButtonState["Pending"] = 1] = "Pending";
|
|
814
|
+
PromiseButtonState[PromiseButtonState["Error"] = 2] = "Error";
|
|
815
|
+
})(PromiseButtonState || (PromiseButtonState = {}));
|
|
816
|
+
const Button = class {
|
|
817
|
+
constructor(hostRef) {
|
|
818
|
+
index.registerInstance(this, hostRef);
|
|
819
|
+
this.fillWidth = false;
|
|
820
|
+
this.fillWidthOnMobile = false;
|
|
821
|
+
this.disabled = false;
|
|
822
|
+
this.variant = 'primary';
|
|
823
|
+
this.size = 'base';
|
|
824
|
+
this.promiseFn = () => Promise.resolve();
|
|
825
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
826
|
+
this.state = PromiseButtonState.Available;
|
|
3719
827
|
}
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
828
|
+
render() {
|
|
829
|
+
const sizeCss = {
|
|
830
|
+
xs: 'px-2.5 py-1.5 text-xs',
|
|
831
|
+
base: 'px-4 py-2 text-base',
|
|
832
|
+
xl: 'px-6 py-3 text-base'
|
|
3725
833
|
};
|
|
834
|
+
return (index.h("button", { "data-testid": this.testid, class: {
|
|
835
|
+
[sizeCss[this.size]]: true,
|
|
836
|
+
'inline-flex items-center justify-center border font-medium': true,
|
|
837
|
+
'rounded-md shadow-sm focus:outline-none focus:ring-2': true,
|
|
838
|
+
'focus:ring-offset-2 focus:ring-primary-focus pointer-events-auto': true,
|
|
839
|
+
'disabled:pointer-events-none disabled:border-gray-300 disabled:bg-gray-100 disabled:text-gray-400': true,
|
|
840
|
+
'border-transparent text-white bg-primary-base hover:bg-primary-hover': this.variant === 'primary',
|
|
841
|
+
'border-gray-300 text-gray-700 bg-white hover:bg-gray-50': this.variant === 'secondary',
|
|
842
|
+
'border-transparent bg-primary-light hover:bg-primary-base text-primary-dark hover:text-white': this.variant === 'light',
|
|
843
|
+
'w-full': this.fillWidth || this.fillWidthOnMobile,
|
|
844
|
+
'sm:w-auto': this.fillWidthOnMobile
|
|
845
|
+
}, disabled: this.disabled, onClick: () => this.clicked() }, this.state === PromiseButtonState.Pending && (index.h("sss-loading-indicator", { theme: this.variant === 'primary' ? 'light' : 'primary', size: 16 })), index.h("div", { class: { hidden: this.state === PromiseButtonState.Pending } }, index.h("slot", null))));
|
|
3726
846
|
}
|
|
3727
|
-
|
|
3728
|
-
if (
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
const profileConfigDefaultFundUsi = _function.pipe(this._state.profileConfiguration, Option.map((config) => Option.fromNullable(config.defaultFundUsi)), Option.flatten);
|
|
3735
|
-
if (Option.isSome(profileConfigDefaultFundUsi)) {
|
|
3736
|
-
return profileConfigDefaultFundUsi;
|
|
3737
|
-
}
|
|
3738
|
-
return _function.pipe(this._state.accountConfiguration, Option.map((config) => Option.fromNullable(config.defaultFundUsi)), Option.flatten);
|
|
3739
|
-
}
|
|
3740
|
-
get accountIdOrDefault() {
|
|
3741
|
-
return _function.pipe(this._state.accountConfiguration, Option.map((config) => config.accountId), Option.getOrElse(() => ''));
|
|
3742
|
-
}
|
|
3743
|
-
get partnerIdOrDefault() {
|
|
3744
|
-
return _function.pipe(this._state.superBuyer, Option.map((superBuyer) => superBuyer.partnerId), Option.getOrElse(() => ''));
|
|
3745
|
-
}
|
|
3746
|
-
get jwt() {
|
|
3747
|
-
if (Option.isNone(this._state.jwt)) {
|
|
3748
|
-
throw Error('No authentication information was found');
|
|
3749
|
-
}
|
|
3750
|
-
return this._state.jwt.value;
|
|
3751
|
-
}
|
|
3752
|
-
completeSuperSelectionFlow() {
|
|
3753
|
-
this._state.hasSuccessPageBeenAcknowledged = true;
|
|
3754
|
-
}
|
|
3755
|
-
markSuperSelectionAsSubmitted() {
|
|
3756
|
-
this._state.hasSuperSelectionBeenSubmitted = true;
|
|
3757
|
-
}
|
|
3758
|
-
get isDefinedBenefitsEligible() {
|
|
3759
|
-
return this._state.isDefinedBenefitsEligible;
|
|
3760
|
-
}
|
|
3761
|
-
async loadAppStateAsync() {
|
|
3762
|
-
const appStateResponse = await superSelectionApi.getAppStateAsync();
|
|
3763
|
-
this._state.accountConfiguration = Option.fromNullable(appStateResponse.accountConfiguration);
|
|
3764
|
-
this._state.profileConfiguration = Option.fromNullable(appStateResponse.profileConfiguration);
|
|
3765
|
-
this._state.superBuyer = Option.fromNullable(appStateResponse.superBuyer);
|
|
3766
|
-
this._state.promotedFunds = Option.fromNullable(appStateResponse.promotedFunds);
|
|
3767
|
-
this._state.bringYourOwnFundCustomStepEnabled =
|
|
3768
|
-
appStateResponse.bringYourOwnFundCustomStepEnabled;
|
|
3769
|
-
this._state.featuredFundsEnabled = appStateResponse.featuredFundsEnabled;
|
|
3770
|
-
this._state.superChoicePrefill = Option.fromNullable(appStateResponse.prefill);
|
|
3771
|
-
this._state.isDefinedBenefitsEligible = Option.fromNullable(appStateResponse.isDefinedBenefitsEligible);
|
|
3772
|
-
if (Option.isSome(this._state.accountConfiguration)) {
|
|
3773
|
-
if (this._state.accountConfiguration.value.featureSet.type === 'basic') {
|
|
3774
|
-
this._state.superCampaignEnabled = false;
|
|
3775
|
-
}
|
|
3776
|
-
}
|
|
3777
|
-
}
|
|
3778
|
-
setSuperCampaignPromotedFundsShown(shownFunds) {
|
|
3779
|
-
if (this._state.superCampaignState !== undefined)
|
|
3780
|
-
this._state.superCampaignState.promotedFundsShown = shownFunds;
|
|
3781
|
-
else
|
|
3782
|
-
throw new Error('Cannot set shown funds for SuperCampaing state because it is undefined');
|
|
3783
|
-
}
|
|
3784
|
-
viewSuperFundPanelAsync(placementId, promotedFundIdListOverride) {
|
|
3785
|
-
return superSelectionApi.viewSuperFundPanelAsync(Object.assign(Object.assign({}, this.promotedFundsConfig), { shownFunds: promotedFundIdListOverride
|
|
3786
|
-
? promotedFundIdListOverride
|
|
3787
|
-
: this.promotedFundsConfig.shownFunds, placementId }));
|
|
3788
|
-
}
|
|
3789
|
-
get superCampaignState() {
|
|
3790
|
-
return this._state.superCampaignState;
|
|
3791
|
-
}
|
|
3792
|
-
get superCampaignComponentStatus() {
|
|
3793
|
-
return this._state.superCampaignComponentStatus;
|
|
3794
|
-
}
|
|
3795
|
-
set superCampaignComponentStatus(value) {
|
|
3796
|
-
if (value === SuperCampaignComponentStatus.Loaded) {
|
|
3797
|
-
this._state.superCampaignComponentStatus = SuperCampaignComponentStatus.Loaded;
|
|
3798
|
-
this._state.superCampaignState = new SuperCampaignState();
|
|
847
|
+
async clicked() {
|
|
848
|
+
if (!this.promiseFn || this.state === PromiseButtonState.Pending)
|
|
849
|
+
return;
|
|
850
|
+
try {
|
|
851
|
+
this.state = PromiseButtonState.Pending;
|
|
852
|
+
await this.promiseFn();
|
|
853
|
+
this.state = PromiseButtonState.Available;
|
|
3799
854
|
}
|
|
3800
|
-
|
|
3801
|
-
this.
|
|
3802
|
-
|
|
855
|
+
catch (err) {
|
|
856
|
+
this.state = PromiseButtonState.Error;
|
|
857
|
+
throw err;
|
|
3803
858
|
}
|
|
3804
859
|
}
|
|
3805
|
-
|
|
3806
|
-
return this.state.superCampaignEnabled && this.superCampaignState !== undefined;
|
|
3807
|
-
}
|
|
3808
|
-
get isBringYourOwnFundCustomStepEnabled() {
|
|
3809
|
-
return this.state.bringYourOwnFundCustomStepEnabled;
|
|
3810
|
-
}
|
|
3811
|
-
get isFeaturedFundsEnabled() {
|
|
3812
|
-
return this.state.featuredFundsEnabled;
|
|
3813
|
-
}
|
|
3814
|
-
get superCampaignCanNotBeActivated() {
|
|
3815
|
-
return (!this.state.superCampaignEnabled ||
|
|
3816
|
-
this.superCampaignComponentStatus === SuperCampaignComponentStatus.NotWorking);
|
|
3817
|
-
}
|
|
3818
|
-
get hideFooterSection() {
|
|
3819
|
-
return this._state.hideFooterSection;
|
|
3820
|
-
}
|
|
3821
|
-
set hideFooterSection(value) {
|
|
3822
|
-
this._state.hideFooterSection = value;
|
|
3823
|
-
}
|
|
3824
|
-
get backendUrl() {
|
|
3825
|
-
return Option.map(this.getBaseUrl)(this.state.apiBaseUrl);
|
|
3826
|
-
}
|
|
3827
|
-
getBaseUrl(url) {
|
|
3828
|
-
const parsedUrl = new URL(url);
|
|
3829
|
-
return `${parsedUrl.protocol}//${parsedUrl.hostname}${parsedUrl.port.length > 0 ? `:${parsedUrl.port}` : ''}`;
|
|
3830
|
-
}
|
|
3831
|
-
}
|
|
3832
|
-
const superSelectionAppService = new SuperSelectionAppService();
|
|
3833
|
-
|
|
3834
|
-
class NavigationService {
|
|
3835
|
-
navigateInternally(history, route) {
|
|
3836
|
-
const path = `${this.appBaseUrl}${this.toRouteWithLeadingSlash(route)}`;
|
|
3837
|
-
iframe.navigation(path);
|
|
3838
|
-
history.push(path);
|
|
3839
|
-
}
|
|
3840
|
-
navigateInternallyToStandardChoice(options) {
|
|
3841
|
-
state.handleSubmitFn = options.handleSubmitFn;
|
|
3842
|
-
state.fundName = options.fundName;
|
|
3843
|
-
state.fundDetails = options.fundDetails;
|
|
3844
|
-
state.promotedFundId = options.promotedFundId;
|
|
3845
|
-
this.navigateInternally(options.history, SuperSelectionAppRoutes.StandardChoice);
|
|
3846
|
-
}
|
|
3847
|
-
toExternalUrl(url) {
|
|
3848
|
-
const externalUrl = new URL(url);
|
|
3849
|
-
externalUrl.searchParams.append('_extnav', 'true');
|
|
3850
|
-
return externalUrl.href;
|
|
3851
|
-
}
|
|
3852
|
-
get appBaseUrl() {
|
|
3853
|
-
const baseUrl = superSelectionAppService.appBaseUrl;
|
|
3854
|
-
return baseUrl.replace(/\/$/, '');
|
|
3855
|
-
}
|
|
3856
|
-
toRouteWithLeadingSlash(route) {
|
|
3857
|
-
return route.length > 0 && route[0] === '/' ? route : `/${route}`;
|
|
3858
|
-
}
|
|
3859
|
-
}
|
|
3860
|
-
const navigationService = new NavigationService();
|
|
860
|
+
};
|
|
3861
861
|
|
|
3862
862
|
const ChoiceRouter = class {
|
|
3863
863
|
constructor(hostRef) {
|
|
3864
864
|
index.registerInstance(this, hostRef);
|
|
3865
865
|
}
|
|
3866
866
|
async componentWillLoad() {
|
|
3867
|
-
if (superSelectionAppService.superCampaignCanNotBeActivated) {
|
|
3868
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.MyOwnFund);
|
|
867
|
+
if (customFundChoice_api.superSelectionAppService.superCampaignCanNotBeActivated) {
|
|
868
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.MyOwnFund);
|
|
3869
869
|
}
|
|
3870
870
|
else {
|
|
3871
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.SuperCampaign);
|
|
871
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.SuperCampaign);
|
|
3872
872
|
}
|
|
3873
873
|
}
|
|
3874
874
|
render() {
|
|
3875
875
|
return index.h(index.Fragment, null);
|
|
3876
876
|
}
|
|
3877
877
|
};
|
|
3878
|
-
injectHistory(ChoiceRouter);
|
|
878
|
+
customFundChoice_api.injectHistory(ChoiceRouter);
|
|
3879
879
|
|
|
3880
880
|
var CustomFundTypes;
|
|
3881
881
|
(function (CustomFundTypes) {
|
|
@@ -3886,11 +886,11 @@ var CustomFundTypes;
|
|
|
3886
886
|
})(CustomFundTypes || (CustomFundTypes = {}));
|
|
3887
887
|
const initialStateCustomFund = {
|
|
3888
888
|
myOwnFundForm: {
|
|
3889
|
-
fundUsi: none,
|
|
3890
|
-
fundName: none,
|
|
3891
|
-
memberNumber: none,
|
|
3892
|
-
memberFirstName: none,
|
|
3893
|
-
memberFamilyName: none
|
|
889
|
+
fundUsi: customFundChoice_api.none,
|
|
890
|
+
fundName: customFundChoice_api.none,
|
|
891
|
+
memberNumber: customFundChoice_api.none,
|
|
892
|
+
memberFirstName: customFundChoice_api.none,
|
|
893
|
+
memberFamilyName: customFundChoice_api.none
|
|
3894
894
|
},
|
|
3895
895
|
selfManagedFundForm: {
|
|
3896
896
|
fundName: '',
|
|
@@ -3908,11 +908,11 @@ const initialStateCustomFund = {
|
|
|
3908
908
|
memberFamilyName: ''
|
|
3909
909
|
}
|
|
3910
910
|
};
|
|
3911
|
-
const { state
|
|
911
|
+
const { state, reset } = customFundChoice_api.createStore(initialStateCustomFund);
|
|
3912
912
|
|
|
3913
913
|
const myOwnFundCustomOption = {
|
|
3914
914
|
label: CustomFundTypes.MyOwnFund,
|
|
3915
|
-
value: SuperSelectionAppRoutes.MyOwnFund
|
|
915
|
+
value: customFundChoice_api.SuperSelectionAppRoutes.MyOwnFund
|
|
3916
916
|
};
|
|
3917
917
|
const CustomFund = class {
|
|
3918
918
|
constructor(hostRef) {
|
|
@@ -3921,36 +921,36 @@ const CustomFund = class {
|
|
|
3921
921
|
this.showFundOptionsSelection = false;
|
|
3922
922
|
}
|
|
3923
923
|
componentWillLoad() {
|
|
3924
|
-
let currentRoute = SuperSelectionAppRoutes.MyOwnFund;
|
|
3925
|
-
if (window.location.pathname.includes(SuperSelectionAppRoutes.MyOwnFund))
|
|
3926
|
-
currentRoute = SuperSelectionAppRoutes.MyOwnFund;
|
|
3927
|
-
if (window.location.pathname.includes(SuperSelectionAppRoutes.DefaultFund))
|
|
3928
|
-
currentRoute = SuperSelectionAppRoutes.DefaultFund;
|
|
3929
|
-
if (window.location.pathname.includes(SuperSelectionAppRoutes.SelfManagedFund))
|
|
3930
|
-
currentRoute = SuperSelectionAppRoutes.SelfManagedFund;
|
|
3931
|
-
if (window.location.pathname.includes(SuperSelectionAppRoutes.FeaturedFunds))
|
|
3932
|
-
currentRoute = SuperSelectionAppRoutes.FeaturedFunds;
|
|
924
|
+
let currentRoute = customFundChoice_api.SuperSelectionAppRoutes.MyOwnFund;
|
|
925
|
+
if (window.location.pathname.includes(customFundChoice_api.SuperSelectionAppRoutes.MyOwnFund))
|
|
926
|
+
currentRoute = customFundChoice_api.SuperSelectionAppRoutes.MyOwnFund;
|
|
927
|
+
if (window.location.pathname.includes(customFundChoice_api.SuperSelectionAppRoutes.DefaultFund))
|
|
928
|
+
currentRoute = customFundChoice_api.SuperSelectionAppRoutes.DefaultFund;
|
|
929
|
+
if (window.location.pathname.includes(customFundChoice_api.SuperSelectionAppRoutes.SelfManagedFund))
|
|
930
|
+
currentRoute = customFundChoice_api.SuperSelectionAppRoutes.SelfManagedFund;
|
|
931
|
+
if (window.location.pathname.includes(customFundChoice_api.SuperSelectionAppRoutes.FeaturedFunds))
|
|
932
|
+
currentRoute = customFundChoice_api.SuperSelectionAppRoutes.FeaturedFunds;
|
|
3933
933
|
this.fundOptionsList = [
|
|
3934
934
|
myOwnFundCustomOption,
|
|
3935
935
|
{
|
|
3936
936
|
label: CustomFundTypes.SelfManagedFund,
|
|
3937
|
-
value: SuperSelectionAppRoutes.SelfManagedFund
|
|
937
|
+
value: customFundChoice_api.SuperSelectionAppRoutes.SelfManagedFund
|
|
3938
938
|
}
|
|
3939
939
|
];
|
|
3940
|
-
if (superSelectionAppService.isFeaturedFundsEnabled &&
|
|
3941
|
-
superSelectionAppService.isUsingSuperCampaign) {
|
|
940
|
+
if (customFundChoice_api.superSelectionAppService.isFeaturedFundsEnabled &&
|
|
941
|
+
customFundChoice_api.superSelectionAppService.isUsingSuperCampaign) {
|
|
3942
942
|
this.fundOptionsList.push({
|
|
3943
943
|
label: CustomFundTypes.FeaturedFunds,
|
|
3944
|
-
value: SuperSelectionAppRoutes.FeaturedFunds
|
|
944
|
+
value: customFundChoice_api.SuperSelectionAppRoutes.FeaturedFunds
|
|
3945
945
|
});
|
|
3946
946
|
}
|
|
3947
947
|
this.fundOptionsList.push({
|
|
3948
948
|
label: CustomFundTypes.DefaultFund,
|
|
3949
|
-
value: SuperSelectionAppRoutes.DefaultFund
|
|
949
|
+
value: customFundChoice_api.SuperSelectionAppRoutes.DefaultFund
|
|
3950
950
|
});
|
|
3951
951
|
this.currentCustomFund =
|
|
3952
952
|
this.fundOptionsList.find((item) => item.value === currentRoute) || this.currentCustomFund;
|
|
3953
|
-
navigationService.navigateInternally(this.history, currentRoute);
|
|
953
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, currentRoute);
|
|
3954
954
|
}
|
|
3955
955
|
render() {
|
|
3956
956
|
const ChevronDownIcon = () => {
|
|
@@ -3964,25 +964,25 @@ const CustomFund = class {
|
|
|
3964
964
|
'text-gray-500': this.showFundOptionsSelection
|
|
3965
965
|
} }, this.showFundOptionsSelection ? 'Select' : this.currentCustomFund.label), index.h("span", { class: "absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none" }, index.h(ChevronDownIcon, null))), this.showFundOptionsSelection && (index.h("ul", { class: "absolute z-10 mt-1 w-full bg-white shadow-lg max-h-60 rounded-md py-1 ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none text-base sm:text-sm" }, this.fundOptionsList.map((f) => (index.h("li", { class: "text-gray-900 cursor-default select-none relative py-2 pl-3 pr-9 group hover:bg-primary-base hover:text-white", onClick: () => {
|
|
3966
966
|
this.showFundOptionsSelection = !this.showFundOptionsSelection;
|
|
3967
|
-
navigationService.navigateInternally(this.history, f.value);
|
|
967
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, f.value);
|
|
3968
968
|
} }, index.h("span", { class: {
|
|
3969
969
|
'block truncate': true,
|
|
3970
970
|
'font-semibold': this.currentCustomFund === f
|
|
3971
971
|
} }, f.label), this.currentCustomFund === f && (index.h("span", { class: "absolute inset-y-0 right-0 flex items-center pr-4" }, index.h(CheckIcon, null))))))))), index.h("div", { onClick: () => (this.showFundOptionsSelection = false) }, index.h("slot", null))));
|
|
3972
972
|
}
|
|
3973
973
|
};
|
|
3974
|
-
injectHistory(CustomFund);
|
|
974
|
+
customFundChoice_api.injectHistory(CustomFund);
|
|
3975
975
|
|
|
3976
976
|
class AustralianFundLookupService {
|
|
3977
977
|
async searchFundsAsync(searchString, maxRecordCount) {
|
|
3978
|
-
return superSelectionApi.getAustralianFundsAsync({
|
|
978
|
+
return customFundChoice_api.superSelectionApi.getAustralianFundsAsync({
|
|
3979
979
|
searchString,
|
|
3980
980
|
maxRecordCount
|
|
3981
981
|
});
|
|
3982
982
|
}
|
|
3983
983
|
async getFundAsync(usi, includeInactive) {
|
|
3984
|
-
const result = await superSelectionApi.getAustralianFundAsync(usi, includeInactive);
|
|
3985
|
-
return Option.some(result);
|
|
984
|
+
const result = await customFundChoice_api.superSelectionApi.getAustralianFundAsync(usi, includeInactive);
|
|
985
|
+
return customFundChoice_api.Option.some(result);
|
|
3986
986
|
}
|
|
3987
987
|
}
|
|
3988
988
|
const australianFundLookupService = new AustralianFundLookupService();
|
|
@@ -3992,7 +992,7 @@ class EventTrackingApi {
|
|
|
3992
992
|
return this.instance || (this.instance = new this());
|
|
3993
993
|
}
|
|
3994
994
|
async PostAnalyticsEventAsync(event) {
|
|
3995
|
-
return buildBackendApiClient().url('analytics-events').post(event).res();
|
|
995
|
+
return customFundChoice_api.buildBackendApiClient().url('analytics-events').post(event).res();
|
|
3996
996
|
}
|
|
3997
997
|
}
|
|
3998
998
|
|
|
@@ -4103,56 +1103,6 @@ class EventTrackingService {
|
|
|
4103
1103
|
}
|
|
4104
1104
|
}
|
|
4105
1105
|
|
|
4106
|
-
class CustomFundChoiceApi {
|
|
4107
|
-
async submitDefaultFundChoiceAsync(dto) {
|
|
4108
|
-
return buildBackendApiClient()
|
|
4109
|
-
.url('super-choice/default')
|
|
4110
|
-
.post(dto)
|
|
4111
|
-
.badRequest(() => {
|
|
4112
|
-
throw new Error('Failed to process default fund join request');
|
|
4113
|
-
})
|
|
4114
|
-
.text();
|
|
4115
|
-
}
|
|
4116
|
-
async submitCustomFundChoiceAsync(dto) {
|
|
4117
|
-
return buildBackendApiClient()
|
|
4118
|
-
.url('super-choice/custom-fund')
|
|
4119
|
-
.post(dto)
|
|
4120
|
-
.badRequest(() => {
|
|
4121
|
-
throw new Error('Failed to process custom fund join request');
|
|
4122
|
-
})
|
|
4123
|
-
.text();
|
|
4124
|
-
}
|
|
4125
|
-
async submitSelfManagedFundChoiceAsync(dto) {
|
|
4126
|
-
return buildBackendApiClient()
|
|
4127
|
-
.url('super-choice/smsf')
|
|
4128
|
-
.post(dto)
|
|
4129
|
-
.badRequest(() => {
|
|
4130
|
-
throw new Error('Failed to process SMSF choice request');
|
|
4131
|
-
})
|
|
4132
|
-
.text();
|
|
4133
|
-
}
|
|
4134
|
-
async submitDefinedBenefitsChoiceAsync(dto) {
|
|
4135
|
-
return buildBackendApiClient()
|
|
4136
|
-
.url('super-choice/defined-benefits')
|
|
4137
|
-
.post(dto)
|
|
4138
|
-
.badRequest(() => {
|
|
4139
|
-
throw new Error('Failed to process Defined Benefits choice request');
|
|
4140
|
-
})
|
|
4141
|
-
.text();
|
|
4142
|
-
}
|
|
4143
|
-
async validateAbnForSMSF(abn) {
|
|
4144
|
-
const response = await buildBackendApiClient()
|
|
4145
|
-
.url(`super-choice/smsf/${abn}/validate`)
|
|
4146
|
-
.get()
|
|
4147
|
-
.badRequest(() => {
|
|
4148
|
-
throw new Error('Failed to verify that if the provided abn is used for regulated fund');
|
|
4149
|
-
})
|
|
4150
|
-
.json();
|
|
4151
|
-
return response.result;
|
|
4152
|
-
}
|
|
4153
|
-
}
|
|
4154
|
-
const customFundChoiceApi = new CustomFundChoiceApi();
|
|
4155
|
-
|
|
4156
1106
|
const DefaultFund = class {
|
|
4157
1107
|
constructor(hostRef) {
|
|
4158
1108
|
index.registerInstance(this, hostRef);
|
|
@@ -4160,13 +1110,13 @@ const DefaultFund = class {
|
|
|
4160
1110
|
this.eventTrackingService = EventTrackingService.Instance;
|
|
4161
1111
|
}
|
|
4162
1112
|
async componentWillLoad() {
|
|
4163
|
-
const defaultFundUsi = superSelectionAppService.defaultFundUsi;
|
|
4164
|
-
if (Option.isNone(defaultFundUsi)) {
|
|
1113
|
+
const defaultFundUsi = customFundChoice_api.superSelectionAppService.defaultFundUsi;
|
|
1114
|
+
if (customFundChoice_api.Option.isNone(defaultFundUsi)) {
|
|
4165
1115
|
return;
|
|
4166
1116
|
}
|
|
4167
1117
|
this.isDefaultFundExists = true;
|
|
4168
1118
|
const defaultFundSearchResult = await australianFundLookupService.getFundAsync(defaultFundUsi.value, true);
|
|
4169
|
-
if (Option.isNone(defaultFundSearchResult)) {
|
|
1119
|
+
if (customFundChoice_api.Option.isNone(defaultFundSearchResult)) {
|
|
4170
1120
|
this.isInvalidDefaultFund = true;
|
|
4171
1121
|
return;
|
|
4172
1122
|
}
|
|
@@ -4178,18 +1128,18 @@ const DefaultFund = class {
|
|
|
4178
1128
|
return this.eventTrackingService.TrackDefaultSuperFundDetailViewedAsync({
|
|
4179
1129
|
fundUsi: (_b = (_a = this.defaultFund) === null || _a === void 0 ? void 0 : _a.usi) !== null && _b !== void 0 ? _b : '',
|
|
4180
1130
|
fundName: (_d = (_c = this.defaultFund) === null || _c === void 0 ? void 0 : _c.productName) !== null && _d !== void 0 ? _d : '',
|
|
4181
|
-
promotedFundsShown: superSelectionAppService.promotedFunds,
|
|
4182
|
-
defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi)
|
|
1131
|
+
promotedFundsShown: customFundChoice_api.superSelectionAppService.promotedFunds,
|
|
1132
|
+
defaultFundUsiSet: customFundChoice_api.Option.toUndefined(customFundChoice_api.superSelectionAppService.defaultFundUsi)
|
|
4183
1133
|
});
|
|
4184
1134
|
}
|
|
4185
1135
|
render() {
|
|
4186
|
-
return (index.h(index.Host, null, index.h("sss-header-section", null), index.h("div", { class: "flex justify-center mt-11" }, index.h("sss-custom-fund", null, index.h("div", { class: "p-4 sm:p-6 pb-6 sm:pb-8 border shadow-sm rounded-lg" }, index.h("p", { class: "sm:text-lg font-bold mb-3" }, "Fund details"), (!this.isDefaultFundExists || this.isInvalidDefaultFund) && (index.h("div", { class: "bg-yellow-50 border-l-4 border-yellow-400 p-4 my-3" }, index.h("div", { class: "flex" }, index.h("div", { class: "flex-shrink-0" }, index.h("img", { class: "h-5 w-5", src: index.getAssetPath('assets/icon-exclamation.svg') })), index.h("div", { class: "ml-3 text-sm text-yellow-700 leading-5" }, index.h("span", null, "It looks like your employer has not specified a default fund, please contact them if you\u2019d like to use your company\u2019s default fund."))))), this.isDefaultFundExists && !this.isInvalidDefaultFund && (index.h("div", null, index.h("div", { class: "mt-3" }, index.h("label", { class: "text-sm font-medium text-gray-700" }, "Fund Name"), index.h("div", { class: "mt-1 shadow-sm px-3 py-2 rounded-md border border-gray-300 bg-gray-50 text-gray-500 text-base sm:text-sm" }, this.defaultFundProductName)), index.h("div", { class: "mt-3" }, index.h("label", { class: "text-sm font-medium text-gray-700" }, "Fund USI"), index.h("div", { class: "mt-1 shadow-sm px-3 py-2 rounded-md border border-gray-300 bg-gray-50 text-gray-500 text-base sm:text-sm" }, this.defaultFund.usi)), index.h("div", { class: "mt-8 mb-8 h-px w-full bg-gray-200" }), index.h("div", { class: "text-sm text-gray-700" }, index.h("label", { class: "font-semibold text-gray-900" }, "By clicking \u201CContinue\u201D, you acknowledge that:"), index.h("ul", { class: "list-disc list-outside pl-5" }, index.h("li", { class: "mt-2" }, "you are choosing to join your employer\u2019s default super fund;"), index.h("li", { class: "mt-2" }, "your employer will open a new account for you with their default super fund; and"), index.h("li", { class: "mt-2" }, "your application to join is subject to Trustee approval.")))))), index.h("div", { class: "flex justify-center mt-8" }, index.h("div", { class: "sm:max-w-320 w-full" }, this.isDefaultFundExists && !this.isInvalidDefaultFund && (index.h("div", { class: "mb-4" }, index.h("sss-button", { testid: "continue-button", fillWidth: true, promiseFn: () => this.handleSubmitForm() }, "Continue"))), index.h("stencil-route-link", { url: SuperSelectionAppRoutes.ChoicePage }, index.h("sss-button", { testid: "back-button", fillWidth: true, variant: "secondary" }, "Back"))))))));
|
|
1136
|
+
return (index.h(index.Host, null, index.h("sss-header-section", null), index.h("div", { class: "flex justify-center mt-11" }, index.h("sss-custom-fund", null, index.h("div", { class: "p-4 sm:p-6 pb-6 sm:pb-8 border shadow-sm rounded-lg" }, index.h("p", { class: "sm:text-lg font-bold mb-3" }, "Fund details"), (!this.isDefaultFundExists || this.isInvalidDefaultFund) && (index.h("div", { class: "bg-yellow-50 border-l-4 border-yellow-400 p-4 my-3" }, index.h("div", { class: "flex" }, index.h("div", { class: "flex-shrink-0" }, index.h("img", { class: "h-5 w-5", src: index.getAssetPath('assets/icon-exclamation.svg') })), index.h("div", { class: "ml-3 text-sm text-yellow-700 leading-5" }, index.h("span", null, "It looks like your employer has not specified a default fund, please contact them if you\u2019d like to use your company\u2019s default fund."))))), this.isDefaultFundExists && !this.isInvalidDefaultFund && (index.h("div", null, index.h("div", { class: "mt-3" }, index.h("label", { class: "text-sm font-medium text-gray-700" }, "Fund Name"), index.h("div", { class: "mt-1 shadow-sm px-3 py-2 rounded-md border border-gray-300 bg-gray-50 text-gray-500 text-base sm:text-sm" }, this.defaultFundProductName)), index.h("div", { class: "mt-3" }, index.h("label", { class: "text-sm font-medium text-gray-700" }, "Fund USI"), index.h("div", { class: "mt-1 shadow-sm px-3 py-2 rounded-md border border-gray-300 bg-gray-50 text-gray-500 text-base sm:text-sm" }, this.defaultFund.usi)), index.h("div", { class: "mt-8 mb-8 h-px w-full bg-gray-200" }), index.h("div", { class: "text-sm text-gray-700" }, index.h("label", { class: "font-semibold text-gray-900" }, "By clicking \u201CContinue\u201D, you acknowledge that:"), index.h("ul", { class: "list-disc list-outside pl-5" }, index.h("li", { class: "mt-2" }, "you are choosing to join your employer\u2019s default super fund;"), index.h("li", { class: "mt-2" }, "your employer will open a new account for you with their default super fund; and"), index.h("li", { class: "mt-2" }, "your application to join is subject to Trustee approval.")))))), index.h("div", { class: "flex justify-center mt-8" }, index.h("div", { class: "sm:max-w-320 w-full" }, this.isDefaultFundExists && !this.isInvalidDefaultFund && (index.h("div", { class: "mb-4" }, index.h("sss-button", { testid: "continue-button", fillWidth: true, promiseFn: () => this.handleSubmitForm() }, "Continue"))), index.h("stencil-route-link", { url: customFundChoice_api.SuperSelectionAppRoutes.ChoicePage }, index.h("sss-button", { testid: "back-button", fillWidth: true, variant: "secondary" }, "Back"))))))));
|
|
4187
1137
|
}
|
|
4188
1138
|
async handleSubmitForm() {
|
|
4189
1139
|
if (this.isInvalidDefaultFund) {
|
|
4190
1140
|
return;
|
|
4191
1141
|
}
|
|
4192
|
-
navigationService.navigateInternallyToStandardChoice({
|
|
1142
|
+
customFundChoice_api.navigationService.navigateInternallyToStandardChoice({
|
|
4193
1143
|
history: this.history,
|
|
4194
1144
|
fundName: `Employer’s default fund`,
|
|
4195
1145
|
fundDetails: {
|
|
@@ -4198,7 +1148,7 @@ const DefaultFund = class {
|
|
|
4198
1148
|
fundUsi: this.defaultFund.usi
|
|
4199
1149
|
},
|
|
4200
1150
|
handleSubmitFn: async (standardChoiceFormSignature) => {
|
|
4201
|
-
await customFundChoiceApi.submitDefaultFundChoiceAsync(Object.assign({ standardChoiceFormSignature }, superSelectionAppService.promotedFundsConfig));
|
|
1151
|
+
await customFundChoice_api.customFundChoiceApi.submitDefaultFundChoiceAsync(Object.assign({ standardChoiceFormSignature }, customFundChoice_api.superSelectionAppService.promotedFundsConfig));
|
|
4202
1152
|
}
|
|
4203
1153
|
});
|
|
4204
1154
|
}
|
|
@@ -4375,24 +1325,24 @@ SelectInputAsync.style = dropdownAsyncCss;
|
|
|
4375
1325
|
class ExistingFundService {
|
|
4376
1326
|
async GetExistingFundAsync() {
|
|
4377
1327
|
var _a;
|
|
4378
|
-
const choice = superSelectionAppService.superBuyer.superChoice;
|
|
4379
|
-
const choiceDetails = (_a = superSelectionAppService.superBuyer.superChoice) === null || _a === void 0 ? void 0 : _a.choiceDetails;
|
|
1328
|
+
const choice = customFundChoice_api.superSelectionAppService.superBuyer.superChoice;
|
|
1329
|
+
const choiceDetails = (_a = customFundChoice_api.superSelectionAppService.superBuyer.superChoice) === null || _a === void 0 ? void 0 : _a.choiceDetails;
|
|
4380
1330
|
if (!choice)
|
|
4381
|
-
return none;
|
|
1331
|
+
return customFundChoice_api.none;
|
|
4382
1332
|
if (!choiceDetails)
|
|
4383
|
-
return none;
|
|
4384
|
-
const dateSubmitted = choice.dateSubmitted == undefined ? none : some(new Date(choice.dateSubmitted));
|
|
4385
|
-
const usi = getSuperChoiceUsi(choiceDetails);
|
|
4386
|
-
const memberNumber = getSuperChoiceMemberNumber(choiceDetails);
|
|
1333
|
+
return customFundChoice_api.none;
|
|
1334
|
+
const dateSubmitted = choice.dateSubmitted == undefined ? customFundChoice_api.none : customFundChoice_api.some(new Date(choice.dateSubmitted));
|
|
1335
|
+
const usi = customFundChoice_api.getSuperChoiceUsi(choiceDetails);
|
|
1336
|
+
const memberNumber = customFundChoice_api.getSuperChoiceMemberNumber(choiceDetails);
|
|
4387
1337
|
switch (choiceDetails.kind) {
|
|
4388
1338
|
case 'Promoted': {
|
|
4389
|
-
if (isNone(usi))
|
|
4390
|
-
return none;
|
|
1339
|
+
if (customFundChoice_api.isNone(usi))
|
|
1340
|
+
return customFundChoice_api.none;
|
|
4391
1341
|
const fund = await this.getFundByUsiAsync(usi.value);
|
|
4392
|
-
return some({
|
|
1342
|
+
return customFundChoice_api.some({
|
|
4393
1343
|
type: 'Promoted Fund',
|
|
4394
|
-
id: getPromotedFundId(choiceDetails.promoted),
|
|
4395
|
-
name: isSome(fund) ? fund.value.productName : usi.value,
|
|
1344
|
+
id: customFundChoice_api.getPromotedFundId(choiceDetails.promoted),
|
|
1345
|
+
name: customFundChoice_api.isSome(fund) ? fund.value.productName : usi.value,
|
|
4396
1346
|
usi: usi,
|
|
4397
1347
|
valid: 'Active',
|
|
4398
1348
|
memberNumber: memberNumber,
|
|
@@ -4402,9 +1352,9 @@ class ExistingFundService {
|
|
|
4402
1352
|
case 'MyOwnFund': {
|
|
4403
1353
|
const fundUsi = choiceDetails.myOwnFund.usi;
|
|
4404
1354
|
const fund = await this.getFundByUsiAsync(fundUsi);
|
|
4405
|
-
return some({
|
|
1355
|
+
return customFundChoice_api.some({
|
|
4406
1356
|
type: 'My Own Fund',
|
|
4407
|
-
name: isSome(fund) ? fund.value.productName : fundUsi,
|
|
1357
|
+
name: customFundChoice_api.isSome(fund) ? fund.value.productName : fundUsi,
|
|
4408
1358
|
usi: usi,
|
|
4409
1359
|
valid: this.toFundValidState(fund),
|
|
4410
1360
|
memberNumber: memberNumber,
|
|
@@ -4412,7 +1362,7 @@ class ExistingFundService {
|
|
|
4412
1362
|
});
|
|
4413
1363
|
}
|
|
4414
1364
|
case 'SMSF':
|
|
4415
|
-
return some({
|
|
1365
|
+
return customFundChoice_api.some({
|
|
4416
1366
|
type: 'Self Managed Fund',
|
|
4417
1367
|
name: choiceDetails.smsf.fundName,
|
|
4418
1368
|
valid: 'Unknown',
|
|
@@ -4421,9 +1371,9 @@ class ExistingFundService {
|
|
|
4421
1371
|
case 'Default': {
|
|
4422
1372
|
const defaultUsi = choiceDetails.default.usi;
|
|
4423
1373
|
const defaultFund = await this.getFundByUsiAsync(defaultUsi);
|
|
4424
|
-
return some({
|
|
1374
|
+
return customFundChoice_api.some({
|
|
4425
1375
|
type: 'Default Fund',
|
|
4426
|
-
name: isSome(defaultFund) ? defaultFund.value.productName : defaultUsi,
|
|
1376
|
+
name: customFundChoice_api.isSome(defaultFund) ? defaultFund.value.productName : defaultUsi,
|
|
4427
1377
|
usi: usi,
|
|
4428
1378
|
valid: this.toFundValidState(defaultFund),
|
|
4429
1379
|
lastNominatedAt: dateSubmitted
|
|
@@ -4432,10 +1382,10 @@ class ExistingFundService {
|
|
|
4432
1382
|
case 'PromotedDefault': {
|
|
4433
1383
|
const defaultUsi = choiceDetails.promotedDefault.usi;
|
|
4434
1384
|
const defaultFund = await this.getFundByUsiAsync(defaultUsi);
|
|
4435
|
-
return some({
|
|
1385
|
+
return customFundChoice_api.some({
|
|
4436
1386
|
type: 'Promoted Default Fund',
|
|
4437
1387
|
id: choiceDetails.promotedDefault.fundId,
|
|
4438
|
-
name: isSome(defaultFund) ? defaultFund.value.productName : defaultUsi,
|
|
1388
|
+
name: customFundChoice_api.isSome(defaultFund) ? defaultFund.value.productName : defaultUsi,
|
|
4439
1389
|
usi: usi,
|
|
4440
1390
|
valid: this.toFundValidState(defaultFund),
|
|
4441
1391
|
lastNominatedAt: dateSubmitted
|
|
@@ -4444,9 +1394,9 @@ class ExistingFundService {
|
|
|
4444
1394
|
case 'DefinedBenefits': {
|
|
4445
1395
|
const defaultUsi = choiceDetails.definedBenefits.usi;
|
|
4446
1396
|
const fund = await this.getFundByUsiAsync(defaultUsi);
|
|
4447
|
-
return some({
|
|
1397
|
+
return customFundChoice_api.some({
|
|
4448
1398
|
type: 'Defined Benefits Fund',
|
|
4449
|
-
name: isSome(fund) ? fund.value.productName : defaultUsi,
|
|
1399
|
+
name: customFundChoice_api.isSome(fund) ? fund.value.productName : defaultUsi,
|
|
4450
1400
|
usi: usi,
|
|
4451
1401
|
valid: this.toFundValidState(fund),
|
|
4452
1402
|
lastNominatedAt: dateSubmitted
|
|
@@ -4455,10 +1405,10 @@ class ExistingFundService {
|
|
|
4455
1405
|
case 'PromotedDefaultWithJoin': {
|
|
4456
1406
|
const defaultUsi = choiceDetails.promotedDefaultWithJoin.usi;
|
|
4457
1407
|
const defaultFund = await this.getFundByUsiAsync(defaultUsi);
|
|
4458
|
-
return some({
|
|
1408
|
+
return customFundChoice_api.some({
|
|
4459
1409
|
type: 'Promoted Default Fund With Join',
|
|
4460
1410
|
id: choiceDetails.promotedDefaultWithJoin.fundId,
|
|
4461
|
-
name: isSome(defaultFund) ? defaultFund.value.productName : defaultUsi,
|
|
1411
|
+
name: customFundChoice_api.isSome(defaultFund) ? defaultFund.value.productName : defaultUsi,
|
|
4462
1412
|
usi: usi,
|
|
4463
1413
|
valid: this.toFundValidState(defaultFund),
|
|
4464
1414
|
memberNumber: memberNumber,
|
|
@@ -4466,11 +1416,11 @@ class ExistingFundService {
|
|
|
4466
1416
|
});
|
|
4467
1417
|
}
|
|
4468
1418
|
default:
|
|
4469
|
-
return none;
|
|
1419
|
+
return customFundChoice_api.none;
|
|
4470
1420
|
}
|
|
4471
1421
|
}
|
|
4472
1422
|
async submitRetainSuperFundAsync(dto) {
|
|
4473
|
-
return buildBackendApiClient()
|
|
1423
|
+
return customFundChoice_api.buildBackendApiClient()
|
|
4474
1424
|
.url('super-choice/retain-super-fund')
|
|
4475
1425
|
.post(dto)
|
|
4476
1426
|
.badRequest(() => {
|
|
@@ -4482,7 +1432,7 @@ class ExistingFundService {
|
|
|
4482
1432
|
return australianFundLookupService.getFundAsync(usi, true);
|
|
4483
1433
|
}
|
|
4484
1434
|
toFundValidState(fund) {
|
|
4485
|
-
if (isSome(fund)) {
|
|
1435
|
+
if (customFundChoice_api.isSome(fund)) {
|
|
4486
1436
|
return fund.value.isActive ? 'Active' : 'Inactive';
|
|
4487
1437
|
}
|
|
4488
1438
|
else {
|
|
@@ -4498,7 +1448,7 @@ const ExistingChoice = class {
|
|
|
4498
1448
|
this.eventTrackingService = EventTrackingService.Instance;
|
|
4499
1449
|
this.createSuperFundNominationDetail = (fund) => {
|
|
4500
1450
|
function toUndefined(opt) {
|
|
4501
|
-
return isSome(opt) ? opt.value : undefined;
|
|
1451
|
+
return customFundChoice_api.isSome(opt) ? opt.value : undefined;
|
|
4502
1452
|
}
|
|
4503
1453
|
function getUsi(fund) {
|
|
4504
1454
|
return 'usi' in fund ? toUndefined(fund.usi) : undefined;
|
|
@@ -4512,7 +1462,7 @@ const ExistingChoice = class {
|
|
|
4512
1462
|
fundUsi: getUsi(fund),
|
|
4513
1463
|
memberNumber: getMemberNumber(fund),
|
|
4514
1464
|
fundStatus: fund.valid.toString(),
|
|
4515
|
-
lastNominatedAt: isSome(fund.lastNominatedAt) ? fund.lastNominatedAt.value.toISOString() : ''
|
|
1465
|
+
lastNominatedAt: customFundChoice_api.isSome(fund.lastNominatedAt) ? fund.lastNominatedAt.value.toISOString() : ''
|
|
4516
1466
|
};
|
|
4517
1467
|
};
|
|
4518
1468
|
}
|
|
@@ -4522,11 +1472,11 @@ const ExistingChoice = class {
|
|
|
4522
1472
|
}
|
|
4523
1473
|
async componentWillLoad() {
|
|
4524
1474
|
const chosenFundOption = await existingFundService.GetExistingFundAsync();
|
|
4525
|
-
if (isSome(chosenFundOption) && chosenFundOption.value.valid !== 'Inactive') {
|
|
1475
|
+
if (customFundChoice_api.isSome(chosenFundOption) && chosenFundOption.value.valid !== 'Inactive') {
|
|
4526
1476
|
this.existingFund = chosenFundOption.value;
|
|
4527
1477
|
}
|
|
4528
1478
|
else {
|
|
4529
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
1479
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
4530
1480
|
}
|
|
4531
1481
|
}
|
|
4532
1482
|
render() {
|
|
@@ -4584,12 +1534,12 @@ const ExistingChoice = class {
|
|
|
4584
1534
|
async handleFundNominationAccepted() {
|
|
4585
1535
|
const detail = this.createSuperFundNominationDetail(this.existingFund);
|
|
4586
1536
|
await existingFundService.submitRetainSuperFundAsync(detail);
|
|
4587
|
-
superSelectionAppService.markSuperSelectionAsSubmitted();
|
|
1537
|
+
customFundChoice_api.superSelectionAppService.markSuperSelectionAsSubmitted();
|
|
4588
1538
|
}
|
|
4589
1539
|
async handleFundNominationDeclined() {
|
|
4590
1540
|
const detail = this.createSuperFundNominationDetail(this.existingFund);
|
|
4591
1541
|
await this.eventTrackingService.TrackSuperFundNominationDeclinedAsync(detail);
|
|
4592
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
1542
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
4593
1543
|
}
|
|
4594
1544
|
};
|
|
4595
1545
|
|
|
@@ -4602,8 +1552,8 @@ const FooterSection = class {
|
|
|
4602
1552
|
render() {
|
|
4603
1553
|
return (index.h("div", { class: {
|
|
4604
1554
|
'text-center text-gray-500 text-xs w-full max-w-960 mx-auto': true,
|
|
4605
|
-
'mt-8 sm:mt-20': !superSelectionAppService.hideFooterSection
|
|
4606
|
-
} }, !superSelectionAppService.hideFooterSection && index.h("span", null, this.footerText()), index.h("p", { class: "block text-transparent" }, "v", AppVersion)));
|
|
1555
|
+
'mt-8 sm:mt-20': !customFundChoice_api.superSelectionAppService.hideFooterSection
|
|
1556
|
+
} }, !customFundChoice_api.superSelectionAppService.hideFooterSection && index.h("span", null, this.footerText()), index.h("p", { class: "block text-transparent" }, "v", AppVersion)));
|
|
4607
1557
|
}
|
|
4608
1558
|
};
|
|
4609
1559
|
|
|
@@ -4615,15 +1565,15 @@ const RouteLink = (props, children) => {
|
|
|
4615
1565
|
} }, children)));
|
|
4616
1566
|
};
|
|
4617
1567
|
const ChooseAnotherFundLink = (props) => {
|
|
4618
|
-
let route = SuperSelectionAppRoutes.MyOwnFund;
|
|
4619
|
-
if (window.location.href.includes(SuperSelectionAppRoutes.SelfManagedFund)) {
|
|
4620
|
-
route = SuperSelectionAppRoutes.SelfManagedFund;
|
|
1568
|
+
let route = customFundChoice_api.SuperSelectionAppRoutes.MyOwnFund;
|
|
1569
|
+
if (window.location.href.includes(customFundChoice_api.SuperSelectionAppRoutes.SelfManagedFund)) {
|
|
1570
|
+
route = customFundChoice_api.SuperSelectionAppRoutes.SelfManagedFund;
|
|
4621
1571
|
}
|
|
4622
|
-
else if (window.location.href.includes(SuperSelectionAppRoutes.DefaultFund)) {
|
|
4623
|
-
route = SuperSelectionAppRoutes.DefaultFund;
|
|
1572
|
+
else if (window.location.href.includes(customFundChoice_api.SuperSelectionAppRoutes.DefaultFund)) {
|
|
1573
|
+
route = customFundChoice_api.SuperSelectionAppRoutes.DefaultFund;
|
|
4624
1574
|
}
|
|
4625
|
-
else if (window.location.href.includes(SuperSelectionAppRoutes.FeaturedFunds)) {
|
|
4626
|
-
route = SuperSelectionAppRoutes.FeaturedFunds;
|
|
1575
|
+
else if (window.location.href.includes(customFundChoice_api.SuperSelectionAppRoutes.FeaturedFunds)) {
|
|
1576
|
+
route = customFundChoice_api.SuperSelectionAppRoutes.FeaturedFunds;
|
|
4627
1577
|
}
|
|
4628
1578
|
return (index.h(RouteLink, { route: route, isActive: props.isActive }, "Choose another fund"));
|
|
4629
1579
|
};
|
|
@@ -4632,7 +1582,7 @@ const HeaderSection = class {
|
|
|
4632
1582
|
index.registerInstance(this, hostRef);
|
|
4633
1583
|
}
|
|
4634
1584
|
render() {
|
|
4635
|
-
return (index.h("div", { class: "flex justify-center" }, index.h("div", { class: "text-center max-w-800" }, index.h("h3", { class: "font-bold mb-3 sm:mb-4 text-2xl sm:text-3xl" }, "Nominate a super fund"), index.h(index.Fragment, null, index.h("div", { class: "text-gray-600 sm:text-lg leading-7 sm:leading-8" }, superSelectionAppService.superCampaignCanNotBeActivated ? (index.h(index.Fragment, null, "You can choose any super fund, including your current fund/SMSF or your employer\u2019s default fund.")) : (index.h(index.Fragment, null, "You can choose any super fund, including your current fund/SMSF, your employer\u2019s default fund, or alternatively, you can select from one of the featured\u00A0funds."))), !superSelectionAppService.superCampaignCanNotBeActivated && (index.h("div", { class: "inline-flex mt-8 sm:mt-12 bg-primary-base rounded-lg p-0.5 whitespace-normal" }, index.h(RouteLink, { route: SuperSelectionAppRoutes.ChoicePage, isActive: false }, "Featured super funds"), index.h(ChooseAnotherFundLink, { isActive: true })))))));
|
|
1585
|
+
return (index.h("div", { class: "flex justify-center" }, index.h("div", { class: "text-center max-w-800" }, index.h("h3", { class: "font-bold mb-3 sm:mb-4 text-2xl sm:text-3xl" }, "Nominate a super fund"), index.h(index.Fragment, null, index.h("div", { class: "text-gray-600 sm:text-lg leading-7 sm:leading-8" }, customFundChoice_api.superSelectionAppService.superCampaignCanNotBeActivated ? (index.h(index.Fragment, null, "You can choose any super fund, including your current fund/SMSF or your employer\u2019s default fund.")) : (index.h(index.Fragment, null, "You can choose any super fund, including your current fund/SMSF, your employer\u2019s default fund, or alternatively, you can select from one of the featured\u00A0funds."))), !customFundChoice_api.superSelectionAppService.superCampaignCanNotBeActivated && (index.h("div", { class: "inline-flex mt-8 sm:mt-12 bg-primary-base rounded-lg p-0.5 whitespace-normal" }, index.h(RouteLink, { route: customFundChoice_api.SuperSelectionAppRoutes.ChoicePage, isActive: false }, "Featured super funds"), index.h(ChooseAnotherFundLink, { isActive: true })))))));
|
|
4636
1586
|
}
|
|
4637
1587
|
};
|
|
4638
1588
|
|
|
@@ -4656,71 +1606,6 @@ const LoadingPage = class {
|
|
|
4656
1606
|
}
|
|
4657
1607
|
};
|
|
4658
1608
|
|
|
4659
|
-
const MyOwnFund = class {
|
|
4660
|
-
constructor(hostRef) {
|
|
4661
|
-
index.registerInstance(this, hostRef);
|
|
4662
|
-
this.isNotAllInformationProvidedMessageVisible = false;
|
|
4663
|
-
this.isSubmitDisabled = true;
|
|
4664
|
-
this.eventTrackingService = EventTrackingService.Instance;
|
|
4665
|
-
}
|
|
4666
|
-
componentDidLoad() {
|
|
4667
|
-
return this.eventTrackingService.TrackMyOwnSuperFundDetailViewedAsync({
|
|
4668
|
-
promotedFundsShown: superSelectionAppService.promotedFunds,
|
|
4669
|
-
defaultFundUsiSet: toUndefined(superSelectionAppService.defaultFundUsi)
|
|
4670
|
-
});
|
|
4671
|
-
}
|
|
4672
|
-
render() {
|
|
4673
|
-
const superCampaignCanNotBeActivated = superSelectionAppService.superCampaignCanNotBeActivated;
|
|
4674
|
-
return (index.h(index.Host, null, index.h("sss-header-section", null), index.h("div", { class: "flex justify-center mt-11" }, index.h("sss-custom-fund", null, index.h("form", { noValidate: true, onSubmit: (ev) => ev.preventDefault(), class: {
|
|
4675
|
-
'was-validated': this.formState === 'validated'
|
|
4676
|
-
}, ref: (el) => (this.formElement = el), onInput: (_) => (this.isSubmitDisabled = !this.formElement.checkValidity()) }, index.h("div", { class: "p-4 sm:p-6 pb-6 sm:pb-8 border shadow-sm rounded-lg" }, index.h("p", { class: "sm:text-lg font-bold mb-3" }, "Fund details"), index.h("div", { class: "bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-3 sm:mb-4" }, index.h("div", { class: "flex" }, index.h("div", { class: "flex-shrink-0" }, index.h("img", { class: "h-5 w-5", src: index.getAssetPath('assets/icon-exclamation.svg') })), index.h("div", { class: "ml-2" }, index.h("ul", { class: "list-disc list-outside ml-6 space-y-2 text-sm text-yellow-700 leading-5" }, index.h("li", null, "Make sure you are a current member of the fund before completing this step."), index.h("li", null, "Please check that the fund USI is correct as some funds have similar names."))))), index.h("sss-my-own-fund-inputs", { myOwnFundForm: state$1.myOwnFundForm, showValidationErrors: this.formState === 'validated', onFormChanged: (event) => {
|
|
4677
|
-
state$1.myOwnFundForm = Object.assign(Object.assign({}, state$1.myOwnFundForm), event.detail);
|
|
4678
|
-
this.isNotAllInformationProvidedMessageVisible = false;
|
|
4679
|
-
} }), this.isNotAllInformationProvidedMessageVisible && (index.h("div", { class: "mt-4 rounded-md bg-red-50 p-4 text-sm text-red-700" }, "All fields are required to complete submission. Make sure you have selected a fund."))), index.h("div", { class: "flex justify-center mt-8" }, index.h("div", { class: "sm:max-w-320 w-full" }, index.h("div", { class: "mb-4", onClick:
|
|
4680
|
-
// user clicks on disabled button (div wrapper) then validation errors will show
|
|
4681
|
-
() => (this.formState = 'validated') }, index.h("sss-button", { testid: "continue-button", fillWidth: true, promiseFn: () => this.handleSubmitForm(), disabled: this.isSubmitDisabled }, "Continue")), !superCampaignCanNotBeActivated && (index.h("stencil-route-link", { url: SuperSelectionAppRoutes.ChoicePage }, index.h("sss-button", { testid: "back-button", fillWidth: true, variant: "secondary" }, "Back"))))))))));
|
|
4682
|
-
}
|
|
4683
|
-
async handleSubmitForm() {
|
|
4684
|
-
this.formState = 'validated';
|
|
4685
|
-
if (!this.formElement.checkValidity()) {
|
|
4686
|
-
return;
|
|
4687
|
-
}
|
|
4688
|
-
const isAllInformationProvided = isSome(state$1.myOwnFundForm.fundUsi) &&
|
|
4689
|
-
isSome(state$1.myOwnFundForm.memberNumber) &&
|
|
4690
|
-
isSome(state$1.myOwnFundForm.memberFirstName) &&
|
|
4691
|
-
isSome(state$1.myOwnFundForm.memberFamilyName);
|
|
4692
|
-
if (!isAllInformationProvided) {
|
|
4693
|
-
this.isNotAllInformationProvidedMessageVisible = true;
|
|
4694
|
-
return;
|
|
4695
|
-
}
|
|
4696
|
-
if (superSelectionAppService.isBringYourOwnFundCustomStepEnabled &&
|
|
4697
|
-
superSelectionAppService.isUsingSuperCampaign) {
|
|
4698
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.MyOwnFundEngagementStep);
|
|
4699
|
-
return;
|
|
4700
|
-
}
|
|
4701
|
-
navigationService.navigateInternallyToStandardChoice({
|
|
4702
|
-
history: this.history,
|
|
4703
|
-
fundName: this.getOrError(state$1.myOwnFundForm.fundName),
|
|
4704
|
-
fundDetails: {
|
|
4705
|
-
type: 'myOwnFund',
|
|
4706
|
-
fundName: this.getOrError(state$1.myOwnFundForm.fundName),
|
|
4707
|
-
fundUsi: this.getOrError(state$1.myOwnFundForm.fundUsi),
|
|
4708
|
-
memberNumber: this.getOrError(state$1.myOwnFundForm.memberNumber)
|
|
4709
|
-
},
|
|
4710
|
-
handleSubmitFn: async (standardChoiceFormSignature) => {
|
|
4711
|
-
const customFundChoiceDto = Object.assign({ fundUsi: this.getOrError(state$1.myOwnFundForm.fundUsi), memberNumber: this.getOrError(state$1.myOwnFundForm.memberNumber), memberFirstName: this.getOrError(state$1.myOwnFundForm.memberFirstName), memberFamilyName: this.getOrError(state$1.myOwnFundForm.memberFamilyName), standardChoiceFormSignature }, superSelectionAppService.promotedFundsConfig);
|
|
4712
|
-
await customFundChoiceApi.submitCustomFundChoiceAsync(customFundChoiceDto);
|
|
4713
|
-
}
|
|
4714
|
-
});
|
|
4715
|
-
}
|
|
4716
|
-
getOrError(option) {
|
|
4717
|
-
return _function.pipe(option, getOrElse(() => {
|
|
4718
|
-
throw new Error('Option value is none.');
|
|
4719
|
-
}));
|
|
4720
|
-
}
|
|
4721
|
-
};
|
|
4722
|
-
injectHistory(MyOwnFund);
|
|
4723
|
-
|
|
4724
1609
|
const MyOwnFundEngagementStep = class {
|
|
4725
1610
|
constructor(hostRef) {
|
|
4726
1611
|
index.registerInstance(this, hostRef);
|
|
@@ -4745,40 +1630,40 @@ const MyOwnFundEngagementStep = class {
|
|
|
4745
1630
|
};
|
|
4746
1631
|
}
|
|
4747
1632
|
async componentWillLoad() {
|
|
4748
|
-
if (superSelectionAppService.isBringYourOwnFundCustomStepEnabled &&
|
|
4749
|
-
superSelectionAppService.isUsingSuperCampaign &&
|
|
4750
|
-
Option.isSome(state
|
|
4751
|
-
Option.isSome(state
|
|
4752
|
-
Option.isSome(state
|
|
4753
|
-
Option.isSome(state
|
|
4754
|
-
Option.isSome(state
|
|
4755
|
-
Option.isSome(superSelectionAppService.backendUrl) &&
|
|
4756
|
-
Option.isSome(superSelectionAppService.state.jwt)) {
|
|
4757
|
-
this.backendUrl = superSelectionAppService.backendUrl.value;
|
|
4758
|
-
this.accessToken = superSelectionAppService.state.jwt.value;
|
|
4759
|
-
this.fundUsi = state
|
|
4760
|
-
this.fundName = state
|
|
4761
|
-
this.memberNumber = state
|
|
4762
|
-
this.memberFirstName = state
|
|
4763
|
-
this.memberFamilyName = state
|
|
1633
|
+
if (customFundChoice_api.superSelectionAppService.isBringYourOwnFundCustomStepEnabled &&
|
|
1634
|
+
customFundChoice_api.superSelectionAppService.isUsingSuperCampaign &&
|
|
1635
|
+
customFundChoice_api.Option.isSome(state.myOwnFundForm.fundUsi) &&
|
|
1636
|
+
customFundChoice_api.Option.isSome(state.myOwnFundForm.fundName) &&
|
|
1637
|
+
customFundChoice_api.Option.isSome(state.myOwnFundForm.memberNumber) &&
|
|
1638
|
+
customFundChoice_api.Option.isSome(state.myOwnFundForm.memberFirstName) &&
|
|
1639
|
+
customFundChoice_api.Option.isSome(state.myOwnFundForm.memberFamilyName) &&
|
|
1640
|
+
customFundChoice_api.Option.isSome(customFundChoice_api.superSelectionAppService.backendUrl) &&
|
|
1641
|
+
customFundChoice_api.Option.isSome(customFundChoice_api.superSelectionAppService.state.jwt)) {
|
|
1642
|
+
this.backendUrl = customFundChoice_api.superSelectionAppService.backendUrl.value;
|
|
1643
|
+
this.accessToken = customFundChoice_api.superSelectionAppService.state.jwt.value;
|
|
1644
|
+
this.fundUsi = state.myOwnFundForm.fundUsi.value;
|
|
1645
|
+
this.fundName = state.myOwnFundForm.fundName.value;
|
|
1646
|
+
this.memberNumber = state.myOwnFundForm.memberNumber.value;
|
|
1647
|
+
this.memberFirstName = state.myOwnFundForm.memberFirstName.value;
|
|
1648
|
+
this.memberFamilyName = state.myOwnFundForm.memberFamilyName.value;
|
|
4764
1649
|
this.unSubscribeFromStepEvents();
|
|
4765
1650
|
this.subscribeToStepEvents();
|
|
4766
|
-
superSelectionAppService.hideFooterSection = true;
|
|
1651
|
+
customFundChoice_api.superSelectionAppService.hideFooterSection = true;
|
|
4767
1652
|
await EventTrackingService.Instance.TrackSuperMyOwnFundEngagementStepActivationSucceeded(this.fundUsi);
|
|
4768
1653
|
}
|
|
4769
1654
|
else {
|
|
4770
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.MyOwnFund);
|
|
1655
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.MyOwnFund);
|
|
4771
1656
|
}
|
|
4772
1657
|
}
|
|
4773
1658
|
disconnectedCallback() {
|
|
4774
1659
|
this.unSubscribeFromStepEvents();
|
|
4775
|
-
superSelectionAppService.hideFooterSection = false;
|
|
1660
|
+
customFundChoice_api.superSelectionAppService.hideFooterSection = false;
|
|
4776
1661
|
}
|
|
4777
1662
|
render() {
|
|
4778
1663
|
return (index.h(index.Host, null, index.h("apollo-super-byof-engagement", { "backend-url": this.backendUrl, "access-token": this.accessToken, "fund-usi": this.fundUsi })));
|
|
4779
1664
|
}
|
|
4780
1665
|
navigateToStandardChoice() {
|
|
4781
|
-
navigationService.navigateInternallyToStandardChoice({
|
|
1666
|
+
customFundChoice_api.navigationService.navigateInternallyToStandardChoice({
|
|
4782
1667
|
history: this.history,
|
|
4783
1668
|
fundName: this.fundName,
|
|
4784
1669
|
fundDetails: {
|
|
@@ -4788,67 +1673,13 @@ const MyOwnFundEngagementStep = class {
|
|
|
4788
1673
|
memberNumber: this.memberNumber
|
|
4789
1674
|
},
|
|
4790
1675
|
handleSubmitFn: async (standardChoiceFormSignature) => {
|
|
4791
|
-
const customFundChoiceDto = Object.assign({ fundUsi: this.fundUsi, memberNumber: this.memberNumber, memberFirstName: this.memberFirstName, memberFamilyName: this.memberFamilyName, standardChoiceFormSignature }, superSelectionAppService.promotedFundsConfig);
|
|
4792
|
-
await customFundChoiceApi.submitCustomFundChoiceAsync(customFundChoiceDto);
|
|
1676
|
+
const customFundChoiceDto = Object.assign({ fundUsi: this.fundUsi, memberNumber: this.memberNumber, memberFirstName: this.memberFirstName, memberFamilyName: this.memberFamilyName, standardChoiceFormSignature }, customFundChoice_api.superSelectionAppService.promotedFundsConfig);
|
|
1677
|
+
await customFundChoice_api.customFundChoiceApi.submitCustomFundChoiceAsync(customFundChoiceDto);
|
|
4793
1678
|
}
|
|
4794
1679
|
});
|
|
4795
1680
|
}
|
|
4796
1681
|
};
|
|
4797
|
-
injectHistory(MyOwnFundEngagementStep);
|
|
4798
|
-
|
|
4799
|
-
const MyOwnFundInputs = class {
|
|
4800
|
-
constructor(hostRef) {
|
|
4801
|
-
index.registerInstance(this, hostRef);
|
|
4802
|
-
this.formChanged = index.createEvent(this, "formChanged", 7);
|
|
4803
|
-
this.MIN_SEARCH_STRING_LENGTH = 3;
|
|
4804
|
-
this.MAX_RECORD_COUNT = 25;
|
|
4805
|
-
this.searchFundsAsync = async (searchBy) => {
|
|
4806
|
-
const response = await australianFundLookupService.searchFundsAsync(searchBy, this.MAX_RECORD_COUNT);
|
|
4807
|
-
switch (response.result) {
|
|
4808
|
-
case 'TooManyResults': {
|
|
4809
|
-
return { kind: 'too-many-results' };
|
|
4810
|
-
}
|
|
4811
|
-
default: {
|
|
4812
|
-
const funds = response.data
|
|
4813
|
-
.sort((a, b) => a.productName.localeCompare(b.productName))
|
|
4814
|
-
.map((fund) => ({
|
|
4815
|
-
label: `${fund.productName} (${fund.usi})`,
|
|
4816
|
-
value: fund.usi
|
|
4817
|
-
}));
|
|
4818
|
-
return { kind: 'success', value: funds };
|
|
4819
|
-
}
|
|
4820
|
-
}
|
|
4821
|
-
};
|
|
4822
|
-
if (isSome(this.myOwnFundForm.fundUsi) && isSome(this.myOwnFundForm.fundName)) {
|
|
4823
|
-
this.selectedOption = {
|
|
4824
|
-
label: this.myOwnFundForm.fundName.value,
|
|
4825
|
-
value: this.myOwnFundForm.fundUsi.value
|
|
4826
|
-
};
|
|
4827
|
-
}
|
|
4828
|
-
}
|
|
4829
|
-
render() {
|
|
4830
|
-
return (index.h("div", null, index.h("div", null, index.h("label", { class: "text-sm font-medium text-gray-700" }, "Fund name"), index.h("div", { class: "mt-1" }, index.h("sss-dropdown-async", { testId: "fund-search-input", searchFunction: this.searchFundsAsync, minSearchStringLength: this.MIN_SEARCH_STRING_LENGTH, required: true, requiredValidationMessage: "Select a fund", placeholder: `Type to search by name or USI...`, value: this.selectedOption, onValueChanged: (ev) => {
|
|
4831
|
-
this.selectedOption = ev.detail;
|
|
4832
|
-
this.updateFund(ev.detail);
|
|
4833
|
-
}, showValidationErrors: this.showValidationErrors })), isSome(this.myOwnFundForm.fundUsi) && (index.h("div", { class: "mt-3" }, index.h("label", { class: "text-sm font-medium text-gray-700" }, "Fund USI"), index.h("div", { class: "mt-1 shadow-sm px-3 py-2 rounded-md border border-gray-300 bg-gray-50 text-gray-500 text-base sm:text-sm" }, this.myOwnFundForm.fundUsi.value)))), index.h("div", { class: "mt-3" }, index.h("label", { class: "text-sm font-medium text-gray-700" }, "Member number"), index.h("div", { class: "mt-1" }, index.h("input", { "data-testid": "member-number-input", type: "text", class: {
|
|
4834
|
-
'shadow-sm focus:ring-primary-focus focus:border-primary-base block w-full text-base sm:text-sm border-gray-300 rounded-md': true,
|
|
4835
|
-
'invalid:border-red-300 invalid:text-red-900 invalid:focus:ring-red-500 invalid:focus:border-red-500': this
|
|
4836
|
-
.showValidationErrors
|
|
4837
|
-
}, required: true, pattern: "[A-Za-z0-9]{4,16}", name: "memberNumber", id: "memberNumber", value: toUndefined(state$1.myOwnFundForm.memberNumber), onChange: (ev) => this.updateMemberNumber(ev.target.value.trim()) }), index.h("div", { class: "invalid-feedback mt-2 text-sm text-red-600" }, "Enter a valid member number (only numbers and / or letters)"))), index.h("div", { class: "flex space-x-4" }, index.h("div", { class: "mt-3 w-1/2" }, index.h("label", { class: "text-sm font-medium text-gray-700" }, "Given name(s)"), index.h("div", { class: "mt-1" }, index.h("sss-name-input", { testId: "member-given-names-input", name: "memberFirstName", readableName: "Member given name(s)", showValidationErrors: this.showValidationErrors, value: toUndefined(state$1.myOwnFundForm.memberFirstName), onChange: (ev) => this.updateMemberFirstName(ev.target.value.trim()) }))), index.h("div", { class: "mt-3 w-1/2" }, index.h("label", { class: "text-sm font-medium text-gray-700" }, "Last name"), index.h("div", { class: "mt-1" }, index.h("sss-name-input", { testId: "member-last-name-input", name: "memberFamilyName", readableName: "Member last name", showValidationErrors: this.showValidationErrors, value: toUndefined(state$1.myOwnFundForm.memberFamilyName), onChange: (ev) => this.updateMemberFamilyName(ev.target.value.trim()) }))))));
|
|
4838
|
-
}
|
|
4839
|
-
updateFund(fund) {
|
|
4840
|
-
this.formChanged.emit({ fundUsi: some(fund.value), fundName: some(fund.label) });
|
|
4841
|
-
}
|
|
4842
|
-
updateMemberNumber(memberNumber) {
|
|
4843
|
-
this.formChanged.emit({ memberNumber: some(memberNumber) });
|
|
4844
|
-
}
|
|
4845
|
-
updateMemberFirstName(memberFirstName) {
|
|
4846
|
-
this.formChanged.emit({ memberFirstName: some(memberFirstName) });
|
|
4847
|
-
}
|
|
4848
|
-
updateMemberFamilyName(memberFamilyName) {
|
|
4849
|
-
this.formChanged.emit({ memberFamilyName: some(memberFamilyName) });
|
|
4850
|
-
}
|
|
4851
|
-
};
|
|
1682
|
+
customFundChoice_api.injectHistory(MyOwnFundEngagementStep);
|
|
4852
1683
|
|
|
4853
1684
|
const MemberNameInput = class {
|
|
4854
1685
|
constructor(hostRef) {
|
|
@@ -4915,8 +1746,8 @@ const Prefill = class {
|
|
|
4915
1746
|
window.removeEventListener('popstate', this.ignorePopState);
|
|
4916
1747
|
}
|
|
4917
1748
|
async componentWillLoad() {
|
|
4918
|
-
this.prefill = isSome(superSelectionAppService.state.superChoicePrefill)
|
|
4919
|
-
? superSelectionAppService.state.superChoicePrefill.value
|
|
1749
|
+
this.prefill = customFundChoice_api.isSome(customFundChoice_api.superSelectionAppService.state.superChoicePrefill)
|
|
1750
|
+
? customFundChoice_api.superSelectionAppService.state.superChoicePrefill.value
|
|
4920
1751
|
: undefined;
|
|
4921
1752
|
}
|
|
4922
1753
|
render() {
|
|
@@ -4936,7 +1767,7 @@ const Prefill = class {
|
|
|
4936
1767
|
return this.renderInvalidSMSF(this.prefill.data);
|
|
4937
1768
|
}
|
|
4938
1769
|
}
|
|
4939
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
1770
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
4940
1771
|
return null;
|
|
4941
1772
|
}
|
|
4942
1773
|
renderMyOwnFund(data) {
|
|
@@ -5332,7 +2163,7 @@ const PrefillInvalidMyOwnFund = class {
|
|
|
5332
2163
|
else {
|
|
5333
2164
|
// If prefill does not exist, or is valid we should
|
|
5334
2165
|
// not have landed on this page, navigate to choice page
|
|
5335
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
2166
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
5336
2167
|
}
|
|
5337
2168
|
}
|
|
5338
2169
|
render() {
|
|
@@ -5343,7 +2174,7 @@ const PrefillInvalidMyOwnFund = class {
|
|
|
5343
2174
|
async handleChooseAnotherFund() {
|
|
5344
2175
|
const detail = this.createSuperFundPrefillDeclinedDetail(this.prefill);
|
|
5345
2176
|
await this.eventTrackingService.TrackSuperFundPrefillDeclinedAsync(detail);
|
|
5346
|
-
return navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
2177
|
+
return customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
5347
2178
|
}
|
|
5348
2179
|
};
|
|
5349
2180
|
|
|
@@ -5379,7 +2210,7 @@ const PrefillInvalidSMSF = class {
|
|
|
5379
2210
|
else {
|
|
5380
2211
|
// If prefill does not exist, or is valid we should
|
|
5381
2212
|
// not have landed on this page, navigate to PrefillInvalidMyOwnFundPage page
|
|
5382
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.PrefillInvalidMyOwnFundPage);
|
|
2213
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.PrefillInvalidMyOwnFundPage);
|
|
5383
2214
|
}
|
|
5384
2215
|
}
|
|
5385
2216
|
render() {
|
|
@@ -5406,7 +2237,7 @@ const PrefillInvalidSMSF = class {
|
|
|
5406
2237
|
async handleFundNominationDeclined() {
|
|
5407
2238
|
const detail = this.createSuperFundPrefillDeclinedDetail(this.prefill);
|
|
5408
2239
|
await this.eventTrackingService.TrackSuperFundPrefillDeclinedAsync(detail);
|
|
5409
|
-
return navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
2240
|
+
return customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
5410
2241
|
}
|
|
5411
2242
|
};
|
|
5412
2243
|
|
|
@@ -5447,7 +2278,7 @@ const PrefillMyOwnFund = class {
|
|
|
5447
2278
|
else {
|
|
5448
2279
|
// If prefill does not exist, or is invalid we should
|
|
5449
2280
|
// not have landed on this page, navigate to choice page
|
|
5450
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
2281
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
5451
2282
|
}
|
|
5452
2283
|
}
|
|
5453
2284
|
render() {
|
|
@@ -5510,7 +2341,7 @@ const PrefillMyOwnFund = class {
|
|
|
5510
2341
|
if (this.mode === 'edit' && !this.formElement.checkValidity()) {
|
|
5511
2342
|
return;
|
|
5512
2343
|
}
|
|
5513
|
-
navigationService.navigateInternallyToStandardChoice({
|
|
2344
|
+
customFundChoice_api.navigationService.navigateInternallyToStandardChoice({
|
|
5514
2345
|
history: this.history,
|
|
5515
2346
|
fundName: this.fundName.value,
|
|
5516
2347
|
fundDetails: {
|
|
@@ -5520,15 +2351,15 @@ const PrefillMyOwnFund = class {
|
|
|
5520
2351
|
memberNumber: this.memberNumber.value
|
|
5521
2352
|
},
|
|
5522
2353
|
handleSubmitFn: async (standardChoiceFormSignature) => {
|
|
5523
|
-
const customFundChoiceDto = Object.assign({ fundUsi: this.fundUsi.value, memberNumber: this.memberNumber.value, memberFirstName: this.memberGivenNames.value, memberFamilyName: this.memberLastName.value, standardChoiceFormSignature }, superSelectionAppService.promotedFundsConfig);
|
|
5524
|
-
await customFundChoiceApi.submitCustomFundChoiceAsync(customFundChoiceDto);
|
|
2354
|
+
const customFundChoiceDto = Object.assign({ fundUsi: this.fundUsi.value, memberNumber: this.memberNumber.value, memberFirstName: this.memberGivenNames.value, memberFamilyName: this.memberLastName.value, standardChoiceFormSignature }, customFundChoice_api.superSelectionAppService.promotedFundsConfig);
|
|
2355
|
+
await customFundChoice_api.customFundChoiceApi.submitCustomFundChoiceAsync(customFundChoiceDto);
|
|
5525
2356
|
}
|
|
5526
2357
|
});
|
|
5527
2358
|
}
|
|
5528
2359
|
async handleFundNominationDeclined() {
|
|
5529
2360
|
const detail = this.createSuperFundPrefillDeclinedDetail(this.prefill);
|
|
5530
2361
|
await this.eventTrackingService.TrackSuperFundPrefillDeclinedAsync(detail);
|
|
5531
|
-
return navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
2362
|
+
return customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
5532
2363
|
}
|
|
5533
2364
|
};
|
|
5534
2365
|
|
|
@@ -5679,7 +2510,7 @@ const PrefillSMSF = class {
|
|
|
5679
2510
|
else {
|
|
5680
2511
|
// If prefill does not exist, or is invalid we should
|
|
5681
2512
|
// not have landed on this page, navigate to PrefillInvalidSMSFPage page
|
|
5682
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.PrefillInvalidSMSFPage);
|
|
2513
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.PrefillInvalidSMSFPage);
|
|
5683
2514
|
}
|
|
5684
2515
|
}
|
|
5685
2516
|
render() {
|
|
@@ -5831,7 +2662,7 @@ const PrefillSMSF = class {
|
|
|
5831
2662
|
if (this.mode === 'edit' && !this.formElement.checkValidity()) {
|
|
5832
2663
|
return;
|
|
5833
2664
|
}
|
|
5834
|
-
navigationService.navigateInternallyToStandardChoice({
|
|
2665
|
+
customFundChoice_api.navigationService.navigateInternallyToStandardChoice({
|
|
5835
2666
|
history: this.history,
|
|
5836
2667
|
fundName: 'Self-managed super fund',
|
|
5837
2668
|
fundDetails: {
|
|
@@ -5858,8 +2689,8 @@ const PrefillSMSF = class {
|
|
|
5858
2689
|
electronicServiceAddress: this.fundEsa.value,
|
|
5859
2690
|
memberFirstName: this.memberGivenNames.value,
|
|
5860
2691
|
memberFamilyName: this.memberLastName.value
|
|
5861
|
-
}, standardChoiceFormSignature }, superSelectionAppService.promotedFundsConfig);
|
|
5862
|
-
await customFundChoiceApi.submitSelfManagedFundChoiceAsync(smsfChoiceDto);
|
|
2692
|
+
}, standardChoiceFormSignature }, customFundChoice_api.superSelectionAppService.promotedFundsConfig);
|
|
2693
|
+
await customFundChoice_api.customFundChoiceApi.submitSelfManagedFundChoiceAsync(smsfChoiceDto);
|
|
5863
2694
|
}
|
|
5864
2695
|
});
|
|
5865
2696
|
}
|
|
@@ -5885,7 +2716,7 @@ const PrefillSMSF = class {
|
|
|
5885
2716
|
async handleFundNominationDeclined() {
|
|
5886
2717
|
const detail = this.createSuperFundPrefillDeclinedDetail(this.prefill);
|
|
5887
2718
|
await this.eventTrackingService.TrackSuperFundPrefillDeclinedAsync(detail);
|
|
5888
|
-
return navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
2719
|
+
return customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
5889
2720
|
}
|
|
5890
2721
|
};
|
|
5891
2722
|
|
|
@@ -5917,9 +2748,9 @@ const StandardChoiceFormInputDefaultFund = class {
|
|
|
5917
2748
|
window.removeEventListener('popstate', this.ignorePopState);
|
|
5918
2749
|
}
|
|
5919
2750
|
render() {
|
|
5920
|
-
return (index.h(index.Host, null, index.h("div", { class: "text-2xl sm:text-3xl font-bold text-center" }, "Confirm your super choice"), index.h("div", { class: "sm:text-lg text-gray-600 max-w-800 mt-4 text-center leading-7 sm:leading-8" }, "Your authorisation is required to complete your super choice by signing the standard choice form, which informs your employer of your choice of fund."), index.h("div", { class: "flex justify-center mt-8 sm:mt-12" }, index.h("div", { class: "max-w-560" }, index.h("div", { class: "p-4 sm:p-6 border shadow-sm rounded-lg flex flex-col sm:flex-row" }, this.renderLogo(), index.h("div", { class: "flex justify-between w-full" }, index.h("div", null, index.h("div", { class: "text-xs font-semibold text-gray-500 uppercase" }, "Nominated fund"), index.h("div", { class: "text-sm mt-2" }, state.fundName)), index.h("div", { class: "grid content-center ml-4" }, index.h("sss-button", { testid: "change-fund-button", size: "xs", variant: "secondary", promiseFn: async () => {
|
|
2751
|
+
return (index.h(index.Host, null, index.h("div", { class: "text-2xl sm:text-3xl font-bold text-center" }, "Confirm your super choice"), index.h("div", { class: "sm:text-lg text-gray-600 max-w-800 mt-4 text-center leading-7 sm:leading-8" }, "Your authorisation is required to complete your super choice by signing the standard choice form, which informs your employer of your choice of fund."), index.h("div", { class: "flex justify-center mt-8 sm:mt-12" }, index.h("div", { class: "max-w-560" }, index.h("div", { class: "p-4 sm:p-6 border shadow-sm rounded-lg flex flex-col sm:flex-row" }, this.renderLogo(), index.h("div", { class: "flex justify-between w-full" }, index.h("div", null, index.h("div", { class: "text-xs font-semibold text-gray-500 uppercase" }, "Nominated fund"), index.h("div", { class: "text-sm mt-2" }, customFundChoice_api.state.fundName)), index.h("div", { class: "grid content-center ml-4" }, index.h("sss-button", { testid: "change-fund-button", size: "xs", variant: "secondary", promiseFn: async () => {
|
|
5921
2752
|
await this.trackChangeRequestedAsync();
|
|
5922
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
2753
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
5923
2754
|
} }, "Change")))), index.h("div", { class: "mt-4 p-4 sm:p-6 border shadow-sm rounded-lg" }, index.h("div", { class: "sm:text-lg font-bold" }, "Superannuation Standard Choice Form"), index.h("div", { class: "bg-blue-50 border-l-4 border-blue-400 p-4 mt-3" }, index.h("div", { class: "flex" }, index.h("div", { class: "flex-shrink-0" }, index.h("img", { class: "h-5 w-5", src: index.getAssetPath('assets/icon-information-circle.svg') })), index.h("div", { class: "ml-2" }, index.h("p", { class: "text-sm text-blue-800 leading-5" }, "Applying your full name in the text field below is the same as applying your written signature and is legally binding.")))), index.h("form", { noValidate: true, onSubmit: (ev) => ev.preventDefault(), class: {
|
|
5924
2755
|
'mt-3': true,
|
|
5925
2756
|
'was-validated': this.formState === 'validated'
|
|
@@ -5947,38 +2778,38 @@ const StandardChoiceFormInputDefaultFund = class {
|
|
|
5947
2778
|
}
|
|
5948
2779
|
async trackChangeRequestedAsync() {
|
|
5949
2780
|
const common = {
|
|
5950
|
-
promotedFundsShown: superSelectionAppService.promotedFunds,
|
|
5951
|
-
defaultFundUsiSet: toUndefined(superSelectionAppService.defaultFundUsi)
|
|
2781
|
+
promotedFundsShown: customFundChoice_api.superSelectionAppService.promotedFunds,
|
|
2782
|
+
defaultFundUsiSet: customFundChoice_api.toUndefined(customFundChoice_api.superSelectionAppService.defaultFundUsi)
|
|
5952
2783
|
};
|
|
5953
|
-
switch (state.fundDetails.type) {
|
|
2784
|
+
switch (customFundChoice_api.state.fundDetails.type) {
|
|
5954
2785
|
case 'default':
|
|
5955
2786
|
await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
|
|
5956
|
-
DefaultFund: Object.assign(Object.assign({}, state.fundDetails), common)
|
|
2787
|
+
DefaultFund: Object.assign(Object.assign({}, customFundChoice_api.state.fundDetails), common)
|
|
5957
2788
|
});
|
|
5958
2789
|
break;
|
|
5959
2790
|
case 'myOwnFund':
|
|
5960
2791
|
await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
|
|
5961
|
-
MyOwnFund: Object.assign(Object.assign({}, state.fundDetails), common)
|
|
2792
|
+
MyOwnFund: Object.assign(Object.assign({}, customFundChoice_api.state.fundDetails), common)
|
|
5962
2793
|
});
|
|
5963
2794
|
break;
|
|
5964
2795
|
case 'smsf':
|
|
5965
2796
|
await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
|
|
5966
|
-
Smsf: Object.assign(Object.assign({}, state.fundDetails), common)
|
|
2797
|
+
Smsf: Object.assign(Object.assign({}, customFundChoice_api.state.fundDetails), common)
|
|
5967
2798
|
});
|
|
5968
2799
|
break;
|
|
5969
2800
|
case 'promoted':
|
|
5970
2801
|
await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
|
|
5971
|
-
PromotedFund: Object.assign(Object.assign({}, state.fundDetails), common)
|
|
2802
|
+
PromotedFund: Object.assign(Object.assign({}, customFundChoice_api.state.fundDetails), common)
|
|
5972
2803
|
});
|
|
5973
2804
|
break;
|
|
5974
2805
|
case 'promotedDefault':
|
|
5975
2806
|
await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
|
|
5976
|
-
PromotedDefaultFund: Object.assign(Object.assign({}, state.fundDetails), common)
|
|
2807
|
+
PromotedDefaultFund: Object.assign(Object.assign({}, customFundChoice_api.state.fundDetails), common)
|
|
5977
2808
|
});
|
|
5978
2809
|
break;
|
|
5979
2810
|
case 'promotedDefaultWithJoin':
|
|
5980
2811
|
await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
|
|
5981
|
-
PromotedDefaultFundWithJoin: Object.assign(Object.assign({}, state.fundDetails), common)
|
|
2812
|
+
PromotedDefaultFundWithJoin: Object.assign(Object.assign({}, customFundChoice_api.state.fundDetails), common)
|
|
5982
2813
|
});
|
|
5983
2814
|
break;
|
|
5984
2815
|
case 'null':
|
|
@@ -5988,8 +2819,8 @@ const StandardChoiceFormInputDefaultFund = class {
|
|
|
5988
2819
|
async handleSubmitForm() {
|
|
5989
2820
|
this.formState = 'validated';
|
|
5990
2821
|
if (this.formElement.checkValidity()) {
|
|
5991
|
-
await state.handleSubmitFn(this.standardChoiceFormSignature.trim());
|
|
5992
|
-
superSelectionAppService.markSuperSelectionAsSubmitted();
|
|
2822
|
+
await customFundChoice_api.state.handleSubmitFn(this.standardChoiceFormSignature.trim());
|
|
2823
|
+
customFundChoice_api.superSelectionAppService.markSuperSelectionAsSubmitted();
|
|
5993
2824
|
}
|
|
5994
2825
|
}
|
|
5995
2826
|
};
|
|
@@ -6013,26 +2844,26 @@ const Success = class {
|
|
|
6013
2844
|
return (index.h(index.Host, { class: "text-center" }, index.h("div", { class: "flex justify-center" }, index.h("div", { class: "relative" }, index.h("div", { class: "h-20 w-20 rounded-full bg-primary-base opacity-10" }), index.h("div", { class: "h-8 w-8 absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2" }, index.h(CheckIcon, null)))), index.h("h3", { class: "text-2xl leading-8 font-bold mt-4" }, "Your super choice has been submitted"), index.h("p", { class: "mt-4 text-center text-gray-600 leading-7 max-w-560 mx-auto" }, "Your superannuation details have been updated successfully and will be submitted to your employer."), index.h("div", { class: "flex justify-center mt-8" }, index.h("div", { class: "max-w-[200px] w-full" }, index.h("sss-button", { testid: "continue-button", size: "xl", fillWidth: true, onClick: this.handleContinueButtonClick }, index.h("span", null, "Continue"))))));
|
|
6014
2845
|
}
|
|
6015
2846
|
handleContinueButtonClick(_event) {
|
|
6016
|
-
superSelectionAppService.completeSuperSelectionFlow();
|
|
2847
|
+
customFundChoice_api.superSelectionAppService.completeSuperSelectionFlow();
|
|
6017
2848
|
}
|
|
6018
2849
|
};
|
|
6019
2850
|
|
|
6020
2851
|
class MiscService {
|
|
6021
2852
|
trackClickPromotedTileAsync(payload) {
|
|
6022
|
-
return superSelectionApi.clickPromotedTileAsync(payload);
|
|
2853
|
+
return customFundChoice_api.superSelectionApi.clickPromotedTileAsync(payload);
|
|
6023
2854
|
}
|
|
6024
2855
|
}
|
|
6025
2856
|
const miscService = new MiscService();
|
|
6026
2857
|
|
|
6027
2858
|
const getSuperCampaignState = () => {
|
|
6028
|
-
if (superSelectionAppService.superCampaignState != undefined)
|
|
6029
|
-
return superSelectionAppService.superCampaignState;
|
|
2859
|
+
if (customFundChoice_api.superSelectionAppService.superCampaignState != undefined)
|
|
2860
|
+
return customFundChoice_api.superSelectionAppService.superCampaignState;
|
|
6030
2861
|
throw new Error('Super campaign state has not been initialized');
|
|
6031
2862
|
};
|
|
6032
2863
|
const fundTileClicked = async ({ sender, placementId, fundId, fundUsi, fundName, fundType }) => {
|
|
6033
2864
|
if (sender === 'super-campaign' || sender === 'featured-funds') {
|
|
6034
2865
|
const promotedFundsShown = getSuperCampaignState().PromotedFundIds;
|
|
6035
|
-
const defaultFundUsiSet = Option.toUndefined(superSelectionAppService.defaultFundUsi);
|
|
2866
|
+
const defaultFundUsiSet = customFundChoice_api.Option.toUndefined(customFundChoice_api.superSelectionAppService.defaultFundUsi);
|
|
6036
2867
|
await Promise.all([
|
|
6037
2868
|
fundType === 'promoted-default'
|
|
6038
2869
|
? await EventTrackingService.Instance.TrackPromotedDefaultSuperFundDetailViewedAsync({
|
|
@@ -15653,10 +12484,10 @@ class ReactNativeInteropMode {
|
|
|
15653
12484
|
function createInitialState() {
|
|
15654
12485
|
return {
|
|
15655
12486
|
authenticationState: AuthenticationState.Unauthorized,
|
|
15656
|
-
jwt: none,
|
|
15657
|
-
reactNativeInterop: none,
|
|
15658
|
-
iframeInterop: none,
|
|
15659
|
-
appConfiguration: none,
|
|
12487
|
+
jwt: customFundChoice_api.none,
|
|
12488
|
+
reactNativeInterop: customFundChoice_api.none,
|
|
12489
|
+
iframeInterop: customFundChoice_api.none,
|
|
12490
|
+
appConfiguration: customFundChoice_api.none,
|
|
15660
12491
|
ignoreExistingSelection: false
|
|
15661
12492
|
};
|
|
15662
12493
|
}
|
|
@@ -15678,7 +12509,7 @@ class AppConfigurationQuery extends datoramaAkita.Query {
|
|
|
15678
12509
|
}
|
|
15679
12510
|
get configuration() {
|
|
15680
12511
|
const configuration = this.getValue().appConfiguration;
|
|
15681
|
-
if (isNone(configuration)) {
|
|
12512
|
+
if (customFundChoice_api.isNone(configuration)) {
|
|
15682
12513
|
throw Error('App configuration is not yet loaded');
|
|
15683
12514
|
}
|
|
15684
12515
|
return configuration.value;
|
|
@@ -15730,7 +12561,7 @@ const appInsights = new AppInsightsService();
|
|
|
15730
12561
|
|
|
15731
12562
|
class PromotedFundChoiceApi {
|
|
15732
12563
|
async submitChoiceAsync(dto) {
|
|
15733
|
-
return buildBackendApiClient()
|
|
12564
|
+
return customFundChoice_api.buildBackendApiClient()
|
|
15734
12565
|
.url('super-choice/promoted-fund')
|
|
15735
12566
|
.post(dto)
|
|
15736
12567
|
.badRequest(() => {
|
|
@@ -15739,7 +12570,7 @@ class PromotedFundChoiceApi {
|
|
|
15739
12570
|
.text();
|
|
15740
12571
|
}
|
|
15741
12572
|
async submitDefaultChoiceAsync(dto) {
|
|
15742
|
-
return buildBackendApiClient()
|
|
12573
|
+
return customFundChoice_api.buildBackendApiClient()
|
|
15743
12574
|
.url('super-choice/promoted-fund/default')
|
|
15744
12575
|
.post(dto)
|
|
15745
12576
|
.badRequest(() => {
|
|
@@ -15748,7 +12579,7 @@ class PromotedFundChoiceApi {
|
|
|
15748
12579
|
.text();
|
|
15749
12580
|
}
|
|
15750
12581
|
async submitDefaultChoiceWithJoinAsync(dto) {
|
|
15751
|
-
return buildBackendApiClient()
|
|
12582
|
+
return customFundChoice_api.buildBackendApiClient()
|
|
15752
12583
|
.url('super-choice/promoted-fund/default-with-join')
|
|
15753
12584
|
.post(dto)
|
|
15754
12585
|
.badRequest(() => {
|
|
@@ -15761,7 +12592,7 @@ const promotedFundChoiceApi = new PromotedFundChoiceApi();
|
|
|
15761
12592
|
|
|
15762
12593
|
class SlateChoiceApi {
|
|
15763
12594
|
async submitSlateChoiceAsync(dto) {
|
|
15764
|
-
return buildBackendApiClient()
|
|
12595
|
+
return customFundChoice_api.buildBackendApiClient()
|
|
15765
12596
|
.url('super-choice/slate')
|
|
15766
12597
|
.post(dto)
|
|
15767
12598
|
.badRequest(() => {
|
|
@@ -15810,8 +12641,8 @@ class PromotedFundJoinedEventHandler {
|
|
|
15810
12641
|
return;
|
|
15811
12642
|
}
|
|
15812
12643
|
const usi = Usi.clean(data.usi);
|
|
15813
|
-
const defaultFundUsiSet = Option.toUndefined(superSelectionAppService.defaultFundUsi);
|
|
15814
|
-
navigationService.navigateInternallyToStandardChoice({
|
|
12644
|
+
const defaultFundUsiSet = customFundChoice_api.Option.toUndefined(customFundChoice_api.superSelectionAppService.defaultFundUsi);
|
|
12645
|
+
customFundChoice_api.navigationService.navigateInternallyToStandardChoice({
|
|
15815
12646
|
history: this.history,
|
|
15816
12647
|
fundName: data.fundName,
|
|
15817
12648
|
promotedFundId: data.fundId,
|
|
@@ -15823,7 +12654,7 @@ class PromotedFundJoinedEventHandler {
|
|
|
15823
12654
|
promotedFundId: data.fundId
|
|
15824
12655
|
},
|
|
15825
12656
|
handleSubmitFn: async (standardChoiceFormSignature) => {
|
|
15826
|
-
if (data.fundId === slate.fundId) {
|
|
12657
|
+
if (data.fundId === customFundChoice_api.slate.fundId) {
|
|
15827
12658
|
await slateChoiceApi.submitSlateChoiceAsync(Object.assign({ memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, standardChoiceFormSignature,
|
|
15828
12659
|
defaultFundUsiSet, placementId: this.placementId }, this.PromotedFundsConfig));
|
|
15829
12660
|
}
|
|
@@ -15841,7 +12672,7 @@ class PromotedFundJoinedEventHandler {
|
|
|
15841
12672
|
return;
|
|
15842
12673
|
}
|
|
15843
12674
|
const usi = Usi.clean(data.usi);
|
|
15844
|
-
navigationService.navigateInternallyToStandardChoice({
|
|
12675
|
+
customFundChoice_api.navigationService.navigateInternallyToStandardChoice({
|
|
15845
12676
|
history: this.history,
|
|
15846
12677
|
fundName: data.fundName,
|
|
15847
12678
|
promotedFundId: data.fundId,
|
|
@@ -15852,7 +12683,7 @@ class PromotedFundJoinedEventHandler {
|
|
|
15852
12683
|
promotedFundId: data.fundId
|
|
15853
12684
|
},
|
|
15854
12685
|
handleSubmitFn: (standardChoiceFormSignature) => promotedFundChoiceApi.submitDefaultChoiceAsync(Object.assign({ fundId: data.fundId, usi,
|
|
15855
|
-
standardChoiceFormSignature, defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi), placementId: this.placementId }, this.PromotedFundsConfig))
|
|
12686
|
+
standardChoiceFormSignature, defaultFundUsiSet: customFundChoice_api.Option.toUndefined(customFundChoice_api.superSelectionAppService.defaultFundUsi), placementId: this.placementId }, this.PromotedFundsConfig))
|
|
15856
12687
|
});
|
|
15857
12688
|
};
|
|
15858
12689
|
this.handlePromotedDefaultFundWithJoinWasJoined = (data) => {
|
|
@@ -15861,7 +12692,7 @@ class PromotedFundJoinedEventHandler {
|
|
|
15861
12692
|
return;
|
|
15862
12693
|
}
|
|
15863
12694
|
const usi = Usi.clean(data.usi);
|
|
15864
|
-
navigationService.navigateInternallyToStandardChoice({
|
|
12695
|
+
customFundChoice_api.navigationService.navigateInternallyToStandardChoice({
|
|
15865
12696
|
history: this.history,
|
|
15866
12697
|
fundName: data.fundName,
|
|
15867
12698
|
promotedFundId: data.fundId,
|
|
@@ -15873,7 +12704,7 @@ class PromotedFundJoinedEventHandler {
|
|
|
15873
12704
|
promotedFundId: data.fundId
|
|
15874
12705
|
},
|
|
15875
12706
|
handleSubmitFn: (standardChoiceFormSignature) => promotedFundChoiceApi.submitDefaultChoiceWithJoinAsync(Object.assign({ fundId: data.fundId, memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, usi,
|
|
15876
|
-
standardChoiceFormSignature, defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi), placementId: this.placementId }, this.PromotedFundsConfig))
|
|
12707
|
+
standardChoiceFormSignature, defaultFundUsiSet: customFundChoice_api.Option.toUndefined(customFundChoice_api.superSelectionAppService.defaultFundUsi), placementId: this.placementId }, this.PromotedFundsConfig))
|
|
15877
12708
|
});
|
|
15878
12709
|
};
|
|
15879
12710
|
this.handleDefinedBenefitsJoined = async (data) => {
|
|
@@ -15881,14 +12712,14 @@ class PromotedFundJoinedEventHandler {
|
|
|
15881
12712
|
appInsights.trackErrorTrace('Super Campaign did not return (DefinedBenefits) memberNumber and/or usi');
|
|
15882
12713
|
return;
|
|
15883
12714
|
}
|
|
15884
|
-
await customFundChoiceApi.submitDefinedBenefitsChoiceAsync(Object.assign({ fundUsi: Usi.clean(data.usi), fundId: data.fundId, memberNumber: data.memberNumber, memberElectContributionRatePreTax: data.memberElectContributionRatePreTax, memberElectContributionRatePostTax: data.memberElectContributionRatePostTax }, this.PromotedFundsConfig));
|
|
15885
|
-
superSelectionAppService.markSuperSelectionAsSubmitted();
|
|
12715
|
+
await customFundChoice_api.customFundChoiceApi.submitDefinedBenefitsChoiceAsync(Object.assign({ fundUsi: Usi.clean(data.usi), fundId: data.fundId, memberNumber: data.memberNumber, memberElectContributionRatePreTax: data.memberElectContributionRatePreTax, memberElectContributionRatePostTax: data.memberElectContributionRatePostTax }, this.PromotedFundsConfig));
|
|
12716
|
+
customFundChoice_api.superSelectionAppService.markSuperSelectionAsSubmitted();
|
|
15886
12717
|
};
|
|
15887
12718
|
this.history = history;
|
|
15888
12719
|
this.placementId = placementId;
|
|
15889
12720
|
}
|
|
15890
12721
|
get PromotedFundsConfig() {
|
|
15891
|
-
return superSelectionAppService.promotedFundsConfig;
|
|
12722
|
+
return customFundChoice_api.superSelectionAppService.promotedFundsConfig;
|
|
15892
12723
|
}
|
|
15893
12724
|
}
|
|
15894
12725
|
|
|
@@ -15907,7 +12738,7 @@ const FeaturedFunds = class {
|
|
|
15907
12738
|
}
|
|
15908
12739
|
};
|
|
15909
12740
|
this.backClicked = () => {
|
|
15910
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
12741
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
15911
12742
|
return Promise.resolve();
|
|
15912
12743
|
};
|
|
15913
12744
|
this.cancelClicked = () => {
|
|
@@ -15928,7 +12759,7 @@ const FeaturedFunds = class {
|
|
|
15928
12759
|
this.fundPanelShown = async (event) => {
|
|
15929
12760
|
if (event.detail.sender === 'featured-funds') {
|
|
15930
12761
|
const fundIdList = event.detail.shownFunds.map((f) => f.fundId);
|
|
15931
|
-
await superSelectionAppService.viewSuperFundPanelAsync('byof', fundIdList);
|
|
12762
|
+
await customFundChoice_api.superSelectionAppService.viewSuperFundPanelAsync('byof', fundIdList);
|
|
15932
12763
|
}
|
|
15933
12764
|
};
|
|
15934
12765
|
this.eventHandlers = {
|
|
@@ -15940,23 +12771,23 @@ const FeaturedFunds = class {
|
|
|
15940
12771
|
};
|
|
15941
12772
|
}
|
|
15942
12773
|
componentWillLoad() {
|
|
15943
|
-
if (superSelectionAppService.isFeaturedFundsEnabled &&
|
|
15944
|
-
superSelectionAppService.isUsingSuperCampaign &&
|
|
15945
|
-
Option.isSome(superSelectionAppService.backendUrl) &&
|
|
15946
|
-
Option.isSome(superSelectionAppService.state.jwt)) {
|
|
15947
|
-
this.backendUrl = superSelectionAppService.backendUrl.value;
|
|
15948
|
-
this.accessToken = superSelectionAppService.state.jwt.value;
|
|
12774
|
+
if (customFundChoice_api.superSelectionAppService.isFeaturedFundsEnabled &&
|
|
12775
|
+
customFundChoice_api.superSelectionAppService.isUsingSuperCampaign &&
|
|
12776
|
+
customFundChoice_api.Option.isSome(customFundChoice_api.superSelectionAppService.backendUrl) &&
|
|
12777
|
+
customFundChoice_api.Option.isSome(customFundChoice_api.superSelectionAppService.state.jwt)) {
|
|
12778
|
+
this.backendUrl = customFundChoice_api.superSelectionAppService.backendUrl.value;
|
|
12779
|
+
this.accessToken = customFundChoice_api.superSelectionAppService.state.jwt.value;
|
|
15949
12780
|
this.unsubscribeFromEvents();
|
|
15950
12781
|
this.subscribeToEvents();
|
|
15951
|
-
superSelectionAppService.hideFooterSection = true;
|
|
12782
|
+
customFundChoice_api.superSelectionAppService.hideFooterSection = true;
|
|
15952
12783
|
}
|
|
15953
12784
|
else {
|
|
15954
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.MyOwnFund);
|
|
12785
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.MyOwnFund);
|
|
15955
12786
|
}
|
|
15956
12787
|
}
|
|
15957
12788
|
disconnectedCallback() {
|
|
15958
12789
|
this.unsubscribeFromEvents();
|
|
15959
|
-
superSelectionAppService.hideFooterSection = false;
|
|
12790
|
+
customFundChoice_api.superSelectionAppService.hideFooterSection = false;
|
|
15960
12791
|
}
|
|
15961
12792
|
render() {
|
|
15962
12793
|
return (index.h(index.Host, null, this.currentView === 'featured-funds' && index.h("sss-header-section", null), index.h("div", { class: {
|
|
@@ -15965,22 +12796,22 @@ const FeaturedFunds = class {
|
|
|
15965
12796
|
} }, this.currentView === 'featured-funds' && index.h("sss-custom-fund", null), index.h("apollo-super-campaign-featured-funds", { "backend-url": this.backendUrl, "access-token": this.accessToken }))));
|
|
15966
12797
|
}
|
|
15967
12798
|
};
|
|
15968
|
-
injectHistory(FeaturedFunds);
|
|
12799
|
+
customFundChoice_api.injectHistory(FeaturedFunds);
|
|
15969
12800
|
|
|
15970
12801
|
class SuperCampaignErrorApi {
|
|
15971
12802
|
static get Instance() {
|
|
15972
12803
|
return this.instance || (this.instance = new this());
|
|
15973
12804
|
}
|
|
15974
12805
|
async PostError(error) {
|
|
15975
|
-
buildBackendApiClient().url('super-campaign/errors').post(error);
|
|
12806
|
+
customFundChoice_api.buildBackendApiClient().url('super-campaign/errors').post(error);
|
|
15976
12807
|
}
|
|
15977
12808
|
}
|
|
15978
12809
|
|
|
15979
12810
|
const SuperFundDisclaimerViewedDetail = {
|
|
15980
12811
|
create: (superCampaignEnabled) => {
|
|
15981
12812
|
let isDefinedBenefitsEligibleString = 'Not set';
|
|
15982
|
-
if (Option.isSome(superSelectionAppService.isDefinedBenefitsEligible)) {
|
|
15983
|
-
isDefinedBenefitsEligibleString = superSelectionAppService.isDefinedBenefitsEligible.value
|
|
12813
|
+
if (customFundChoice_api.Option.isSome(customFundChoice_api.superSelectionAppService.isDefinedBenefitsEligible)) {
|
|
12814
|
+
isDefinedBenefitsEligibleString = customFundChoice_api.superSelectionAppService.isDefinedBenefitsEligible.value
|
|
15984
12815
|
? 'True'
|
|
15985
12816
|
: 'False';
|
|
15986
12817
|
}
|
|
@@ -16022,7 +12853,7 @@ const SuperCampaignHost = class {
|
|
|
16022
12853
|
};
|
|
16023
12854
|
this.superCampaignLoaded = async (event) => {
|
|
16024
12855
|
if (event.detail.sender === 'super-campaign') {
|
|
16025
|
-
superSelectionAppService.superCampaignComponentStatus = SuperCampaignComponentStatus.Loaded;
|
|
12856
|
+
customFundChoice_api.superSelectionAppService.superCampaignComponentStatus = customFundChoice_api.SuperCampaignComponentStatus.Loaded;
|
|
16026
12857
|
clearTimeout(this.loadingTimeoutRef);
|
|
16027
12858
|
await EventTrackingService.Instance.TrackSuperCampaignActivationSucceededAsync({});
|
|
16028
12859
|
}
|
|
@@ -16046,13 +12877,13 @@ const SuperCampaignHost = class {
|
|
|
16046
12877
|
};
|
|
16047
12878
|
this.chooseAnotherFundRequested = async (event) => {
|
|
16048
12879
|
if (event.detail.sender === 'super-campaign') {
|
|
16049
|
-
await navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.MyOwnFund);
|
|
12880
|
+
await customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.MyOwnFund);
|
|
16050
12881
|
}
|
|
16051
12882
|
};
|
|
16052
12883
|
this.fundPanelShown = async (event) => {
|
|
16053
12884
|
if (event.detail.sender === 'super-campaign') {
|
|
16054
|
-
superSelectionAppService.setSuperCampaignPromotedFundsShown(event.detail.shownFunds);
|
|
16055
|
-
await superSelectionAppService.viewSuperFundPanelAsync('panel');
|
|
12885
|
+
customFundChoice_api.superSelectionAppService.setSuperCampaignPromotedFundsShown(event.detail.shownFunds);
|
|
12886
|
+
await customFundChoice_api.superSelectionAppService.viewSuperFundPanelAsync('panel');
|
|
16056
12887
|
}
|
|
16057
12888
|
};
|
|
16058
12889
|
this.fundTileClicked = async (event) => {
|
|
@@ -16101,27 +12932,27 @@ const SuperCampaignHost = class {
|
|
|
16101
12932
|
};
|
|
16102
12933
|
}
|
|
16103
12934
|
async componentWillLoad() {
|
|
16104
|
-
if (superSelectionAppService.state.superCampaignComponentStatus ===
|
|
16105
|
-
SuperCampaignComponentStatus.NotWorking) {
|
|
16106
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.MyOwnFund);
|
|
12935
|
+
if (customFundChoice_api.superSelectionAppService.state.superCampaignComponentStatus ===
|
|
12936
|
+
customFundChoice_api.SuperCampaignComponentStatus.NotWorking) {
|
|
12937
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.MyOwnFund);
|
|
16107
12938
|
return;
|
|
16108
12939
|
}
|
|
16109
12940
|
let superCampaingScriptPath = undefined;
|
|
16110
12941
|
try {
|
|
16111
|
-
if (Option.isSome(superSelectionAppService.backendUrl) &&
|
|
16112
|
-
Option.isSome(superSelectionAppService.state.jwt)) {
|
|
16113
|
-
this.backendUrl = superSelectionAppService.backendUrl.value;
|
|
16114
|
-
this.accessToken = superSelectionAppService.state.jwt.value;
|
|
12942
|
+
if (customFundChoice_api.Option.isSome(customFundChoice_api.superSelectionAppService.backendUrl) &&
|
|
12943
|
+
customFundChoice_api.Option.isSome(customFundChoice_api.superSelectionAppService.state.jwt)) {
|
|
12944
|
+
this.backendUrl = customFundChoice_api.superSelectionAppService.backendUrl.value;
|
|
12945
|
+
this.accessToken = customFundChoice_api.superSelectionAppService.state.jwt.value;
|
|
16115
12946
|
this.unSubscribeFromSuperCampaignEvents();
|
|
16116
|
-
if (superSelectionAppService.state.superCampaignComponentStatus ===
|
|
16117
|
-
SuperCampaignComponentStatus.NotLoaded) {
|
|
12947
|
+
if (customFundChoice_api.superSelectionAppService.state.superCampaignComponentStatus ===
|
|
12948
|
+
customFundChoice_api.SuperCampaignComponentStatus.NotLoaded) {
|
|
16118
12949
|
superCampaingScriptPath = this.createApolloSuperCampaignScriptUrl(this.getEnvironmentTag());
|
|
16119
12950
|
await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(superCampaingScriptPath)); });
|
|
16120
12951
|
this.loadingTimeoutRef = setTimeout(this.superCampaignLoadingTimeoutTriggered.bind(this), LoadWaitingTimeout);
|
|
16121
12952
|
}
|
|
16122
12953
|
this.subscribeToSuperCampaignEvents();
|
|
16123
12954
|
this.scriptImported = true;
|
|
16124
|
-
superSelectionAppService.hideFooterSection = true;
|
|
12955
|
+
customFundChoice_api.superSelectionAppService.hideFooterSection = true;
|
|
16125
12956
|
}
|
|
16126
12957
|
else {
|
|
16127
12958
|
throw Error(`SuperCampaignHost pre-requisites not met.`);
|
|
@@ -16137,22 +12968,22 @@ const SuperCampaignHost = class {
|
|
|
16137
12968
|
disconnectedCallback() {
|
|
16138
12969
|
clearTimeout(this.loadingTimeoutRef);
|
|
16139
12970
|
this.unSubscribeFromSuperCampaignEvents();
|
|
16140
|
-
superSelectionAppService.hideFooterSection = false;
|
|
12971
|
+
customFundChoice_api.superSelectionAppService.hideFooterSection = false;
|
|
16141
12972
|
}
|
|
16142
12973
|
render() {
|
|
16143
12974
|
return (index.h("div", null, this.scriptImported ? (index.h("apollo-super-campaign", { "backend-url": this.backendUrl, "access-token": this.accessToken })) : null));
|
|
16144
12975
|
}
|
|
16145
12976
|
async activateFallbackMechanism(error) {
|
|
16146
|
-
if (superSelectionAppService.superCampaignComponentStatus !==
|
|
16147
|
-
SuperCampaignComponentStatus.NotWorking) {
|
|
16148
|
-
superSelectionAppService.superCampaignComponentStatus =
|
|
16149
|
-
SuperCampaignComponentStatus.NotWorking;
|
|
12977
|
+
if (customFundChoice_api.superSelectionAppService.superCampaignComponentStatus !==
|
|
12978
|
+
customFundChoice_api.SuperCampaignComponentStatus.NotWorking) {
|
|
12979
|
+
customFundChoice_api.superSelectionAppService.superCampaignComponentStatus =
|
|
12980
|
+
customFundChoice_api.SuperCampaignComponentStatus.NotWorking;
|
|
16150
12981
|
await SuperCampaignErrorApi.Instance.PostError(error);
|
|
16151
|
-
await navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.MyOwnFund);
|
|
12982
|
+
await customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.MyOwnFund);
|
|
16152
12983
|
}
|
|
16153
12984
|
}
|
|
16154
12985
|
async superCampaignLoadingTimeoutTriggered() {
|
|
16155
|
-
if (superSelectionAppService.superCampaignComponentStatus !== SuperCampaignComponentStatus.Loaded) {
|
|
12986
|
+
if (customFundChoice_api.superSelectionAppService.superCampaignComponentStatus !== customFundChoice_api.SuperCampaignComponentStatus.Loaded) {
|
|
16156
12987
|
this.activateFallbackMechanism({
|
|
16157
12988
|
type: 'SuperCampaignActivationFailed',
|
|
16158
12989
|
reason: `Activation timeout was triggered after:${LoadWaitingTimeout / 1000} seconds`
|
|
@@ -16163,7 +12994,7 @@ const SuperCampaignHost = class {
|
|
|
16163
12994
|
return `https://npm-cdn.flarehr.com/@flarehr/apollo-super-campaign@${envTag}/dist/apollo-super-campaign.js`;
|
|
16164
12995
|
}
|
|
16165
12996
|
};
|
|
16166
|
-
injectHistory(SuperCampaignHost);
|
|
12997
|
+
customFundChoice_api.injectHistory(SuperCampaignHost);
|
|
16167
12998
|
|
|
16168
12999
|
const LoadWaitingTimeout$1 = 30000;
|
|
16169
13000
|
|
|
@@ -16195,7 +13026,7 @@ const SuperSmsfHost = class {
|
|
|
16195
13026
|
};
|
|
16196
13027
|
this.smsfCompleted = async (event) => {
|
|
16197
13028
|
if (event.detail.sender === 'super-smsf') {
|
|
16198
|
-
navigationService.navigateInternallyToStandardChoice({
|
|
13029
|
+
customFundChoice_api.navigationService.navigateInternallyToStandardChoice({
|
|
16199
13030
|
history: this.history,
|
|
16200
13031
|
fundName: 'Self-managed super fund',
|
|
16201
13032
|
fundDetails: {
|
|
@@ -16220,15 +13051,15 @@ const SuperSmsfHost = class {
|
|
|
16220
13051
|
electronicServiceAddress: event.detail.fundEsa,
|
|
16221
13052
|
memberFirstName: event.detail.memberFirstName,
|
|
16222
13053
|
memberFamilyName: event.detail.memberLastName
|
|
16223
|
-
}, standardChoiceFormSignature }, superSelectionAppService.promotedFundsConfig);
|
|
16224
|
-
await customFundChoiceApi.submitSelfManagedFundChoiceAsync(requestDto);
|
|
13054
|
+
}, standardChoiceFormSignature }, customFundChoice_api.superSelectionAppService.promotedFundsConfig);
|
|
13055
|
+
await customFundChoice_api.customFundChoiceApi.submitSelfManagedFundChoiceAsync(requestDto);
|
|
16225
13056
|
}
|
|
16226
13057
|
});
|
|
16227
13058
|
}
|
|
16228
13059
|
};
|
|
16229
13060
|
this.smsfCancelled = async (event) => {
|
|
16230
13061
|
if (event.detail.sender === 'super-smsf') {
|
|
16231
|
-
await navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
13062
|
+
await customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
16232
13063
|
}
|
|
16233
13064
|
};
|
|
16234
13065
|
this.smsfEventHandlers = {
|
|
@@ -16238,9 +13069,9 @@ const SuperSmsfHost = class {
|
|
|
16238
13069
|
};
|
|
16239
13070
|
}
|
|
16240
13071
|
async componentWillLoad() {
|
|
16241
|
-
if (Option.isSome(superSelectionAppService.backendUrl) && Option.isSome(superSelectionAppService.state.jwt)) {
|
|
16242
|
-
this.backendUrl = superSelectionAppService.backendUrl.value;
|
|
16243
|
-
this.accessToken = superSelectionAppService.state.jwt.value;
|
|
13072
|
+
if (customFundChoice_api.Option.isSome(customFundChoice_api.superSelectionAppService.backendUrl) && customFundChoice_api.Option.isSome(customFundChoice_api.superSelectionAppService.state.jwt)) {
|
|
13073
|
+
this.backendUrl = customFundChoice_api.superSelectionAppService.backendUrl.value;
|
|
13074
|
+
this.accessToken = customFundChoice_api.superSelectionAppService.state.jwt.value;
|
|
16244
13075
|
if (superSmsfComponentStatus === SuperSmsfComponentStatus.NotLoaded) {
|
|
16245
13076
|
this.loadingTimeoutRef = setTimeout(this.smsfLoadingTimeoutTriggered.bind(this), LoadWaitingTimeout$1);
|
|
16246
13077
|
}
|
|
@@ -16263,7 +13094,7 @@ const SuperSmsfHost = class {
|
|
|
16263
13094
|
}
|
|
16264
13095
|
}
|
|
16265
13096
|
};
|
|
16266
|
-
injectHistory(SuperSmsfHost);
|
|
13097
|
+
customFundChoice_api.injectHistory(SuperSmsfHost);
|
|
16267
13098
|
|
|
16268
13099
|
const routeCss = "stencil-route.inactive{display:none}";
|
|
16269
13100
|
|
|
@@ -17209,63 +14040,63 @@ const SuperSelectionApp = class {
|
|
|
17209
14040
|
this.isAppInitialised = false;
|
|
17210
14041
|
}
|
|
17211
14042
|
async componentWillLoad() {
|
|
17212
|
-
const jwt = Option.fromNullable(this.accessToken);
|
|
17213
|
-
if (Option.isNone(jwt)) {
|
|
14043
|
+
const jwt = customFundChoice_api.Option.fromNullable(this.accessToken);
|
|
14044
|
+
if (customFundChoice_api.Option.isNone(jwt)) {
|
|
17214
14045
|
throw Error(`jwt property is missing.`);
|
|
17215
14046
|
}
|
|
17216
|
-
superSelectionAppService.state.jwt = jwt;
|
|
17217
|
-
const apiBaseUrl = Option.fromNullable(this.backendUrl);
|
|
17218
|
-
if (Option.isNone(apiBaseUrl)) {
|
|
14047
|
+
customFundChoice_api.superSelectionAppService.state.jwt = jwt;
|
|
14048
|
+
const apiBaseUrl = customFundChoice_api.Option.fromNullable(this.backendUrl);
|
|
14049
|
+
if (customFundChoice_api.Option.isNone(apiBaseUrl)) {
|
|
17219
14050
|
throw Error(`apiBaseUrl property is missing.`);
|
|
17220
14051
|
}
|
|
17221
|
-
superSelectionAppService.state.apiBaseUrl = Option.some(apiBaseUrl.value.replace(/\/$/, '') + '/');
|
|
17222
|
-
const appBaseUrl = Option.fromNullable(this.appBaseUrl);
|
|
17223
|
-
if (Option.isNone(appBaseUrl)) {
|
|
14052
|
+
customFundChoice_api.superSelectionAppService.state.apiBaseUrl = customFundChoice_api.Option.some(apiBaseUrl.value.replace(/\/$/, '') + '/');
|
|
14053
|
+
const appBaseUrl = customFundChoice_api.Option.fromNullable(this.appBaseUrl);
|
|
14054
|
+
if (customFundChoice_api.Option.isNone(appBaseUrl)) {
|
|
17224
14055
|
throw Error(`appBaseUrl property is missing.`);
|
|
17225
14056
|
}
|
|
17226
|
-
superSelectionAppService.state.appBaseUrl = Option.some(appBaseUrl.value.replace(/\/$/, ''));
|
|
17227
|
-
superSelectionAppService.onChange('hasSuccessPageBeenAcknowledged', (_) => this.successPageAcknowledged.emit());
|
|
17228
|
-
superSelectionAppService.onChange('hasSuperSelectionBeenSubmitted', (submitted) => {
|
|
14057
|
+
customFundChoice_api.superSelectionAppService.state.appBaseUrl = customFundChoice_api.Option.some(appBaseUrl.value.replace(/\/$/, ''));
|
|
14058
|
+
customFundChoice_api.superSelectionAppService.onChange('hasSuccessPageBeenAcknowledged', (_) => this.successPageAcknowledged.emit());
|
|
14059
|
+
customFundChoice_api.superSelectionAppService.onChange('hasSuperSelectionBeenSubmitted', (submitted) => {
|
|
17229
14060
|
if (!submitted)
|
|
17230
14061
|
return;
|
|
17231
14062
|
this.stepSubmitSuccess.emit();
|
|
17232
|
-
superSelectionAppService.state.hasSuperSelectionBeenSubmitted = false;
|
|
14063
|
+
customFundChoice_api.superSelectionAppService.state.hasSuperSelectionBeenSubmitted = false;
|
|
17233
14064
|
if (this.isSelfHosted) {
|
|
17234
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.Success);
|
|
14065
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.Success);
|
|
17235
14066
|
}
|
|
17236
14067
|
});
|
|
17237
14068
|
}
|
|
17238
14069
|
async componentDidLoad() {
|
|
17239
|
-
await superSelectionAppService.loadAppStateAsync();
|
|
14070
|
+
await customFundChoice_api.superSelectionAppService.loadAppStateAsync();
|
|
17240
14071
|
const chosenFundOption = await existingFundService.GetExistingFundAsync();
|
|
17241
14072
|
this.isAppInitialised = true;
|
|
17242
14073
|
this.initialised.emit({
|
|
17243
|
-
accountIdOrDefault: superSelectionAppService.accountIdOrDefault,
|
|
17244
|
-
partnerIdOrDefault: superSelectionAppService.partnerIdOrDefault,
|
|
17245
|
-
profileId: superSelectionAppService.profileId
|
|
14074
|
+
accountIdOrDefault: customFundChoice_api.superSelectionAppService.accountIdOrDefault,
|
|
14075
|
+
partnerIdOrDefault: customFundChoice_api.superSelectionAppService.partnerIdOrDefault,
|
|
14076
|
+
profileId: customFundChoice_api.superSelectionAppService.profileId
|
|
17246
14077
|
});
|
|
17247
|
-
iframe.appReady();
|
|
17248
|
-
const ignoreExistingSelectionOption = Option.fromNullable(this.ignoreExistingSelection);
|
|
17249
|
-
const shouldIgnoreExistingDefinedBenefitsChoice = Option.isSome(chosenFundOption) &&
|
|
14078
|
+
customFundChoice_api.iframe.appReady();
|
|
14079
|
+
const ignoreExistingSelectionOption = customFundChoice_api.Option.fromNullable(this.ignoreExistingSelection);
|
|
14080
|
+
const shouldIgnoreExistingDefinedBenefitsChoice = customFundChoice_api.Option.isSome(chosenFundOption) &&
|
|
17250
14081
|
chosenFundOption.value.type == 'Defined Benefits Fund' &&
|
|
17251
|
-
(Option.isNone(superSelectionAppService.isDefinedBenefitsEligible) ||
|
|
17252
|
-
!superSelectionAppService.isDefinedBenefitsEligible.value);
|
|
17253
|
-
const shouldIgnoreExistingChoice = (Option.isSome(ignoreExistingSelectionOption) && ignoreExistingSelectionOption.value) ||
|
|
14082
|
+
(customFundChoice_api.Option.isNone(customFundChoice_api.superSelectionAppService.isDefinedBenefitsEligible) ||
|
|
14083
|
+
!customFundChoice_api.superSelectionAppService.isDefinedBenefitsEligible.value);
|
|
14084
|
+
const shouldIgnoreExistingChoice = (customFundChoice_api.Option.isSome(ignoreExistingSelectionOption) && ignoreExistingSelectionOption.value) ||
|
|
17254
14085
|
shouldIgnoreExistingDefinedBenefitsChoice;
|
|
17255
|
-
if (Option.isSome(superSelectionAppService.state.superChoicePrefill)) {
|
|
17256
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.Prefill);
|
|
14086
|
+
if (customFundChoice_api.Option.isSome(customFundChoice_api.superSelectionAppService.state.superChoicePrefill)) {
|
|
14087
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.Prefill);
|
|
17257
14088
|
}
|
|
17258
|
-
else if (Option.isSome(chosenFundOption) &&
|
|
14089
|
+
else if (customFundChoice_api.Option.isSome(chosenFundOption) &&
|
|
17259
14090
|
chosenFundOption.value.valid !== 'Inactive' &&
|
|
17260
14091
|
!shouldIgnoreExistingChoice) {
|
|
17261
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ExistingChoicePage);
|
|
14092
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ExistingChoicePage);
|
|
17262
14093
|
}
|
|
17263
14094
|
else {
|
|
17264
|
-
navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
|
|
14095
|
+
customFundChoice_api.navigationService.navigateInternally(this.history, customFundChoice_api.SuperSelectionAppRoutes.ChoicePage);
|
|
17265
14096
|
}
|
|
17266
14097
|
}
|
|
17267
14098
|
authTokenChanged(newValue) {
|
|
17268
|
-
superSelectionAppService.state.jwt = Option.fromNullable(newValue);
|
|
14099
|
+
customFundChoice_api.superSelectionAppService.state.jwt = customFundChoice_api.Option.fromNullable(newValue);
|
|
17269
14100
|
}
|
|
17270
14101
|
onRouteChange() {
|
|
17271
14102
|
window === null || window === void 0 ? void 0 : window.scroll(0, 0);
|
|
@@ -17278,7 +14109,7 @@ const SuperSelectionApp = class {
|
|
|
17278
14109
|
return ((_a = this.appBaseUrl) === null || _a === void 0 ? void 0 : _a.replace(/\/$/, '')) + '/';
|
|
17279
14110
|
}
|
|
17280
14111
|
renderAppContent() {
|
|
17281
|
-
return (index.h("stencil-router", { root: this.routerBaseUrl(), class: "font-inter" }, index.h("stencil-route-switch", { scrollTopOffset: 0 }, this.isAppInitialised ? (index.h("div", { class: "pt-28 -mt-12 pb-6" }, superSelectionAppStencilRoutes, index.h("sss-footer-section", null))) : (index.h("div", { class: "flex justify-center py-20" }, index.h("sss-loading-indicator", null))))));
|
|
14112
|
+
return (index.h("stencil-router", { root: this.routerBaseUrl(), class: "font-inter" }, index.h("stencil-route-switch", { scrollTopOffset: 0 }, this.isAppInitialised ? (index.h("div", { class: "pt-28 -mt-12 pb-6" }, customFundChoice_api.superSelectionAppStencilRoutes, index.h("sss-footer-section", null))) : (index.h("div", { class: "flex justify-center py-20" }, index.h("sss-loading-indicator", null))))));
|
|
17282
14113
|
}
|
|
17283
14114
|
static get assetsDirs() { return ["assets"]; }
|
|
17284
14115
|
static get watchers() { return {
|
|
@@ -17286,7 +14117,7 @@ const SuperSelectionApp = class {
|
|
|
17286
14117
|
"location": ["onRouteChange"]
|
|
17287
14118
|
}; }
|
|
17288
14119
|
};
|
|
17289
|
-
injectHistory(SuperSelectionApp);
|
|
14120
|
+
customFundChoice_api.injectHistory(SuperSelectionApp);
|
|
17290
14121
|
SuperSelectionApp.style = superSelectionAppCss;
|
|
17291
14122
|
|
|
17292
14123
|
var resizeObservers = [];
|
|
@@ -17792,14 +14623,14 @@ class AppConfigurationService {
|
|
|
17792
14623
|
this.getAppHostUrl = () => `${window.location.origin}${this.getAppRootUrl()}`.replace(/\/$/, '');
|
|
17793
14624
|
}
|
|
17794
14625
|
async loadConfigurationAsync() {
|
|
17795
|
-
const configuration = await factory(`${this.getAppRootUrl()}config.json`)
|
|
14626
|
+
const configuration = await customFundChoice_api.factory(`${this.getAppRootUrl()}config.json`)
|
|
17796
14627
|
.get()
|
|
17797
14628
|
.json();
|
|
17798
|
-
sessionStore.update({ appConfiguration: Option.fromNullable(configuration) });
|
|
14629
|
+
sessionStore.update({ appConfiguration: customFundChoice_api.Option.fromNullable(configuration) });
|
|
17799
14630
|
}
|
|
17800
14631
|
resolveRootUrl() {
|
|
17801
|
-
const match = Option.fromNullable(window.location.pathname.match(/^\/super-selection\/embed\/v1.0\/app/));
|
|
17802
|
-
if (Option.isNone(match)) {
|
|
14632
|
+
const match = customFundChoice_api.Option.fromNullable(window.location.pathname.match(/^\/super-selection\/embed\/v1.0\/app/));
|
|
14633
|
+
if (customFundChoice_api.Option.isNone(match)) {
|
|
17803
14634
|
throw Error('Unsupported host URL');
|
|
17804
14635
|
}
|
|
17805
14636
|
return match.value[0] + '/';
|
|
@@ -17813,8 +14644,8 @@ class AppParametersService {
|
|
|
17813
14644
|
}
|
|
17814
14645
|
init(query) {
|
|
17815
14646
|
const urlParams = new URLSearchParams(query);
|
|
17816
|
-
const queryParamValue = Option.fromNullable(urlParams.get(this.ignoreExistingSelectionQueryParameter));
|
|
17817
|
-
const ignoreExistingSelection = Option.fold(() => false, (value) => value === 'true')(queryParamValue);
|
|
14647
|
+
const queryParamValue = customFundChoice_api.Option.fromNullable(urlParams.get(this.ignoreExistingSelectionQueryParameter));
|
|
14648
|
+
const ignoreExistingSelection = customFundChoice_api.Option.fold(() => false, (value) => value === 'true')(queryParamValue);
|
|
17818
14649
|
sessionStore.update({ ignoreExistingSelection: ignoreExistingSelection });
|
|
17819
14650
|
}
|
|
17820
14651
|
}
|
|
@@ -17852,11 +14683,11 @@ class AuthenticationService {
|
|
|
17852
14683
|
}
|
|
17853
14684
|
authorizationCodeIsPresent(query) {
|
|
17854
14685
|
const authCode = this.getAuthorizationCodeFromRoute(query);
|
|
17855
|
-
return Option.isSome(authCode);
|
|
14686
|
+
return customFundChoice_api.Option.isSome(authCode);
|
|
17856
14687
|
}
|
|
17857
14688
|
initFromRoute(query) {
|
|
17858
14689
|
const authorizationCode = this.getAuthorizationCodeFromRoute(query);
|
|
17859
|
-
if (Option.isNone(authorizationCode)) {
|
|
14690
|
+
if (customFundChoice_api.Option.isNone(authorizationCode)) {
|
|
17860
14691
|
sessionStore.update({ authenticationState: AuthenticationState.Error });
|
|
17861
14692
|
throw Error(`"${this.authCodeQueryParameter}" URL query parameter missing`);
|
|
17862
14693
|
}
|
|
@@ -17869,7 +14700,7 @@ class AuthenticationService {
|
|
|
17869
14700
|
['code', authorizationCode],
|
|
17870
14701
|
['redirect_uri', `${appConfigurationService.getAppHostUrl()}`]
|
|
17871
14702
|
]);
|
|
17872
|
-
const tokenResponse = await factory(appConfigurationQuery.configuration.OidcAuthority + '/connect/token')
|
|
14703
|
+
const tokenResponse = await customFundChoice_api.factory(appConfigurationQuery.configuration.OidcAuthority + '/connect/token')
|
|
17873
14704
|
.headers({ 'Content-Type': 'application/x-www-form-urlencoded' })
|
|
17874
14705
|
.post(formData.toString())
|
|
17875
14706
|
.badRequest(() => {
|
|
@@ -17878,7 +14709,7 @@ class AuthenticationService {
|
|
|
17878
14709
|
})
|
|
17879
14710
|
.json();
|
|
17880
14711
|
sessionStore.update({
|
|
17881
|
-
jwt: Option.fromNullable(tokenResponse.access_token),
|
|
14712
|
+
jwt: customFundChoice_api.Option.fromNullable(tokenResponse.access_token),
|
|
17882
14713
|
authenticationState: AuthenticationState.Authenticated
|
|
17883
14714
|
});
|
|
17884
14715
|
sendAnalyticsEvent('oidc_sign_in', {});
|
|
@@ -17886,7 +14717,7 @@ class AuthenticationService {
|
|
|
17886
14717
|
}
|
|
17887
14718
|
getAuthorizationCodeFromRoute(query) {
|
|
17888
14719
|
const urlParams = new URLSearchParams(query);
|
|
17889
|
-
return Option.fromNullable(urlParams.get(this.authCodeQueryParameter));
|
|
14720
|
+
return customFundChoice_api.Option.fromNullable(urlParams.get(this.authCodeQueryParameter));
|
|
17890
14721
|
}
|
|
17891
14722
|
}
|
|
17892
14723
|
const authenticationService = new AuthenticationService();
|
|
@@ -17897,14 +14728,14 @@ class InteropQuery extends datoramaAkita.Query {
|
|
|
17897
14728
|
this.store = store;
|
|
17898
14729
|
}
|
|
17899
14730
|
isReactNativeInteropEnabled() {
|
|
17900
|
-
return isSome(this.getValue().reactNativeInterop);
|
|
14731
|
+
return customFundChoice_api.isSome(this.getValue().reactNativeInterop);
|
|
17901
14732
|
}
|
|
17902
14733
|
isIframeInteropEnabled() {
|
|
17903
|
-
return isSome(this.getValue().iframeInterop);
|
|
14734
|
+
return customFundChoice_api.isSome(this.getValue().iframeInterop);
|
|
17904
14735
|
}
|
|
17905
14736
|
getIframeInteropMode() {
|
|
17906
14737
|
const iframeInterop = this.getValue().iframeInterop;
|
|
17907
|
-
if (isNone(iframeInterop)) {
|
|
14738
|
+
if (customFundChoice_api.isNone(iframeInterop)) {
|
|
17908
14739
|
throw Error('Failed to get iframe interop information: no data in store');
|
|
17909
14740
|
}
|
|
17910
14741
|
if (!this.isIframeInteropEnabled()) {
|
|
@@ -17918,22 +14749,22 @@ const interopQuery = new InteropQuery(sessionStore);
|
|
|
17918
14749
|
class IFrameInteropService {
|
|
17919
14750
|
static completeSuperSelectionStep() {
|
|
17920
14751
|
const { successRedirectionUrl } = interopQuery.getIframeInteropMode();
|
|
17921
|
-
if (Option.isSome(successRedirectionUrl)) {
|
|
14752
|
+
if (customFundChoice_api.Option.isSome(successRedirectionUrl)) {
|
|
17922
14753
|
window.top.location.href = successRedirectionUrl.value;
|
|
17923
14754
|
}
|
|
17924
14755
|
else {
|
|
17925
|
-
iframe.complete();
|
|
14756
|
+
customFundChoice_api.iframe.complete();
|
|
17926
14757
|
}
|
|
17927
14758
|
}
|
|
17928
14759
|
static initFromRoute(route) {
|
|
17929
14760
|
const redirectionUrlQueryParameter = 'success-redirection-url';
|
|
17930
14761
|
const urlParams = new URLSearchParams(route);
|
|
17931
|
-
const redirectionUrl = Option.fromNullable(urlParams.get(redirectionUrlQueryParameter));
|
|
17932
|
-
const iframeMode = { successRedirectionUrl: Option.none };
|
|
17933
|
-
if (Option.isSome(redirectionUrl)) {
|
|
14762
|
+
const redirectionUrl = customFundChoice_api.Option.fromNullable(urlParams.get(redirectionUrlQueryParameter));
|
|
14763
|
+
const iframeMode = { successRedirectionUrl: customFundChoice_api.Option.none };
|
|
14764
|
+
if (customFundChoice_api.Option.isSome(redirectionUrl)) {
|
|
17934
14765
|
try {
|
|
17935
14766
|
const validatedUrl = new URL(redirectionUrl.value);
|
|
17936
|
-
iframeMode.successRedirectionUrl = Option.some(validatedUrl.toString());
|
|
14767
|
+
iframeMode.successRedirectionUrl = customFundChoice_api.Option.some(validatedUrl.toString());
|
|
17937
14768
|
}
|
|
17938
14769
|
catch (error) {
|
|
17939
14770
|
throw Error(`"${redirectionUrl.value}" is not a valid URL`);
|
|
@@ -17980,12 +14811,12 @@ class HostInteropService {
|
|
|
17980
14811
|
}
|
|
17981
14812
|
init(urlQuery) {
|
|
17982
14813
|
const urlParams = new URLSearchParams(urlQuery);
|
|
17983
|
-
const interopMode = fromNullable(urlParams.get(this.interopModeQueryParameter));
|
|
17984
|
-
if (isSome(interopMode) && interopMode.value === "react-native") {
|
|
17985
|
-
sessionStore.update({ reactNativeInterop: some(ReactNativeInteropService.init()) });
|
|
14814
|
+
const interopMode = customFundChoice_api.fromNullable(urlParams.get(this.interopModeQueryParameter));
|
|
14815
|
+
if (customFundChoice_api.isSome(interopMode) && interopMode.value === "react-native") {
|
|
14816
|
+
sessionStore.update({ reactNativeInterop: customFundChoice_api.some(ReactNativeInteropService.init()) });
|
|
17986
14817
|
return;
|
|
17987
14818
|
}
|
|
17988
|
-
sessionStore.update({ iframeInterop: some(IFrameInteropService.initFromRoute(urlQuery)) });
|
|
14819
|
+
sessionStore.update({ iframeInterop: customFundChoice_api.some(IFrameInteropService.initFromRoute(urlQuery)) });
|
|
17989
14820
|
}
|
|
17990
14821
|
}
|
|
17991
14822
|
const hostInteropService = new HostInteropService();
|
|
@@ -18030,10 +14861,10 @@ const SuperSelectionAppHost = class {
|
|
|
18030
14861
|
appParametersQuery.ignoreExistingSelection$.subscribe((newValue) => (this.ignoreExistingSelection = newValue));
|
|
18031
14862
|
}
|
|
18032
14863
|
render() {
|
|
18033
|
-
return (index.h(index.Host, null, index.h("link", { rel: "stylesheet", href: index.getAssetPath('apollo-super-selection.css'), media: "all" }), index.h("div", { ref: (el) => this.observeContentResize(el) }, Option.isNone(this.appConfiguration) ? (index.h("sss-loading-page", { class: "font-inter" })) : (this.renderAppContent()))));
|
|
14864
|
+
return (index.h(index.Host, null, index.h("link", { rel: "stylesheet", href: index.getAssetPath('apollo-super-selection.css'), media: "all" }), index.h("div", { ref: (el) => this.observeContentResize(el) }, customFundChoice_api.Option.isNone(this.appConfiguration) ? (index.h("sss-loading-page", { class: "font-inter" })) : (this.renderAppContent()))));
|
|
18034
14865
|
}
|
|
18035
14866
|
renderAppContent() {
|
|
18036
|
-
return (index.h("stencil-router", { root: appConfigurationService.getAppRootUrl(), class: "sss-app-container" }, index.h("stencil-route-switch", { scrollTopOffset: 0 }, index.h("stencil-route", { url: "/", routeRender: this.renderProtectedRoute((props) => (index.h("super-selection-app", Object.assign({ accessToken: Option.toUndefined(this.jwt), ignoreExistingSelection: this.ignoreExistingSelection, backendUrl: appConfigurationQuery.configuration.ApiBaseUrl, appBaseUrl: this.getAppBaseUrl(), onSuccessPageAcknowledged: this.handleSuccessPageAcknowledged, "onStep-completion": this.handleStepSubmitSuccess, onInitialised: this.handleAppInitialised, isSelfHosted: true }, props)))) }))));
|
|
14867
|
+
return (index.h("stencil-router", { root: appConfigurationService.getAppRootUrl(), class: "sss-app-container" }, index.h("stencil-route-switch", { scrollTopOffset: 0 }, index.h("stencil-route", { url: "/", routeRender: this.renderProtectedRoute((props) => (index.h("super-selection-app", Object.assign({ accessToken: customFundChoice_api.Option.toUndefined(this.jwt), ignoreExistingSelection: this.ignoreExistingSelection, backendUrl: appConfigurationQuery.configuration.ApiBaseUrl, appBaseUrl: this.getAppBaseUrl(), onSuccessPageAcknowledged: this.handleSuccessPageAcknowledged, "onStep-completion": this.handleStepSubmitSuccess, onInitialised: this.handleAppInitialised, isSelfHosted: true }, props)))) }))));
|
|
18037
14868
|
}
|
|
18038
14869
|
getAppBaseUrl() {
|
|
18039
14870
|
const splits = window.location.pathname.split('app');
|
|
@@ -18043,7 +14874,7 @@ const SuperSelectionAppHost = class {
|
|
|
18043
14874
|
hostInteropService.completeSuperSelectionStep();
|
|
18044
14875
|
}
|
|
18045
14876
|
handleStepSubmitSuccess() {
|
|
18046
|
-
iframe.submitSuccess();
|
|
14877
|
+
customFundChoice_api.iframe.submitSuccess();
|
|
18047
14878
|
}
|
|
18048
14879
|
handleAppInitialised(evt) {
|
|
18049
14880
|
appInsights.addCustomProperties({
|
|
@@ -18060,7 +14891,7 @@ const SuperSelectionAppHost = class {
|
|
|
18060
14891
|
observeContentResize(appContent) {
|
|
18061
14892
|
const ResizeObserver$1 = window.ResizeObserver || ResizeObserver;
|
|
18062
14893
|
new ResizeObserver$1(() => {
|
|
18063
|
-
iframe.resize(appContent.offsetHeight, -1);
|
|
14894
|
+
customFundChoice_api.iframe.resize(appContent.offsetHeight, -1);
|
|
18064
14895
|
}).observe(appContent);
|
|
18065
14896
|
}
|
|
18066
14897
|
renderProtectedRoute(renderProtectedComponent) {
|
|
@@ -18088,9 +14919,7 @@ exports.sss_footer_section = FooterSection;
|
|
|
18088
14919
|
exports.sss_header_section = HeaderSection;
|
|
18089
14920
|
exports.sss_loading_indicator = LoadingIndicator;
|
|
18090
14921
|
exports.sss_loading_page = LoadingPage;
|
|
18091
|
-
exports.sss_my_own_fund = MyOwnFund;
|
|
18092
14922
|
exports.sss_my_own_fund_engagement_step_host = MyOwnFundEngagementStep;
|
|
18093
|
-
exports.sss_my_own_fund_inputs = MyOwnFundInputs;
|
|
18094
14923
|
exports.sss_name_input = MemberNameInput;
|
|
18095
14924
|
exports.sss_prefill = Prefill;
|
|
18096
14925
|
exports.sss_prefill_display_field = DisplayField;
|