@flarehr/apollo-super-selection 4.57.45667 → 4.58.46161

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.
@@ -1 +1 @@
1
- System.register(["./p-44bec843.system.js","./p-14885f78.system.js","./p-15f0e5eb.system.js"],(function(e,s){"use strict";var t,i,o;return{setters:[function(e){t=e.p;i=e.b},function(){},function(e){o=e.g}],execute:function(){var e=function(){var e=s.meta.url;var i={};if(e!==""){i.resourcesUrl=new URL(".",e).href}return t(i)};e().then((function(e){o();return i([["p-6ac8791e.system",[[0,"context-consumer",{context:[16],renderer:[16],subscribe:[16],unsubscribe:[32]}]]],["p-02f24922.system",[[0,"stencil-async-content",{documentLocation:[1,"document-location"],content:[32]}]]],["p-ef3afa00.system",[[0,"stencil-route-title",{titleSuffix:[1,"title-suffix"],pageTitle:[1,"page-title"]}]]],["p-f29066b9.system",[[0,"stencil-router-prompt",{when:[4],message:[1],history:[16],unblock:[32]}]]],["p-51aefdb1.system",[[0,"stencil-router-redirect",{history:[16],root:[1],url:[1]}]]],["p-afdef603.system",[[0,"sss-prefill",{history:[16],prefill:[32]}],[0,"sss-my-own-fund",{history:[16],formState:[32],isNotAllInformationProvidedMessageVisible:[32],isSubmitDisabled:[32]}],[0,"sss-self-managed-fund",{history:[16],formState:[32],isSubmitDisabled:[32]}],[0,"sss-super-choice-page",{history:[16],promotedFunds:[32]}],[1,"super-selection-app-host",{sessionState:[32],jwt:[32],appConfiguration:[32],ignoreExistingSelection:[32]}],[0,"sss-default-fund",{history:[16],defaultFundProductName:[32]}],[0,"sss-consent-page",{history:[16],campaignConnectRequestInProgress:[32]}],[0,"sss-existing-choice-page",{history:[16],existingFund:[32]}],[0,"sss-standard-choice-form",{history:[16],standardChoiceFormSignature:[32],formState:[32],isSubmitDisabled:[32]}],[0,"sss-promoted-fund-join-v1-page",{history:[16]}],[0,"sss-promoted-fund-join-v2-page",{history:[16]}],[0,"sss-slate-join-page",{history:[16]}],[0,"sss-success"],[0,"sss-super-campaign-host",{history:[16],componentLoaded:[32],backendUrl:[32],accessToken:[32]}],[0,"sss-prefill-my-own-fund",{history:[16],prefill:[16],mode:[32],formState:[32],isSubmitDisabled:[32],fundUsi:[32],fundName:[32],memberNumber:[32],memberGivenNames:[32],memberLastName:[32]}],[0,"sss-prefill-smsf",{history:[16],prefill:[16],mode:[32],formState:[32],isSubmitDisabled:[32],fundName:[32],fundAbn:[32],fundEsa:[32],fundAddressLine1:[32],fundAddressLine2:[32],fundAddressCity:[32],fundAddressPostcode:[32],fundAddressState:[32],fundAddress:[32],memberGivenNames:[32],memberLastName:[32],bankAccountName:[32],bankName:[32],bankAccountBsb:[32],bankAccountNumber:[32]}],[0,"sss-prefill-invalid-my-own-fund",{history:[16],prefill:[16],fundUsi:[32],fundName:[32],memberNumber:[32],memberGivenNames:[32],memberLastName:[32]}],[0,"sss-prefill-invalid-smsf",{history:[16],prefill:[16],fundName:[32],fundAbn:[32],fundEsa:[32],fundAddressLine1:[32],fundAddressLine2:[32],fundAddressCity:[32],fundAddressPostcode:[32],fundAddressState:[32],fundAddress:[32],memberGivenNames:[32],memberLastName:[32],bankAccountName:[32],bankAccountBsb:[32],bankAccountNumber:[32]}],[1,"super-selection-app",{ignoreExistingSelection:[4,"ignore-existing-selection"],accessToken:[1,"access-token"],backendUrl:[1,"backend-url"],appBaseUrl:[1,"app-base-url"],history:[16],location:[16],isSelfHosted:[4,"is-self-hosted"],isAppInitialised:[32]}],[0,"sss-my-own-fund-inputs",{myOwnFundForm:[16],showValidationErrors:[4,"show-validation-errors"],selectedOption:[32]}],[0,"sss-loading-super-indicator"],[0,"sss-self-managed-fund-inputs",{fundForm:[16],showValidationErrors:[4,"show-validation-errors"],isAbnValid:[32],isAbnTouched:[32],isAbnUsedForRegulated:[32],currentBank:[32],addressErrorMessage:[32]}],[0,"sss-super-choice-item-bottom",{disclaimer:[16],abnInfo:[1,"abn-info"],abn:[1],isMultiFund:[4,"is-multi-fund"]}],[0,"sss-loading-page"],[0,"sss-super-choice-item-top",{name:[1],logo:[1],features:[16],featureSubText:[16],customContent:[16],isMultiFund:[4,"is-multi-fund"],isPromotedDefault:[4,"is-promoted-default"],extraBadge:[16]}],[4,"sss-loading-component",{header:[1]}],[0,"sss-dropdown-async",{placeholder:[1],searchFunction:[16],value:[16],required:[4],requiredValidationMessage:[1,"required-validation-message"],disabled:[4],minSearchStringLength:[2,"min-search-string-length"],showValidationErrors:[4,"show-validation-errors"],searchState:[32],inputValue:[32],isDropdownVisible:[32],filteredOptions:[32],highlightedOptionIndex:[32],selectedOption:[32]},[[2,"focus","handleFocus"],[2,"blur","handleBlur"],[2,"keydown","handleKeyDown"]]],[0,"sss-footer-section",{textOverride:[16]}],[4,"stencil-route-switch",{group:[513],scrollTopOffset:[2,"scroll-top-offset"],location:[16],routeViewsUpdated:[16]}],[4,"stencil-router",{root:[1],historyType:[1,"history-type"],titleSuffix:[1,"title-suffix"],scrollTopOffset:[2,"scroll-top-offset"],location:[32],history:[32]}],[4,"sss-custom-fund",{history:[16],currentCustomFund:[32],fundOptionsList:[32],showFundOptionsSelection:[32]}],[0,"sss-iframe-host",{build:[16]}],[0,"sss-prefill-warning-box",{notificationList:[16]}],[0,"sss-header-section",{currentPage:[1,"current-page"]}],[0,"sss-name-input",{value:[1],name:[1],readableName:[1,"readable-name"],showValidationErrors:[4,"show-validation-errors"],errorMessage:[32]}],[0,"sss-prefill-display-field",{field:[16]}],[0,"sss-prefill-error-box",{withHeader:[4,"with-header"],notificationList:[16]}],[4,"stencil-route-link",{url:[1],urlMatch:[1,"url-match"],activeClass:[1,"active-class"],exact:[4],strict:[4],custom:[1],anchorClass:[1,"anchor-class"],anchorRole:[1,"anchor-role"],anchorTitle:[1,"anchor-title"],anchorTabIndex:[1,"anchor-tab-index"],anchorId:[1,"anchor-id"],history:[16],location:[16],root:[1],ariaHaspopup:[1,"aria-haspopup"],ariaPosinset:[1,"aria-posinset"],ariaSetsize:[2,"aria-setsize"],ariaLabel:[1,"aria-label"],match:[32]}],[4,"sss-button",{fillWidth:[4,"fill-width"],fillWidthOnMobile:[4,"fill-width-on-mobile"],disabled:[4],variant:[1],size:[1],promiseFn:[16],state:[32]}],[0,"sss-loading-indicator",{theme:[1],size:[2]}],[0,"stencil-route",{group:[513],componentUpdated:[16],match:[1040],url:[1],component:[1],componentProps:[16],exact:[4],routeRender:[16],scrollTopOffset:[2,"scroll-top-offset"],routeViewsUpdated:[16],location:[16],history:[16],historyType:[1,"history-type"]}]]]],e)}))}}}));
1
+ System.register(["./p-44bec843.system.js","./p-14885f78.system.js","./p-15f0e5eb.system.js"],(function(e,s){"use strict";var t,i,o;return{setters:[function(e){t=e.p;i=e.b},function(){},function(e){o=e.g}],execute:function(){var e=function(){var e=s.meta.url;var i={};if(e!==""){i.resourcesUrl=new URL(".",e).href}return t(i)};e().then((function(e){o();return i([["p-6ac8791e.system",[[0,"context-consumer",{context:[16],renderer:[16],subscribe:[16],unsubscribe:[32]}]]],["p-02f24922.system",[[0,"stencil-async-content",{documentLocation:[1,"document-location"],content:[32]}]]],["p-ef3afa00.system",[[0,"stencil-route-title",{titleSuffix:[1,"title-suffix"],pageTitle:[1,"page-title"]}]]],["p-f29066b9.system",[[0,"stencil-router-prompt",{when:[4],message:[1],history:[16],unblock:[32]}]]],["p-51aefdb1.system",[[0,"stencil-router-redirect",{history:[16],root:[1],url:[1]}]]],["p-8263f5b7.system",[[0,"sss-prefill",{history:[16],prefill:[32]}],[0,"sss-my-own-fund",{history:[16],formState:[32],isNotAllInformationProvidedMessageVisible:[32],isSubmitDisabled:[32]}],[0,"sss-self-managed-fund",{history:[16],formState:[32],isSubmitDisabled:[32]}],[0,"sss-super-choice-page",{history:[16],promotedFunds:[32]}],[1,"super-selection-app-host",{sessionState:[32],jwt:[32],appConfiguration:[32],ignoreExistingSelection:[32]}],[0,"sss-default-fund",{history:[16],defaultFundProductName:[32]}],[0,"sss-consent-page",{history:[16],campaignConnectRequestInProgress:[32]}],[0,"sss-existing-choice-page",{history:[16],existingFund:[32]}],[0,"sss-standard-choice-form",{history:[16],standardChoiceFormSignature:[32],formState:[32],isSubmitDisabled:[32]}],[0,"sss-promoted-fund-join-v1-page",{history:[16]}],[0,"sss-promoted-fund-join-v2-page",{history:[16]}],[0,"sss-slate-join-page",{history:[16]}],[0,"sss-success"],[0,"sss-super-campaign-host",{history:[16],componentLoaded:[32],backendUrl:[32],accessToken:[32]}],[0,"sss-prefill-my-own-fund",{history:[16],prefill:[16],mode:[32],formState:[32],isSubmitDisabled:[32],fundUsi:[32],fundName:[32],memberNumber:[32],memberGivenNames:[32],memberLastName:[32]}],[0,"sss-prefill-smsf",{history:[16],prefill:[16],mode:[32],formState:[32],isSubmitDisabled:[32],fundName:[32],fundAbn:[32],fundEsa:[32],fundAddressLine1:[32],fundAddressLine2:[32],fundAddressCity:[32],fundAddressPostcode:[32],fundAddressState:[32],fundAddress:[32],memberGivenNames:[32],memberLastName:[32],bankAccountName:[32],bankName:[32],bankAccountBsb:[32],bankAccountNumber:[32]}],[0,"sss-prefill-invalid-my-own-fund",{history:[16],prefill:[16],fundUsi:[32],fundName:[32],memberNumber:[32],memberGivenNames:[32],memberLastName:[32]}],[0,"sss-prefill-invalid-smsf",{history:[16],prefill:[16],fundName:[32],fundAbn:[32],fundEsa:[32],fundAddressLine1:[32],fundAddressLine2:[32],fundAddressCity:[32],fundAddressPostcode:[32],fundAddressState:[32],fundAddress:[32],memberGivenNames:[32],memberLastName:[32],bankAccountName:[32],bankAccountBsb:[32],bankAccountNumber:[32]}],[1,"super-selection-app",{ignoreExistingSelection:[4,"ignore-existing-selection"],accessToken:[1,"access-token"],backendUrl:[1,"backend-url"],appBaseUrl:[1,"app-base-url"],history:[16],location:[16],isSelfHosted:[4,"is-self-hosted"],isAppInitialised:[32]}],[0,"sss-my-own-fund-inputs",{myOwnFundForm:[16],showValidationErrors:[4,"show-validation-errors"],selectedOption:[32]}],[0,"sss-loading-super-indicator"],[0,"sss-self-managed-fund-inputs",{fundForm:[16],showValidationErrors:[4,"show-validation-errors"],isAbnValid:[32],isAbnTouched:[32],isAbnUsedForRegulated:[32],currentBank:[32],addressErrorMessage:[32]}],[0,"sss-super-choice-item-bottom",{disclaimer:[16],abnInfo:[1,"abn-info"],abn:[1],isMultiFund:[4,"is-multi-fund"]}],[0,"sss-loading-page"],[0,"sss-super-choice-item-top",{name:[1],logo:[1],features:[16],featureSubText:[16],customContent:[16],isMultiFund:[4,"is-multi-fund"],isPromotedDefault:[4,"is-promoted-default"],extraBadge:[16]}],[4,"sss-loading-component",{header:[1]}],[0,"sss-dropdown-async",{placeholder:[1],searchFunction:[16],value:[16],required:[4],requiredValidationMessage:[1,"required-validation-message"],disabled:[4],minSearchStringLength:[2,"min-search-string-length"],showValidationErrors:[4,"show-validation-errors"],searchState:[32],inputValue:[32],isDropdownVisible:[32],filteredOptions:[32],highlightedOptionIndex:[32],selectedOption:[32]},[[2,"focus","handleFocus"],[2,"blur","handleBlur"],[2,"keydown","handleKeyDown"]]],[0,"sss-footer-section",{textOverride:[16]}],[4,"stencil-route-switch",{group:[513],scrollTopOffset:[2,"scroll-top-offset"],location:[16],routeViewsUpdated:[16]}],[4,"stencil-router",{root:[1],historyType:[1,"history-type"],titleSuffix:[1,"title-suffix"],scrollTopOffset:[2,"scroll-top-offset"],location:[32],history:[32]}],[4,"sss-custom-fund",{history:[16],currentCustomFund:[32],fundOptionsList:[32],showFundOptionsSelection:[32]}],[0,"sss-iframe-host",{build:[16]}],[0,"sss-prefill-warning-box",{notificationList:[16]}],[0,"sss-header-section",{currentPage:[1,"current-page"]}],[0,"sss-name-input",{value:[1],name:[1],readableName:[1,"readable-name"],showValidationErrors:[4,"show-validation-errors"],errorMessage:[32]}],[0,"sss-prefill-display-field",{field:[16]}],[0,"sss-prefill-error-box",{withHeader:[4,"with-header"],notificationList:[16]}],[4,"stencil-route-link",{url:[1],urlMatch:[1,"url-match"],activeClass:[1,"active-class"],exact:[4],strict:[4],custom:[1],anchorClass:[1,"anchor-class"],anchorRole:[1,"anchor-role"],anchorTitle:[1,"anchor-title"],anchorTabIndex:[1,"anchor-tab-index"],anchorId:[1,"anchor-id"],history:[16],location:[16],root:[1],ariaHaspopup:[1,"aria-haspopup"],ariaPosinset:[1,"aria-posinset"],ariaSetsize:[2,"aria-setsize"],ariaLabel:[1,"aria-label"],match:[32]}],[4,"sss-button",{fillWidth:[4,"fill-width"],fillWidthOnMobile:[4,"fill-width-on-mobile"],disabled:[4],variant:[1],size:[1],promiseFn:[16],state:[32]}],[0,"sss-loading-indicator",{theme:[1],size:[2]}],[0,"stencil-route",{group:[513],componentUpdated:[16],match:[1040],url:[1],component:[1],componentProps:[16],exact:[4],routeRender:[16],scrollTopOffset:[2,"scroll-top-offset"],routeViewsUpdated:[16],location:[16],history:[16],historyType:[1,"history-type"]}]]]],e)}))}}}));
@@ -284,7 +284,7 @@ class TapSubscriber extends datoramaAkita.Subscriber {
284
284
  }
285
285
  }
286
286
 
287
- const AppVersion = '4.57.45667';
287
+ const AppVersion = '4.58.46161';
288
288
 
289
289
  // -------------------------------------------------------------------------------------
290
290
  // guards
@@ -3520,6 +3520,22 @@ class SuperSelectionApi {
3520
3520
  }
3521
3521
  const superSelectionApi = new SuperSelectionApi();
3522
3522
 
3523
+ class SuperCampaignState {
3524
+ constructor(funds) {
3525
+ this.promotedFundsShown = funds;
3526
+ }
3527
+ get PromotedFundIds() {
3528
+ return this.promotedFundsShown.map((p) => p.fundId);
3529
+ }
3530
+ get DefaultFundPosition() {
3531
+ this.promotedFundsShown.filter((value, index) => {
3532
+ if (value.fundType == 'promoted-default') {
3533
+ return index;
3534
+ }
3535
+ });
3536
+ return undefined;
3537
+ }
3538
+ }
3523
3539
  const initialState = {
3524
3540
  apiBaseUrl: Option.none,
3525
3541
  appBaseUrl: Option.none,
@@ -3536,9 +3552,7 @@ const initialState = {
3536
3552
  isDefinedBenefitsEligible: Option.none,
3537
3553
  campaignConnect: Option.none,
3538
3554
  superCampaignEnabled: false,
3539
- superCampaignState: {
3540
- promotedFundsShown: []
3541
- }
3555
+ superCampaignState: undefined
3542
3556
  };
3543
3557
 
3544
3558
  class SuperSelectionAppService {
@@ -3665,8 +3679,8 @@ class SuperSelectionAppService {
3665
3679
  this._state.campaignConnect = Option.fromNullable(campaignConnect);
3666
3680
  }
3667
3681
  }
3668
- setSuperCampaignPromotedFundsShown(shownFund) {
3669
- this._state.superCampaignState.promotedFundsShown = shownFund;
3682
+ setSuperCampaignPromotedFundsShown(shownFunds) {
3683
+ this._state.superCampaignState = new SuperCampaignState(shownFunds);
3670
3684
  }
3671
3685
  get superCampaignState() {
3672
3686
  return this._state.superCampaignState;
@@ -16830,6 +16844,12 @@ class MiscService {
16830
16844
  }
16831
16845
  const miscService = new MiscService();
16832
16846
 
16847
+ const Usi = {
16848
+ clean: (usi) => {
16849
+ return usi.replace(/ /g, '');
16850
+ }
16851
+ };
16852
+
16833
16853
  const SuperCampaignHost = class {
16834
16854
  constructor(hostRef) {
16835
16855
  index.registerInstance(this, hostRef);
@@ -16867,7 +16887,7 @@ const SuperCampaignHost = class {
16867
16887
  // eslint-disable-next-line no-console
16868
16888
  console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
16869
16889
  const promotedFundsShown = event.detail.shownFunds.map((f) => f.fundId);
16870
- superSelectionAppService.setSuperCampaignPromotedFundsShown(promotedFundsShown);
16890
+ superSelectionAppService.setSuperCampaignPromotedFundsShown(event.detail.shownFunds);
16871
16891
  await EventTrackingService.Instance.TrackSuperFundPanelViewedAsync({
16872
16892
  promotedFundsShown,
16873
16893
  defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi),
@@ -16881,10 +16901,10 @@ const SuperCampaignHost = class {
16881
16901
  if (eventDetails.sender == 'super-campaign') {
16882
16902
  // eslint-disable-next-line no-console
16883
16903
  console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
16884
- const promotedFundsShown = superSelectionAppService.superCampaignState.promotedFundsShown;
16904
+ const promotedFundsShown = this.SuperCampaignState.PromotedFundIds;
16885
16905
  const defaultFundUsiSet = Option.toUndefined(superSelectionAppService.defaultFundUsi);
16886
16906
  await Promise.all([
16887
- eventDetails.fundType == 'PromotedDefault'
16907
+ eventDetails.fundType == 'promoted-default'
16888
16908
  ? await EventTrackingService.Instance.TrackPromotedDefaultSuperFundDetailViewedAsync({
16889
16909
  fundUsi: (_b = eventDetails.fundUsi) !== null && _b !== void 0 ? _b : '',
16890
16910
  fundName: eventDetails.fundName,
@@ -16901,7 +16921,7 @@ const SuperCampaignHost = class {
16901
16921
  defaultFundUsiSet,
16902
16922
  superCampaignEnabled: true
16903
16923
  }),
16904
- miscService.trackClickPromotedTileAsync(eventDetails.fundType == 'PromotedDefault'
16924
+ miscService.trackClickPromotedTileAsync(eventDetails.fundType == 'promoted-default'
16905
16925
  ? {
16906
16926
  promotedDefault: {
16907
16927
  fundId: eventDetails.fundId
@@ -16946,13 +16966,127 @@ const SuperCampaignHost = class {
16946
16966
  });
16947
16967
  }
16948
16968
  };
16969
+ this.promotedFundJoined = async (event) => {
16970
+ var _a;
16971
+ if (event.detail.sender == 'super-campaign') {
16972
+ // eslint-disable-next-line no-console
16973
+ console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
16974
+ const fundJoinInfo = event.detail.fundJoinInfo;
16975
+ switch (fundJoinInfo.fundType) {
16976
+ case 'Promoted':
16977
+ this.handlePromotedFundJoined(fundJoinInfo);
16978
+ break;
16979
+ case 'DefinedBenefits':
16980
+ await this.handleDefinedBenefitsJoined(fundJoinInfo);
16981
+ break;
16982
+ case 'PromotedDefault':
16983
+ this.handlePromotedDefaultFundJoined(fundJoinInfo);
16984
+ break;
16985
+ case 'PromotedDefaultWithJoin':
16986
+ this.handlePromotedDefaultFundWithJoinWasJoined(fundJoinInfo);
16987
+ break;
16988
+ }
16989
+ }
16990
+ return Promise.resolve();
16991
+ };
16992
+ this.getFundName = (fundId) => {
16993
+ return _function.pipe(getFundNameByFundId(fundId), Option.getOrElse(() => ''));
16994
+ };
16995
+ this.stringIsNullOrEmtpty = (s) => {
16996
+ return !(typeof s === 'string' && s.trim().length > 0);
16997
+ };
16998
+ this.handlePromotedFundJoined = (data) => {
16999
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
17000
+ appInsights.trackErrorTrace('Super Campaign did not return (Promoted) memberNumber and/or usi');
17001
+ navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
17002
+ return;
17003
+ }
17004
+ const usi = Usi.clean(data.usi);
17005
+ const fundName = this.getFundName(data.fundId);
17006
+ const defaultFundUsiSet = Option.toUndefined(superSelectionAppService.defaultFundUsi);
17007
+ navigationService.navigateInternallyToStandardChoice({
17008
+ history: this.history,
17009
+ fundName,
17010
+ promotedFundId: data.fundId,
17011
+ fundDetails: {
17012
+ type: 'promoted',
17013
+ fundName,
17014
+ fundUsi: usi,
17015
+ memberNumber: data.memberNumber,
17016
+ promotedFundId: data.fundId
17017
+ },
17018
+ handleSubmitFn: async (standardChoiceFormSignature) => {
17019
+ if (data.fundId == fund$8.fundId) {
17020
+ await slateChoiceApi.submitSlateChoiceAsync(Object.assign({ memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, standardChoiceFormSignature,
17021
+ defaultFundUsiSet }, this.PromotedFundsConfig));
17022
+ }
17023
+ else {
17024
+ await promotedFundChoiceApi.submitChoiceAsync(Object.assign({ fundId: data.fundId, memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, usi,
17025
+ standardChoiceFormSignature,
17026
+ defaultFundUsiSet }, this.PromotedFundsConfig));
17027
+ }
17028
+ }
17029
+ });
17030
+ };
17031
+ this.handlePromotedDefaultFundJoined = (data) => {
17032
+ if (this.stringIsNullOrEmtpty(data.usi)) {
17033
+ appInsights.trackErrorTrace('Super Campaign did not return (PromotedDefault) usi');
17034
+ return;
17035
+ }
17036
+ const usi = Usi.clean(data.usi);
17037
+ const fundName = this.getFundName(data.fundId);
17038
+ navigationService.navigateInternallyToStandardChoice({
17039
+ history: this.history,
17040
+ fundName,
17041
+ promotedFundId: data.fundId,
17042
+ fundDetails: {
17043
+ type: 'promotedDefault',
17044
+ fundName,
17045
+ fundUsi: usi,
17046
+ promotedFundId: data.fundId
17047
+ },
17048
+ handleSubmitFn: (standardChoiceFormSignature) => promotedFundChoiceApi.submitDefaultChoiceAsync(Object.assign({ fundId: data.fundId, usi,
17049
+ standardChoiceFormSignature, defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi) }, this.PromotedFundsConfig))
17050
+ });
17051
+ };
17052
+ this.handlePromotedDefaultFundWithJoinWasJoined = (data) => {
17053
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
17054
+ appInsights.trackErrorTrace('Super Campaign did not return (PromotedDefaultWithJoin) memberNumber and/or usi');
17055
+ return;
17056
+ }
17057
+ const usi = Usi.clean(data.usi);
17058
+ const fundName = this.getFundName(data.fundId);
17059
+ navigationService.navigateInternallyToStandardChoice({
17060
+ history: this.history,
17061
+ fundName,
17062
+ promotedFundId: data.fundId,
17063
+ fundDetails: {
17064
+ type: 'promotedDefaultWithJoin',
17065
+ fundName,
17066
+ fundUsi: usi,
17067
+ memberNumber: data.memberNumber,
17068
+ promotedFundId: data.fundId
17069
+ },
17070
+ handleSubmitFn: (standardChoiceFormSignature) => promotedFundChoiceApi.submitDefaultChoiceWithJoinAsync(Object.assign({ fundId: data.fundId, memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, usi,
17071
+ standardChoiceFormSignature, defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi) }, this.PromotedFundsConfig))
17072
+ });
17073
+ };
17074
+ this.handleDefinedBenefitsJoined = async (data) => {
17075
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
17076
+ appInsights.trackErrorTrace('Super Campaign did not return (DefinedBenefits) memberNumber and/or usi');
17077
+ return;
17078
+ }
17079
+ await customFundChoiceApi.submitDefinedBenefitsChoiceAsync(Object.assign({ fundUsi: Usi.clean(data.usi), fundId: data.fundId, memberNumber: data.memberNumber, memberElectContributionRatePreTax: data.memberElectContributionRatePreTax, memberElectContributionRatePostTax: data.memberElectContributionRatePostTax }, this.PromotedFundsConfig));
17080
+ superSelectionAppService.markSuperSelectionAsSubmitted();
17081
+ };
16949
17082
  this.superCampaignEventHandlers = {
16950
17083
  'choose-another-fund-requested': this.chooseAnotherFundRequested.bind(this),
16951
17084
  'fund-panel-shown': this.fundPanelShown.bind(this),
16952
17085
  'fund-tile-clicked': this.fundTileClicked.bind(this),
16953
17086
  'fund-pds-viewed': this.fundPdsViewed.bind(this),
16954
17087
  'disclaimer-viewed': this.disclaimerViewed.bind(this),
16955
- 'disclaimer-accepted': this.disclaimerAccepted.bind(this)
17088
+ 'disclaimer-accepted': this.disclaimerAccepted.bind(this),
17089
+ 'promoted-fund-joined': this.promotedFundJoined.bind(this)
16956
17090
  };
16957
17091
  }
16958
17092
  async componentWillLoad() {
@@ -16989,6 +17123,18 @@ const SuperCampaignHost = class {
16989
17123
  const parsedUrl = new URL(url);
16990
17124
  return `${parsedUrl.protocol}//${parsedUrl.hostname}${parsedUrl.port.length > 0 ? `:${parsedUrl.port}` : ''}`;
16991
17125
  }
17126
+ get SuperCampaignState() {
17127
+ if (superSelectionAppService.superCampaignState != undefined)
17128
+ return superSelectionAppService.superCampaignState;
17129
+ throw new Error('Super campaign state has not been initialized');
17130
+ }
17131
+ get PromotedFundsConfig() {
17132
+ return {
17133
+ shownFunds: this.SuperCampaignState.PromotedFundIds,
17134
+ promotedDefaultFundPosition: this.SuperCampaignState.DefaultFundPosition,
17135
+ promotedFundsConfigSource: 'superCampaign'
17136
+ };
17137
+ }
16992
17138
  };
16993
17139
  injectHistory(SuperCampaignHost);
16994
17140
 
@@ -1 +1,5 @@
1
- export {};
1
+ export const Usi = {
2
+ clean: (usi) => {
3
+ return usi.replace(/ /g, '');
4
+ }
5
+ };
@@ -1,13 +1,21 @@
1
1
  import { Component, h, Prop, State } from '@stencil/core';
2
2
  import { injectHistory } from '@stencil/router';
3
+ import { pipe } from 'fp-ts/lib/function';
3
4
  import * as O from 'fp-ts/lib/Option';
4
5
  import { isSome } from 'fp-ts/lib/Option';
6
+ import appInsightsService from '../app-host/services/appinsights.service';
5
7
  import { SuperFundDisclaimerViewedDetail } from '../super-selection-app/api/super-selection-events.model';
8
+ import { getFundNameByFundId } from '../super-selection-app/funds/constants';
9
+ import customFundChoiceApi from '../super-selection-app/funds/custom-fund/api/custom-fund-choice.api';
10
+ import promotedFundChoiceApi from '../super-selection-app/funds/promoted-fund/api/promoted-fund-choice.api';
11
+ import slate from '../super-selection-app/funds/promoted-fund/funds/slate';
12
+ import slateChoiceApi from '../super-selection-app/funds/slate-super/api/slate-choice.api';
6
13
  import { EventTrackingService } from '../super-selection-app/services/event-tracking.service';
7
14
  import miscService from '../super-selection-app/services/misc.service';
8
15
  import navigationService from '../super-selection-app/services/navigation.service';
9
16
  import { SuperSelectionAppRoutes } from '../super-selection-app/services/super-selection-app.routes';
10
17
  import superSelectionAppService from '../super-selection-app/services/super-selection-app.service';
18
+ import { Usi } from './super-campaign-types';
11
19
  export class SuperCampaignHost {
12
20
  constructor() {
13
21
  this.componentLoaded = false;
@@ -44,7 +52,7 @@ export class SuperCampaignHost {
44
52
  // eslint-disable-next-line no-console
45
53
  console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
46
54
  const promotedFundsShown = event.detail.shownFunds.map((f) => f.fundId);
47
- superSelectionAppService.setSuperCampaignPromotedFundsShown(promotedFundsShown);
55
+ superSelectionAppService.setSuperCampaignPromotedFundsShown(event.detail.shownFunds);
48
56
  await EventTrackingService.Instance.TrackSuperFundPanelViewedAsync({
49
57
  promotedFundsShown,
50
58
  defaultFundUsiSet: O.toUndefined(superSelectionAppService.defaultFundUsi),
@@ -58,10 +66,10 @@ export class SuperCampaignHost {
58
66
  if (eventDetails.sender == 'super-campaign') {
59
67
  // eslint-disable-next-line no-console
60
68
  console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
61
- const promotedFundsShown = superSelectionAppService.superCampaignState.promotedFundsShown;
69
+ const promotedFundsShown = this.SuperCampaignState.PromotedFundIds;
62
70
  const defaultFundUsiSet = O.toUndefined(superSelectionAppService.defaultFundUsi);
63
71
  await Promise.all([
64
- eventDetails.fundType == 'PromotedDefault'
72
+ eventDetails.fundType == 'promoted-default'
65
73
  ? await EventTrackingService.Instance.TrackPromotedDefaultSuperFundDetailViewedAsync({
66
74
  fundUsi: (_b = eventDetails.fundUsi) !== null && _b !== void 0 ? _b : '',
67
75
  fundName: eventDetails.fundName,
@@ -78,7 +86,7 @@ export class SuperCampaignHost {
78
86
  defaultFundUsiSet,
79
87
  superCampaignEnabled: true
80
88
  }),
81
- miscService.trackClickPromotedTileAsync(eventDetails.fundType == 'PromotedDefault'
89
+ miscService.trackClickPromotedTileAsync(eventDetails.fundType == 'promoted-default'
82
90
  ? {
83
91
  promotedDefault: {
84
92
  fundId: eventDetails.fundId
@@ -123,13 +131,127 @@ export class SuperCampaignHost {
123
131
  });
124
132
  }
125
133
  };
134
+ this.promotedFundJoined = async (event) => {
135
+ var _a;
136
+ if (event.detail.sender == 'super-campaign') {
137
+ // eslint-disable-next-line no-console
138
+ console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
139
+ const fundJoinInfo = event.detail.fundJoinInfo;
140
+ switch (fundJoinInfo.fundType) {
141
+ case 'Promoted':
142
+ this.handlePromotedFundJoined(fundJoinInfo);
143
+ break;
144
+ case 'DefinedBenefits':
145
+ await this.handleDefinedBenefitsJoined(fundJoinInfo);
146
+ break;
147
+ case 'PromotedDefault':
148
+ this.handlePromotedDefaultFundJoined(fundJoinInfo);
149
+ break;
150
+ case 'PromotedDefaultWithJoin':
151
+ this.handlePromotedDefaultFundWithJoinWasJoined(fundJoinInfo);
152
+ break;
153
+ }
154
+ }
155
+ return Promise.resolve();
156
+ };
157
+ this.getFundName = (fundId) => {
158
+ return pipe(getFundNameByFundId(fundId), O.getOrElse(() => ''));
159
+ };
160
+ this.stringIsNullOrEmtpty = (s) => {
161
+ return !(typeof s === 'string' && s.trim().length > 0);
162
+ };
163
+ this.handlePromotedFundJoined = (data) => {
164
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
165
+ appInsightsService.trackErrorTrace('Super Campaign did not return (Promoted) memberNumber and/or usi');
166
+ navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
167
+ return;
168
+ }
169
+ const usi = Usi.clean(data.usi);
170
+ const fundName = this.getFundName(data.fundId);
171
+ const defaultFundUsiSet = O.toUndefined(superSelectionAppService.defaultFundUsi);
172
+ navigationService.navigateInternallyToStandardChoice({
173
+ history: this.history,
174
+ fundName,
175
+ promotedFundId: data.fundId,
176
+ fundDetails: {
177
+ type: 'promoted',
178
+ fundName,
179
+ fundUsi: usi,
180
+ memberNumber: data.memberNumber,
181
+ promotedFundId: data.fundId
182
+ },
183
+ handleSubmitFn: async (standardChoiceFormSignature) => {
184
+ if (data.fundId == slate.fundId) {
185
+ await slateChoiceApi.submitSlateChoiceAsync(Object.assign({ memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, standardChoiceFormSignature,
186
+ defaultFundUsiSet }, this.PromotedFundsConfig));
187
+ }
188
+ else {
189
+ await promotedFundChoiceApi.submitChoiceAsync(Object.assign({ fundId: data.fundId, memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, usi,
190
+ standardChoiceFormSignature,
191
+ defaultFundUsiSet }, this.PromotedFundsConfig));
192
+ }
193
+ }
194
+ });
195
+ };
196
+ this.handlePromotedDefaultFundJoined = (data) => {
197
+ if (this.stringIsNullOrEmtpty(data.usi)) {
198
+ appInsightsService.trackErrorTrace('Super Campaign did not return (PromotedDefault) usi');
199
+ return;
200
+ }
201
+ const usi = Usi.clean(data.usi);
202
+ const fundName = this.getFundName(data.fundId);
203
+ navigationService.navigateInternallyToStandardChoice({
204
+ history: this.history,
205
+ fundName,
206
+ promotedFundId: data.fundId,
207
+ fundDetails: {
208
+ type: 'promotedDefault',
209
+ fundName,
210
+ fundUsi: usi,
211
+ promotedFundId: data.fundId
212
+ },
213
+ handleSubmitFn: (standardChoiceFormSignature) => promotedFundChoiceApi.submitDefaultChoiceAsync(Object.assign({ fundId: data.fundId, usi,
214
+ standardChoiceFormSignature, defaultFundUsiSet: O.toUndefined(superSelectionAppService.defaultFundUsi) }, this.PromotedFundsConfig))
215
+ });
216
+ };
217
+ this.handlePromotedDefaultFundWithJoinWasJoined = (data) => {
218
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
219
+ appInsightsService.trackErrorTrace('Super Campaign did not return (PromotedDefaultWithJoin) memberNumber and/or usi');
220
+ return;
221
+ }
222
+ const usi = Usi.clean(data.usi);
223
+ const fundName = this.getFundName(data.fundId);
224
+ navigationService.navigateInternallyToStandardChoice({
225
+ history: this.history,
226
+ fundName,
227
+ promotedFundId: data.fundId,
228
+ fundDetails: {
229
+ type: 'promotedDefaultWithJoin',
230
+ fundName,
231
+ fundUsi: usi,
232
+ memberNumber: data.memberNumber,
233
+ promotedFundId: data.fundId
234
+ },
235
+ handleSubmitFn: (standardChoiceFormSignature) => promotedFundChoiceApi.submitDefaultChoiceWithJoinAsync(Object.assign({ fundId: data.fundId, memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, usi,
236
+ standardChoiceFormSignature, defaultFundUsiSet: O.toUndefined(superSelectionAppService.defaultFundUsi) }, this.PromotedFundsConfig))
237
+ });
238
+ };
239
+ this.handleDefinedBenefitsJoined = async (data) => {
240
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
241
+ appInsightsService.trackErrorTrace('Super Campaign did not return (DefinedBenefits) memberNumber and/or usi');
242
+ return;
243
+ }
244
+ await customFundChoiceApi.submitDefinedBenefitsChoiceAsync(Object.assign({ fundUsi: Usi.clean(data.usi), fundId: data.fundId, memberNumber: data.memberNumber, memberElectContributionRatePreTax: data.memberElectContributionRatePreTax, memberElectContributionRatePostTax: data.memberElectContributionRatePostTax }, this.PromotedFundsConfig));
245
+ superSelectionAppService.markSuperSelectionAsSubmitted();
246
+ };
126
247
  this.superCampaignEventHandlers = {
127
248
  'choose-another-fund-requested': this.chooseAnotherFundRequested.bind(this),
128
249
  'fund-panel-shown': this.fundPanelShown.bind(this),
129
250
  'fund-tile-clicked': this.fundTileClicked.bind(this),
130
251
  'fund-pds-viewed': this.fundPdsViewed.bind(this),
131
252
  'disclaimer-viewed': this.disclaimerViewed.bind(this),
132
- 'disclaimer-accepted': this.disclaimerAccepted.bind(this)
253
+ 'disclaimer-accepted': this.disclaimerAccepted.bind(this),
254
+ 'promoted-fund-joined': this.promotedFundJoined.bind(this)
133
255
  };
134
256
  }
135
257
  async componentWillLoad() {
@@ -166,6 +288,19 @@ export class SuperCampaignHost {
166
288
  const parsedUrl = new URL(url);
167
289
  return `${parsedUrl.protocol}//${parsedUrl.hostname}${parsedUrl.port.length > 0 ? `:${parsedUrl.port}` : ''}`;
168
290
  }
291
+ get SuperCampaignState() {
292
+ if (superSelectionAppService.superCampaignState != undefined)
293
+ return superSelectionAppService.superCampaignState;
294
+ throw new Error('Super campaign state has not been initialized');
295
+ }
296
+ get PromotedFundsConfig() {
297
+ superSelectionAppService.superCampaignState;
298
+ return {
299
+ shownFunds: this.SuperCampaignState.PromotedFundIds,
300
+ promotedDefaultFundPosition: this.SuperCampaignState.DefaultFundPosition,
301
+ promotedFundsConfigSource: 'superCampaign'
302
+ };
303
+ }
169
304
  static get is() { return "sss-super-campaign-host"; }
170
305
  static get properties() { return {
171
306
  "history": {
@@ -3,7 +3,7 @@ import { pipe } from 'fp-ts/lib/function';
3
3
  import * as O from 'fp-ts/lib/Option';
4
4
  import jwtDecode from 'jwt-decode';
5
5
  import superSelectionApi from '../api/super-selection.api';
6
- import { initialState } from './super-selection.store';
6
+ import { initialState, SuperCampaignState } from './super-selection.store';
7
7
  export class SuperSelectionAppService {
8
8
  constructor() {
9
9
  const { state, onChange } = createStore(initialState);
@@ -128,8 +128,8 @@ export class SuperSelectionAppService {
128
128
  this._state.campaignConnect = O.fromNullable(campaignConnect);
129
129
  }
130
130
  }
131
- setSuperCampaignPromotedFundsShown(shownFund) {
132
- this._state.superCampaignState.promotedFundsShown = shownFund;
131
+ setSuperCampaignPromotedFundsShown(shownFunds) {
132
+ this._state.superCampaignState = new SuperCampaignState(shownFunds);
133
133
  }
134
134
  get superCampaignState() {
135
135
  return this._state.superCampaignState;
@@ -1,4 +1,20 @@
1
1
  import * as O from 'fp-ts/lib/Option';
2
+ export class SuperCampaignState {
3
+ constructor(funds) {
4
+ this.promotedFundsShown = funds;
5
+ }
6
+ get PromotedFundIds() {
7
+ return this.promotedFundsShown.map((p) => p.fundId);
8
+ }
9
+ get DefaultFundPosition() {
10
+ this.promotedFundsShown.filter((value, index) => {
11
+ if (value.fundType == 'promoted-default') {
12
+ return index;
13
+ }
14
+ });
15
+ return undefined;
16
+ }
17
+ }
2
18
  export const initialState = {
3
19
  apiBaseUrl: O.none,
4
20
  appBaseUrl: O.none,
@@ -15,7 +31,5 @@ export const initialState = {
15
31
  isDefinedBenefitsEligible: O.none,
16
32
  campaignConnect: O.none,
17
33
  superCampaignEnabled: false,
18
- superCampaignState: {
19
- promotedFundsShown: []
20
- }
34
+ superCampaignState: undefined
21
35
  };