@flarehr/apollo-super-selection 1.3.65232 → 1.4.32906

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/lib/apollo-super-selection/apollo-super-selection.css +1 -1
  2. package/dist/lib/apollo-super-selection/apollo-super-selection.esm.js +1 -1
  3. package/dist/lib/apollo-super-selection/apollo-super-selection.js +1 -1
  4. package/dist/lib/apollo-super-selection/p-2054e932.system.entry.js +69 -0
  5. package/dist/lib/apollo-super-selection/{p-ef3afa00.system.entry.js → p-22939048.system.entry.js} +1 -1
  6. package/dist/lib/apollo-super-selection/p-24d6e2b8.js +1 -0
  7. package/dist/lib/apollo-super-selection/{p-02f24922.system.entry.js → p-2b42304a.system.entry.js} +1 -1
  8. package/dist/lib/apollo-super-selection/{p-9c855634.entry.js → p-33eca162.entry.js} +1 -1
  9. package/dist/lib/apollo-super-selection/p-4e871154.entry.js +1 -0
  10. package/dist/lib/apollo-super-selection/{p-6ac8791e.system.entry.js → p-53b231f0.system.entry.js} +1 -1
  11. package/dist/lib/apollo-super-selection/{p-b89b68db.entry.js → p-5c73c587.entry.js} +1 -1
  12. package/dist/lib/apollo-super-selection/{p-fcb4050d.entry.js → p-69bbf1dd.entry.js} +1 -1
  13. package/dist/lib/apollo-super-selection/{p-44bec843.system.js → p-71ca4cf8.system.js} +1 -1
  14. package/dist/lib/apollo-super-selection/p-9101bd39.entry.js +14 -0
  15. package/dist/lib/apollo-super-selection/p-97188c78.system.js +1 -0
  16. package/dist/lib/apollo-super-selection/{p-23cfdd82.entry.js → p-9d2a7c0e.entry.js} +1 -1
  17. package/dist/lib/apollo-super-selection/p-a0063575.system.entry.js +1 -0
  18. package/dist/lib/apollo-super-selection/p-b00f648b.entry.js +1 -0
  19. package/dist/lib/apollo-super-selection/p-bd6e6a8f.system.js +1 -0
  20. package/dist/lib/apollo-super-selection/p-c775c0e4.system.entry.js +1 -0
  21. package/dist/lib/apollo-super-selection/p-cd3ed541.system.js +1 -0
  22. package/dist/lib/apollo-super-selection/{p-51c6dd08.js → p-db0bded8.js} +1 -1
  23. package/dist/lib/apollo-super-selection/{p-f29066b9.system.entry.js → p-e957b393.system.entry.js} +1 -1
  24. package/dist/lib/apollo-super-selection/{p-7a89efaf.js → p-fdadb647.js} +1 -1
  25. package/dist/lib/cjs/apollo-super-selection.cjs.js +1 -1
  26. package/dist/lib/cjs/custom-fund-choice.api-293c1ace.js +3209 -0
  27. package/dist/lib/cjs/loader.cjs.js +1 -1
  28. package/dist/lib/cjs/{sss-button_34.cjs.entry.js → sss-button_32.cjs.entry.js} +577 -3838
  29. package/dist/lib/cjs/sss-super-byof-host.cjs.entry.js +111 -0
  30. package/dist/lib/collection/apollo-super-selection.css +1 -1
  31. package/dist/lib/collection/collection-manifest.json +6 -9
  32. package/dist/lib/collection/components/super-byof/super-byof-types.js +1 -0
  33. package/dist/lib/collection/components/super-byof/super-byof.js +139 -0
  34. package/dist/lib/collection/components/super-campaign/super-campaign.js +15 -18
  35. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/custom-fund.js +5 -5
  36. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/smsf-engagement-step-host.js +161 -0
  37. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/smsf-engagement-step-types.js +1 -0
  38. package/dist/lib/collection/components/super-selection-app/header-section/header-section.js +24 -5
  39. package/dist/lib/collection/components/super-selection-app/services/event-tracking.service.js +10 -0
  40. package/dist/lib/collection/components/super-selection-app/services/super-selection-app.routes.js +4 -2
  41. package/dist/lib/collection/components/super-selection-app/services/super-selection-app.service.js +4 -0
  42. package/dist/lib/collection/components/super-selection-app/services/super-selection.store.js +1 -0
  43. package/dist/lib/collection/components/super-smsf/super-smsf-types.js +1 -0
  44. package/dist/lib/collection/components/super-smsf/super-smsf.form.js +1 -0
  45. package/dist/lib/collection/components/super-smsf/super-smsf.js +166 -0
  46. package/dist/lib/esm/{active-router-5e40c0f8.js → active-router-d18b36fb.js} +1 -1
  47. package/dist/lib/esm/apollo-super-selection.js +2 -2
  48. package/dist/lib/esm/context-consumer.entry.js +1 -1
  49. package/dist/lib/esm/custom-fund-choice.api-42801d64.js +3188 -0
  50. package/dist/lib/esm/{index-189b2180.js → index-107d7c24.js} +1 -1
  51. package/dist/lib/esm/loader.js +2 -2
  52. package/dist/lib/esm/{sss-button_34.entry.js → sss-button_32.entry.js} +374 -3633
  53. package/dist/lib/esm/sss-super-byof-host.entry.js +107 -0
  54. package/dist/lib/esm/stencil-async-content.entry.js +1 -1
  55. package/dist/lib/esm/stencil-route-title.entry.js +2 -2
  56. package/dist/lib/esm/stencil-router-prompt.entry.js +2 -2
  57. package/dist/lib/esm/stencil-router-redirect.entry.js +2 -2
  58. package/dist/lib/esm-es5/{active-router-5e40c0f8.js → active-router-d18b36fb.js} +1 -1
  59. package/dist/lib/esm-es5/apollo-super-selection.js +1 -1
  60. package/dist/lib/esm-es5/context-consumer.entry.js +1 -1
  61. package/dist/lib/esm-es5/custom-fund-choice.api-42801d64.js +1 -0
  62. package/dist/lib/esm-es5/{index-189b2180.js → index-107d7c24.js} +1 -1
  63. package/dist/lib/esm-es5/loader.js +1 -1
  64. package/dist/lib/esm-es5/sss-button_32.entry.js +69 -0
  65. package/dist/lib/esm-es5/sss-super-byof-host.entry.js +1 -0
  66. package/dist/lib/esm-es5/stencil-async-content.entry.js +1 -1
  67. package/dist/lib/esm-es5/stencil-route-title.entry.js +1 -1
  68. package/dist/lib/esm-es5/stencil-router-prompt.entry.js +1 -1
  69. package/dist/lib/esm-es5/stencil-router-redirect.entry.js +1 -1
  70. package/dist/lib/types/components/super-byof/super-byof-types.d.ts +26 -0
  71. package/dist/lib/types/components/super-byof/super-byof.d.ts +19 -0
  72. package/dist/lib/types/components/super-byof/super-byof.form.d.ts +6 -0
  73. package/dist/lib/types/components/super-campaign/super-campaign.d.ts +0 -1
  74. package/dist/lib/types/components/super-selection-app/api/super-selection-events.model.d.ts +8 -0
  75. package/dist/lib/types/components/super-selection-app/api/super-selection.api.dto.d.ts +1 -0
  76. package/dist/lib/types/components/super-selection-app/funds/custom-fund/custom-fund.store.d.ts +1 -1
  77. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/smsf-engagement-step-host.d.ts +28 -0
  78. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/smsf-engagement-step-types.d.ts +15 -0
  79. package/dist/lib/types/components/super-selection-app/services/event-tracking.service.d.ts +2 -0
  80. package/dist/lib/types/components/super-selection-app/services/super-selection-app.routes.d.ts +1 -0
  81. package/dist/lib/types/components/super-selection-app/services/super-selection-app.service.d.ts +1 -0
  82. package/dist/lib/types/components/super-selection-app/services/super-selection.store.d.ts +1 -0
  83. package/dist/lib/types/components/super-smsf/super-smsf-types.d.ts +34 -0
  84. package/dist/lib/types/components/super-smsf/super-smsf.d.ts +20 -0
  85. package/dist/lib/types/components.d.ts +39 -63
  86. package/package.json +2 -1
  87. package/dist/lib/apollo-super-selection/p-071b8545.entry.js +0 -1
  88. package/dist/lib/apollo-super-selection/p-51aefdb1.system.entry.js +0 -1
  89. package/dist/lib/apollo-super-selection/p-6cfd85e3.system.entry.js +0 -69
  90. package/dist/lib/apollo-super-selection/p-80178f87.system.js +0 -1
  91. package/dist/lib/apollo-super-selection/p-bdcfc026.system.js +0 -1
  92. package/dist/lib/apollo-super-selection/p-d9f1e505.entry.js +0 -14
  93. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund-inputs.js +0 -143
  94. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund.js +0 -123
  95. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund-inputs.js +0 -253
  96. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.js +0 -121
  97. package/dist/lib/esm-es5/sss-button_34.entry.js +0 -69
  98. package/dist/lib/types/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund-inputs.d.ts +0 -16
  99. package/dist/lib/types/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund.d.ts +0 -13
  100. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund-inputs.d.ts +0 -29
  101. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.d.ts +0 -14
  102. /package/dist/lib/collection/components/{super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.form.js → super-byof/super-byof.form.js} +0 -0
  103. /package/dist/lib/types/components/{super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.form.d.ts → super-smsf/super-smsf.form.d.ts} +0 -0
@@ -1,6 +1,7 @@
1
- import { r as registerInstance, h, g as getRenderingRef, f as forceUpdate, F as Fragment, a as getAssetPath, H as Host, c as createEvent, s as setErrorHandler, d as getElement, e as getContext } from './index-189b2180.js';
1
+ import { r as registerInstance, h, F as Fragment, g as getAssetPath, H as Host, c as createEvent, s as setErrorHandler, a as getElement, d as getContext } from './index-107d7c24.js';
2
2
  import { f as from, m as map, S as SimpleOuterSubscriber, a as SimpleInnerSubscriber, i as innerSubscribe, b as isArray, O as Observable, c as isFunction, d as async, g as Subscriber, h as distinctUntilChanged, j as filter, k as StoreConfig, l as Store, Q as Query } from './datorama-akita-127aea91.js';
3
- import { A as ActiveRouter } from './active-router-5e40c0f8.js';
3
+ import { n as none, i as isSome, s as some, a as superSelectionAppService, b as navigationService, S as SuperSelectionAppRoutes, c as injectHistory, C as CustomFundTypes, d as superSelectionApi, O as Option, E as EventTrackingService, e as customFundChoiceApi, f as isNone, g as getPromotedFundId, h as buildBackendApiClient, j as getSuperChoiceUsi, k as getSuperChoiceMemberNumber, l as state, m as state$1, t as toUndefined, o as slate, p as SuperCampaignComponentStatus, q as iframe, r as superSelectionAppStencilRoutes, u as factory, v as fromNullable } from './custom-fund-choice.api-42801d64.js';
4
+ import { A as ActiveRouter } from './active-router-d18b36fb.js';
4
5
 
5
6
  function noop() { }
6
7
 
@@ -260,132 +261,7 @@ class TapSubscriber extends Subscriber {
260
261
  }
261
262
  }
262
263
 
263
- const AppVersion = '1.3.65232';
264
-
265
- // -------------------------------------------------------------------------------------
266
- // guards
267
- // -------------------------------------------------------------------------------------
268
- /**
269
- * Returns `true` if the option is an instance of `Some`, `false` otherwise.
270
- *
271
- * @example
272
- * import { some, none, isSome } from 'fp-ts/Option'
273
- *
274
- * assert.strictEqual(isSome(some(1)), true)
275
- * assert.strictEqual(isSome(none), false)
276
- *
277
- * @category guards
278
- * @since 2.0.0
279
- */
280
- var isSome = function (fa) { return fa._tag === 'Some'; };
281
- /**
282
- * Returns `true` if the option is `None`, `false` otherwise.
283
- *
284
- * @example
285
- * import { some, none, isNone } from 'fp-ts/Option'
286
- *
287
- * assert.strictEqual(isNone(some(1)), false)
288
- * assert.strictEqual(isNone(none), true)
289
- *
290
- * @category guards
291
- * @since 2.0.0
292
- */
293
- var isNone = function (fa) { return fa._tag === 'None'; };
294
- // -------------------------------------------------------------------------------------
295
- // constructors
296
- // -------------------------------------------------------------------------------------
297
- /**
298
- * `None` doesn't have a constructor, instead you can use it directly as a value. Represents a missing value.
299
- *
300
- * @category constructors
301
- * @since 2.0.0
302
- */
303
- var none = { _tag: 'None' };
304
- /**
305
- * Constructs a `Some`. Represents an optional value that exists.
306
- *
307
- * @category constructors
308
- * @since 2.0.0
309
- */
310
- var some = function (a) { return ({ _tag: 'Some', value: a }); };
311
- /**
312
- * Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise
313
- * returns the value wrapped in a `Some`.
314
- *
315
- * @example
316
- * import { none, some, fromNullable } from 'fp-ts/Option'
317
- *
318
- * assert.deepStrictEqual(fromNullable(undefined), none)
319
- * assert.deepStrictEqual(fromNullable(null), none)
320
- * assert.deepStrictEqual(fromNullable(1), some(1))
321
- *
322
- * @category constructors
323
- * @since 2.0.0
324
- */
325
- function fromNullable(a) {
326
- return a == null ? none : some(a);
327
- }
328
- /**
329
- * Extracts the value out of the structure, if it exists. Otherwise returns `undefined`.
330
- *
331
- * @example
332
- * import { some, none, toUndefined } from 'fp-ts/Option'
333
- * import { pipe } from 'fp-ts/function'
334
- *
335
- * assert.strictEqual(
336
- * pipe(
337
- * some(1),
338
- * toUndefined
339
- * ),
340
- * 1
341
- * )
342
- * assert.strictEqual(
343
- * pipe(
344
- * none,
345
- * toUndefined
346
- * ),
347
- * undefined
348
- * )
349
- *
350
- * @category destructors
351
- * @since 2.0.0
352
- */
353
- function toUndefined(ma) {
354
- return isNone(ma) ? undefined : ma.value;
355
- }
356
- /**
357
- * Less strict version of [`getOrElse`](#getOrElse).
358
- *
359
- * @category destructors
360
- * @since 2.6.0
361
- */
362
- var getOrElseW = function (onNone) { return function (ma) { return (isNone(ma) ? onNone() : ma.value); }; };
363
- /**
364
- * Extracts the value out of the structure, if it exists. Otherwise returns the given default value
365
- *
366
- * @example
367
- * import { some, none, getOrElse } from 'fp-ts/Option'
368
- * import { pipe } from 'fp-ts/function'
369
- *
370
- * assert.strictEqual(
371
- * pipe(
372
- * some(1),
373
- * getOrElse(() => 0)
374
- * ),
375
- * 1
376
- * )
377
- * assert.strictEqual(
378
- * pipe(
379
- * none,
380
- * getOrElse(() => 0)
381
- * ),
382
- * 0
383
- * )
384
- *
385
- * @category destructors
386
- * @since 2.0.0
387
- */
388
- var getOrElse = getOrElseW;
264
+ const AppVersion = '1.4.32906';
389
265
 
390
266
  class Lazy {
391
267
  constructor(factory) {
@@ -409,10 +285,6 @@ function addSlashToUrl() {
409
285
  }
410
286
  }
411
287
 
412
- function injectHistory(Component) {
413
- ActiveRouter.injectProps(Component, ['history', 'location']);
414
- }
415
-
416
288
  /**
417
289
  * TS adaption of https://github.com/pillarjs/path-to-regexp/blob/master/index.js
418
290
  */
@@ -963,3171 +835,100 @@ const Button = class {
963
835
  }
964
836
  };
965
837
 
966
- function appReady() {
967
- postMessage({
968
- type: 'appReady'
969
- });
970
- }
971
- function postMessage(message, origin) {
972
- if (origin === undefined)
973
- origin = '*';
974
- message.sender = 'flare';
975
- window.parent.postMessage(message, origin);
976
- }
977
- function resize(height, width) {
978
- postMessage({
979
- type: 'contentResized',
980
- height,
981
- width
982
- });
983
- }
984
- function navigation(url) {
985
- postMessage({
986
- type: 'pageNavigated',
987
- url
988
- });
989
- }
990
- function complete() {
991
- postMessage({ type: 'complete' });
992
- }
993
- function submitSuccess() {
994
- postMessage({
995
- type: 'submitSuccess'
996
- });
997
- }
998
- const iframe = { appReady, resize, navigation, complete, submitSuccess };
999
-
1000
- const appendToMap = (map, propName, value) => {
1001
- const items = map.get(propName);
1002
- if (!items) {
1003
- map.set(propName, [value]);
1004
- }
1005
- else if (!items.includes(value)) {
1006
- items.push(value);
1007
- }
1008
- };
1009
- const debounce = (fn, ms) => {
1010
- let timeoutId;
1011
- return (...args) => {
1012
- if (timeoutId) {
1013
- clearTimeout(timeoutId);
1014
- }
1015
- timeoutId = setTimeout(() => {
1016
- timeoutId = 0;
1017
- fn(...args);
1018
- }, ms);
1019
- };
1020
- };
1021
-
1022
- /**
1023
- * Check if a possible element isConnected.
1024
- * The property might not be there, so we check for it.
1025
- *
1026
- * We want it to return true if isConnected is not a property,
1027
- * otherwise we would remove these elements and would not update.
1028
- *
1029
- * Better leak in Edge than to be useless.
1030
- */
1031
- const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
1032
- const cleanupElements = debounce((map) => {
1033
- for (let key of map.keys()) {
1034
- map.set(key, map.get(key).filter(isConnected));
1035
- }
1036
- }, 2000);
1037
- const stencilSubscription = ({ on }) => {
1038
- const elmsToUpdate = new Map();
1039
- if (typeof getRenderingRef === 'function') {
1040
- // If we are not in a stencil project, we do nothing.
1041
- // This function is not really exported by @stencil/core.
1042
- on('dispose', () => {
1043
- elmsToUpdate.clear();
1044
- });
1045
- on('get', (propName) => {
1046
- const elm = getRenderingRef();
1047
- if (elm) {
1048
- appendToMap(elmsToUpdate, propName, elm);
1049
- }
1050
- });
1051
- on('set', (propName) => {
1052
- const elements = elmsToUpdate.get(propName);
1053
- if (elements) {
1054
- elmsToUpdate.set(propName, elements.filter(forceUpdate));
1055
- }
1056
- cleanupElements(elmsToUpdate);
1057
- });
1058
- on('reset', () => {
1059
- elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
1060
- cleanupElements(elmsToUpdate);
1061
- });
838
+ const ChoiceRouter = class {
839
+ constructor(hostRef) {
840
+ registerInstance(this, hostRef);
841
+ }
842
+ async componentWillLoad() {
843
+ if (superSelectionAppService.superCampaignCanNotBeActivated) {
844
+ navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.MyOwnFund);
1062
845
  }
1063
- };
1064
-
1065
- const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
1066
- let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
1067
- const handlers = {
1068
- dispose: [],
1069
- get: [],
1070
- set: [],
1071
- reset: [],
1072
- };
1073
- const reset = () => {
1074
- states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
1075
- handlers.reset.forEach((cb) => cb());
1076
- };
1077
- const dispose = () => {
1078
- // Call first dispose as resetting the state would
1079
- // cause less updates ;)
1080
- handlers.dispose.forEach((cb) => cb());
1081
- reset();
1082
- };
1083
- const get = (propName) => {
1084
- handlers.get.forEach((cb) => cb(propName));
1085
- return states.get(propName);
1086
- };
1087
- const set = (propName, value) => {
1088
- const oldValue = states.get(propName);
1089
- if (shouldUpdate(value, oldValue, propName)) {
1090
- states.set(propName, value);
1091
- handlers.set.forEach((cb) => cb(propName, value, oldValue));
1092
- }
1093
- };
1094
- const state = (typeof Proxy === 'undefined'
1095
- ? {}
1096
- : new Proxy(defaultState, {
1097
- get(_, propName) {
1098
- return get(propName);
1099
- },
1100
- ownKeys(_) {
1101
- return Array.from(states.keys());
1102
- },
1103
- getOwnPropertyDescriptor() {
1104
- return {
1105
- enumerable: true,
1106
- configurable: true,
1107
- };
1108
- },
1109
- has(_, propName) {
1110
- return states.has(propName);
1111
- },
1112
- set(_, propName, value) {
1113
- set(propName, value);
1114
- return true;
1115
- },
1116
- }));
1117
- const on = (eventName, callback) => {
1118
- handlers[eventName].push(callback);
1119
- return () => {
1120
- removeFromArray(handlers[eventName], callback);
1121
- };
1122
- };
1123
- const onChange = (propName, cb) => {
1124
- const unSet = on('set', (key, newValue) => {
1125
- if (key === propName) {
1126
- cb(newValue);
1127
- }
1128
- });
1129
- const unReset = on('reset', () => cb(defaultState[propName]));
1130
- return () => {
1131
- unSet();
1132
- unReset();
1133
- };
1134
- };
1135
- const use = (...subscriptions) => subscriptions.forEach((subscription) => {
1136
- if (subscription.set) {
1137
- on('set', subscription.set);
1138
- }
1139
- if (subscription.get) {
1140
- on('get', subscription.get);
1141
- }
1142
- if (subscription.reset) {
1143
- on('reset', subscription.reset);
1144
- }
1145
- });
1146
- return {
1147
- state,
1148
- get,
1149
- set,
1150
- on,
1151
- onChange,
1152
- use,
1153
- dispose,
1154
- reset,
1155
- };
1156
- };
1157
- const removeFromArray = (array, item) => {
1158
- const index = array.indexOf(item);
1159
- if (index >= 0) {
1160
- array[index] = array[array.length - 1];
1161
- array.length--;
846
+ else {
847
+ navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.SuperCampaign);
1162
848
  }
849
+ }
850
+ render() {
851
+ return h(Fragment, null);
852
+ }
1163
853
  };
854
+ injectHistory(ChoiceRouter);
1164
855
 
1165
- const createStore = (defaultState, shouldUpdate) => {
1166
- const map = createObservableMap(defaultState, shouldUpdate);
1167
- stencilSubscription(map);
1168
- return map;
1169
- };
1170
-
1171
- const initial = {
1172
- handleSubmitFn: async function () {
1173
- return;
1174
- },
1175
- fundName: '',
1176
- fundDetails: { type: 'null' },
1177
- promotedFundId: undefined
1178
- };
1179
- const { state } = createStore(initial);
1180
-
1181
- var SuperSelectionAppRoutes;
1182
- (function (SuperSelectionAppRoutes) {
1183
- SuperSelectionAppRoutes["ExistingChoicePage"] = "/existing";
1184
- SuperSelectionAppRoutes["SuperCampaign"] = "/super-campaign";
1185
- SuperSelectionAppRoutes["ChoicePage"] = "/";
1186
- SuperSelectionAppRoutes["MyOwnFund"] = "/super-choice/my-own-fund/";
1187
- SuperSelectionAppRoutes["MyOwnFundEngagementStep"] = "/super-choice/my-own-fund-engagement/";
1188
- SuperSelectionAppRoutes["Prefill"] = "/super-choice/prefill/";
1189
- SuperSelectionAppRoutes["PrefillInvalidMyOwnFundPage"] = "/super-choice/sss-prefill-invalid-my-own-fund/";
1190
- SuperSelectionAppRoutes["PrefillMyOwnFundPage"] = "/super-choice/prefill-my-own-fund/";
1191
- SuperSelectionAppRoutes["PrefillSMSFPage"] = "/super-choice/prefill-smsf/";
1192
- SuperSelectionAppRoutes["PrefillInvalidSMSFPage"] = "/super-choice/prefill-invalid-smsf/";
1193
- SuperSelectionAppRoutes["SelfManagedFund"] = "/super-choice/smsf/";
1194
- SuperSelectionAppRoutes["DefaultFund"] = "/super-choice/default/";
1195
- SuperSelectionAppRoutes["FeaturedFunds"] = "/super-choice/featured-funds/";
1196
- SuperSelectionAppRoutes["StandardChoice"] = "/standard-choice/";
1197
- SuperSelectionAppRoutes["Success"] = "/success/";
1198
- })(SuperSelectionAppRoutes || (SuperSelectionAppRoutes = {}));
1199
- const superSelectionAppStencilRoutes = [
1200
- h("stencil-route", { url: SuperSelectionAppRoutes.ExistingChoicePage, component: "sss-existing-choice-page" }),
1201
- h("stencil-route", { url: SuperSelectionAppRoutes.SuperCampaign, component: "sss-super-campaign-host" }),
1202
- h("stencil-route", { exact: true, url: SuperSelectionAppRoutes.ChoicePage, component: "sss-choice-router" }),
1203
- h("stencil-route", { url: SuperSelectionAppRoutes.MyOwnFund, component: "sss-my-own-fund" }),
1204
- h("stencil-route", { url: SuperSelectionAppRoutes.MyOwnFundEngagementStep, component: "sss-my-own-fund-engagement-step-host" }),
1205
- h("stencil-route", { url: SuperSelectionAppRoutes.PrefillInvalidMyOwnFundPage, component: "sss-prefill-invalid-my-own-fund" }),
1206
- h("stencil-route", { url: SuperSelectionAppRoutes.Prefill, component: "sss-prefill" }),
1207
- h("stencil-route", { url: SuperSelectionAppRoutes.PrefillMyOwnFundPage, component: "sss-prefill-my-own-fund" }),
1208
- h("stencil-route", { url: SuperSelectionAppRoutes.PrefillSMSFPage, component: "sss-prefill-smsf" }),
1209
- h("stencil-route", { url: SuperSelectionAppRoutes.PrefillInvalidSMSFPage, component: "sss-prefill-invalid-smsf" }),
1210
- h("stencil-route", { url: SuperSelectionAppRoutes.SelfManagedFund, component: "sss-self-managed-fund" }),
1211
- h("stencil-route", { url: SuperSelectionAppRoutes.DefaultFund, component: "sss-default-fund" }),
1212
- h("stencil-route", { url: SuperSelectionAppRoutes.FeaturedFunds, component: "sss-super-campaign-featured-funds" }),
1213
- h("stencil-route", { url: SuperSelectionAppRoutes.StandardChoice, component: "sss-standard-choice-form" }),
1214
- h("stencil-route", { url: SuperSelectionAppRoutes.Success, component: "sss-success" })
1215
- ];
1216
-
1217
- function createCommonjsModule(fn, basedir, module) {
1218
- return module = {
1219
- path: basedir,
1220
- exports: {},
1221
- require: function (path, base) {
1222
- return commonjsRequire();
1223
- }
1224
- }, fn(module, module.exports), module.exports;
1225
- }
1226
-
1227
- function commonjsRequire () {
1228
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
1229
- }
1230
-
1231
- var _function = createCommonjsModule(function (module, exports) {
1232
- /**
1233
- * @since 2.0.0
1234
- */
1235
- Object.defineProperty(exports, "__esModule", { value: true });
1236
- 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;
1237
- /**
1238
- * @since 2.0.0
1239
- */
1240
- function identity(a) {
1241
- return a;
1242
- }
1243
- exports.identity = identity;
1244
- /**
1245
- * @since 2.0.0
1246
- */
1247
- exports.unsafeCoerce = identity;
1248
- /**
1249
- * @since 2.0.0
1250
- */
1251
- function not(predicate) {
1252
- return function (a) { return !predicate(a); };
1253
- }
1254
- exports.not = not;
1255
- /**
1256
- * @since 2.0.0
1257
- */
1258
- function constant(a) {
1259
- return function () { return a; };
1260
- }
1261
- exports.constant = constant;
1262
- /**
1263
- * A thunk that returns always `true`.
1264
- *
1265
- * @since 2.0.0
1266
- */
1267
- exports.constTrue =
1268
- /*#__PURE__*/
1269
- constant(true);
1270
- /**
1271
- * A thunk that returns always `false`.
1272
- *
1273
- * @since 2.0.0
1274
- */
1275
- exports.constFalse =
1276
- /*#__PURE__*/
1277
- constant(false);
1278
- /**
1279
- * A thunk that returns always `null`.
1280
- *
1281
- * @since 2.0.0
1282
- */
1283
- exports.constNull =
1284
- /*#__PURE__*/
1285
- constant(null);
1286
- /**
1287
- * A thunk that returns always `undefined`.
1288
- *
1289
- * @since 2.0.0
1290
- */
1291
- exports.constUndefined =
1292
- /*#__PURE__*/
1293
- constant(undefined);
1294
- /**
1295
- * A thunk that returns always `void`.
1296
- *
1297
- * @since 2.0.0
1298
- */
1299
- exports.constVoid = exports.constUndefined;
1300
- // TODO: remove in v3
1301
- /**
1302
- * Flips the order of the arguments of a function of two arguments.
1303
- *
1304
- * @since 2.0.0
1305
- */
1306
- function flip(f) {
1307
- return function (b, a) { return f(a, b); };
1308
- }
1309
- exports.flip = flip;
1310
- function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
1311
- switch (arguments.length) {
1312
- case 1:
1313
- return ab;
1314
- case 2:
1315
- return function () {
1316
- return bc(ab.apply(this, arguments));
1317
- };
1318
- case 3:
1319
- return function () {
1320
- return cd(bc(ab.apply(this, arguments)));
1321
- };
1322
- case 4:
1323
- return function () {
1324
- return de(cd(bc(ab.apply(this, arguments))));
1325
- };
1326
- case 5:
1327
- return function () {
1328
- return ef(de(cd(bc(ab.apply(this, arguments)))));
1329
- };
1330
- case 6:
1331
- return function () {
1332
- return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
1333
- };
1334
- case 7:
1335
- return function () {
1336
- return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
1337
- };
1338
- case 8:
1339
- return function () {
1340
- return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
1341
- };
1342
- case 9:
1343
- return function () {
1344
- return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
1345
- };
1346
- }
1347
- return;
1348
- }
1349
- exports.flow = flow;
1350
- /**
1351
- * @since 2.0.0
1352
- */
1353
- function tuple() {
1354
- var t = [];
1355
- for (var _i = 0; _i < arguments.length; _i++) {
1356
- t[_i] = arguments[_i];
1357
- }
1358
- return t;
1359
- }
1360
- exports.tuple = tuple;
1361
- /**
1362
- * @since 2.0.0
1363
- */
1364
- function increment(n) {
1365
- return n + 1;
1366
- }
1367
- exports.increment = increment;
1368
- /**
1369
- * @since 2.0.0
1370
- */
1371
- function decrement(n) {
1372
- return n - 1;
1373
- }
1374
- exports.decrement = decrement;
1375
- /**
1376
- * @since 2.0.0
1377
- */
1378
- function absurd(_) {
1379
- throw new Error('Called `absurd` function which should be uncallable');
1380
- }
1381
- exports.absurd = absurd;
1382
- /**
1383
- * Creates a tupled version of this function: instead of `n` arguments, it accepts a single tuple argument.
1384
- *
1385
- * @example
1386
- * import { tupled } from 'fp-ts/function'
1387
- *
1388
- * const add = tupled((x: number, y: number): number => x + y)
1389
- *
1390
- * assert.strictEqual(add([1, 2]), 3)
1391
- *
1392
- * @since 2.4.0
1393
- */
1394
- function tupled(f) {
1395
- return function (a) { return f.apply(void 0, a); };
1396
- }
1397
- exports.tupled = tupled;
1398
- /**
1399
- * Inverse function of `tupled`
1400
- *
1401
- * @since 2.4.0
1402
- */
1403
- function untupled(f) {
1404
- return function () {
1405
- var a = [];
1406
- for (var _i = 0; _i < arguments.length; _i++) {
1407
- a[_i] = arguments[_i];
1408
- }
1409
- return f(a);
1410
- };
1411
- }
1412
- exports.untupled = untupled;
1413
- function pipe(a, ab, bc, cd, de, ef, fg, gh, hi, ij, jk, kl, lm, mn, no, op, pq, qr, rs, st) {
1414
- switch (arguments.length) {
1415
- case 1:
1416
- return a;
1417
- case 2:
1418
- return ab(a);
1419
- case 3:
1420
- return bc(ab(a));
1421
- case 4:
1422
- return cd(bc(ab(a)));
1423
- case 5:
1424
- return de(cd(bc(ab(a))));
1425
- case 6:
1426
- return ef(de(cd(bc(ab(a)))));
1427
- case 7:
1428
- return fg(ef(de(cd(bc(ab(a))))));
1429
- case 8:
1430
- return gh(fg(ef(de(cd(bc(ab(a)))))));
1431
- case 9:
1432
- return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
1433
- case 10:
1434
- return ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))));
1435
- case 11:
1436
- return jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))));
1437
- case 12:
1438
- return kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))));
1439
- case 13:
1440
- return lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))));
1441
- case 14:
1442
- return mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))));
1443
- case 15:
1444
- return no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))));
1445
- case 16:
1446
- return op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))));
1447
- case 17:
1448
- return pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))));
1449
- case 18:
1450
- return qr(pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))));
1451
- case 19:
1452
- return rs(qr(pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))))));
1453
- case 20:
1454
- return st(rs(qr(pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))))));
1455
- }
1456
- return;
1457
- }
1458
- exports.pipe = pipe;
1459
- /**
1460
- * Type hole simulation
1461
- *
1462
- * @since 2.7.0
1463
- */
1464
- exports.hole = absurd;
1465
- /**
1466
- * @internal
1467
- */
1468
- var bind_ = function (a, name, b) {
1469
- var _a;
1470
- return Object.assign({}, a, (_a = {}, _a[name] = b, _a));
856
+ const myOwnFundCustomOption = {
857
+ label: CustomFundTypes.MyOwnFund,
858
+ value: SuperSelectionAppRoutes.MyOwnFund
1471
859
  };
1472
- exports.bind_ = bind_;
1473
- /**
1474
- * @internal
1475
- */
1476
- var bindTo_ = function (name) { return function (b) {
1477
- var _a;
1478
- return (_a = {}, _a[name] = b, _a);
1479
- }; };
1480
- exports.bindTo_ = bindTo_;
1481
- });
1482
-
1483
- var Option = createCommonjsModule(function (module, exports) {
1484
- Object.defineProperty(exports, "__esModule", { value: true });
1485
- 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;
1486
- 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;
1487
-
1488
- // -------------------------------------------------------------------------------------
1489
- // guards
1490
- // -------------------------------------------------------------------------------------
1491
- /**
1492
- * Returns `true` if the option is an instance of `Some`, `false` otherwise.
1493
- *
1494
- * @example
1495
- * import { some, none, isSome } from 'fp-ts/Option'
1496
- *
1497
- * assert.strictEqual(isSome(some(1)), true)
1498
- * assert.strictEqual(isSome(none), false)
1499
- *
1500
- * @category guards
1501
- * @since 2.0.0
1502
- */
1503
- var isSome = function (fa) { return fa._tag === 'Some'; };
1504
- exports.isSome = isSome;
1505
- /**
1506
- * Returns `true` if the option is `None`, `false` otherwise.
1507
- *
1508
- * @example
1509
- * import { some, none, isNone } from 'fp-ts/Option'
1510
- *
1511
- * assert.strictEqual(isNone(some(1)), false)
1512
- * assert.strictEqual(isNone(none), true)
1513
- *
1514
- * @category guards
1515
- * @since 2.0.0
1516
- */
1517
- var isNone = function (fa) { return fa._tag === 'None'; };
1518
- exports.isNone = isNone;
1519
- // -------------------------------------------------------------------------------------
1520
- // constructors
1521
- // -------------------------------------------------------------------------------------
1522
- /**
1523
- * `None` doesn't have a constructor, instead you can use it directly as a value. Represents a missing value.
1524
- *
1525
- * @category constructors
1526
- * @since 2.0.0
1527
- */
1528
- exports.none = { _tag: 'None' };
1529
- /**
1530
- * Constructs a `Some`. Represents an optional value that exists.
1531
- *
1532
- * @category constructors
1533
- * @since 2.0.0
1534
- */
1535
- var some = function (a) { return ({ _tag: 'Some', value: a }); };
1536
- exports.some = some;
1537
- /**
1538
- * Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise
1539
- * returns the value wrapped in a `Some`.
1540
- *
1541
- * @example
1542
- * import { none, some, fromNullable } from 'fp-ts/Option'
1543
- *
1544
- * assert.deepStrictEqual(fromNullable(undefined), none)
1545
- * assert.deepStrictEqual(fromNullable(null), none)
1546
- * assert.deepStrictEqual(fromNullable(1), some(1))
1547
- *
1548
- * @category constructors
1549
- * @since 2.0.0
1550
- */
1551
- function fromNullable(a) {
1552
- return a == null ? exports.none : exports.some(a);
1553
- }
1554
- exports.fromNullable = fromNullable;
1555
- function fromPredicate(predicate) {
1556
- return function (a) { return (predicate(a) ? exports.some(a) : exports.none); };
1557
- }
1558
- exports.fromPredicate = fromPredicate;
1559
- /**
1560
- * Transforms an exception into an `Option`. If `f` throws, returns `None`, otherwise returns the output wrapped in a
1561
- * `Some`.
1562
- *
1563
- * @example
1564
- * import { none, some, tryCatch } from 'fp-ts/Option'
1565
- *
1566
- * assert.deepStrictEqual(
1567
- * tryCatch(() => {
1568
- * throw new Error()
1569
- * }),
1570
- * none
1571
- * )
1572
- * assert.deepStrictEqual(tryCatch(() => 1), some(1))
1573
- *
1574
- * @category constructors
1575
- * @since 2.0.0
1576
- */
1577
- function tryCatch(f) {
1578
- try {
1579
- return exports.some(f());
1580
- }
1581
- catch (e) {
1582
- return exports.none;
860
+ const CustomFund = class {
861
+ constructor(hostRef) {
862
+ registerInstance(this, hostRef);
863
+ this.currentCustomFund = myOwnFundCustomOption;
864
+ this.showFundOptionsSelection = false;
865
+ }
866
+ componentWillLoad() {
867
+ let currentRoute = SuperSelectionAppRoutes.MyOwnFund;
868
+ if (window.location.pathname.includes(SuperSelectionAppRoutes.MyOwnFund))
869
+ currentRoute = SuperSelectionAppRoutes.MyOwnFund;
870
+ if (window.location.pathname.includes(SuperSelectionAppRoutes.DefaultFund))
871
+ currentRoute = SuperSelectionAppRoutes.DefaultFund;
872
+ if (window.location.pathname.includes(SuperSelectionAppRoutes.SelfManagedFund))
873
+ currentRoute = SuperSelectionAppRoutes.SelfManagedFund;
874
+ if (window.location.pathname.includes(SuperSelectionAppRoutes.FeaturedFunds))
875
+ currentRoute = SuperSelectionAppRoutes.FeaturedFunds;
876
+ this.fundOptionsList = [
877
+ myOwnFundCustomOption,
878
+ {
879
+ label: CustomFundTypes.SelfManagedFund,
880
+ value: SuperSelectionAppRoutes.SelfManagedFund
881
+ }
882
+ ];
883
+ if (superSelectionAppService.isFeaturedFundsEnabled &&
884
+ superSelectionAppService.isUsingSuperCampaign) {
885
+ this.fundOptionsList.push({
886
+ label: CustomFundTypes.FeaturedFunds,
887
+ value: SuperSelectionAppRoutes.FeaturedFunds
888
+ });
1583
889
  }
1584
- }
1585
- exports.tryCatch = tryCatch;
1586
- /**
1587
- * Returns the `Left` value of an `Either` if possible.
1588
- *
1589
- * @example
1590
- * import { getLeft, none, some } from 'fp-ts/Option'
1591
- * import { right, left } from 'fp-ts/Either'
1592
- *
1593
- * assert.deepStrictEqual(getLeft(right(1)), none)
1594
- * assert.deepStrictEqual(getLeft(left('a')), some('a'))
1595
- *
1596
- * @category constructors
1597
- * @since 2.0.0
1598
- */
1599
- function getLeft(ma) {
1600
- return ma._tag === 'Right' ? exports.none : exports.some(ma.left);
1601
- }
1602
- exports.getLeft = getLeft;
1603
- /**
1604
- * Returns the `Right` value of an `Either` if possible.
1605
- *
1606
- * @example
1607
- * import { getRight, none, some } from 'fp-ts/Option'
1608
- * import { right, left } from 'fp-ts/Either'
1609
- *
1610
- * assert.deepStrictEqual(getRight(right(1)), some(1))
1611
- * assert.deepStrictEqual(getRight(left('a')), none)
1612
- *
1613
- * @category constructors
1614
- * @since 2.0.0
1615
- */
1616
- function getRight(ma) {
1617
- return ma._tag === 'Left' ? exports.none : exports.some(ma.right);
1618
- }
1619
- exports.getRight = getRight;
1620
- /**
1621
- * Transforms an `Either` to an `Option` discarding the error.
1622
- *
1623
- * Alias of [getRight](#getRight)
1624
- *
1625
- * Derivable from `MonadThrow`.
1626
- *
1627
- * @category constructors
1628
- * @since 2.0.0
1629
- */
1630
- exports.fromEither = getRight;
1631
- // -------------------------------------------------------------------------------------
1632
- // destructors
1633
- // -------------------------------------------------------------------------------------
1634
- /**
1635
- * Takes a (lazy) default value, a function, and an `Option` value, if the `Option` value is `None` the default value is
1636
- * returned, otherwise the function is applied to the value inside the `Some` and the result is returned.
1637
- *
1638
- * @example
1639
- * import { some, none, fold } from 'fp-ts/Option'
1640
- * import { pipe } from 'fp-ts/function'
1641
- *
1642
- * assert.strictEqual(
1643
- * pipe(
1644
- * some(1),
1645
- * fold(() => 'a none', a => `a some containing ${a}`)
1646
- * ),
1647
- * 'a some containing 1'
1648
- * )
1649
- *
1650
- * assert.strictEqual(
1651
- * pipe(
1652
- * none,
1653
- * fold(() => 'a none', a => `a some containing ${a}`)
1654
- * ),
1655
- * 'a none'
1656
- * )
1657
- *
1658
- * @category destructors
1659
- * @since 2.0.0
1660
- */
1661
- function fold(onNone, onSome) {
1662
- return function (ma) { return (exports.isNone(ma) ? onNone() : onSome(ma.value)); };
1663
- }
1664
- exports.fold = fold;
1665
- /**
1666
- * Extracts the value out of the structure, if it exists. Otherwise returns `null`.
1667
- *
1668
- * @example
1669
- * import { some, none, toNullable } from 'fp-ts/Option'
1670
- * import { pipe } from 'fp-ts/function'
1671
- *
1672
- * assert.strictEqual(
1673
- * pipe(
1674
- * some(1),
1675
- * toNullable
1676
- * ),
1677
- * 1
1678
- * )
1679
- * assert.strictEqual(
1680
- * pipe(
1681
- * none,
1682
- * toNullable
1683
- * ),
1684
- * null
1685
- * )
1686
- *
1687
- * @category destructors
1688
- * @since 2.0.0
1689
- */
1690
- function toNullable(ma) {
1691
- return exports.isNone(ma) ? null : ma.value;
1692
- }
1693
- exports.toNullable = toNullable;
1694
- /**
1695
- * Extracts the value out of the structure, if it exists. Otherwise returns `undefined`.
1696
- *
1697
- * @example
1698
- * import { some, none, toUndefined } from 'fp-ts/Option'
1699
- * import { pipe } from 'fp-ts/function'
1700
- *
1701
- * assert.strictEqual(
1702
- * pipe(
1703
- * some(1),
1704
- * toUndefined
1705
- * ),
1706
- * 1
1707
- * )
1708
- * assert.strictEqual(
1709
- * pipe(
1710
- * none,
1711
- * toUndefined
1712
- * ),
1713
- * undefined
1714
- * )
1715
- *
1716
- * @category destructors
1717
- * @since 2.0.0
1718
- */
1719
- function toUndefined(ma) {
1720
- return exports.isNone(ma) ? undefined : ma.value;
1721
- }
1722
- exports.toUndefined = toUndefined;
1723
- /**
1724
- * Less strict version of [`getOrElse`](#getOrElse).
1725
- *
1726
- * @category destructors
1727
- * @since 2.6.0
1728
- */
1729
- var getOrElseW = function (onNone) { return function (ma) { return (exports.isNone(ma) ? onNone() : ma.value); }; };
1730
- exports.getOrElseW = getOrElseW;
1731
- /**
1732
- * Extracts the value out of the structure, if it exists. Otherwise returns the given default value
1733
- *
1734
- * @example
1735
- * import { some, none, getOrElse } from 'fp-ts/Option'
1736
- * import { pipe } from 'fp-ts/function'
1737
- *
1738
- * assert.strictEqual(
1739
- * pipe(
1740
- * some(1),
1741
- * getOrElse(() => 0)
1742
- * ),
1743
- * 1
1744
- * )
1745
- * assert.strictEqual(
1746
- * pipe(
1747
- * none,
1748
- * getOrElse(() => 0)
1749
- * ),
1750
- * 0
1751
- * )
1752
- *
1753
- * @category destructors
1754
- * @since 2.0.0
1755
- */
1756
- exports.getOrElse = exports.getOrElseW;
1757
- // -------------------------------------------------------------------------------------
1758
- // combinators
1759
- // -------------------------------------------------------------------------------------
1760
- /**
1761
- * Returns a *smart constructor* from a function that returns a nullable value.
1762
- *
1763
- * @example
1764
- * import { fromNullableK, none, some } from 'fp-ts/Option'
1765
- *
1766
- * const f = (s: string): number | undefined => {
1767
- * const n = parseFloat(s)
1768
- * return isNaN(n) ? undefined : n
1769
- * }
1770
- *
1771
- * const g = fromNullableK(f)
1772
- *
1773
- * assert.deepStrictEqual(g('1'), some(1))
1774
- * assert.deepStrictEqual(g('a'), none)
1775
- *
1776
- * @category combinators
1777
- * @since 2.9.0
1778
- */
1779
- function fromNullableK(f) {
1780
- return function () {
1781
- var a = [];
1782
- for (var _i = 0; _i < arguments.length; _i++) {
1783
- a[_i] = arguments[_i];
1784
- }
1785
- return fromNullable(f.apply(void 0, a));
1786
- };
1787
- }
1788
- exports.fromNullableK = fromNullableK;
1789
- /**
1790
- * @category combinators
1791
- * @since 2.0.0
1792
- * @deprecated
1793
- */
1794
- exports.mapNullable = chainNullableK;
1795
- /**
1796
- * This is `chain` + `fromNullable`, useful when working with optional values.
1797
- *
1798
- * @example
1799
- * import { some, none, fromNullable, chainNullableK } from 'fp-ts/Option'
1800
- * import { pipe } from 'fp-ts/function'
1801
- *
1802
- * interface Employee {
1803
- * company?: {
1804
- * address?: {
1805
- * street?: {
1806
- * name?: string
1807
- * }
1808
- * }
1809
- * }
1810
- * }
1811
- *
1812
- * const employee1: Employee = { company: { address: { street: { name: 'high street' } } } }
1813
- *
1814
- * assert.deepStrictEqual(
1815
- * pipe(
1816
- * fromNullable(employee1.company),
1817
- * chainNullableK(company => company.address),
1818
- * chainNullableK(address => address.street),
1819
- * chainNullableK(street => street.name)
1820
- * ),
1821
- * some('high street')
1822
- * )
1823
- *
1824
- * const employee2: Employee = { company: { address: { street: {} } } }
1825
- *
1826
- * assert.deepStrictEqual(
1827
- * pipe(
1828
- * fromNullable(employee2.company),
1829
- * chainNullableK(company => company.address),
1830
- * chainNullableK(address => address.street),
1831
- * chainNullableK(street => street.name)
1832
- * ),
1833
- * none
1834
- * )
1835
- *
1836
- * @category combinators
1837
- * @since 2.9.0
1838
- */
1839
- function chainNullableK(f) {
1840
- return function (ma) { return (exports.isNone(ma) ? exports.none : fromNullable(f(ma.value))); };
1841
- }
1842
- exports.chainNullableK = chainNullableK;
1843
- // -------------------------------------------------------------------------------------
1844
- // non-pipeables
1845
- // -------------------------------------------------------------------------------------
1846
- var map_ = function (fa, f) { return _function.pipe(fa, exports.map(f)); };
1847
- var ap_ = function (fab, fa) { return _function.pipe(fab, exports.ap(fa)); };
1848
- var chain_ = function (ma, f) { return _function.pipe(ma, exports.chain(f)); };
1849
- var reduce_ = function (fa, b, f) { return _function.pipe(fa, exports.reduce(b, f)); };
1850
- var foldMap_ = function (M) {
1851
- var foldMapM = exports.foldMap(M);
1852
- return function (fa, f) { return _function.pipe(fa, foldMapM(f)); };
1853
- };
1854
- var reduceRight_ = function (fa, b, f) { return _function.pipe(fa, exports.reduceRight(b, f)); };
1855
- var traverse_ = function (F) {
1856
- var traverseF = exports.traverse(F);
1857
- return function (ta, f) { return _function.pipe(ta, traverseF(f)); };
1858
- };
1859
- /* istanbul ignore next */
1860
- var alt_ = function (fa, that) { return _function.pipe(fa, exports.alt(that)); };
1861
- var filter_ = function (fa, predicate) {
1862
- return _function.pipe(fa, exports.filter(predicate));
1863
- };
1864
- /* istanbul ignore next */
1865
- var filterMap_ = function (fa, f) { return _function.pipe(fa, exports.filterMap(f)); };
1866
- /* istanbul ignore next */
1867
- var extend_ = function (wa, f) { return _function.pipe(wa, exports.extend(f)); };
1868
- /* istanbul ignore next */
1869
- var partition_ = function (fa, predicate) { return _function.pipe(fa, exports.partition(predicate)); };
1870
- /* istanbul ignore next */
1871
- var partitionMap_ = function (fa, f) { return _function.pipe(fa, exports.partitionMap(f)); };
1872
- /* istanbul ignore next */
1873
- var wither_ = function (F) {
1874
- var witherF = exports.wither(F);
1875
- return function (fa, f) { return _function.pipe(fa, witherF(f)); };
1876
- };
1877
- /* istanbul ignore next */
1878
- var wilt_ = function (F) {
1879
- var wiltF = exports.wilt(F);
1880
- return function (fa, f) { return _function.pipe(fa, wiltF(f)); };
1881
- };
1882
- // -------------------------------------------------------------------------------------
1883
- // pipeables
1884
- // -------------------------------------------------------------------------------------
1885
- /**
1886
- * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
1887
- * use the type constructor `F` to represent some computational context.
1888
- *
1889
- * @category Functor
1890
- * @since 2.0.0
1891
- */
1892
- var map = function (f) { return function (fa) {
1893
- return exports.isNone(fa) ? exports.none : exports.some(f(fa.value));
1894
- }; };
1895
- exports.map = map;
1896
- /**
1897
- * Apply a function to an argument under a type constructor.
1898
- *
1899
- * @category Apply
1900
- * @since 2.0.0
1901
- */
1902
- var ap = function (fa) { return function (fab) {
1903
- return exports.isNone(fab) ? exports.none : exports.isNone(fa) ? exports.none : exports.some(fab.value(fa.value));
1904
- }; };
1905
- exports.ap = ap;
1906
- /**
1907
- * Combine two effectful actions, keeping only the result of the first.
1908
- *
1909
- * Derivable from `Apply`.
1910
- *
1911
- * @category combinators
1912
- * @since 2.0.0
1913
- */
1914
- var apFirst = function (fb) {
1915
- return _function.flow(exports.map(function (a) { return function () { return a; }; }), exports.ap(fb));
1916
- };
1917
- exports.apFirst = apFirst;
1918
- /**
1919
- * Combine two effectful actions, keeping only the result of the second.
1920
- *
1921
- * Derivable from `Apply`.
1922
- *
1923
- * @category combinators
1924
- * @since 2.0.0
1925
- */
1926
- var apSecond = function (fb) {
1927
- return _function.flow(exports.map(function () { return function (b) { return b; }; }), exports.ap(fb));
1928
- };
1929
- exports.apSecond = apSecond;
1930
- /**
1931
- * Wrap a value into the type constructor.
1932
- *
1933
- * @category Applicative
1934
- * @since 2.7.0
1935
- */
1936
- exports.of = exports.some;
1937
- /**
1938
- * Composes computations in sequence, using the return value of one computation to determine the next computation.
1939
- *
1940
- * @category Monad
1941
- * @since 2.0.0
1942
- */
1943
- var chain = function (f) { return function (ma) {
1944
- return exports.isNone(ma) ? exports.none : f(ma.value);
1945
- }; };
1946
- exports.chain = chain;
1947
- /**
1948
- * Composes computations in sequence, using the return value of one computation to determine the next computation and
1949
- * keeping only the result of the first.
1950
- *
1951
- * Derivable from `Monad`.
1952
- *
1953
- * @category combinators
1954
- * @since 2.0.0
1955
- */
1956
- var chainFirst = function (f) {
1957
- return exports.chain(function (a) {
1958
- return _function.pipe(f(a), exports.map(function () { return a; }));
890
+ this.fundOptionsList.push({
891
+ label: CustomFundTypes.DefaultFund,
892
+ value: SuperSelectionAppRoutes.DefaultFund
1959
893
  });
1960
- };
1961
- exports.chainFirst = chainFirst;
1962
- /**
1963
- * Derivable from `Monad`.
1964
- *
1965
- * @category combinators
1966
- * @since 2.0.0
1967
- */
1968
- exports.flatten =
1969
- /*#__PURE__*/
1970
- exports.chain(_function.identity);
1971
- /**
1972
- * Less strict version of [`alt`](#alt).
1973
- *
1974
- * @category Alt
1975
- * @since 2.9.0
1976
- */
1977
- var altW = function (that) { return function (fa) {
1978
- return exports.isNone(fa) ? that() : fa;
1979
- }; };
1980
- exports.altW = altW;
1981
- /**
1982
- * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
1983
- * types of kind `* -> *`.
1984
- *
1985
- * In case of `Option` returns the left-most non-`None` value.
1986
- *
1987
- * @example
1988
- * import * as O from 'fp-ts/Option'
1989
- * import { pipe } from 'fp-ts/function'
1990
- *
1991
- * assert.deepStrictEqual(
1992
- * pipe(
1993
- * O.some('a'),
1994
- * O.alt(() => O.some('b'))
1995
- * ),
1996
- * O.some('a')
1997
- * )
1998
- * assert.deepStrictEqual(
1999
- * pipe(
2000
- * O.none,
2001
- * O.alt(() => O.some('b'))
2002
- * ),
2003
- * O.some('b')
2004
- * )
2005
- *
2006
- * @category Alt
2007
- * @since 2.0.0
2008
- */
2009
- exports.alt = exports.altW;
2010
- /**
2011
- * @category Alternative
2012
- * @since 2.7.0
2013
- */
2014
- var zero = function () { return exports.none; };
2015
- exports.zero = zero;
2016
- /**
2017
- * @category MonadThrow
2018
- * @since 2.7.0
2019
- */
2020
- var throwError = function () { return exports.none; };
2021
- exports.throwError = throwError;
2022
- /**
2023
- * @category Extend
2024
- * @since 2.0.0
2025
- */
2026
- var extend = function (f) { return function (wa) {
2027
- return exports.isNone(wa) ? exports.none : exports.some(f(wa));
2028
- }; };
2029
- exports.extend = extend;
2030
- /**
2031
- * Derivable from `Extend`.
2032
- *
2033
- * @category combinators
2034
- * @since 2.0.0
2035
- */
2036
- exports.duplicate =
2037
- /*#__PURE__*/
2038
- exports.extend(_function.identity);
2039
- /**
2040
- * @category Foldable
2041
- * @since 2.0.0
2042
- */
2043
- var reduce = function (b, f) { return function (fa) {
2044
- return exports.isNone(fa) ? b : f(b, fa.value);
2045
- }; };
2046
- exports.reduce = reduce;
2047
- /**
2048
- * @category Foldable
2049
- * @since 2.0.0
2050
- */
2051
- var foldMap = function (M) { return function (f) { return function (fa) {
2052
- return exports.isNone(fa) ? M.empty : f(fa.value);
2053
- }; }; };
2054
- exports.foldMap = foldMap;
2055
- /**
2056
- * @category Foldable
2057
- * @since 2.0.0
2058
- */
2059
- var reduceRight = function (b, f) { return function (fa) {
2060
- return exports.isNone(fa) ? b : f(fa.value, b);
2061
- }; };
2062
- exports.reduceRight = reduceRight;
2063
- /**
2064
- * @category Compactable
2065
- * @since 2.0.0
2066
- */
2067
- exports.compact = exports.flatten;
2068
- var defaultSeparate = { left: exports.none, right: exports.none };
2069
- /**
2070
- * @category Compactable
2071
- * @since 2.0.0
2072
- */
2073
- var separate = function (ma) {
2074
- var o = _function.pipe(ma, exports.map(function (e) { return ({
2075
- left: getLeft(e),
2076
- right: getRight(e)
2077
- }); }));
2078
- return exports.isNone(o) ? defaultSeparate : o.value;
2079
- };
2080
- exports.separate = separate;
2081
- /**
2082
- * @category Filterable
2083
- * @since 2.0.0
2084
- */
2085
- var filter = function (predicate) { return function (fa) { return (exports.isNone(fa) ? exports.none : predicate(fa.value) ? fa : exports.none); }; };
2086
- exports.filter = filter;
2087
- /**
2088
- * @category Filterable
2089
- * @since 2.0.0
2090
- */
2091
- var filterMap = function (f) { return function (fa) {
2092
- return exports.isNone(fa) ? exports.none : f(fa.value);
2093
- }; };
2094
- exports.filterMap = filterMap;
2095
- /**
2096
- * @category Filterable
2097
- * @since 2.0.0
2098
- */
2099
- var partition = function (predicate) { return function (fa) {
2100
- return {
2101
- left: filter_(fa, function (a) { return !predicate(a); }),
2102
- right: filter_(fa, predicate)
2103
- };
2104
- }; };
2105
- exports.partition = partition;
2106
- /**
2107
- * @category Filterable
2108
- * @since 2.0.0
2109
- */
2110
- var partitionMap = function (f) { return _function.flow(exports.map(f), exports.separate); };
2111
- exports.partitionMap = partitionMap;
2112
- /**
2113
- * @category Traversable
2114
- * @since 2.6.3
2115
- */
2116
- 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)); }; }; };
2117
- exports.traverse = traverse;
2118
- /**
2119
- * @category Traversable
2120
- * @since 2.6.3
2121
- */
2122
- var sequence = function (F) { return function (ta) { return (exports.isNone(ta) ? F.of(exports.none) : F.map(ta.value, exports.some)); }; };
2123
- exports.sequence = sequence;
2124
- /**
2125
- * @category Witherable
2126
- * @since 2.6.5
2127
- */
2128
- var wither = function (F) { return function (f) { return function (fa) { return (exports.isNone(fa) ? F.of(exports.none) : f(fa.value)); }; }; };
2129
- exports.wither = wither;
2130
- /**
2131
- * @category Witherable
2132
- * @since 2.6.5
2133
- */
2134
- var wilt = function (F) { return function (f) { return function (fa) {
2135
- return exports.isNone(fa)
2136
- ? F.of({
2137
- left: exports.none,
2138
- right: exports.none
2139
- })
2140
- : F.map(f(fa.value), function (e) { return ({
2141
- left: getLeft(e),
2142
- right: getRight(e)
2143
- }); });
2144
- }; }; };
2145
- exports.wilt = wilt;
2146
- // -------------------------------------------------------------------------------------
2147
- // instances
2148
- // -------------------------------------------------------------------------------------
2149
- /**
2150
- * @category instances
2151
- * @since 2.0.0
2152
- */
2153
- exports.URI = 'Option';
2154
- /**
2155
- * @category instances
2156
- * @since 2.0.0
2157
- */
2158
- function getShow(S) {
2159
- return {
2160
- show: function (ma) { return (exports.isNone(ma) ? 'none' : "some(" + S.show(ma.value) + ")"); }
2161
- };
2162
- }
2163
- exports.getShow = getShow;
2164
- /**
2165
- * @example
2166
- * import { none, some, getEq } from 'fp-ts/Option'
2167
- * import { eqNumber } from 'fp-ts/Eq'
2168
- *
2169
- * const E = getEq(eqNumber)
2170
- * assert.strictEqual(E.equals(none, none), true)
2171
- * assert.strictEqual(E.equals(none, some(1)), false)
2172
- * assert.strictEqual(E.equals(some(1), none), false)
2173
- * assert.strictEqual(E.equals(some(1), some(2)), false)
2174
- * assert.strictEqual(E.equals(some(1), some(1)), true)
2175
- *
2176
- * @category instances
2177
- * @since 2.0.0
2178
- */
2179
- function getEq(E) {
2180
- return {
2181
- equals: function (x, y) { return x === y || (exports.isNone(x) ? exports.isNone(y) : exports.isNone(y) ? false : E.equals(x.value, y.value)); }
2182
- };
2183
- }
2184
- exports.getEq = getEq;
2185
- /**
2186
- * The `Ord` instance allows `Option` values to be compared with
2187
- * `compare`, whenever there is an `Ord` instance for
2188
- * the type the `Option` contains.
2189
- *
2190
- * `None` is considered to be less than any `Some` value.
2191
- *
2192
- *
2193
- * @example
2194
- * import { none, some, getOrd } from 'fp-ts/Option'
2195
- * import { ordNumber } from 'fp-ts/Ord'
2196
- *
2197
- * const O = getOrd(ordNumber)
2198
- * assert.strictEqual(O.compare(none, none), 0)
2199
- * assert.strictEqual(O.compare(none, some(1)), -1)
2200
- * assert.strictEqual(O.compare(some(1), none), 1)
2201
- * assert.strictEqual(O.compare(some(1), some(2)), -1)
2202
- * assert.strictEqual(O.compare(some(1), some(1)), 0)
2203
- *
2204
- * @category instances
2205
- * @since 2.0.0
2206
- */
2207
- function getOrd(O) {
2208
- return {
2209
- equals: getEq(O).equals,
2210
- compare: function (x, y) { return (x === y ? 0 : exports.isSome(x) ? (exports.isSome(y) ? O.compare(x.value, y.value) : 1) : -1); }
2211
- };
2212
- }
2213
- exports.getOrd = getOrd;
2214
- /**
2215
- * `Apply` semigroup
2216
- *
2217
- * | x | y | concat(x, y) |
2218
- * | ------- | ------- | ------------------ |
2219
- * | none | none | none |
2220
- * | some(a) | none | none |
2221
- * | none | some(a) | none |
2222
- * | some(a) | some(b) | some(concat(a, b)) |
2223
- *
2224
- * @example
2225
- * import { getApplySemigroup, some, none } from 'fp-ts/Option'
2226
- * import { semigroupSum } from 'fp-ts/Semigroup'
2227
- *
2228
- * const S = getApplySemigroup(semigroupSum)
2229
- * assert.deepStrictEqual(S.concat(none, none), none)
2230
- * assert.deepStrictEqual(S.concat(some(1), none), none)
2231
- * assert.deepStrictEqual(S.concat(none, some(1)), none)
2232
- * assert.deepStrictEqual(S.concat(some(1), some(2)), some(3))
2233
- *
2234
- * @category instances
2235
- * @since 2.0.0
2236
- */
2237
- function getApplySemigroup(S) {
2238
- return {
2239
- concat: function (x, y) { return (exports.isSome(x) && exports.isSome(y) ? exports.some(S.concat(x.value, y.value)) : exports.none); }
2240
- };
2241
- }
2242
- exports.getApplySemigroup = getApplySemigroup;
2243
- /**
2244
- * @category instances
2245
- * @since 2.0.0
2246
- */
2247
- function getApplyMonoid(M) {
2248
- return {
2249
- concat: getApplySemigroup(M).concat,
2250
- empty: exports.some(M.empty)
2251
- };
2252
- }
2253
- exports.getApplyMonoid = getApplyMonoid;
2254
- /**
2255
- * Monoid returning the left-most non-`None` value
2256
- *
2257
- * | x | y | concat(x, y) |
2258
- * | ------- | ------- | ------------ |
2259
- * | none | none | none |
2260
- * | some(a) | none | some(a) |
2261
- * | none | some(a) | some(a) |
2262
- * | some(a) | some(b) | some(a) |
2263
- *
2264
- * @example
2265
- * import { getFirstMonoid, some, none } from 'fp-ts/Option'
2266
- *
2267
- * const M = getFirstMonoid<number>()
2268
- * assert.deepStrictEqual(M.concat(none, none), none)
2269
- * assert.deepStrictEqual(M.concat(some(1), none), some(1))
2270
- * assert.deepStrictEqual(M.concat(none, some(1)), some(1))
2271
- * assert.deepStrictEqual(M.concat(some(1), some(2)), some(1))
2272
- *
2273
- * @category instances
2274
- * @since 2.0.0
2275
- */
2276
- function getFirstMonoid() {
2277
- return {
2278
- concat: function (x, y) { return (exports.isNone(x) ? y : x); },
2279
- empty: exports.none
2280
- };
2281
- }
2282
- exports.getFirstMonoid = getFirstMonoid;
2283
- /**
2284
- * Monoid returning the right-most non-`None` value
2285
- *
2286
- * | x | y | concat(x, y) |
2287
- * | ------- | ------- | ------------ |
2288
- * | none | none | none |
2289
- * | some(a) | none | some(a) |
2290
- * | none | some(a) | some(a) |
2291
- * | some(a) | some(b) | some(b) |
2292
- *
2293
- * @example
2294
- * import { getLastMonoid, some, none } from 'fp-ts/Option'
2295
- *
2296
- * const M = getLastMonoid<number>()
2297
- * assert.deepStrictEqual(M.concat(none, none), none)
2298
- * assert.deepStrictEqual(M.concat(some(1), none), some(1))
2299
- * assert.deepStrictEqual(M.concat(none, some(1)), some(1))
2300
- * assert.deepStrictEqual(M.concat(some(1), some(2)), some(2))
2301
- *
2302
- * @category instances
2303
- * @since 2.0.0
2304
- */
2305
- function getLastMonoid() {
2306
- return {
2307
- concat: function (x, y) { return (exports.isNone(y) ? x : y); },
2308
- empty: exports.none
2309
- };
2310
- }
2311
- exports.getLastMonoid = getLastMonoid;
2312
- /**
2313
- * Monoid returning the left-most non-`None` value. If both operands are `Some`s then the inner values are
2314
- * concatenated using the provided `Semigroup`
2315
- *
2316
- * | x | y | concat(x, y) |
2317
- * | ------- | ------- | ------------------ |
2318
- * | none | none | none |
2319
- * | some(a) | none | some(a) |
2320
- * | none | some(a) | some(a) |
2321
- * | some(a) | some(b) | some(concat(a, b)) |
2322
- *
2323
- * @example
2324
- * import { getMonoid, some, none } from 'fp-ts/Option'
2325
- * import { semigroupSum } from 'fp-ts/Semigroup'
2326
- *
2327
- * const M = getMonoid(semigroupSum)
2328
- * assert.deepStrictEqual(M.concat(none, none), none)
2329
- * assert.deepStrictEqual(M.concat(some(1), none), some(1))
2330
- * assert.deepStrictEqual(M.concat(none, some(1)), some(1))
2331
- * assert.deepStrictEqual(M.concat(some(1), some(2)), some(3))
2332
- *
2333
- * @category instances
2334
- * @since 2.0.0
2335
- */
2336
- function getMonoid(S) {
2337
- return {
2338
- concat: function (x, y) { return (exports.isNone(x) ? y : exports.isNone(y) ? x : exports.some(S.concat(x.value, y.value))); },
2339
- empty: exports.none
2340
- };
2341
- }
2342
- exports.getMonoid = getMonoid;
2343
- /**
2344
- * @category instances
2345
- * @since 2.7.0
2346
- */
2347
- exports.Functor = {
2348
- URI: exports.URI,
2349
- map: map_
2350
- };
2351
- /**
2352
- * @category instances
2353
- * @since 2.7.0
2354
- */
2355
- exports.Applicative = {
2356
- URI: exports.URI,
2357
- map: map_,
2358
- ap: ap_,
2359
- of: exports.of
2360
- };
2361
- /**
2362
- * @category instances
2363
- * @since 2.7.0
2364
- */
2365
- exports.Monad = {
2366
- URI: exports.URI,
2367
- map: map_,
2368
- ap: ap_,
2369
- of: exports.of,
2370
- chain: chain_
2371
- };
2372
- /**
2373
- * @category instances
2374
- * @since 2.7.0
2375
- */
2376
- exports.Foldable = {
2377
- URI: exports.URI,
2378
- reduce: reduce_,
2379
- foldMap: foldMap_,
2380
- reduceRight: reduceRight_
2381
- };
2382
- /**
2383
- * @category instances
2384
- * @since 2.7.0
2385
- */
2386
- exports.Alt = {
2387
- URI: exports.URI,
2388
- map: map_,
2389
- alt: alt_
2390
- };
2391
- /**
2392
- * @category instances
2393
- * @since 2.7.0
2394
- */
2395
- exports.Alternative = {
2396
- URI: exports.URI,
2397
- map: map_,
2398
- ap: ap_,
2399
- of: exports.of,
2400
- alt: alt_,
2401
- zero: exports.zero
2402
- };
2403
- /**
2404
- * @category instances
2405
- * @since 2.7.0
2406
- */
2407
- exports.Extend = {
2408
- URI: exports.URI,
2409
- map: map_,
2410
- extend: extend_
2411
- };
2412
- /**
2413
- * @category instances
2414
- * @since 2.7.0
2415
- */
2416
- exports.Compactable = {
2417
- URI: exports.URI,
2418
- compact: exports.compact,
2419
- separate: exports.separate
2420
- };
2421
- /**
2422
- * @category instances
2423
- * @since 2.7.0
2424
- */
2425
- exports.Filterable = {
2426
- URI: exports.URI,
2427
- map: map_,
2428
- compact: exports.compact,
2429
- separate: exports.separate,
2430
- filter: filter_,
2431
- filterMap: filterMap_,
2432
- partition: partition_,
2433
- partitionMap: partitionMap_
2434
- };
2435
- /**
2436
- * @category instances
2437
- * @since 2.7.0
2438
- */
2439
- exports.Traversable = {
2440
- URI: exports.URI,
2441
- map: map_,
2442
- reduce: reduce_,
2443
- foldMap: foldMap_,
2444
- reduceRight: reduceRight_,
2445
- traverse: traverse_,
2446
- sequence: exports.sequence
2447
- };
2448
- /**
2449
- * @category instances
2450
- * @since 2.7.0
2451
- */
2452
- exports.Witherable = {
2453
- URI: exports.URI,
2454
- map: map_,
2455
- reduce: reduce_,
2456
- foldMap: foldMap_,
2457
- reduceRight: reduceRight_,
2458
- traverse: traverse_,
2459
- sequence: exports.sequence,
2460
- compact: exports.compact,
2461
- separate: exports.separate,
2462
- filter: filter_,
2463
- filterMap: filterMap_,
2464
- partition: partition_,
2465
- partitionMap: partitionMap_,
2466
- wither: wither_,
2467
- wilt: wilt_
2468
- };
2469
- /**
2470
- * @category instances
2471
- * @since 2.7.0
2472
- */
2473
- exports.MonadThrow = {
2474
- URI: exports.URI,
2475
- map: map_,
2476
- ap: ap_,
2477
- of: exports.of,
2478
- chain: chain_,
2479
- throwError: exports.throwError
2480
- };
2481
- // TODO: remove in v3
2482
- /**
2483
- * @category instances
2484
- * @since 2.0.0
2485
- */
2486
- exports.option = {
2487
- URI: exports.URI,
2488
- map: map_,
2489
- of: exports.of,
2490
- ap: ap_,
2491
- chain: chain_,
2492
- reduce: reduce_,
2493
- foldMap: foldMap_,
2494
- reduceRight: reduceRight_,
2495
- traverse: traverse_,
2496
- sequence: exports.sequence,
2497
- zero: exports.zero,
2498
- alt: alt_,
2499
- extend: extend_,
2500
- compact: exports.compact,
2501
- separate: exports.separate,
2502
- filter: filter_,
2503
- filterMap: filterMap_,
2504
- partition: partition_,
2505
- partitionMap: partitionMap_,
2506
- wither: wither_,
2507
- wilt: wilt_,
2508
- throwError: exports.throwError
2509
- };
2510
- // -------------------------------------------------------------------------------------
2511
- // utils
2512
- // -------------------------------------------------------------------------------------
2513
- /**
2514
- * Returns `true` if `ma` contains `a`
2515
- *
2516
- * @example
2517
- * import { some, none, elem } from 'fp-ts/Option'
2518
- * import { eqNumber } from 'fp-ts/Eq'
2519
- *
2520
- * assert.strictEqual(elem(eqNumber)(1, some(1)), true)
2521
- * assert.strictEqual(elem(eqNumber)(2, some(1)), false)
2522
- * assert.strictEqual(elem(eqNumber)(1, none), false)
2523
- *
2524
- * @since 2.0.0
2525
- */
2526
- function elem(E) {
2527
- return function (a, ma) { return (exports.isNone(ma) ? false : E.equals(a, ma.value)); };
2528
- }
2529
- exports.elem = elem;
2530
- /**
2531
- * Returns `true` if the predicate is satisfied by the wrapped value
2532
- *
2533
- * @example
2534
- * import { some, none, exists } from 'fp-ts/Option'
2535
- * import { pipe } from 'fp-ts/function'
2536
- *
2537
- * assert.strictEqual(
2538
- * pipe(
2539
- * some(1),
2540
- * exists(n => n > 0)
2541
- * ),
2542
- * true
2543
- * )
2544
- * assert.strictEqual(
2545
- * pipe(
2546
- * some(1),
2547
- * exists(n => n > 1)
2548
- * ),
2549
- * false
2550
- * )
2551
- * assert.strictEqual(
2552
- * pipe(
2553
- * none,
2554
- * exists(n => n > 0)
2555
- * ),
2556
- * false
2557
- * )
2558
- *
2559
- * @since 2.0.0
2560
- */
2561
- function exists(predicate) {
2562
- return function (ma) { return (exports.isNone(ma) ? false : predicate(ma.value)); };
2563
- }
2564
- exports.exists = exists;
2565
- /**
2566
- * Returns a `Refinement` (i.e. a custom type guard) from a `Option` returning function.
2567
- * This function ensures that a custom type guard definition is type-safe.
2568
- *
2569
- * ```ts
2570
- * import { some, none, getRefinement } from 'fp-ts/Option'
2571
- *
2572
- * type A = { type: 'A' }
2573
- * type B = { type: 'B' }
2574
- * type C = A | B
2575
- *
2576
- * const isA = (c: C): c is A => c.type === 'B' // <= typo but typescript doesn't complain
2577
- * const isA = getRefinement<C, A>(c => (c.type === 'B' ? some(c) : none)) // static error: Type '"B"' is not assignable to type '"A"'
2578
- * ```
2579
- *
2580
- * @since 2.0.0
2581
- */
2582
- function getRefinement(getOption) {
2583
- return function (a) { return exports.isSome(getOption(a)); };
2584
- }
2585
- exports.getRefinement = getRefinement;
2586
- // -------------------------------------------------------------------------------------
2587
- // do notation
2588
- // -------------------------------------------------------------------------------------
2589
- /**
2590
- * @since 2.9.0
2591
- */
2592
- exports.Do =
2593
- /*#__PURE__*/
2594
- exports.of({});
2595
- /**
2596
- * @since 2.8.0
2597
- */
2598
- var bindTo = function (name) { return exports.map(_function.bindTo_(name)); };
2599
- exports.bindTo = bindTo;
2600
- /**
2601
- * @since 2.8.0
2602
- */
2603
- var bind = function (name, f) {
2604
- return exports.chain(function (a) {
2605
- return _function.pipe(f(a), exports.map(function (b) { return _function.bind_(a, name, b); }));
2606
- });
2607
- };
2608
- exports.bind = bind;
2609
- // -------------------------------------------------------------------------------------
2610
- // pipeable sequence S
2611
- // -------------------------------------------------------------------------------------
2612
- /**
2613
- * @since 2.8.0
2614
- */
2615
- var apS = function (name, fb) {
2616
- return _function.flow(exports.map(function (a) { return function (b) { return _function.bind_(a, name, b); }; }), exports.ap(fb));
2617
- };
2618
- exports.apS = apS;
2619
- // -------------------------------------------------------------------------------------
2620
- // array utils
2621
- // -------------------------------------------------------------------------------------
2622
- /**
2623
- *
2624
- * @since 2.9.0
2625
- */
2626
- var traverseArrayWithIndex = function (f) { return function (arr) {
2627
- // tslint:disable-next-line: readonly-array
2628
- var result = [];
2629
- for (var i = 0; i < arr.length; i++) {
2630
- var b = f(i, arr[i]);
2631
- if (exports.isNone(b)) {
2632
- return exports.none;
2633
- }
2634
- result.push(b.value);
2635
- }
2636
- return exports.some(result);
2637
- }; };
2638
- exports.traverseArrayWithIndex = traverseArrayWithIndex;
2639
- /**
2640
- * Runs an action for every element in array and accumulates the results in option
2641
- *
2642
- * this function have the same behavior of `A.sequence(O.option)` but it's optimized and perform better
2643
- *
2644
- * @example
2645
- *
2646
- * import * as A from 'fp-ts/Array'
2647
- * import { traverseArray, some, fromPredicate, none } from 'fp-ts/Option'
2648
- * import { pipe } from 'fp-ts/function'
2649
- *
2650
- * const arr = A.range(0, 10)
2651
- * assert.deepStrictEqual(pipe(arr, traverseArray(some)), some(arr))
2652
- * assert.deepStrictEqual(pipe(arr, traverseArray(fromPredicate((x) => x > 5))), none)
2653
- *
2654
- * @since 2.9.0
2655
- */
2656
- var traverseArray = function (f) { return exports.traverseArrayWithIndex(function (_, a) { return f(a); }); };
2657
- exports.traverseArray = traverseArray;
2658
- /**
2659
- * get an array of option and convert it to option of array
2660
- *
2661
- * this function have the same behavior of `A.sequence(O.option)` but it's optimized and perform better
2662
- *
2663
- * @example
2664
- *
2665
- * import * as A from 'fp-ts/Array'
2666
- * import { sequenceArray, some, none, fromPredicate } from 'fp-ts/Option'
2667
- * import { pipe } from 'fp-ts/function'
2668
- *
2669
- * const arr = A.range(0, 10)
2670
- * assert.deepStrictEqual(pipe(arr, A.map(some), sequenceArray), some(arr))
2671
- * assert.deepStrictEqual(pipe(arr, A.map(fromPredicate(x => x > 8)), sequenceArray), none)
2672
- *
2673
- * @since 2.9.0
2674
- */
2675
- exports.sequenceArray =
2676
- /*#__PURE__*/
2677
- exports.traverseArray(_function.identity);
2678
- });
2679
-
2680
- 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";
2681
-
2682
- var __assign$1 = (undefined && undefined.__assign) || function () {
2683
- __assign$1 = Object.assign || function(t) {
2684
- for (var s, i = 1, n = arguments.length; i < n; i++) {
2685
- s = arguments[i];
2686
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
2687
- t[p] = s[p];
2688
- }
2689
- return t;
2690
- };
2691
- return __assign$1.apply(this, arguments);
2692
- };
2693
- var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
2694
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
2695
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
2696
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
2697
- r[k] = a[j];
2698
- return r;
2699
- };
2700
- var mix = function (one, two, mergeArrays) {
2701
- if (mergeArrays === void 0) { mergeArrays = false; }
2702
- if (!one || !two || typeof one !== "object" || typeof two !== "object")
2703
- return one;
2704
- var clone = __assign$1({}, one);
2705
- for (var prop in two) {
2706
- if (two.hasOwnProperty(prop)) {
2707
- if (two[prop] instanceof Array && one[prop] instanceof Array) {
2708
- clone[prop] = mergeArrays ? __spreadArrays(one[prop], two[prop]) : two[prop];
2709
- }
2710
- else if (typeof two[prop] === "object" && typeof one[prop] === "object") {
2711
- clone[prop] = mix(one[prop], two[prop], mergeArrays);
2712
- }
2713
- else {
2714
- clone[prop] = two[prop];
2715
- }
2716
- }
2717
- }
2718
- return clone;
2719
- };
2720
-
2721
- var __spreadArrays$1 = (undefined && undefined.__spreadArrays) || function () {
2722
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
2723
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
2724
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
2725
- r[k] = a[j];
2726
- return r;
2727
- };
2728
- var config = {
2729
- // Default options
2730
- defaults: {},
2731
- // Error type
2732
- errorType: null,
2733
- // Polyfills
2734
- polyfills: {
2735
- fetch: null,
2736
- FormData: null,
2737
- URLSearchParams: null,
2738
- performance: null,
2739
- PerformanceObserver: null,
2740
- AbortController: null
2741
- },
2742
- polyfill: function (p, _a) {
2743
- var _b = _a === void 0 ? {} : _a, _c = _b.doThrow, doThrow = _c === void 0 ? true : _c, _d = _b.instance, instance = _d === void 0 ? false : _d;
2744
- var args = [];
2745
- for (var _i = 2; _i < arguments.length; _i++) {
2746
- args[_i - 2] = arguments[_i];
2747
- }
2748
- var res = this.polyfills[p] ||
2749
- (typeof self !== "undefined" ? self[p] : null) ||
2750
- (typeof global !== "undefined" ? global[p] : null);
2751
- if (doThrow && !res)
2752
- throw new Error(p + " is not defined");
2753
- return instance && res ? new (res.bind.apply(res, __spreadArrays$1([void 0], args)))() : res;
2754
- }
2755
- };
2756
-
2757
- var onMatch = function (entries, name, callback, _performance) {
2758
- if (!entries.getEntriesByName)
2759
- return false;
2760
- var matches = entries.getEntriesByName(name);
2761
- if (matches && matches.length > 0) {
2762
- callback(matches.reverse()[0]);
2763
- if (_performance.clearMeasures)
2764
- _performance.clearMeasures(name);
2765
- perfs.callbacks.delete(name);
2766
- if (perfs.callbacks.size < 1) {
2767
- perfs.observer.disconnect();
2768
- if (_performance.clearResourceTimings) {
2769
- _performance.clearResourceTimings();
2770
- }
2771
- }
2772
- return true;
2773
- }
2774
- return false;
2775
- };
2776
- var lazyObserver = function (_performance, _observer) {
2777
- if (!perfs.observer && _performance && _observer) {
2778
- perfs.observer = new _observer(function (entries) {
2779
- perfs.callbacks.forEach(function (callback, name) {
2780
- onMatch(entries, name, callback, _performance);
2781
- });
2782
- });
2783
- if (_performance.clearResourceTimings)
2784
- _performance.clearResourceTimings();
2785
- }
2786
- return perfs.observer;
2787
- };
2788
- var perfs = {
2789
- callbacks: new Map(),
2790
- observer: null,
2791
- observe: function (name, callback) {
2792
- if (!name || !callback)
2793
- return;
2794
- var _performance = config.polyfill("performance", { doThrow: false });
2795
- var _observer = config.polyfill("PerformanceObserver", { doThrow: false });
2796
- if (!lazyObserver(_performance, _observer))
2797
- return;
2798
- if (!onMatch(_performance, name, callback, _performance)) {
2799
- if (perfs.callbacks.size < 1)
2800
- perfs.observer.observe({ entryTypes: ["resource", "measure"] });
2801
- perfs.callbacks.set(name, callback);
2802
- }
2803
- }
2804
- };
2805
-
2806
- var middlewareHelper = function (middlewares) { return function (fetchFunction) {
2807
- return (middlewares.length === 0 ?
2808
- fetchFunction :
2809
- middlewares.length === 1 ?
2810
- middlewares[0](fetchFunction) :
2811
- middlewares.reduceRight(function (acc, curr, idx) {
2812
- return (idx === middlewares.length - 2) ? curr(acc(fetchFunction)) : curr(acc);
2813
- }));
2814
- }; };
2815
-
2816
- var WretchErrorWrapper = /** @class */ (function () {
2817
- function WretchErrorWrapper(error) {
2818
- this.error = error;
2819
- }
2820
- return WretchErrorWrapper;
2821
- }());
2822
- var resolver = function (wretcher) {
2823
- var url = wretcher._url, _catchers = wretcher._catchers, resolvers = wretcher._resolvers, middlewares = wretcher._middlewares, opts = wretcher._options;
2824
- var catchers = new Map(_catchers);
2825
- var finalOptions = mix(config.defaults, opts);
2826
- var fetchController = config.polyfill("AbortController", { doThrow: false, instance: true });
2827
- if (!finalOptions["signal"] && fetchController) {
2828
- finalOptions["signal"] = fetchController.signal;
2829
- }
2830
- // Request timeout
2831
- var timeout = {
2832
- ref: null,
2833
- clear: function () {
2834
- if (timeout.ref) {
2835
- clearTimeout(timeout.ref);
2836
- timeout.ref = null;
2837
- }
2838
- }
2839
- };
2840
- // The generated fetch request
2841
- var fetchRequest = middlewareHelper(middlewares)(config.polyfill("fetch"))(url, finalOptions);
2842
- // Throws on an http error
2843
- var throwingPromise = fetchRequest
2844
- .catch(function (error) {
2845
- throw new WretchErrorWrapper(error);
2846
- })
2847
- .then(function (response) {
2848
- timeout.clear();
2849
- if (!response.ok) {
2850
- return response[config.errorType || "text"]().then(function (msg) {
2851
- // Enhances the error object
2852
- var err = new Error(msg);
2853
- err[config.errorType || "text"] = msg;
2854
- err["status"] = response.status;
2855
- err["response"] = response;
2856
- throw err;
2857
- });
2858
- }
2859
- return response;
2860
- });
2861
- // Wraps the Promise in order to dispatch the error to a matching catcher
2862
- var catchersWrapper = function (promise) {
2863
- return promise.catch(function (err) {
2864
- timeout.clear();
2865
- var error = err instanceof WretchErrorWrapper ? err.error : err;
2866
- if (err instanceof WretchErrorWrapper && catchers.has("__fromFetch"))
2867
- return catchers.get("__fromFetch")(error, wretcher);
2868
- else if (catchers.has(error.status))
2869
- return catchers.get(error.status)(error, wretcher);
2870
- else if (catchers.has(error.name))
2871
- return catchers.get(error.name)(error, wretcher);
2872
- else
2873
- throw error;
2874
- });
2875
- };
2876
- var bodyParser = function (funName) { return function (cb) { return funName ?
2877
- // If a callback is provided, then callback with the body result otherwise return the parsed body itself.
2878
- catchersWrapper(throwingPromise.then(function (_) { return _ && _[funName](); }).then(function (_) { return cb ? cb(_) : _; })) :
2879
- // No body parsing method - return the response
2880
- catchersWrapper(throwingPromise.then(function (_) { return cb ? cb(_) : _; })); }; };
2881
- var responseChain = {
2882
- /**
2883
- * Retrieves the raw result as a promise.
2884
- */
2885
- res: bodyParser(null),
2886
- /**
2887
- * Retrieves the result as a parsed JSON object.
2888
- */
2889
- json: bodyParser("json"),
2890
- /**
2891
- * Retrieves the result as a Blob object.
2892
- */
2893
- blob: bodyParser("blob"),
2894
- /**
2895
- * Retrieves the result as a FormData object.
2896
- */
2897
- formData: bodyParser("formData"),
2898
- /**
2899
- * Retrieves the result as an ArrayBuffer object.
2900
- */
2901
- arrayBuffer: bodyParser("arrayBuffer"),
2902
- /**
2903
- * Retrieves the result as a string.
2904
- */
2905
- text: bodyParser("text"),
2906
- /**
2907
- * Performs a callback on the API performance timings of the request.
2908
- *
2909
- * Warning: Still experimental on browsers and node.js
2910
- */
2911
- perfs: function (cb) {
2912
- fetchRequest.then(function (res) { return perfs.observe(res.url, cb); });
2913
- return responseChain;
2914
- },
2915
- /**
2916
- * Aborts the request after a fixed time.
2917
- *
2918
- * @param time Time in milliseconds
2919
- * @param controller A custom controller
2920
- */
2921
- setTimeout: function (time, controller) {
2922
- if (controller === void 0) { controller = fetchController; }
2923
- timeout.clear();
2924
- timeout.ref = setTimeout(function () { return controller.abort(); }, time);
2925
- return responseChain;
2926
- },
2927
- /**
2928
- * Returns the automatically generated AbortController alongside the current wretch response as a pair.
2929
- */
2930
- controller: function () { return [fetchController, responseChain]; },
2931
- /**
2932
- * Catches an http response with a specific error code or name and performs a callback.
2933
- */
2934
- error: function (errorId, cb) {
2935
- catchers.set(errorId, cb);
2936
- return responseChain;
2937
- },
2938
- /**
2939
- * Catches a bad request (http code 400) and performs a callback.
2940
- */
2941
- badRequest: function (cb) { return responseChain.error(400, cb); },
2942
- /**
2943
- * Catches an unauthorized request (http code 401) and performs a callback.
2944
- */
2945
- unauthorized: function (cb) { return responseChain.error(401, cb); },
2946
- /**
2947
- * Catches a forbidden request (http code 403) and performs a callback.
2948
- */
2949
- forbidden: function (cb) { return responseChain.error(403, cb); },
2950
- /**
2951
- * Catches a "not found" request (http code 404) and performs a callback.
2952
- */
2953
- notFound: function (cb) { return responseChain.error(404, cb); },
2954
- /**
2955
- * Catches a timeout (http code 408) and performs a callback.
2956
- */
2957
- timeout: function (cb) { return responseChain.error(408, cb); },
2958
- /**
2959
- * Catches an internal server error (http code 500) and performs a callback.
2960
- */
2961
- internalError: function (cb) { return responseChain.error(500, cb); },
2962
- /**
2963
- * Catches errors thrown when calling the fetch function and performs a callback.
2964
- */
2965
- fetchError: function (cb) { return responseChain.error("__fromFetch", cb); },
2966
- /**
2967
- * Catches an AbortError and performs a callback.
2968
- */
2969
- onAbort: function (cb) { return responseChain.error("AbortError", cb); }
2970
- };
2971
- return resolvers.reduce(function (chain, r) { return r(chain, wretcher); }, responseChain);
2972
- };
2973
-
2974
- var __assign$2 = (undefined && undefined.__assign) || function () {
2975
- __assign$2 = Object.assign || function(t) {
2976
- for (var s, i = 1, n = arguments.length; i < n; i++) {
2977
- s = arguments[i];
2978
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
2979
- t[p] = s[p];
2980
- }
2981
- return t;
2982
- };
2983
- return __assign$2.apply(this, arguments);
2984
- };
2985
- var __spreadArrays$2 = (undefined && undefined.__spreadArrays) || function () {
2986
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
2987
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
2988
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
2989
- r[k] = a[j];
2990
- return r;
2991
- };
2992
- var JSON_MIME = "application/json";
2993
- var CONTENT_TYPE_HEADER = "Content-Type";
2994
- /**
2995
- * The Wretcher class used to perform easy fetch requests.
2996
- *
2997
- * Immutability : almost every method of this class return a fresh Wretcher object.
2998
- */
2999
- var Wretcher = /** @class */ (function () {
3000
- function Wretcher(_url, _options, _catchers, _resolvers, _middlewares, _deferredChain) {
3001
- if (_catchers === void 0) { _catchers = new Map(); }
3002
- if (_resolvers === void 0) { _resolvers = []; }
3003
- if (_middlewares === void 0) { _middlewares = []; }
3004
- if (_deferredChain === void 0) { _deferredChain = []; }
3005
- this._url = _url;
3006
- this._options = _options;
3007
- this._catchers = _catchers;
3008
- this._resolvers = _resolvers;
3009
- this._middlewares = _middlewares;
3010
- this._deferredChain = _deferredChain;
3011
- }
3012
- Wretcher.factory = function (url, options) {
3013
- if (url === void 0) { url = ""; }
3014
- if (options === void 0) { options = {}; }
3015
- return new Wretcher(url, options);
3016
- };
3017
- Wretcher.prototype.selfFactory = function (_a) {
3018
- 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;
3019
- return new Wretcher(url, __assign$2({}, options), new Map(catchers), __spreadArrays$2(resolvers), __spreadArrays$2(middlewares), __spreadArrays$2(deferredChain));
3020
- };
3021
- /**
3022
- * Sets the default fetch options used for every subsequent fetch call.
3023
- * @param options New default options
3024
- * @param mixin If true, mixes in instead of replacing the existing options
3025
- */
3026
- Wretcher.prototype.defaults = function (options, mixin) {
3027
- if (mixin === void 0) { mixin = false; }
3028
- config.defaults = mixin ? mix(config.defaults, options) : options;
3029
- return this;
3030
- };
3031
- /**
3032
- * Sets the method (text, json ...) used to parse the data contained in the response body in case of an HTTP error.
3033
- *
3034
- * Persists for every subsequent requests.
3035
- *
3036
- * Default is "text".
3037
- */
3038
- Wretcher.prototype.errorType = function (method) {
3039
- config.errorType = method;
3040
- return this;
3041
- };
3042
- /**
3043
- * Sets the non-global polyfills which will be used for every subsequent calls.
3044
- *
3045
- * Needed for libraries like [fetch-ponyfill](https://github.com/qubyte/fetch-ponyfill).
3046
- *
3047
- * @param polyfills An object containing the polyfills.
3048
- */
3049
- Wretcher.prototype.polyfills = function (polyfills) {
3050
- config.polyfills = __assign$2(__assign$2({}, config.polyfills), polyfills);
3051
- return this;
3052
- };
3053
- /**
3054
- * Returns a new Wretcher object with the argument url appended and the same options.
3055
- * @param url String url
3056
- * @param replace Boolean If true, replaces the current url instead of appending
3057
- */
3058
- Wretcher.prototype.url = function (url, replace) {
3059
- if (replace === void 0) { replace = false; }
3060
- if (replace)
3061
- return this.selfFactory({ url: url });
3062
- var split = this._url.split("?");
3063
- return this.selfFactory({
3064
- url: split.length > 1 ?
3065
- split[0] + url + "?" + split[1] :
3066
- this._url + url
3067
- });
3068
- };
3069
- /**
3070
- * Returns a new Wretcher object with the same url and new options.
3071
- * @param options New options
3072
- * @param mixin If true, mixes in instead of replacing the existing options
3073
- */
3074
- Wretcher.prototype.options = function (options, mixin) {
3075
- if (mixin === void 0) { mixin = true; }
3076
- return this.selfFactory({ options: mixin ? mix(this._options, options) : options });
3077
- };
3078
- /**
3079
- * Converts a javascript object to query parameters,
3080
- * then appends this query string to the current url.
3081
- *
3082
- * If given a string, use the string as the query verbatim.
3083
- *
3084
- * ```
3085
- * let w = wretch("http://example.com") // url is http://example.com
3086
- *
3087
- * // Chain query calls
3088
- * w = w.query({ a: 1, b : 2 }) // url is now http://example.com?a=1&b=2
3089
- * w = w.query("foo-bar-baz-woz") // url is now http://example.com?a=1&b=2&foo-bar-baz-woz
3090
- *
3091
- * // Pass true as the second argument to replace existing query parameters
3092
- * w = w.query("c=3&d=4", true) // url is now http://example.com?c=3&d=4
3093
- * ```
3094
- *
3095
- * @param qp An object which will be converted, or a string which will be used verbatim.
3096
- */
3097
- Wretcher.prototype.query = function (qp, replace) {
3098
- if (replace === void 0) { replace = false; }
3099
- return this.selfFactory({ url: appendQueryParams(this._url, qp, replace) });
3100
- };
3101
- /**
3102
- * Set request headers.
3103
- * @param headerValues An object containing header keys and values
3104
- */
3105
- Wretcher.prototype.headers = function (headerValues) {
3106
- return this.selfFactory({ options: mix(this._options, { headers: headerValues || {} }) });
3107
- };
3108
- /**
3109
- * Shortcut to set the "Accept" header.
3110
- * @param headerValue Header value
3111
- */
3112
- Wretcher.prototype.accept = function (headerValue) {
3113
- return this.headers({ Accept: headerValue });
3114
- };
3115
- /**
3116
- * Shortcut to set the "Content-Type" header.
3117
- * @param headerValue Header value
3118
- */
3119
- Wretcher.prototype.content = function (headerValue) {
3120
- var _a;
3121
- return this.headers((_a = {}, _a[CONTENT_TYPE_HEADER] = headerValue, _a));
3122
- };
3123
- /**
3124
- * Shortcut to set the "Authorization" header.
3125
- * @param headerValue Header value
3126
- */
3127
- Wretcher.prototype.auth = function (headerValue) {
3128
- return this.headers({ Authorization: headerValue });
3129
- };
3130
- /**
3131
- * Adds a default catcher which will be called on every subsequent request error when the error code matches.
3132
- * @param errorId Error code or name
3133
- * @param catcher: The catcher method
3134
- */
3135
- Wretcher.prototype.catcher = function (errorId, catcher) {
3136
- var newMap = new Map(this._catchers);
3137
- newMap.set(errorId, catcher);
3138
- return this.selfFactory({ catchers: newMap });
3139
- };
3140
- /**
3141
- * Associates a custom signal with the request.
3142
- * @param controller : An AbortController
3143
- */
3144
- Wretcher.prototype.signal = function (controller) {
3145
- return this.selfFactory({ options: __assign$2(__assign$2({}, this._options), { signal: controller.signal }) });
3146
- };
3147
- /**
3148
- * Program a resolver to perform response chain tasks automatically.
3149
- * @param doResolve : Resolver callback
3150
- */
3151
- Wretcher.prototype.resolve = function (doResolve, clear) {
3152
- if (clear === void 0) { clear = false; }
3153
- return this.selfFactory({ resolvers: clear ? [doResolve] : __spreadArrays$2(this._resolvers, [doResolve]) });
3154
- };
3155
- /**
3156
- * Defer wretcher methods that will be chained and called just before the request is performed.
3157
- */
3158
- Wretcher.prototype.defer = function (callback, clear) {
3159
- if (clear === void 0) { clear = false; }
3160
- return this.selfFactory({
3161
- deferredChain: clear ? [callback] : __spreadArrays$2(this._deferredChain, [callback])
3162
- });
3163
- };
3164
- /**
3165
- * Add middlewares to intercept a request before being sent.
3166
- */
3167
- Wretcher.prototype.middlewares = function (middlewares, clear) {
3168
- if (clear === void 0) { clear = false; }
3169
- return this.selfFactory({
3170
- middlewares: clear ? middlewares : __spreadArrays$2(this._middlewares, middlewares)
3171
- });
3172
- };
3173
- Wretcher.prototype.method = function (method, options, body) {
3174
- if (options === void 0) { options = {}; }
3175
- if (body === void 0) { body = null; }
3176
- var headers = this._options.headers;
3177
- var baseWretcher = !body ? this :
3178
- typeof body === "object" && (!headers ||
3179
- Object.entries(headers).every(function (_a) {
3180
- var k = _a[0], v = _a[1];
3181
- return k.toLowerCase() !== CONTENT_TYPE_HEADER.toLowerCase() ||
3182
- v.startsWith(JSON_MIME);
3183
- })) ? this.json(body) :
3184
- this.body(body);
3185
- baseWretcher = baseWretcher.options(__assign$2(__assign$2({}, options), { method: method }));
3186
- var deferredWretcher = baseWretcher._deferredChain.reduce(function (acc, curr) { return curr(acc, acc._url, acc._options); }, baseWretcher);
3187
- return resolver(deferredWretcher);
3188
- };
3189
- /**
3190
- * Performs a get request.
3191
- */
3192
- Wretcher.prototype.get = function (options) {
3193
- return this.method("GET", options);
3194
- };
3195
- /**
3196
- * Performs a delete request.
3197
- */
3198
- Wretcher.prototype.delete = function (options) {
3199
- return this.method("DELETE", options);
3200
- };
3201
- /**
3202
- * Performs a put request.
3203
- */
3204
- Wretcher.prototype.put = function (body, options) {
3205
- return this.method("PUT", options, body);
3206
- };
3207
- /**
3208
- * Performs a post request.
3209
- */
3210
- Wretcher.prototype.post = function (body, options) {
3211
- return this.method("POST", options, body);
3212
- };
3213
- /**
3214
- * Performs a patch request.
3215
- */
3216
- Wretcher.prototype.patch = function (body, options) {
3217
- return this.method("PATCH", options, body);
3218
- };
3219
- /**
3220
- * Performs a head request.
3221
- */
3222
- Wretcher.prototype.head = function (options) {
3223
- return this.method("HEAD", options);
3224
- };
3225
- /**
3226
- * Performs an options request
3227
- */
3228
- Wretcher.prototype.opts = function (options) {
3229
- return this.method("OPTIONS", options);
3230
- };
3231
- /**
3232
- * Replay a request.
3233
- */
3234
- Wretcher.prototype.replay = function (options) {
3235
- return this.method(this._options.method, options);
3236
- };
3237
- /**
3238
- * Sets the request body with any content.
3239
- * @param contents The body contents
3240
- */
3241
- Wretcher.prototype.body = function (contents) {
3242
- return this.selfFactory({ options: __assign$2(__assign$2({}, this._options), { body: contents }) });
3243
- };
3244
- /**
3245
- * Sets the content type header, stringifies an object and sets the request body.
3246
- * @param jsObject An object which will be serialized into a JSON
3247
- */
3248
- Wretcher.prototype.json = function (jsObject) {
3249
- var _a;
3250
- var preservedContentType = (_a = Object.entries(this._options.headers || {}).find(function (_a) {
3251
- var k = _a[0], v = _a[1];
3252
- return k.toLowerCase() === CONTENT_TYPE_HEADER.toLowerCase() && v.startsWith(JSON_MIME);
3253
- })) === null || _a === void 0 ? void 0 : _a[1];
3254
- return this.content(preservedContentType || JSON_MIME).body(JSON.stringify(jsObject));
3255
- };
3256
- /**
3257
- * Converts the javascript object to a FormData and sets the request body.
3258
- * @param formObject An object which will be converted to a FormData
3259
- * @param recursive If `true`, will recurse through all nested objects
3260
- * Can be set as an array of string to exclude specific keys.
3261
- * See https://github.com/elbywan/wretch/issues/68 for more details.
3262
- */
3263
- Wretcher.prototype.formData = function (formObject, recursive) {
3264
- if (recursive === void 0) { recursive = false; }
3265
- return this.body(convertFormData(formObject, recursive));
3266
- };
3267
- /**
3268
- * Converts the input to an url encoded string and sets the content-type header and body.
3269
- * If the input argument is already a string, skips the conversion part.
3270
- *
3271
- * @param input An object to convert into an url encoded string or an already encoded string
3272
- */
3273
- Wretcher.prototype.formUrl = function (input) {
3274
- return this
3275
- .body(typeof input === "string" ? input : convertFormUrl(input))
3276
- .content("application/x-www-form-urlencoded");
3277
- };
3278
- return Wretcher;
3279
- }());
3280
- // Internal helpers
3281
- var appendQueryParams = function (url, qp, replace) {
3282
- var queryString;
3283
- if (typeof qp === "string") {
3284
- queryString = qp;
3285
- }
3286
- else {
3287
- var usp = config.polyfill("URLSearchParams", { instance: true });
3288
- for (var key in qp) {
3289
- if (qp[key] instanceof Array) {
3290
- for (var _i = 0, _a = qp[key]; _i < _a.length; _i++) {
3291
- var val = _a[_i];
3292
- usp.append(key, val);
3293
- }
3294
- }
3295
- else {
3296
- usp.append(key, qp[key]);
3297
- }
3298
- }
3299
- queryString = usp.toString();
3300
- }
3301
- var split = url.split("?");
3302
- if (replace || split.length < 2)
3303
- return split[0] + "?" + queryString;
3304
- return url + "&" + queryString;
3305
- };
3306
- function convertFormData(formObject, recursive, formData, ancestors) {
3307
- if (recursive === void 0) { recursive = false; }
3308
- if (formData === void 0) { formData = config.polyfill("FormData", { instance: true }); }
3309
- if (ancestors === void 0) { ancestors = []; }
3310
- Object.entries(formObject).forEach(function (_a) {
3311
- var key = _a[0], value = _a[1];
3312
- var formKey = ancestors.reduce(function (acc, ancestor) { return (acc ? acc + "[" + ancestor + "]" : ancestor); }, null);
3313
- formKey = formKey ? formKey + "[" + key + "]" : key;
3314
- if (value instanceof Array) {
3315
- for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
3316
- var item = value_1[_i];
3317
- formData.append(formKey + "[]", item);
3318
- }
3319
- }
3320
- else if (recursive &&
3321
- typeof value === "object" &&
3322
- (!(recursive instanceof Array) ||
3323
- !recursive.includes(key))) {
3324
- if (value !== null) {
3325
- convertFormData(value, recursive, formData, __spreadArrays$2(ancestors, [key]));
3326
- }
3327
- }
3328
- else {
3329
- formData.append(formKey, value);
3330
- }
3331
- });
3332
- return formData;
3333
- }
3334
- function encodeQueryValue(key, value) {
3335
- return encodeURIComponent(key) +
3336
- "=" +
3337
- encodeURIComponent(typeof value === "object" ?
3338
- JSON.stringify(value) :
3339
- "" + value);
3340
- }
3341
- function convertFormUrl(formObject) {
3342
- return Object.keys(formObject)
3343
- .map(function (key) {
3344
- var value = formObject[key];
3345
- if (value instanceof Array) {
3346
- return value.map(function (v) { return encodeQueryValue(key, v); }).join("&");
3347
- }
3348
- return encodeQueryValue(key, value);
3349
- })
3350
- .join("&");
3351
- }
3352
-
3353
- var factory = Wretcher.factory;
3354
- factory["default"] = Wretcher.factory;
3355
-
3356
- function buildBackendApiClient() {
3357
- const jwt = superSelectionAppService.jwt;
3358
- const profileId = superSelectionAppService.profileId;
3359
- const accountId = superSelectionAppService.accountIdOrDefault;
3360
- const partnerId = superSelectionAppService.partnerIdOrDefault;
3361
- return factory(superSelectionAppService.apiBaseUrl).headers({
3362
- Authorization: `Bearer ${jwt}`,
3363
- 'X-PROFILE-ID': profileId,
3364
- 'X-PARTNER-ID': partnerId,
3365
- 'X-ACCOUNT-ID': accountId
3366
- });
3367
- }
3368
-
3369
- const slate = {
3370
- fundId: 'slate',
3371
- usi: '32367272075001'
3372
- };
3373
-
3374
- function hydratePromotedFundChoiceDtoKind(dto) {
3375
- if ('slate' in dto) {
3376
- dto.kind = 'slate';
3377
- }
3378
- else if ('australianRetirementTrust' in dto) {
3379
- dto.kind = 'australianRetirementTrust';
3380
- }
3381
- else if ('aware' in dto) {
3382
- dto.kind = 'aware';
3383
- }
3384
- else if ('active' in dto) {
3385
- dto.kind = 'active';
3386
- }
3387
- else if ('australianEthical' in dto) {
3388
- dto.kind = 'australianEthical';
3389
- }
3390
- else if ('virgin' in dto) {
3391
- dto.kind = 'virgin';
3392
- }
3393
- else if ('spirit' in dto) {
3394
- dto.kind = 'spirit';
3395
- }
3396
- else if ('firstSuper' in dto) {
3397
- dto.kind = 'firstSuper';
3398
- }
3399
- else if ('mercerMyChoice' in dto) {
3400
- dto.kind = 'mercerMyChoice';
3401
- }
3402
- else if ('generic' in dto) {
3403
- dto.kind = 'generic';
3404
- }
3405
- }
3406
- function getPromotedFundUsi(dto) {
3407
- switch (dto.kind) {
3408
- case 'slate':
3409
- return slate.usi;
3410
- case 'australianRetirementTrust':
3411
- return dto.australianRetirementTrust.usi;
3412
- case 'aware':
3413
- return dto.aware.usi;
3414
- case 'active':
3415
- return dto.active.usi;
3416
- case 'australianEthical':
3417
- return dto.australianEthical.usi;
3418
- case 'virgin':
3419
- return dto.virgin.usi;
3420
- case 'spirit':
3421
- return dto.spirit.usi;
3422
- case 'firstSuper':
3423
- return dto.firstSuper.usi;
3424
- case 'mercerMyChoice':
3425
- return dto.mercerMyChoice.usi;
3426
- case 'generic':
3427
- return dto.generic.usi;
3428
- default:
3429
- return '';
3430
- }
3431
- }
3432
- function getPromotedFundId(dto) {
3433
- switch (dto.kind) {
3434
- case 'slate':
3435
- return slate.fundId;
3436
- case 'australianRetirementTrust':
3437
- return 'australian-retirement-trust';
3438
- case 'aware':
3439
- return 'aware';
3440
- case 'active':
3441
- return 'active';
3442
- case 'australianEthical':
3443
- return 'australian-ethical';
3444
- case 'virgin':
3445
- return 'virgin';
3446
- case 'spirit':
3447
- return 'spirit';
3448
- case 'firstSuper':
3449
- return 'first-super';
3450
- case 'mercerMyChoice':
3451
- return 'mercermychoice';
3452
- case 'generic':
3453
- return dto.generic.fundId;
3454
- default:
3455
- return '';
3456
- }
3457
- }
3458
- function getSuperChoiceUsi(dto) {
3459
- switch (dto.kind) {
3460
- case 'Promoted':
3461
- return some(getPromotedFundUsi(dto.promoted));
3462
- case 'MyOwnFund':
3463
- return some(dto.myOwnFund.usi);
3464
- case 'SMSF':
3465
- return none;
3466
- case 'Default':
3467
- return some(dto.default.usi);
3468
- case 'PromotedDefault':
3469
- return some(dto.promotedDefault.usi);
3470
- case 'DefinedBenefits':
3471
- return some(dto.definedBenefits.usi);
3472
- case 'PromotedDefaultWithJoin':
3473
- return some(dto.promotedDefaultWithJoin.usi);
3474
- default:
3475
- return none;
3476
- }
3477
- }
3478
- function getPromotedFundMemberNumber(dto) {
3479
- switch (dto.kind) {
3480
- case 'slate':
3481
- return dto.slate.memberNumber;
3482
- case 'australianRetirementTrust':
3483
- return dto.australianRetirementTrust.memberNumber;
3484
- case 'aware':
3485
- return dto.aware.memberNumber;
3486
- case 'active':
3487
- return dto.active.memberNumber;
3488
- case 'australianEthical':
3489
- return dto.australianEthical.memberNumber;
3490
- case 'virgin':
3491
- return dto.virgin.memberNumber;
3492
- case 'spirit':
3493
- return dto.spirit.memberNumber;
3494
- case 'firstSuper':
3495
- return dto.firstSuper.memberNumber;
3496
- case 'mercerMyChoice':
3497
- return dto.mercerMyChoice.memberNumber;
3498
- case 'generic':
3499
- return dto.generic.memberNumber;
3500
- default:
3501
- return '';
3502
- }
3503
- }
3504
- function getSuperChoiceMemberNumber(dto) {
3505
- switch (dto.kind) {
3506
- case 'Promoted':
3507
- return some(getPromotedFundMemberNumber(dto.promoted));
3508
- case 'MyOwnFund':
3509
- return some(dto.myOwnFund.memberNumber);
3510
- case 'DefinedBenefits':
3511
- return some(dto.definedBenefits.memberNumber);
3512
- case 'PromotedDefaultWithJoin':
3513
- return some(dto.promotedDefaultWithJoin.memberNumber);
3514
- case 'SMSF':
3515
- case 'Default':
3516
- case 'PromotedDefault':
3517
- return none;
3518
- default:
3519
- return none;
3520
- }
3521
- }
3522
- function hydrateSuperChoiceDetailsDtoKind(dto) {
3523
- if ('promoted' in dto) {
3524
- dto.kind = 'Promoted';
3525
- }
3526
- else if ('myOwnFund' in dto) {
3527
- dto.kind = 'MyOwnFund';
3528
- }
3529
- else if ('smsf' in dto) {
3530
- dto.kind = 'SMSF';
3531
- }
3532
- else if ('default' in dto) {
3533
- dto.kind = 'Default';
3534
- }
3535
- else if ('promotedDefault' in dto) {
3536
- dto.kind = 'PromotedDefault';
3537
- }
3538
- else if ('definedBenefits' in dto) {
3539
- dto.kind = 'DefinedBenefits';
3540
- }
3541
- else if ('promotedDefaultWithJoin' in dto) {
3542
- dto.kind = 'PromotedDefaultWithJoin';
3543
- }
3544
- }
3545
-
3546
- class SuperSelectionApi {
3547
- async getAustralianFundsAsync(searchFilter, includeInactive = false) {
3548
- return buildBackendApiClient()
3549
- .url(`super-choice/australian-funds-v2?${this.toQueryString(includeInactive, searchFilter)}`)
3550
- .get()
3551
- .notFound(() => {
3552
- throw new Error('Failed to fetch the list of australian super funds.');
3553
- })
3554
- .json();
3555
- }
3556
- async getAustralianFundAsync(usi, includeInactive) {
3557
- const queryStr = includeInactive ? '?includeInactive=true' : '';
3558
- return buildBackendApiClient()
3559
- .url(`super-choice/australian-funds/${usi}${queryStr}`)
3560
- .get()
3561
- .notFound(() => {
3562
- throw new Error('Failed to fetch australian super fund.');
3563
- })
3564
- .json();
3565
- }
3566
- async getAppStateAsync() {
3567
- var _a;
3568
- const response = await buildBackendApiClient()
3569
- .url('client-app-state')
3570
- .get()
3571
- .notFound(() => {
3572
- throw new Error('Failed to fetch application configuration.');
3573
- })
3574
- .json();
3575
- if ((_a = response.superBuyer.superChoice) === null || _a === void 0 ? void 0 : _a.choiceDetails) {
3576
- hydrateSuperChoiceDetailsDtoKind(response.superBuyer.superChoice.choiceDetails);
3577
- switch (response.superBuyer.superChoice.choiceDetails.kind) {
3578
- case 'Promoted':
3579
- hydratePromotedFundChoiceDtoKind(response.superBuyer.superChoice.choiceDetails.promoted);
3580
- break;
3581
- }
3582
- }
3583
- return response;
3584
- }
3585
- async clickPromotedTileAsync(payload) {
3586
- return buildBackendApiClient().url('click-promoted-tile').post(payload).res();
3587
- }
3588
- async viewSuperFundPanelAsync(payload) {
3589
- return buildBackendApiClient().url('view-super-fund-panel').post(payload).res();
3590
- }
3591
- toSearchFilterQueryString(searchFilter) {
3592
- return (`search=${searchFilter.searchString}` +
3593
- (searchFilter.maxRecordCount > 0 ? '&maxRecordCount=' + searchFilter.maxRecordCount : ''));
3594
- }
3595
- toQueryString(includeInactive, searchFilter) {
3596
- const search = this.toSearchFilterQueryString(searchFilter);
3597
- const inactive = includeInactive ? 'includeInactive=true' : '';
3598
- const isNotEmpty = (s) => s && s.length;
3599
- return [search, inactive].filter(isNotEmpty).join('&');
3600
- }
3601
- }
3602
- const superSelectionApi = new SuperSelectionApi();
3603
-
3604
- var SuperCampaignComponentStatus;
3605
- (function (SuperCampaignComponentStatus) {
3606
- SuperCampaignComponentStatus[SuperCampaignComponentStatus["NotLoaded"] = 1] = "NotLoaded";
3607
- SuperCampaignComponentStatus[SuperCampaignComponentStatus["Loaded"] = 2] = "Loaded";
3608
- SuperCampaignComponentStatus[SuperCampaignComponentStatus["NotWorking"] = 3] = "NotWorking";
3609
- })(SuperCampaignComponentStatus || (SuperCampaignComponentStatus = {}));
3610
- class SuperCampaignState {
3611
- constructor() {
3612
- this._promotedFundsShown = [];
3613
- }
3614
- get PromotedFundIds() {
3615
- return this._promotedFundsShown.map((p) => p.fundId);
3616
- }
3617
- set promotedFundsShown(value) {
3618
- this._promotedFundsShown = value;
3619
- }
3620
- get DefaultFundPosition() {
3621
- const index = this._promotedFundsShown.findIndex((value) => value.fundType === 'promoted-default');
3622
- if (index === -1)
3623
- return undefined;
3624
- return index + 1;
3625
- }
3626
- }
3627
- const initialState = {
3628
- apiBaseUrl: Option.none,
3629
- appBaseUrl: Option.none,
3630
- profileId: Option.none,
3631
- jwt: Option.none,
3632
- superBuyer: Option.none,
3633
- superChoicePrefill: Option.none,
3634
- promotedFunds: Option.none,
3635
- accountConfiguration: Option.none,
3636
- profileConfiguration: Option.none,
3637
- hasSuccessPageBeenAcknowledged: false,
3638
- hasSuperSelectionBeenSubmitted: false,
3639
- isDefinedBenefitsEligible: Option.none,
3640
- superCampaignEnabled: true,
3641
- superCampaignState: undefined,
3642
- superCampaignComponentStatus: SuperCampaignComponentStatus.NotLoaded,
3643
- hideFooterSection: false,
3644
- bringYourOwnFundCustomStepEnabled: false,
3645
- featuredFundsEnabled: false
3646
- };
3647
-
3648
- class SuperSelectionAppService {
3649
- constructor() {
3650
- const { state, onChange } = createStore(initialState);
3651
- this._state = state;
3652
- this._onChange = onChange;
3653
- onChange('jwt', (jwt) => {
3654
- this._state.profileId = _function.pipe(jwt, Option.chain((jwtValue) => Option.fromNullable(o(jwtValue).sub)));
3655
- });
3656
- }
3657
- get state() {
3658
- return this._state;
3659
- }
3660
- get onChange() {
3661
- return this._onChange;
3662
- }
3663
- get superBuyer() {
3664
- if (Option.isNone(this._state.superBuyer)) {
3665
- throw Error('User information is not set');
3666
- }
3667
- return this._state.superBuyer.value;
3668
- }
3669
- get apiBaseUrl() {
3670
- if (Option.isNone(this._state.apiBaseUrl)) {
3671
- throw Error('API base URL is not set');
3672
- }
3673
- return this._state.apiBaseUrl.value;
3674
- }
3675
- get appBaseUrl() {
3676
- if (Option.isNone(this._state.appBaseUrl)) {
3677
- throw Error('App base URL is not set');
3678
- }
3679
- return this._state.appBaseUrl.value;
3680
- }
3681
- get promotedFunds() {
3682
- if (this.state.superCampaignEnabled && this.superCampaignState !== undefined) {
3683
- return this.superCampaignState.PromotedFundIds;
3684
- }
3685
- if (Option.isNone(this._state.promotedFunds)) {
3686
- throw Error('Promoted Funds is not set');
3687
- }
3688
- return this._state.promotedFunds.value;
3689
- }
3690
- get promotedDefaultFundPosition() {
3691
- if (this.state.superCampaignEnabled && this.superCampaignState !== undefined) {
3692
- return Option.fromNullable(this.superCampaignState.DefaultFundPosition);
3693
- }
3694
- return Option.none;
3695
- }
3696
- get promotedFundsConfig() {
3697
- return {
3698
- shownFunds: this.promotedFunds,
3699
- promotedDefaultFundPosition: Option.toUndefined(this.promotedDefaultFundPosition),
3700
- promotedFundsConfigSource: this.isUsingSuperCampaign ? 'superCampaign' : 'superSelection'
3701
- };
3702
- }
3703
- get profileId() {
3704
- if (Option.isNone(this._state.profileId)) {
3705
- throw Error('Failed to get Profile ID from JWT');
3706
- }
3707
- return this._state.profileId.value;
3708
- }
3709
- get defaultFundUsi() {
3710
- const profileConfigDefaultFundUsi = _function.pipe(this._state.profileConfiguration, Option.map((config) => Option.fromNullable(config.defaultFundUsi)), Option.flatten);
3711
- if (Option.isSome(profileConfigDefaultFundUsi)) {
3712
- return profileConfigDefaultFundUsi;
3713
- }
3714
- return _function.pipe(this._state.accountConfiguration, Option.map((config) => Option.fromNullable(config.defaultFundUsi)), Option.flatten);
3715
- }
3716
- get accountIdOrDefault() {
3717
- return _function.pipe(this._state.accountConfiguration, Option.map((config) => config.accountId), Option.getOrElse(() => ''));
3718
- }
3719
- get partnerIdOrDefault() {
3720
- return _function.pipe(this._state.superBuyer, Option.map((superBuyer) => superBuyer.partnerId), Option.getOrElse(() => ''));
3721
- }
3722
- get jwt() {
3723
- if (Option.isNone(this._state.jwt)) {
3724
- throw Error('No authentication information was found');
3725
- }
3726
- return this._state.jwt.value;
3727
- }
3728
- completeSuperSelectionFlow() {
3729
- this._state.hasSuccessPageBeenAcknowledged = true;
3730
- }
3731
- markSuperSelectionAsSubmitted() {
3732
- this._state.hasSuperSelectionBeenSubmitted = true;
3733
- }
3734
- get isDefinedBenefitsEligible() {
3735
- return this._state.isDefinedBenefitsEligible;
3736
- }
3737
- async loadAppStateAsync() {
3738
- const appStateResponse = await superSelectionApi.getAppStateAsync();
3739
- this._state.accountConfiguration = Option.fromNullable(appStateResponse.accountConfiguration);
3740
- this._state.profileConfiguration = Option.fromNullable(appStateResponse.profileConfiguration);
3741
- this._state.superBuyer = Option.fromNullable(appStateResponse.superBuyer);
3742
- this._state.promotedFunds = Option.fromNullable(appStateResponse.promotedFunds);
3743
- this._state.bringYourOwnFundCustomStepEnabled =
3744
- appStateResponse.bringYourOwnFundCustomStepEnabled;
3745
- this._state.featuredFundsEnabled = appStateResponse.featuredFundsEnabled;
3746
- this._state.superChoicePrefill = Option.fromNullable(appStateResponse.prefill);
3747
- this._state.isDefinedBenefitsEligible = Option.fromNullable(appStateResponse.isDefinedBenefitsEligible);
3748
- if (Option.isSome(this._state.accountConfiguration)) {
3749
- if (this._state.accountConfiguration.value.featureSet.type === 'basic') {
3750
- this._state.superCampaignEnabled = false;
3751
- }
3752
- }
3753
- }
3754
- setSuperCampaignPromotedFundsShown(shownFunds) {
3755
- if (this._state.superCampaignState !== undefined)
3756
- this._state.superCampaignState.promotedFundsShown = shownFunds;
3757
- else
3758
- throw new Error('Cannot set shown funds for SuperCampaing state because it is undefined');
3759
- }
3760
- viewSuperFundPanelAsync(placementId, promotedFundIdListOverride) {
3761
- return superSelectionApi.viewSuperFundPanelAsync(Object.assign(Object.assign({}, this.promotedFundsConfig), { shownFunds: promotedFundIdListOverride
3762
- ? promotedFundIdListOverride
3763
- : this.promotedFundsConfig.shownFunds, placementId }));
3764
- }
3765
- get superCampaignState() {
3766
- return this._state.superCampaignState;
3767
- }
3768
- get superCampaignComponentStatus() {
3769
- return this._state.superCampaignComponentStatus;
3770
- }
3771
- set superCampaignComponentStatus(value) {
3772
- if (value === SuperCampaignComponentStatus.Loaded) {
3773
- this._state.superCampaignComponentStatus = SuperCampaignComponentStatus.Loaded;
3774
- this._state.superCampaignState = new SuperCampaignState();
3775
- }
3776
- else {
3777
- this._state.superCampaignComponentStatus = value;
3778
- this._state.superCampaignState = undefined;
3779
- }
3780
- }
3781
- get isUsingSuperCampaign() {
3782
- return this.state.superCampaignEnabled && this.superCampaignState !== undefined;
3783
- }
3784
- get isBringYourOwnFundCustomStepEnabled() {
3785
- return this.state.bringYourOwnFundCustomStepEnabled;
3786
- }
3787
- get isFeaturedFundsEnabled() {
3788
- return this.state.featuredFundsEnabled;
3789
- }
3790
- get superCampaignCanNotBeActivated() {
3791
- return (!this.state.superCampaignEnabled ||
3792
- this.superCampaignComponentStatus === SuperCampaignComponentStatus.NotWorking);
3793
- }
3794
- get hideFooterSection() {
3795
- return this._state.hideFooterSection;
3796
- }
3797
- set hideFooterSection(value) {
3798
- this._state.hideFooterSection = value;
3799
- }
3800
- get backendUrl() {
3801
- return Option.map(this.getBaseUrl)(this.state.apiBaseUrl);
3802
- }
3803
- getBaseUrl(url) {
3804
- const parsedUrl = new URL(url);
3805
- return `${parsedUrl.protocol}//${parsedUrl.hostname}${parsedUrl.port.length > 0 ? `:${parsedUrl.port}` : ''}`;
3806
- }
3807
- }
3808
- const superSelectionAppService = new SuperSelectionAppService();
3809
-
3810
- class NavigationService {
3811
- navigateInternally(history, route) {
3812
- const path = `${this.appBaseUrl}${this.toRouteWithLeadingSlash(route)}`;
3813
- iframe.navigation(path);
3814
- history.push(path);
3815
- }
3816
- navigateInternallyToStandardChoice(options) {
3817
- state.handleSubmitFn = options.handleSubmitFn;
3818
- state.fundName = options.fundName;
3819
- state.fundDetails = options.fundDetails;
3820
- state.promotedFundId = options.promotedFundId;
3821
- this.navigateInternally(options.history, SuperSelectionAppRoutes.StandardChoice);
3822
- }
3823
- toExternalUrl(url) {
3824
- const externalUrl = new URL(url);
3825
- externalUrl.searchParams.append('_extnav', 'true');
3826
- return externalUrl.href;
3827
- }
3828
- get appBaseUrl() {
3829
- const baseUrl = superSelectionAppService.appBaseUrl;
3830
- return baseUrl.replace(/\/$/, '');
3831
- }
3832
- toRouteWithLeadingSlash(route) {
3833
- return route.length > 0 && route[0] === '/' ? route : `/${route}`;
3834
- }
3835
- }
3836
- const navigationService = new NavigationService();
3837
-
3838
- const ChoiceRouter = class {
3839
- constructor(hostRef) {
3840
- registerInstance(this, hostRef);
3841
- }
3842
- async componentWillLoad() {
3843
- if (superSelectionAppService.superCampaignCanNotBeActivated) {
3844
- navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.MyOwnFund);
3845
- }
3846
- else {
3847
- navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.SuperCampaign);
3848
- }
3849
- }
3850
- render() {
3851
- return h(Fragment, null);
3852
- }
3853
- };
3854
- injectHistory(ChoiceRouter);
3855
-
3856
- var CustomFundTypes;
3857
- (function (CustomFundTypes) {
3858
- CustomFundTypes["MyOwnFund"] = "Existing super fund";
3859
- CustomFundTypes["DefaultFund"] = "Default super fund";
3860
- CustomFundTypes["SelfManagedFund"] = "Self-managed super fund";
3861
- CustomFundTypes["FeaturedFunds"] = "Featured super funds";
3862
- })(CustomFundTypes || (CustomFundTypes = {}));
3863
- const initialStateCustomFund = {
3864
- myOwnFundForm: {
3865
- fundUsi: none,
3866
- fundName: none,
3867
- memberNumber: none,
3868
- memberFirstName: none,
3869
- memberFamilyName: none
3870
- },
3871
- selfManagedFundForm: {
3872
- fundName: '',
3873
- fundAbn: '',
3874
- fundEsa: '',
3875
- addressLine1: '',
3876
- addressLine2: '',
3877
- state: '',
3878
- postcode: '',
3879
- city: '',
3880
- bankAccountName: '',
3881
- bsb: '',
3882
- bankAccountNumber: '',
3883
- memberFirstName: '',
3884
- memberFamilyName: ''
3885
- }
3886
- };
3887
- const { state: state$1, reset } = createStore(initialStateCustomFund);
3888
-
3889
- const myOwnFundCustomOption = {
3890
- label: CustomFundTypes.MyOwnFund,
3891
- value: SuperSelectionAppRoutes.MyOwnFund
3892
- };
3893
- const CustomFund = class {
3894
- constructor(hostRef) {
3895
- registerInstance(this, hostRef);
3896
- this.currentCustomFund = myOwnFundCustomOption;
3897
- this.showFundOptionsSelection = false;
3898
- }
3899
- componentWillLoad() {
3900
- let currentRoute = SuperSelectionAppRoutes.MyOwnFund;
3901
- if (window.location.pathname.includes(SuperSelectionAppRoutes.MyOwnFund))
3902
- currentRoute = SuperSelectionAppRoutes.MyOwnFund;
3903
- if (window.location.pathname.includes(SuperSelectionAppRoutes.DefaultFund))
3904
- currentRoute = SuperSelectionAppRoutes.DefaultFund;
3905
- if (window.location.pathname.includes(SuperSelectionAppRoutes.SelfManagedFund))
3906
- currentRoute = SuperSelectionAppRoutes.SelfManagedFund;
3907
- if (window.location.pathname.includes(SuperSelectionAppRoutes.FeaturedFunds))
3908
- currentRoute = SuperSelectionAppRoutes.FeaturedFunds;
3909
- this.fundOptionsList = [
3910
- myOwnFundCustomOption,
3911
- {
3912
- label: CustomFundTypes.SelfManagedFund,
3913
- value: SuperSelectionAppRoutes.SelfManagedFund
3914
- },
3915
- {
3916
- label: CustomFundTypes.DefaultFund,
3917
- value: SuperSelectionAppRoutes.DefaultFund
3918
- }
3919
- ];
3920
- if (superSelectionAppService.isFeaturedFundsEnabled &&
3921
- superSelectionAppService.isUsingSuperCampaign) {
3922
- this.fundOptionsList.push({
3923
- label: CustomFundTypes.FeaturedFunds,
3924
- value: SuperSelectionAppRoutes.FeaturedFunds
3925
- });
3926
- }
3927
- this.currentCustomFund =
3928
- this.fundOptionsList.find((item) => item.value === currentRoute) || this.currentCustomFund;
3929
- navigationService.navigateInternally(this.history, currentRoute);
3930
- }
3931
- render() {
3932
- const ChevronDownIcon = () => {
3933
- return (h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "h-5 w-5 text-gray-500", viewBox: "0 0 20 20" }, h("path", { "fill-rule": "evenodd", d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", "clip-rule": "evenodd" })));
894
+ this.currentCustomFund =
895
+ this.fundOptionsList.find((item) => item.value === currentRoute) || this.currentCustomFund;
896
+ navigationService.navigateInternally(this.history, currentRoute);
897
+ }
898
+ render() {
899
+ const ChevronDownIcon = () => {
900
+ return (h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "h-5 w-5 text-gray-500", viewBox: "0 0 20 20" }, h("path", { "fill-rule": "evenodd", d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", "clip-rule": "evenodd" })));
3934
901
  };
3935
902
  const CheckIcon = () => {
3936
- return (h("svg", { class: "h-5 w-5 fill-primary-base group-hover:fill-white", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20" }, h("path", { "fill-rule": "evenodd", d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z", "clip-rule": "evenodd" })));
3937
- };
3938
- return (h("div", { class: "max-w-560 sm:w-560 relative" }, h("label", { class: "font-medium text-gray-700 text-sm" }, "Which fund would you like to nominate?"), h("div", { class: "mt-1 mb-4" }, h("button", { type: "button", class: "bg-white relative w-full border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-primary-focus focus:border-primary-base text-base sm:text-sm", onClick: () => (this.showFundOptionsSelection = !this.showFundOptionsSelection) }, h("span", { class: {
3939
- 'block truncate': true,
3940
- 'text-gray-500': this.showFundOptionsSelection
3941
- } }, this.showFundOptionsSelection ? 'Select' : this.currentCustomFund.label), h("span", { class: "absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none" }, h(ChevronDownIcon, null))), this.showFundOptionsSelection && (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) => (h("li", { class: "text-gray-900 cursor-default select-none relative py-2 pl-3 pr-9 group hover:bg-primary-base", onClick: () => {
3942
- this.showFundOptionsSelection = !this.showFundOptionsSelection;
3943
- navigationService.navigateInternally(this.history, f.value);
3944
- } }, h("span", { class: {
3945
- 'block truncate': true,
3946
- 'font-semibold': this.currentCustomFund === f
3947
- } }, f.label), this.currentCustomFund === f && (h("span", { class: "absolute inset-y-0 right-0 flex items-center pr-4" }, h(CheckIcon, null))))))))), h("div", { onClick: () => (this.showFundOptionsSelection = false) }, h("slot", null))));
3948
- }
3949
- };
3950
- injectHistory(CustomFund);
3951
-
3952
- class AustralianFundLookupService {
3953
- async searchFundsAsync(searchString, maxRecordCount) {
3954
- return superSelectionApi.getAustralianFundsAsync({
3955
- searchString,
3956
- maxRecordCount
3957
- });
3958
- }
3959
- async getFundAsync(usi, includeInactive) {
3960
- const result = await superSelectionApi.getAustralianFundAsync(usi, includeInactive);
3961
- return Option.some(result);
3962
- }
3963
- }
3964
- const australianFundLookupService = new AustralianFundLookupService();
3965
-
3966
- class EventTrackingApi {
3967
- static get Instance() {
3968
- return this.instance || (this.instance = new this());
3969
- }
3970
- async PostAnalyticsEventAsync(event) {
3971
- return buildBackendApiClient().url('analytics-events').post(event).res();
3972
- }
3973
- }
3974
-
3975
- class EventTrackingService {
3976
- constructor() {
3977
- this.eventTrackingApi = EventTrackingApi.Instance;
3978
- }
3979
- static get Instance() {
3980
- return this.instance || (this.instance = new this());
3981
- }
3982
- async TrackSuperFundPdsViewedAsync(detail) {
3983
- return this.trackEventAsync({
3984
- SuperFundPdsViewed: detail
3985
- });
3986
- }
3987
- async TrackPromotedSuperFundDetailViewedAsync(detail) {
3988
- return this.trackEventAsync({
3989
- SuperFundDetailViewed: {
3990
- PromotedFund: detail
3991
- }
3992
- });
3993
- }
3994
- async TrackPromotedDefaultSuperFundDetailViewedAsync(detail) {
3995
- return this.trackEventAsync({
3996
- SuperFundDetailViewed: {
3997
- PromotedDefaultFund: detail
3998
- }
3999
- });
4000
- }
4001
- async TrackMyOwnSuperFundDetailViewedAsync(detail) {
4002
- return this.trackEventAsync({
4003
- SuperFundDetailViewed: {
4004
- MyOwnFund: detail
4005
- }
4006
- });
4007
- }
4008
- async TrackSmsfSuperFundDetailViewedAsync(detail) {
4009
- return this.trackEventAsync({
4010
- SuperFundDetailViewed: {
4011
- Smsf: detail
4012
- }
4013
- });
4014
- }
4015
- async TrackDefaultSuperFundDetailViewedAsync(detail) {
4016
- return this.trackEventAsync({
4017
- SuperFundDetailViewed: {
4018
- DefaultFund: detail
4019
- }
4020
- });
4021
- }
4022
- async TrackSuperFundNominationViewedAsync(detail) {
4023
- return this.trackEventAsync({
4024
- SuperFundNominationViewed: detail
4025
- });
4026
- }
4027
- async TrackSuperFundNominationDeclinedAsync(detail) {
4028
- return this.trackEventAsync({
4029
- SuperFundNominationDeclined: detail
4030
- });
4031
- }
4032
- async TrackSuperFundDisclaimerViewedAsync(detail) {
4033
- return this.trackEventAsync({
4034
- SuperFundDisclaimerViewed: detail
4035
- });
4036
- }
4037
- async TrackSuperFundDisclaimerAcceptedAsync(detail) {
4038
- return this.trackEventAsync({
4039
- SuperFundDisclaimerAccepted: detail
4040
- });
4041
- }
4042
- async TrackSuperFundPrefillViewedAsync(detail) {
4043
- return this.trackEventAsync({
4044
- SuperFundPrefillViewed: detail
4045
- });
4046
- }
4047
- async TrackSuperFundPrefillDeclinedAsync(detail) {
4048
- return this.trackEventAsync({
4049
- SuperFundPrefillDeclined: detail
4050
- });
4051
- }
4052
- async TrackSuperFundDetailChangeRequestedAsync(detail) {
4053
- return this.trackEventAsync({
4054
- SuperFundDetailChangeRequested: detail
4055
- });
4056
- }
4057
- async TrackSuperCampaignActivationSucceededAsync(detail) {
4058
- return this.trackEventAsync({
4059
- SuperCampaignActivationSucceeded: detail
4060
- });
4061
- }
4062
- async TrackSuperMyOwnFundEngagementStepActivationSucceeded(fundUsi) {
4063
- return this.trackEventAsync({
4064
- SuperMyOwnFundEngagementStepActivationSucceeded: { fundUsi }
4065
- });
4066
- }
4067
- async TrackSuperMyOwnFundEngagementStepContinued(fundUsi, reason) {
4068
- return this.trackEventAsync({
4069
- SuperMyOwnFundEngagementStepContinued: { fundUsi, reason }
4070
- });
4071
- }
4072
- async trackEventAsync(event) {
4073
- try {
4074
- await this.eventTrackingApi.PostAnalyticsEventAsync({ event });
4075
- }
4076
- catch (_a) {
4077
- return;
4078
- }
4079
- }
4080
- }
4081
-
4082
- class CustomFundChoiceApi {
4083
- async submitDefaultFundChoiceAsync(dto) {
4084
- return buildBackendApiClient()
4085
- .url('super-choice/default')
4086
- .post(dto)
4087
- .badRequest(() => {
4088
- throw new Error('Failed to process default fund join request');
4089
- })
4090
- .text();
4091
- }
4092
- async submitCustomFundChoiceAsync(dto) {
4093
- return buildBackendApiClient()
4094
- .url('super-choice/custom-fund')
4095
- .post(dto)
4096
- .badRequest(() => {
4097
- throw new Error('Failed to process custom fund join request');
4098
- })
4099
- .text();
4100
- }
4101
- async submitSelfManagedFundChoiceAsync(dto) {
4102
- return buildBackendApiClient()
4103
- .url('super-choice/smsf')
4104
- .post(dto)
4105
- .badRequest(() => {
4106
- throw new Error('Failed to process SMSF choice request');
4107
- })
4108
- .text();
903
+ return (h("svg", { class: "h-5 w-5 fill-primary-base group-hover:fill-white", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20" }, h("path", { "fill-rule": "evenodd", d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z", "clip-rule": "evenodd" })));
904
+ };
905
+ return (h("div", { class: "max-w-560 sm:w-560 relative" }, h("label", { class: "font-medium text-gray-700 text-sm" }, "Which fund would you like to nominate?"), h("div", { class: "mt-1 mb-4" }, h("button", { type: "button", class: "bg-white relative w-full border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-primary-focus focus:border-primary-base text-base sm:text-sm", onClick: () => (this.showFundOptionsSelection = !this.showFundOptionsSelection) }, h("span", { class: {
906
+ 'block truncate': true,
907
+ 'text-gray-500': this.showFundOptionsSelection
908
+ } }, this.showFundOptionsSelection ? 'Select' : this.currentCustomFund.label), h("span", { class: "absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none" }, h(ChevronDownIcon, null))), this.showFundOptionsSelection && (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) => (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: () => {
909
+ this.showFundOptionsSelection = !this.showFundOptionsSelection;
910
+ navigationService.navigateInternally(this.history, f.value);
911
+ } }, h("span", { class: {
912
+ 'block truncate': true,
913
+ 'font-semibold': this.currentCustomFund === f
914
+ } }, f.label), this.currentCustomFund === f && (h("span", { class: "absolute inset-y-0 right-0 flex items-center pr-4" }, h(CheckIcon, null))))))))), h("div", { onClick: () => (this.showFundOptionsSelection = false) }, h("slot", null))));
4109
915
  }
4110
- async submitDefinedBenefitsChoiceAsync(dto) {
4111
- return buildBackendApiClient()
4112
- .url('super-choice/defined-benefits')
4113
- .post(dto)
4114
- .badRequest(() => {
4115
- throw new Error('Failed to process Defined Benefits choice request');
4116
- })
4117
- .text();
916
+ };
917
+ injectHistory(CustomFund);
918
+
919
+ class AustralianFundLookupService {
920
+ async searchFundsAsync(searchString, maxRecordCount) {
921
+ return superSelectionApi.getAustralianFundsAsync({
922
+ searchString,
923
+ maxRecordCount
924
+ });
4118
925
  }
4119
- async validateAbnForSMSF(abn) {
4120
- const response = await buildBackendApiClient()
4121
- .url(`super-choice/smsf/${abn}/validate`)
4122
- .get()
4123
- .badRequest(() => {
4124
- throw new Error('Failed to verify that if the provided abn is used for regulated fund');
4125
- })
4126
- .json();
4127
- return response.result;
926
+ async getFundAsync(usi, includeInactive) {
927
+ const result = await superSelectionApi.getAustralianFundAsync(usi, includeInactive);
928
+ return Option.some(result);
4128
929
  }
4129
930
  }
4130
- const customFundChoiceApi = new CustomFundChoiceApi();
931
+ const australianFundLookupService = new AustralianFundLookupService();
4131
932
 
4132
933
  const DefaultFund = class {
4133
934
  constructor(hostRef) {
@@ -4583,12 +1384,32 @@ const FooterSection = class {
4583
1384
  }
4584
1385
  };
4585
1386
 
1387
+ const RouteLink = (props, children) => {
1388
+ return (h("stencil-route-link", { exact: true, url: props.route }, h("div", { class: {
1389
+ 'block focus:outline-none focus:ring-2 ring-offset-1 focus:ring-primary-focus focus:z-10 rounded-md py-2 text-sm font-medium w-auto px-3 sm:px-8 h-full': true,
1390
+ 'bg-white shadow-sm text-primary-base': props.isActive,
1391
+ 'hover:bg-primary-hover text-white': !props.isActive
1392
+ } }, children)));
1393
+ };
1394
+ const ChooseAnotherFundLink = (props) => {
1395
+ let route = SuperSelectionAppRoutes.MyOwnFund;
1396
+ if (window.location.href.includes(SuperSelectionAppRoutes.SelfManagedFund)) {
1397
+ route = SuperSelectionAppRoutes.SelfManagedFund;
1398
+ }
1399
+ else if (window.location.href.includes(SuperSelectionAppRoutes.DefaultFund)) {
1400
+ route = SuperSelectionAppRoutes.DefaultFund;
1401
+ }
1402
+ else if (window.location.href.includes(SuperSelectionAppRoutes.FeaturedFunds)) {
1403
+ route = SuperSelectionAppRoutes.FeaturedFunds;
1404
+ }
1405
+ return (h(RouteLink, { route: route, isActive: props.isActive }, "Choose another fund"));
1406
+ };
4586
1407
  const HeaderSection = class {
4587
1408
  constructor(hostRef) {
4588
1409
  registerInstance(this, hostRef);
4589
1410
  }
4590
1411
  render() {
4591
- return (h("div", { class: "flex justify-center" }, h("div", { class: "text-center max-w-800" }, h("h3", { class: "font-bold mb-3 sm:mb-4 text-2xl sm:text-3xl" }, "Nominate a super fund"), h(Fragment, null, h("div", { class: "text-gray-600 sm:text-lg leading-7 sm:leading-8" }, superSelectionAppService.superCampaignCanNotBeActivated ? (h(Fragment, null, "You can choose any super fund, including your current fund/SMSF or your employer\u2019s default fund.")) : (h(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 && (h("stencil-route-link", { url: SuperSelectionAppRoutes.ChoicePage }, h("a", { class: "inline-flex items-center mt-3 font-semibold text-primary-base" }, h("svg", { width: "16", height: "10", viewBox: "0 0 16 10", fill: "none", class: "mr-1", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M5.7071 9.70711C5.31657 10.0976 4.68341 10.0976 4.29288 9.70711L0.29288 5.70711C-0.0976448 5.31658 -0.0976448 4.68342 0.29288 4.29289L4.29288 0.292893C4.68341 -0.0976315 5.31657 -0.0976315 5.7071 0.292893C6.09762 0.683417 6.09762 1.31658 5.7071 1.70711L3.4142 4L15 4C15.5523 4 16 4.44772 16 5C16 5.55228 15.5523 6 15 6L3.4142 6L5.7071 8.29289C6.09762 8.68342 6.09762 9.31658 5.7071 9.70711Z", fill: "currentColor" })), h("span", { class: "leading-5 text-sm" }, "Back to featured funds"))))))));
1412
+ return (h("div", { class: "flex justify-center" }, h("div", { class: "text-center max-w-800" }, h("h3", { class: "font-bold mb-3 sm:mb-4 text-2xl sm:text-3xl" }, "Nominate a super fund"), h(Fragment, null, h("div", { class: "text-gray-600 sm:text-lg leading-7 sm:leading-8" }, superSelectionAppService.superCampaignCanNotBeActivated ? (h(Fragment, null, "You can choose any super fund, including your current fund/SMSF or your employer\u2019s default fund.")) : (h(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 && (h("div", { class: "inline-flex mt-8 sm:mt-12 bg-primary-base rounded-lg p-0.5 whitespace-normal" }, h(RouteLink, { route: SuperSelectionAppRoutes.ChoicePage, isActive: false }, "Featured super funds"), h(ChooseAnotherFundLink, { isActive: true })))))));
4592
1413
  }
4593
1414
  };
4594
1415
 
@@ -4612,71 +1433,6 @@ const LoadingPage = class {
4612
1433
  }
4613
1434
  };
4614
1435
 
4615
- const MyOwnFund = class {
4616
- constructor(hostRef) {
4617
- registerInstance(this, hostRef);
4618
- this.isNotAllInformationProvidedMessageVisible = false;
4619
- this.isSubmitDisabled = true;
4620
- this.eventTrackingService = EventTrackingService.Instance;
4621
- }
4622
- componentDidLoad() {
4623
- return this.eventTrackingService.TrackMyOwnSuperFundDetailViewedAsync({
4624
- promotedFundsShown: superSelectionAppService.promotedFunds,
4625
- defaultFundUsiSet: toUndefined(superSelectionAppService.defaultFundUsi)
4626
- });
4627
- }
4628
- render() {
4629
- const superCampaignCanNotBeActivated = superSelectionAppService.superCampaignCanNotBeActivated;
4630
- return (h(Host, null, h("sss-header-section", null), h("div", { class: "flex justify-center mt-11" }, h("sss-custom-fund", null, h("form", { noValidate: true, onSubmit: (ev) => ev.preventDefault(), class: {
4631
- 'was-validated': this.formState === 'validated'
4632
- }, ref: (el) => (this.formElement = el), onInput: (_) => (this.isSubmitDisabled = !this.formElement.checkValidity()) }, h("div", { class: "p-4 sm:p-6 pb-6 sm:pb-8 border shadow-sm rounded-lg" }, h("p", { class: "sm:text-lg font-bold mb-3" }, "Fund details"), h("div", { class: "bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-3 sm:mb-4" }, h("div", { class: "flex" }, h("div", { class: "flex-shrink-0" }, h("img", { class: "h-5 w-5", src: getAssetPath('assets/icon-exclamation.svg') })), h("div", { class: "ml-2" }, h("ul", { class: "list-disc list-outside ml-6 space-y-2 text-sm text-yellow-700 leading-5" }, h("li", null, "Make sure you are a current member of the fund before completing this step."), h("li", null, "Please check that the fund USI is correct as some funds have similar names."))))), h("sss-my-own-fund-inputs", { myOwnFundForm: state$1.myOwnFundForm, showValidationErrors: this.formState === 'validated', onFormChanged: (event) => {
4633
- state$1.myOwnFundForm = Object.assign(Object.assign({}, state$1.myOwnFundForm), event.detail);
4634
- this.isNotAllInformationProvidedMessageVisible = false;
4635
- } }), this.isNotAllInformationProvidedMessageVisible && (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."))), h("div", { class: "flex justify-center mt-8" }, h("div", { class: "sm:max-w-320 w-full" }, h("div", { class: "mb-4", onClick:
4636
- // user clicks on disabled button (div wrapper) then validation errors will show
4637
- () => (this.formState = 'validated') }, h("sss-button", { testid: "continue-button", fillWidth: true, promiseFn: () => this.handleSubmitForm(), disabled: this.isSubmitDisabled }, "Continue")), !superCampaignCanNotBeActivated && (h("stencil-route-link", { url: SuperSelectionAppRoutes.ChoicePage }, h("sss-button", { testid: "back-button", fillWidth: true, variant: "secondary" }, "Back"))))))))));
4638
- }
4639
- async handleSubmitForm() {
4640
- this.formState = 'validated';
4641
- if (!this.formElement.checkValidity()) {
4642
- return;
4643
- }
4644
- const isAllInformationProvided = isSome(state$1.myOwnFundForm.fundUsi) &&
4645
- isSome(state$1.myOwnFundForm.memberNumber) &&
4646
- isSome(state$1.myOwnFundForm.memberFirstName) &&
4647
- isSome(state$1.myOwnFundForm.memberFamilyName);
4648
- if (!isAllInformationProvided) {
4649
- this.isNotAllInformationProvidedMessageVisible = true;
4650
- return;
4651
- }
4652
- if (superSelectionAppService.isBringYourOwnFundCustomStepEnabled &&
4653
- superSelectionAppService.isUsingSuperCampaign) {
4654
- navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.MyOwnFundEngagementStep);
4655
- return;
4656
- }
4657
- navigationService.navigateInternallyToStandardChoice({
4658
- history: this.history,
4659
- fundName: this.getOrError(state$1.myOwnFundForm.fundName),
4660
- fundDetails: {
4661
- type: 'myOwnFund',
4662
- fundName: this.getOrError(state$1.myOwnFundForm.fundName),
4663
- fundUsi: this.getOrError(state$1.myOwnFundForm.fundUsi),
4664
- memberNumber: this.getOrError(state$1.myOwnFundForm.memberNumber)
4665
- },
4666
- handleSubmitFn: async (standardChoiceFormSignature) => {
4667
- 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);
4668
- await customFundChoiceApi.submitCustomFundChoiceAsync(customFundChoiceDto);
4669
- }
4670
- });
4671
- }
4672
- getOrError(option) {
4673
- return _function.pipe(option, getOrElse(() => {
4674
- throw new Error('Option value is none.');
4675
- }));
4676
- }
4677
- };
4678
- injectHistory(MyOwnFund);
4679
-
4680
1436
  const MyOwnFundEngagementStep = class {
4681
1437
  constructor(hostRef) {
4682
1438
  registerInstance(this, hostRef);
@@ -4703,20 +1459,20 @@ const MyOwnFundEngagementStep = class {
4703
1459
  async componentWillLoad() {
4704
1460
  if (superSelectionAppService.isBringYourOwnFundCustomStepEnabled &&
4705
1461
  superSelectionAppService.isUsingSuperCampaign &&
4706
- Option.isSome(state$1.myOwnFundForm.fundUsi) &&
4707
- Option.isSome(state$1.myOwnFundForm.fundName) &&
4708
- Option.isSome(state$1.myOwnFundForm.memberNumber) &&
4709
- Option.isSome(state$1.myOwnFundForm.memberFirstName) &&
4710
- Option.isSome(state$1.myOwnFundForm.memberFamilyName) &&
1462
+ Option.isSome(state.myOwnFundForm.fundUsi) &&
1463
+ Option.isSome(state.myOwnFundForm.fundName) &&
1464
+ Option.isSome(state.myOwnFundForm.memberNumber) &&
1465
+ Option.isSome(state.myOwnFundForm.memberFirstName) &&
1466
+ Option.isSome(state.myOwnFundForm.memberFamilyName) &&
4711
1467
  Option.isSome(superSelectionAppService.backendUrl) &&
4712
1468
  Option.isSome(superSelectionAppService.state.jwt)) {
4713
1469
  this.backendUrl = superSelectionAppService.backendUrl.value;
4714
1470
  this.accessToken = superSelectionAppService.state.jwt.value;
4715
- this.fundUsi = state$1.myOwnFundForm.fundUsi.value;
4716
- this.fundName = state$1.myOwnFundForm.fundName.value;
4717
- this.memberNumber = state$1.myOwnFundForm.memberNumber.value;
4718
- this.memberFirstName = state$1.myOwnFundForm.memberFirstName.value;
4719
- this.memberFamilyName = state$1.myOwnFundForm.memberFamilyName.value;
1471
+ this.fundUsi = state.myOwnFundForm.fundUsi.value;
1472
+ this.fundName = state.myOwnFundForm.fundName.value;
1473
+ this.memberNumber = state.myOwnFundForm.memberNumber.value;
1474
+ this.memberFirstName = state.myOwnFundForm.memberFirstName.value;
1475
+ this.memberFamilyName = state.myOwnFundForm.memberFamilyName.value;
4720
1476
  this.unSubscribeFromStepEvents();
4721
1477
  this.subscribeToStepEvents();
4722
1478
  superSelectionAppService.hideFooterSection = true;
@@ -4752,60 +1508,6 @@ const MyOwnFundEngagementStep = class {
4752
1508
  };
4753
1509
  injectHistory(MyOwnFundEngagementStep);
4754
1510
 
4755
- const MyOwnFundInputs = class {
4756
- constructor(hostRef) {
4757
- registerInstance(this, hostRef);
4758
- this.formChanged = createEvent(this, "formChanged", 7);
4759
- this.MIN_SEARCH_STRING_LENGTH = 3;
4760
- this.MAX_RECORD_COUNT = 25;
4761
- this.searchFundsAsync = async (searchBy) => {
4762
- const response = await australianFundLookupService.searchFundsAsync(searchBy, this.MAX_RECORD_COUNT);
4763
- switch (response.result) {
4764
- case 'TooManyResults': {
4765
- return { kind: 'too-many-results' };
4766
- }
4767
- default: {
4768
- const funds = response.data
4769
- .sort((a, b) => a.productName.localeCompare(b.productName))
4770
- .map((fund) => ({
4771
- label: `${fund.productName} (${fund.usi})`,
4772
- value: fund.usi
4773
- }));
4774
- return { kind: 'success', value: funds };
4775
- }
4776
- }
4777
- };
4778
- if (isSome(this.myOwnFundForm.fundUsi) && isSome(this.myOwnFundForm.fundName)) {
4779
- this.selectedOption = {
4780
- label: this.myOwnFundForm.fundName.value,
4781
- value: this.myOwnFundForm.fundUsi.value
4782
- };
4783
- }
4784
- }
4785
- render() {
4786
- return (h("div", null, h("div", null, h("label", { class: "text-sm font-medium text-gray-700" }, "Fund name"), h("div", { class: "mt-1" }, 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) => {
4787
- this.selectedOption = ev.detail;
4788
- this.updateFund(ev.detail);
4789
- }, showValidationErrors: this.showValidationErrors })), isSome(this.myOwnFundForm.fundUsi) && (h("div", { class: "mt-3" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Fund USI"), 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)))), h("div", { class: "mt-3" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Member number"), h("div", { class: "mt-1" }, h("input", { "data-testid": "member-number-input", type: "text", class: {
4790
- 'shadow-sm focus:ring-primary-focus focus:border-primary-base block w-full text-base sm:text-sm border-gray-300 rounded-md': true,
4791
- 'invalid:border-red-300 invalid:text-red-900 invalid:focus:ring-red-500 invalid:focus:border-red-500': this
4792
- .showValidationErrors
4793
- }, 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()) }), h("div", { class: "invalid-feedback mt-2 text-sm text-red-600" }, "Enter a valid member number (only numbers and / or letters)"))), h("div", { class: "flex space-x-4" }, h("div", { class: "mt-3 w-1/2" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Given name(s)"), h("div", { class: "mt-1" }, 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()) }))), h("div", { class: "mt-3 w-1/2" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Last name"), h("div", { class: "mt-1" }, 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()) }))))));
4794
- }
4795
- updateFund(fund) {
4796
- this.formChanged.emit({ fundUsi: some(fund.value), fundName: some(fund.label) });
4797
- }
4798
- updateMemberNumber(memberNumber) {
4799
- this.formChanged.emit({ memberNumber: some(memberNumber) });
4800
- }
4801
- updateMemberFirstName(memberFirstName) {
4802
- this.formChanged.emit({ memberFirstName: some(memberFirstName) });
4803
- }
4804
- updateMemberFamilyName(memberFamilyName) {
4805
- this.formChanged.emit({ memberFamilyName: some(memberFamilyName) });
4806
- }
4807
- };
4808
-
4809
1511
  const MemberNameInput = class {
4810
1512
  constructor(hostRef) {
4811
1513
  registerInstance(this, hostRef);
@@ -5857,206 +2559,120 @@ const PrefillWarningBox = class {
5857
2559
  }
5858
2560
  };
5859
2561
 
5860
- function validateAbn(abn) {
5861
- const digitArray = abn.split('').map(Number);
5862
- const isAllDigits = digitArray.every((d) => !isNaN(d));
5863
- const weightingFactors = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19];
5864
- if (!isAllDigits || digitArray.length !== weightingFactors.length) {
5865
- return false;
5866
- }
5867
- digitArray[0]--;
5868
- const sum = digitArray.reduce((sum, digit, i) => sum + digit * weightingFactors[i], 0);
5869
- return sum % 89 === 0;
5870
- }
5871
-
5872
- const SelfManagedFund = class {
2562
+ const SmsfEngagementStep = class {
5873
2563
  constructor(hostRef) {
5874
2564
  registerInstance(this, hostRef);
5875
- this.isSubmitDisabled = true;
5876
- this.isAbnValid = validateAbn(state$1.selfManagedFundForm.fundAbn);
5877
- this.eventTrackingService = EventTrackingService.Instance;
5878
- this.success = () => {
5879
- navigationService.navigateInternallyToStandardChoice({
5880
- history: this.history,
5881
- fundName: 'Self-managed super fund',
5882
- fundDetails: {
5883
- type: 'smsf',
5884
- fundName: state$1.selfManagedFundForm.fundName,
5885
- fundEsa: state$1.selfManagedFundForm.fundEsa
5886
- },
5887
- handleSubmitFn: async (standardChoiceFormSignature) => {
5888
- const requestDto = Object.assign({ smsfChoice: {
5889
- abn: state$1.selfManagedFundForm.fundAbn,
5890
- fundName: state$1.selfManagedFundForm.fundName,
5891
- fundAddress: {
5892
- addressLine1: state$1.selfManagedFundForm.addressLine1,
5893
- addressLine2: state$1.selfManagedFundForm.addressLine2,
5894
- city: state$1.selfManagedFundForm.city,
5895
- state: state$1.selfManagedFundForm.state,
5896
- postcode: state$1.selfManagedFundForm.postcode
5897
- },
5898
- bsb: state$1.selfManagedFundForm.bsb,
5899
- bankAccountName: state$1.selfManagedFundForm.bankAccountName,
5900
- bankAccountNumber: state$1.selfManagedFundForm.bankAccountNumber,
5901
- electronicServiceAddress: state$1.selfManagedFundForm.fundEsa,
5902
- memberFirstName: state$1.selfManagedFundForm.memberFirstName,
5903
- memberFamilyName: state$1.selfManagedFundForm.memberFamilyName
5904
- }, standardChoiceFormSignature }, superSelectionAppService.promotedFundsConfig);
5905
- await customFundChoiceApi.submitSelfManagedFundChoiceAsync(requestDto);
5906
- }
5907
- });
2565
+ this.allFormFieldsAreFilled = (selfManagedFundForm) => {
2566
+ return (selfManagedFundForm.fundName != null &&
2567
+ selfManagedFundForm.fundAbn != null &&
2568
+ selfManagedFundForm.fundEsa != null &&
2569
+ selfManagedFundForm.addressLine1 != null &&
2570
+ selfManagedFundForm.city != null &&
2571
+ selfManagedFundForm.state != null &&
2572
+ selfManagedFundForm.postcode != null &&
2573
+ selfManagedFundForm.bsb != null &&
2574
+ selfManagedFundForm.bankAccountName != null &&
2575
+ selfManagedFundForm.bankAccountNumber != null &&
2576
+ selfManagedFundForm.memberFirstName != null &&
2577
+ selfManagedFundForm.memberFamilyName != null);
2578
+ };
2579
+ this.stepContinued = async (event) => {
2580
+ if (event.detail.sender == 'smsf-engagement') {
2581
+ await EventTrackingService.Instance.TrackSuperSmsfEngagementStepContinued(event.detail.reason);
2582
+ this.navigateToStandardChoice();
2583
+ }
2584
+ };
2585
+ this.subscribeToStepEvents = () => {
2586
+ for (const eventName in this.stepEventHandlers) {
2587
+ document.addEventListener(eventName, this.stepEventHandlers[eventName]);
2588
+ }
2589
+ };
2590
+ this.unSubscribeFromStepEvents = () => {
2591
+ for (const eventName in this.stepEventHandlers) {
2592
+ document.removeEventListener(eventName, this.stepEventHandlers[eventName]);
2593
+ }
2594
+ };
2595
+ this.stepEventHandlers = {
2596
+ continue: this.stepContinued.bind(this)
5908
2597
  };
5909
2598
  }
5910
- componentDidLoad() {
5911
- this.updateIsSubmitDisabled();
5912
- return this.eventTrackingService.TrackSmsfSuperFundDetailViewedAsync({
5913
- promotedFundsShown: superSelectionAppService.promotedFunds,
5914
- defaultFundUsiSet: toUndefined(superSelectionAppService.defaultFundUsi)
5915
- });
5916
- }
5917
- render() {
5918
- return (h(Host, null, h("sss-header-section", null), h("div", { class: "flex justify-center mt-11" }, h("sss-custom-fund", null, h("form", { noValidate: true, onSubmit: (ev) => ev.preventDefault(), class: {
5919
- 'was-validated': this.formState === 'validated'
5920
- }, ref: (el) => (this.formElement = el), onInput: (_) => this.updateIsSubmitDisabled() }, h("div", { class: "p-4 sm:p-6 pb-6 sm:pb-8 border shadow-sm rounded-lg max-w-560" }, h("p", { class: "sm:text-lg font-bold" }, "Fund details"), h("div", { class: "bg-yellow-50 border-l-4 border-yellow-400 p-4 my-3" }, h("div", { class: "flex" }, h("div", { class: "flex-shrink-0" }, h("img", { class: "h-5 w-5", src: getAssetPath('assets/icon-exclamation.svg') })), h("div", { class: "ml-3 text-sm text-yellow-700 leading-5" }, "Make sure your Self-managed super fund (SMSF) is a registered fund before completing this step."))), h("sss-self-managed-fund-inputs", { fundForm: state$1.selfManagedFundForm, showValidationErrors: this.formState === 'validated', onFormChanged: (event) => {
5921
- state$1.selfManagedFundForm = Object.assign(Object.assign({}, state$1.selfManagedFundForm), event.detail);
5922
- if (event.detail.isAbnValid !== undefined)
5923
- this.isAbnValid = event.detail.isAbnValid;
5924
- this.updateIsSubmitDisabled();
5925
- } })), h("div", { class: "flex justify-center mt-8" }, h("div", { class: "sm:max-w-320 w-full" }, h("div", { class: "mb-4", onClick:
5926
- // user clicks on disabled button (div wrapper) then validation errors will show
5927
- () => (this.formState = 'validated') }, h("sss-button", { testid: "continue-button", fillWidth: true, promiseFn: () => this.handleSubmitForm(), disabled: this.isSubmitDisabled }, "Continue")), h("stencil-route-link", { url: SuperSelectionAppRoutes.ChoicePage }, h("sss-button", { testid: "back-button", fillWidth: true, variant: "secondary" }, "Back")))))))));
5928
- }
5929
- updateIsSubmitDisabled() {
5930
- this.isSubmitDisabled = !this.formElement.checkValidity() || !this.isAbnValid;
5931
- }
5932
- async handleSubmitForm() {
5933
- this.formState = 'validated';
5934
- if (this.formElement.checkValidity())
5935
- this.success();
2599
+ async componentWillLoad() {
2600
+ if (superSelectionAppService.isSmsfCustomStepEnabled &&
2601
+ superSelectionAppService.isUsingSuperCampaign &&
2602
+ this.allFormFieldsAreFilled(state.selfManagedFundForm) &&
2603
+ Option.isSome(superSelectionAppService.backendUrl) &&
2604
+ Option.isSome(superSelectionAppService.state.jwt)) {
2605
+ this.backendUrl = superSelectionAppService.backendUrl.value;
2606
+ this.accessToken = superSelectionAppService.state.jwt.value;
2607
+ this.accountId = superSelectionAppService.accountIdOrDefault;
2608
+ this.partnerId = superSelectionAppService.partnerIdOrDefault;
2609
+ this.initialiseFormState(state.selfManagedFundForm);
2610
+ this.unSubscribeFromStepEvents();
2611
+ this.subscribeToStepEvents();
2612
+ superSelectionAppService.hideFooterSection = true;
2613
+ await EventTrackingService.Instance.TrackSuperSmsfEngagementStepActivationSucceeded();
2614
+ }
2615
+ else {
2616
+ navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.SelfManagedFund);
2617
+ }
5936
2618
  }
5937
- };
5938
- injectHistory(SelfManagedFund);
5939
-
5940
- var AbnValidationStatus;
5941
- (function (AbnValidationStatus) {
5942
- AbnValidationStatus[AbnValidationStatus["Invalid"] = 1] = "Invalid";
5943
- AbnValidationStatus[AbnValidationStatus["AbnIsUsedForRegulatedFund"] = 2] = "AbnIsUsedForRegulatedFund";
5944
- AbnValidationStatus[AbnValidationStatus["Valid"] = 3] = "Valid";
5945
- })(AbnValidationStatus || (AbnValidationStatus = {}));
5946
- const SelfManagedFundInputs = class {
5947
- constructor(hostRef) {
5948
- registerInstance(this, hostRef);
5949
- this.formChanged = createEvent(this, "formChanged", 7);
5950
- this.abnValidationStatus = AbnValidationStatus.Invalid;
5951
- this.isAbnTouched = false;
5952
- this.currentBank = none;
5953
- this.addressErrorMessage = none;
5954
- this.stateOptions = [
5955
- { value: 'NSW', label: 'NSW' },
5956
- { value: 'QLD', label: 'QLD' },
5957
- { value: 'ACT', label: 'ACT' },
5958
- { value: 'VIC', label: 'VIC' },
5959
- { value: 'TAS', label: 'TAS' },
5960
- { value: 'WA', label: 'WA' },
5961
- { value: 'SA', label: 'SA' },
5962
- { value: 'NT', label: 'NT' }
5963
- ];
5964
- this.bsbRegex = new RegExp(/^[0-9]{3}[0-9]{3}$/);
5965
- this.bankAccountNumberRegex = new RegExp(/^[0-9]{2,10}$/);
2619
+ disconnectedCallback() {
2620
+ this.unSubscribeFromStepEvents();
2621
+ superSelectionAppService.hideFooterSection = false;
5966
2622
  }
5967
2623
  render() {
5968
- const inputClass = {
5969
- 'relative shadow-sm focus:ring-primary-focus focus:border-primary-base block w-full text-base sm:text-sm border-gray-300 rounded-md focus:z-10': true,
5970
- 'invalid:border-red-300 invalid:text-red-900 invalid:placeholder-red-300 invalid:focus:ring-red-500 invalid:focus:border-red-500': this
5971
- .showValidationErrors
5972
- };
5973
- return (h("div", null, h("div", null, h("label", { class: "text-sm font-medium text-gray-700" }, "Fund name"), h("div", { class: "mt-1" }, h("input", { type: "text", class: inputClass, required: true, minlength: "2", name: "fundName", id: "fundName", value: state$1.selfManagedFundForm.fundName, onChange: (ev) => this.updateFormField('fundName', ev.target.value.trim()) }), h("div", { class: "invalid-feedback mt-2 text-sm text-red-600" }, "Enter a valid fund name"))), h("div", { class: "mt-3" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Fund ABN"), h("div", { class: "mt-1" }, h("input", { type: "text", class: inputClass, required: true, minlength: "2", name: "fundAbn", id: "fundAbn", value: state$1.selfManagedFundForm.fundAbn, inputmode: "numeric", pattern: "[0-9]*", onKeyUp: async (ev) => {
5974
- const abnInput = ev.target;
5975
- this.updateFormField('fundAbn', abnInput.value.trim());
5976
- this.abnValidationStatus = AbnValidationStatus.Invalid;
5977
- if (validateAbn(abnInput.value)) {
5978
- const isAbnUsedForRegulatedFund = await this.isAbnUsedForRegulatedAsync(abnInput.value);
5979
- this.abnValidationStatus = isAbnUsedForRegulatedFund
5980
- ? AbnValidationStatus.AbnIsUsedForRegulatedFund
5981
- : AbnValidationStatus.Valid;
5982
- }
5983
- // We need to set a custom validity message to trigger css invalid styles for non valid cases
5984
- const validityMessage = this.abnValidationStatus === AbnValidationStatus.Valid
5985
- ? ''
5986
- : 'Enter a valid fund ABN (digits only)';
5987
- abnInput.setCustomValidity(validityMessage);
5988
- this.updateFormField('isAbnValid', this.abnValidationStatus === AbnValidationStatus.Valid);
5989
- }, onBlur: () => (this.isAbnTouched = true) }), this.renderAbnValidationError())), h("div", { class: "mt-3" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Electronic service address alias (ESA)"), h("div", { class: "mt-1" }, h("input", { type: "text", class: inputClass, required: true, minlength: "2", name: "fundEsa", id: "fundEsa", value: state$1.selfManagedFundForm.fundEsa, onChange: (ev) => this.updateFormField('fundEsa', ev.target.value.trim()) }), h("div", { class: "invalid-feedback mt-2 text-sm text-red-600" }, "Enter a valid fund ESA"))), h("div", { class: "mt-3" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Fund address"), h("div", { class: "mt-1 rounded-md shadow-sm -space-y-px" }, h("input", { placeholder: "Address line 1", type: "text", class: Object.assign(Object.assign({}, inputClass), { 'rounded-none rounded-t-md shadow-none': true }), required: true, minlength: "2", name: "addressLine1", id: "addressLine1", value: state$1.selfManagedFundForm.addressLine1, onChange: (ev) => {
5990
- this.updateFormField('addressLine1', ev.target.value.trim());
5991
- this.updateAddressErrorMessage();
5992
- }, ref: (el) => (this.addressLine1Element = el) }), h("input", { placeholder: "Address line 2 (optional)", type: "text", class: Object.assign(Object.assign({}, inputClass), { 'rounded-none shadow-none': true }), name: "addressLine2", id: "addressLine2", value: state$1.selfManagedFundForm.addressLine2, onChange: (ev) => this.updateFormField('addressLine2', ev.target.value.trim()) }), h("input", { placeholder: "City/suburb", type: "text", class: Object.assign(Object.assign({}, inputClass), { 'rounded-none shadow-none': true }), name: "city", required: true, id: "city", value: state$1.selfManagedFundForm.city, onChange: (ev) => {
5993
- this.updateFormField('city', ev.target.value.trim());
5994
- this.updateAddressErrorMessage();
5995
- }, ref: (el) => (this.cityElement = el) }), h("div", { class: "flex -space-x-px" }, h("div", { class: "w-1/2 flex-1 min-w-0" }, h("input", { placeholder: "Postcode", type: "text", required: true, class: Object.assign(Object.assign({}, inputClass), { 'rounded-none rounded-bl-md shadow-none': true }), name: "postcode", minlength: "4", maxlength: "4", pattern: "[0-9]{4}", id: "postcode", value: state$1.selfManagedFundForm.postcode, inputmode: "numeric", onChange: (ev) => {
5996
- this.updateFormField('postcode', ev.target.value.trim());
5997
- this.updateAddressErrorMessage();
5998
- }, ref: (el) => (this.postcodeElement = el) })), h("div", { class: "flex-1 min-w-0" }, h("select", { class: Object.assign(Object.assign({}, inputClass), { 'rounded-none rounded-br-md shadow-none': true, 'text-gray-500': this.fundForm.state !== undefined }), name: "state", required: true, id: "state", onChange: (ev) => {
5999
- this.updateFormField('state', ev.target.value.trim());
6000
- this.updateAddressErrorMessage();
6001
- }, ref: (el) => (this.stateElement = el) }, h("option", { disabled: true, selected: this.fundForm.state !== undefined, value: "" }, "State"), this.stateOptions.map((s) => (h("option", { value: s.value, selected: this.fundForm.state === s.value }, s.label))))))), isSome(this.addressErrorMessage) && this.showValidationErrors && (h("div", { class: "mt-2 text-sm text-red-600" }, this.addressErrorMessage.value))), h("div", { class: "flex space-x-4" }, h("div", { class: "mt-3 w-1/2" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Given name(s)"), h("div", { class: "mt-1" }, h("sss-name-input", { testId: "member-given-names-input", name: "memberFirstName", readableName: "Member given name(s)", showValidationErrors: this.showValidationErrors, value: state$1.selfManagedFundForm.memberFirstName, onChange: (ev) => this.updateFormField('memberFirstName', ev.target.value.trim()) }))), h("div", { class: "mt-3 w-1/2" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Last name"), h("div", { class: "mt-1" }, h("sss-name-input", { testId: "member-last-name-input", name: "memberFamilyName", readableName: "Member last name", showValidationErrors: this.showValidationErrors, value: state$1.selfManagedFundForm.memberFamilyName, onChange: (ev) => this.updateFormField('memberFamilyName', ev.target.value.trim()) })))), h("h3", { class: "text-lg font-bold mt-6" }, "Fund bank details"), h("div", { class: "mt-3" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Account name"), h("div", { class: "mt-1" }, h("input", { type: "text", required: true, class: inputClass, name: "bankAccountName", minlength: "2", id: "bankAccountName", value: state$1.selfManagedFundForm.bankAccountName, onChange: (ev) => this.updateFormField('bankAccountName', ev.target.value.trim()) }), h("div", { class: "invalid-feedback mt-2 text-sm text-red-600" }, "Enter a valid bank account name"))), h("div", { class: "mt-3" }, h("label", { class: "text-sm font-medium text-gray-700" }, "BSB"), h("div", { class: "mt-1" }, h("input", { type: "text", required: true, class: inputClass, name: "bsb", id: "bsb", minlength: "6", maxlength: "7", inputmode: "numeric", onKeyUp: (ev) => this.updateCurrentBank(ev), pattern: this.bsbRegex.source, value: state$1.selfManagedFundForm.bsb }), h("div", { class: "invalid-feedback mt-2 text-sm text-red-600" }, "Enter a valid BSB"))), isSome(this.currentBank) && (h("div", { class: "mt-3" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Bank name"), h("div", { class: "mt-1 shadow-sm px-3 py-2 rounded-md border border-gray-300 bg-gray-50 text-gray-500 text-sm" }, this.currentBank.value))), h("div", { class: "mt-3" }, h("label", { class: "text-sm font-medium text-gray-700" }, "Account number"), h("div", { class: "mt-1" }, h("input", { type: "text", required: true, class: inputClass, name: "bankAccountNumber", id: "bankAccountNumber", minlength: "2", maxlength: "11", pattern: this.bankAccountNumberRegex.source, inputmode: "numeric", value: state$1.selfManagedFundForm.bankAccountNumber, onKeyUp: (ev) => this.updateCurrentBankAccountNumber(ev), onChange: (ev) => this.updateFormField('bankAccountNumber', ev.target.value.trim()) }), h("div", { class: "invalid-feedback mt-2 text-sm text-red-600" }, "Enter a valid bank account number")))));
6002
- }
6003
- updateFormField(key, value) {
6004
- this.formChanged.emit({ [key]: value });
6005
- }
6006
- async isAbnUsedForRegulatedAsync(abn) {
6007
- return !(await customFundChoiceApi.validateAbnForSMSF(abn));
6008
- }
6009
- renderAbnValidationError() {
6010
- if (this.isAbnTouched || this.showValidationErrors) {
6011
- switch (this.abnValidationStatus) {
6012
- case AbnValidationStatus.Invalid:
6013
- return h("div", { class: "mt-2 text-sm text-red-600" }, "Enter a valid fund ABN (digits only)");
6014
- case AbnValidationStatus.AbnIsUsedForRegulatedFund:
6015
- return (h("div", { class: "mt-2 text-sm text-red-600" }, "The supplied ABN is for a regulated fund"));
6016
- case AbnValidationStatus.Valid:
6017
- return [];
6018
- }
6019
- }
6020
- return [];
2624
+ return (h(Host, null, h("apollo-super-smsf-engagement", { "backend-url": this.backendUrl, "access-token": this.accessToken, "account-id": this.accountId, "partner-id": this.partnerId })));
6021
2625
  }
6022
- filterDigits(str) {
6023
- return str.replace(/[^0-9]/g, '');
2626
+ navigateToStandardChoice() {
2627
+ navigationService.navigateInternallyToStandardChoice({
2628
+ history: this.history,
2629
+ fundName: 'Self-managed super fund',
2630
+ fundDetails: {
2631
+ type: 'smsf',
2632
+ fundName: this.fundName,
2633
+ fundEsa: this.fundEsa
2634
+ },
2635
+ handleSubmitFn: async (standardChoiceFormSignature) => {
2636
+ const requestDto = Object.assign({ smsfChoice: {
2637
+ abn: this.fundAbn,
2638
+ fundName: this.fundName,
2639
+ fundAddress: {
2640
+ addressLine1: this.fundAddress.addressLine1,
2641
+ addressLine2: this.fundAddress.addressLine2,
2642
+ city: this.fundAddress.city,
2643
+ state: this.fundAddress.state,
2644
+ postcode: this.fundAddress.postcode
2645
+ },
2646
+ bsb: this.bsb,
2647
+ bankAccountName: this.bankAccountName,
2648
+ bankAccountNumber: this.bankAccountNumber,
2649
+ electronicServiceAddress: this.fundEsa,
2650
+ memberFirstName: this.memberFirstName,
2651
+ memberFamilyName: this.memberFamilyName
2652
+ }, standardChoiceFormSignature }, superSelectionAppService.promotedFundsConfig);
2653
+ await customFundChoiceApi.submitSelfManagedFundChoiceAsync(requestDto);
2654
+ }
2655
+ });
6024
2656
  }
6025
- updateCurrentBank(ev) {
6026
- const value = this.filterDigits(ev.target.value);
6027
- const firstTwoNumbers = value.substring(0, 2);
6028
- const firstThreeNumbers = value.substring(0, 3);
6029
- const firstTwoNumberBankName = bsbNumbers[firstTwoNumbers];
6030
- const firstThreeNumberBankName = bsbNumbers[firstThreeNumbers];
6031
- if (firstTwoNumberBankName)
6032
- this.currentBank = some(firstTwoNumberBankName);
6033
- if (firstThreeNumberBankName)
6034
- this.currentBank = some(firstThreeNumberBankName);
6035
- if (value === '' || value.length > 6)
6036
- this.currentBank = none;
6037
- this.updateFormField('bsb', value);
6038
- }
6039
- updateCurrentBankAccountNumber(ev) {
6040
- const value = this.filterDigits(ev.target.value);
6041
- this.updateFormField('bankAccountNumber', value);
6042
- }
6043
- updateAddressErrorMessage() {
6044
- let message = none;
6045
- if (isNone(message) && !this.addressLine1Element.checkValidity()) {
6046
- message = some('Enter a valid address line 1');
6047
- }
6048
- if (isNone(message) && !this.cityElement.checkValidity()) {
6049
- message = some('Enter a valid city/suburb');
6050
- }
6051
- if (isNone(message) && !this.postcodeElement.checkValidity()) {
6052
- message = some('Enter a valid post code');
6053
- }
6054
- if (isNone(message) && !this.stateElement.checkValidity()) {
6055
- message = some('Select a state');
6056
- }
6057
- this.addressErrorMessage = message;
2657
+ initialiseFormState(selfManagedFundForm) {
2658
+ this.fundName = selfManagedFundForm.fundName;
2659
+ this.fundAbn = selfManagedFundForm.fundAbn;
2660
+ this.fundEsa = selfManagedFundForm.fundEsa;
2661
+ this.fundAddress = {
2662
+ addressLine1: selfManagedFundForm.addressLine1,
2663
+ addressLine2: selfManagedFundForm.addressLine2,
2664
+ city: selfManagedFundForm.city,
2665
+ state: selfManagedFundForm.state,
2666
+ postcode: selfManagedFundForm.postcode
2667
+ };
2668
+ this.bsb = selfManagedFundForm.bsb;
2669
+ this.bankAccountName = selfManagedFundForm.bankAccountName;
2670
+ this.bankAccountNumber = selfManagedFundForm.bankAccountNumber;
2671
+ this.memberFirstName = selfManagedFundForm.memberFirstName;
2672
+ this.memberFamilyName = selfManagedFundForm.memberFamilyName;
6058
2673
  }
6059
2674
  };
2675
+ injectHistory(SmsfEngagementStep);
6060
2676
 
6061
2677
  const StandardChoiceFormInputDefaultFund = class {
6062
2678
  constructor(hostRef) {
@@ -6074,7 +2690,7 @@ const StandardChoiceFormInputDefaultFund = class {
6074
2690
  window.removeEventListener('popstate', this.ignorePopState);
6075
2691
  }
6076
2692
  render() {
6077
- return (h(Host, null, h("div", { class: "text-2xl sm:text-3xl font-bold text-center" }, "Confirm your super choice"), 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."), h("div", { class: "flex justify-center mt-8 sm:mt-12" }, h("div", { class: "max-w-560" }, h("div", { class: "p-4 sm:p-6 border shadow-sm rounded-lg flex flex-col sm:flex-row" }, this.renderLogo(), h("div", { class: "flex justify-between w-full" }, h("div", null, h("div", { class: "text-xs font-semibold text-gray-500 uppercase" }, "Nominated fund"), h("div", { class: "text-sm mt-2" }, state.fundName)), h("div", { class: "grid content-center ml-4" }, h("sss-button", { testid: "change-fund-button", size: "xs", variant: "secondary", promiseFn: async () => {
2693
+ return (h(Host, null, h("div", { class: "text-2xl sm:text-3xl font-bold text-center" }, "Confirm your super choice"), 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."), h("div", { class: "flex justify-center mt-8 sm:mt-12" }, h("div", { class: "max-w-560" }, h("div", { class: "p-4 sm:p-6 border shadow-sm rounded-lg flex flex-col sm:flex-row" }, this.renderLogo(), h("div", { class: "flex justify-between w-full" }, h("div", null, h("div", { class: "text-xs font-semibold text-gray-500 uppercase" }, "Nominated fund"), h("div", { class: "text-sm mt-2" }, state$1.fundName)), h("div", { class: "grid content-center ml-4" }, h("sss-button", { testid: "change-fund-button", size: "xs", variant: "secondary", promiseFn: async () => {
6078
2694
  await this.trackChangeRequestedAsync();
6079
2695
  navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
6080
2696
  } }, "Change")))), h("div", { class: "mt-4 p-4 sm:p-6 border shadow-sm rounded-lg" }, h("div", { class: "sm:text-lg font-bold" }, "Superannuation Standard Choice Form"), h("div", { class: "bg-blue-50 border-l-4 border-blue-400 p-4 mt-3" }, h("div", { class: "flex" }, h("div", { class: "flex-shrink-0" }, h("img", { class: "h-5 w-5", src: getAssetPath('assets/icon-information-circle.svg') })), h("div", { class: "ml-2" }, 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.")))), h("form", { noValidate: true, onSubmit: (ev) => ev.preventDefault(), class: {
@@ -6107,35 +2723,35 @@ const StandardChoiceFormInputDefaultFund = class {
6107
2723
  promotedFundsShown: superSelectionAppService.promotedFunds,
6108
2724
  defaultFundUsiSet: toUndefined(superSelectionAppService.defaultFundUsi)
6109
2725
  };
6110
- switch (state.fundDetails.type) {
2726
+ switch (state$1.fundDetails.type) {
6111
2727
  case 'default':
6112
2728
  await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
6113
- DefaultFund: Object.assign(Object.assign({}, state.fundDetails), common)
2729
+ DefaultFund: Object.assign(Object.assign({}, state$1.fundDetails), common)
6114
2730
  });
6115
2731
  break;
6116
2732
  case 'myOwnFund':
6117
2733
  await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
6118
- MyOwnFund: Object.assign(Object.assign({}, state.fundDetails), common)
2734
+ MyOwnFund: Object.assign(Object.assign({}, state$1.fundDetails), common)
6119
2735
  });
6120
2736
  break;
6121
2737
  case 'smsf':
6122
2738
  await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
6123
- Smsf: Object.assign(Object.assign({}, state.fundDetails), common)
2739
+ Smsf: Object.assign(Object.assign({}, state$1.fundDetails), common)
6124
2740
  });
6125
2741
  break;
6126
2742
  case 'promoted':
6127
2743
  await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
6128
- PromotedFund: Object.assign(Object.assign({}, state.fundDetails), common)
2744
+ PromotedFund: Object.assign(Object.assign({}, state$1.fundDetails), common)
6129
2745
  });
6130
2746
  break;
6131
2747
  case 'promotedDefault':
6132
2748
  await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
6133
- PromotedDefaultFund: Object.assign(Object.assign({}, state.fundDetails), common)
2749
+ PromotedDefaultFund: Object.assign(Object.assign({}, state$1.fundDetails), common)
6134
2750
  });
6135
2751
  break;
6136
2752
  case 'promotedDefaultWithJoin':
6137
2753
  await this.eventTrackingService.TrackSuperFundDetailChangeRequestedAsync({
6138
- PromotedDefaultFundWithJoin: Object.assign(Object.assign({}, state.fundDetails), common)
2754
+ PromotedDefaultFundWithJoin: Object.assign(Object.assign({}, state$1.fundDetails), common)
6139
2755
  });
6140
2756
  break;
6141
2757
  case 'null':
@@ -6145,7 +2761,7 @@ const StandardChoiceFormInputDefaultFund = class {
6145
2761
  async handleSubmitForm() {
6146
2762
  this.formState = 'validated';
6147
2763
  if (this.formElement.checkValidity()) {
6148
- await state.handleSubmitFn(this.standardChoiceFormSignature.trim());
2764
+ await state$1.handleSubmitFn(this.standardChoiceFormSignature.trim());
6149
2765
  superSelectionAppService.markSuperSelectionAsSubmitted();
6150
2766
  }
6151
2767
  }
@@ -16152,21 +12768,6 @@ const SuperCampaignHost = class {
16152
12768
  constructor(hostRef) {
16153
12769
  registerInstance(this, hostRef);
16154
12770
  this.scriptImported = false;
16155
- this.getEnvironmentTag = () => {
16156
- const discriminator = window.location.hostname.toLowerCase().split('.')[0];
16157
- switch (discriminator) {
16158
- case 'autodev-partner':
16159
- return 'autodev';
16160
- case 'test-partner':
16161
- return 'test';
16162
- case 'partner':
16163
- return 'prod';
16164
- case 'sandbox-partner':
16165
- return 'sandbox';
16166
- default:
16167
- return 'autodev';
16168
- }
16169
- };
16170
12771
  this.subscribeToSuperCampaignEvents = () => {
16171
12772
  for (const eventName in this.superCampaignEventHandlers) {
16172
12773
  document.addEventListener(eventName, this.superCampaignEventHandlers[eventName]);
@@ -16272,7 +12873,7 @@ const SuperCampaignHost = class {
16272
12873
  this.unSubscribeFromSuperCampaignEvents();
16273
12874
  if (superSelectionAppService.state.superCampaignComponentStatus ===
16274
12875
  SuperCampaignComponentStatus.NotLoaded) {
16275
- superCampaingScriptPath = this.createApolloSuperCampaignScriptUrl(this.getEnvironmentTag());
12876
+ superCampaingScriptPath = this.createApolloSuperCampaignScriptUrl();
16276
12877
  await import(superCampaingScriptPath);
16277
12878
  this.loadingTimeoutRef = setTimeout(this.superCampaignLoadingTimeoutTriggered.bind(this), LoadWaitingTimeout);
16278
12879
  }
@@ -16316,12 +12917,152 @@ const SuperCampaignHost = class {
16316
12917
  });
16317
12918
  }
16318
12919
  }
16319
- createApolloSuperCampaignScriptUrl(envTag) {
16320
- return `https://npm-cdn.flarehr.com/@flarehr/apollo-super-campaign@${envTag}/dist/apollo-super-campaign.js`;
12920
+ createApolloSuperCampaignScriptUrl() {
12921
+ const getSubdomain = () => {
12922
+ const discriminator = window.location.hostname.toLowerCase().split('.')[0];
12923
+ switch (discriminator) {
12924
+ case 'test-partner':
12925
+ case 'partner':
12926
+ case 'sandbox-partner':
12927
+ case 'autodev-partner':
12928
+ return discriminator;
12929
+ default:
12930
+ return 'autodev-partner';
12931
+ }
12932
+ };
12933
+ return `https://${getSubdomain()}.flarehr.com/super-campaign/cdn/app/apollo-super-campaign.js`;
16321
12934
  }
16322
12935
  };
16323
12936
  injectHistory(SuperCampaignHost);
16324
12937
 
12938
+ const LoadWaitingTimeout$1 = 30000;
12939
+
12940
+ var SuperSmsfComponentStatus;
12941
+ (function (SuperSmsfComponentStatus) {
12942
+ SuperSmsfComponentStatus[SuperSmsfComponentStatus["NotLoaded"] = 1] = "NotLoaded";
12943
+ SuperSmsfComponentStatus[SuperSmsfComponentStatus["Loaded"] = 2] = "Loaded";
12944
+ })(SuperSmsfComponentStatus || (SuperSmsfComponentStatus = {}));
12945
+ let superSmsfComponentStatus = SuperSmsfComponentStatus.NotLoaded;
12946
+ const SuperSmsfHost = class {
12947
+ constructor(hostRef) {
12948
+ registerInstance(this, hostRef);
12949
+ this.eventTrackingService = EventTrackingService.Instance;
12950
+ this.subscribeToSuperSmsfEvents = () => {
12951
+ for (const eventName in this.smsfEventHandlers) {
12952
+ document.addEventListener(eventName, this.smsfEventHandlers[eventName]);
12953
+ }
12954
+ };
12955
+ this.unSubscribeFromSuperSmsfEvents = () => {
12956
+ for (const eventName in this.smsfEventHandlers) {
12957
+ document.removeEventListener(eventName, this.smsfEventHandlers[eventName]);
12958
+ }
12959
+ };
12960
+ this.smsfLoaded = async (event) => {
12961
+ if (event.detail.sender === 'super-smsf') {
12962
+ superSmsfComponentStatus = SuperSmsfComponentStatus.Loaded;
12963
+ clearTimeout(this.loadingTimeoutRef);
12964
+ await this.eventTrackingService.TrackSmsfSuperFundDetailViewedAsync({
12965
+ promotedFundsShown: superSelectionAppService.promotedFunds,
12966
+ defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi)
12967
+ });
12968
+ }
12969
+ return Promise.resolve();
12970
+ };
12971
+ this.smsfCompleted = async (event) => {
12972
+ if (event.detail.sender === 'super-smsf') {
12973
+ this.updateCustomFundStateStore(event.detail);
12974
+ if (superSelectionAppService.isSmsfCustomStepEnabled &&
12975
+ superSelectionAppService.isUsingSuperCampaign) {
12976
+ navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.SmsfEngagementStep);
12977
+ return;
12978
+ }
12979
+ navigationService.navigateInternallyToStandardChoice({
12980
+ history: this.history,
12981
+ fundName: 'Self-managed super fund',
12982
+ fundDetails: {
12983
+ type: 'smsf',
12984
+ fundName: event.detail.fundName,
12985
+ fundEsa: event.detail.fundEsa
12986
+ },
12987
+ handleSubmitFn: async (standardChoiceFormSignature) => {
12988
+ const requestDto = Object.assign({ smsfChoice: {
12989
+ abn: event.detail.fundAbn,
12990
+ fundName: event.detail.fundName,
12991
+ fundAddress: {
12992
+ addressLine1: event.detail.fundAddressLine1,
12993
+ addressLine2: event.detail.fundAddressLine2,
12994
+ city: event.detail.fundCity,
12995
+ state: event.detail.fundState,
12996
+ postcode: event.detail.fundPostcode
12997
+ },
12998
+ bsb: event.detail.bankBsb,
12999
+ bankAccountName: event.detail.bankAccountName,
13000
+ bankAccountNumber: event.detail.bankAccountNumber,
13001
+ electronicServiceAddress: event.detail.fundEsa,
13002
+ memberFirstName: event.detail.memberFirstName,
13003
+ memberFamilyName: event.detail.memberLastName
13004
+ }, standardChoiceFormSignature }, superSelectionAppService.promotedFundsConfig);
13005
+ await customFundChoiceApi.submitSelfManagedFundChoiceAsync(requestDto);
13006
+ }
13007
+ });
13008
+ }
13009
+ };
13010
+ this.smsfCancelled = async (event) => {
13011
+ if (event.detail.sender === 'super-smsf') {
13012
+ navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
13013
+ }
13014
+ };
13015
+ this.smsfEventHandlers = {
13016
+ 'smsf-loaded': this.smsfLoaded.bind(this),
13017
+ 'smsf-completed': this.smsfCompleted.bind(this),
13018
+ 'smsf-cancelled': this.smsfCancelled.bind(this)
13019
+ };
13020
+ }
13021
+ async componentWillLoad() {
13022
+ if (Option.isSome(superSelectionAppService.backendUrl) && Option.isSome(superSelectionAppService.state.jwt)) {
13023
+ this.backendUrl = superSelectionAppService.backendUrl.value;
13024
+ this.accessToken = superSelectionAppService.state.jwt.value;
13025
+ if (superSmsfComponentStatus === SuperSmsfComponentStatus.NotLoaded) {
13026
+ this.loadingTimeoutRef = setTimeout(this.smsfLoadingTimeoutTriggered.bind(this), LoadWaitingTimeout$1);
13027
+ }
13028
+ this.subscribeToSuperSmsfEvents();
13029
+ }
13030
+ else {
13031
+ throw Error(`SuperSmsfHost pre-requisites not met.`);
13032
+ }
13033
+ }
13034
+ disconnectedCallback() {
13035
+ clearTimeout(this.loadingTimeoutRef);
13036
+ this.unSubscribeFromSuperSmsfEvents();
13037
+ }
13038
+ render() {
13039
+ return (h(Host, null, h("sss-header-section", null), h("div", { class: "flex justify-center mt-11" }, h("sss-custom-fund", null, h("div", null, h("apollo-super-smsf", { "backend-url": this.backendUrl, "access-token": this.accessToken }))))));
13040
+ }
13041
+ updateCustomFundStateStore(details) {
13042
+ state.selfManagedFundForm = {
13043
+ fundAbn: details.fundAbn,
13044
+ fundName: details.fundName,
13045
+ addressLine1: details.fundAddressLine1,
13046
+ addressLine2: details.fundAddressLine2,
13047
+ city: details.fundCity,
13048
+ state: details.fundState,
13049
+ postcode: details.fundPostcode,
13050
+ bsb: details.bankBsb,
13051
+ bankAccountName: details.bankAccountName,
13052
+ bankAccountNumber: details.bankAccountNumber,
13053
+ fundEsa: details.fundEsa,
13054
+ memberFirstName: details.memberFirstName,
13055
+ memberFamilyName: details.memberLastName
13056
+ };
13057
+ }
13058
+ async smsfLoadingTimeoutTriggered() {
13059
+ if (superSmsfComponentStatus !== SuperSmsfComponentStatus.Loaded) {
13060
+ throw Error(`SMSF component failed to load.`);
13061
+ }
13062
+ }
13063
+ };
13064
+ injectHistory(SuperSmsfHost);
13065
+
16325
13066
  const routeCss = "stencil-route.inactive{display:none}";
16326
13067
 
16327
13068
  const Route = class {
@@ -16470,7 +13211,7 @@ const getUrl = (url, root) => {
16470
13211
  }
16471
13212
  return root + url;
16472
13213
  };
16473
- const RouteLink = class {
13214
+ const RouteLink$1 = class {
16474
13215
  constructor(hostRef) {
16475
13216
  registerInstance(this, hostRef);
16476
13217
  this.unsubscribe = () => { return; };
@@ -16524,7 +13265,7 @@ const RouteLink = class {
16524
13265
  "location": ["computeMatch"]
16525
13266
  }; }
16526
13267
  };
16527
- ActiveRouter.injectProps(RouteLink, [
13268
+ ActiveRouter.injectProps(RouteLink$1, [
16528
13269
  'history',
16529
13270
  'location',
16530
13271
  'root'
@@ -18135,4 +14876,4 @@ const SuperSelectionAppHost = class {
18135
14876
  };
18136
14877
  SuperSelectionAppHost.style = superSelectionAppHostCss;
18137
14878
 
18138
- export { Button as sss_button, ChoiceRouter as sss_choice_router, CustomFund as sss_custom_fund, DefaultFund as sss_default_fund, SelectInputAsync as sss_dropdown_async, ExistingChoice as sss_existing_choice_page, FooterSection as sss_footer_section, HeaderSection as sss_header_section, LoadingIndicator as sss_loading_indicator, LoadingPage as sss_loading_page, MyOwnFund as sss_my_own_fund, MyOwnFundEngagementStep as sss_my_own_fund_engagement_step_host, MyOwnFundInputs as sss_my_own_fund_inputs, MemberNameInput as sss_name_input, Prefill as sss_prefill, DisplayField as sss_prefill_display_field, PrefillErrorBox as sss_prefill_error_box, PrefillInvalidMyOwnFund as sss_prefill_invalid_my_own_fund, PrefillInvalidSMSF as sss_prefill_invalid_smsf, PrefillMyOwnFund as sss_prefill_my_own_fund, PrefillSMSF as sss_prefill_smsf, PrefillWarningBox as sss_prefill_warning_box, SelfManagedFund as sss_self_managed_fund, SelfManagedFundInputs as sss_self_managed_fund_inputs, StandardChoiceFormInputDefaultFund as sss_standard_choice_form, Success as sss_success, FeaturedFunds as sss_super_campaign_featured_funds, SuperCampaignHost as sss_super_campaign_host, Route as stencil_route, RouteLink as stencil_route_link, RouteSwitch as stencil_route_switch, Router as stencil_router, SuperSelectionApp as super_selection_app, SuperSelectionAppHost as super_selection_app_host };
14879
+ export { Button as sss_button, ChoiceRouter as sss_choice_router, CustomFund as sss_custom_fund, DefaultFund as sss_default_fund, SelectInputAsync as sss_dropdown_async, ExistingChoice as sss_existing_choice_page, FooterSection as sss_footer_section, HeaderSection as sss_header_section, LoadingIndicator as sss_loading_indicator, LoadingPage as sss_loading_page, MyOwnFundEngagementStep as sss_my_own_fund_engagement_step_host, MemberNameInput as sss_name_input, Prefill as sss_prefill, DisplayField as sss_prefill_display_field, PrefillErrorBox as sss_prefill_error_box, PrefillInvalidMyOwnFund as sss_prefill_invalid_my_own_fund, PrefillInvalidSMSF as sss_prefill_invalid_smsf, PrefillMyOwnFund as sss_prefill_my_own_fund, PrefillSMSF as sss_prefill_smsf, PrefillWarningBox as sss_prefill_warning_box, SmsfEngagementStep as sss_smsf_engagement_step_host, StandardChoiceFormInputDefaultFund as sss_standard_choice_form, Success as sss_success, FeaturedFunds as sss_super_campaign_featured_funds, SuperCampaignHost as sss_super_campaign_host, SuperSmsfHost as sss_super_smsf_host, Route as stencil_route, RouteLink$1 as stencil_route_link, RouteSwitch as stencil_route_switch, Router as stencil_router, SuperSelectionApp as super_selection_app, SuperSelectionAppHost as super_selection_app_host };