@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.
@@ -260,7 +260,7 @@ class TapSubscriber extends Subscriber {
260
260
  }
261
261
  }
262
262
 
263
- const AppVersion = '4.57.45667';
263
+ const AppVersion = '4.58.46161';
264
264
 
265
265
  // -------------------------------------------------------------------------------------
266
266
  // guards
@@ -3496,6 +3496,22 @@ class SuperSelectionApi {
3496
3496
  }
3497
3497
  const superSelectionApi = new SuperSelectionApi();
3498
3498
 
3499
+ class SuperCampaignState {
3500
+ constructor(funds) {
3501
+ this.promotedFundsShown = funds;
3502
+ }
3503
+ get PromotedFundIds() {
3504
+ return this.promotedFundsShown.map((p) => p.fundId);
3505
+ }
3506
+ get DefaultFundPosition() {
3507
+ this.promotedFundsShown.filter((value, index) => {
3508
+ if (value.fundType == 'promoted-default') {
3509
+ return index;
3510
+ }
3511
+ });
3512
+ return undefined;
3513
+ }
3514
+ }
3499
3515
  const initialState = {
3500
3516
  apiBaseUrl: Option.none,
3501
3517
  appBaseUrl: Option.none,
@@ -3512,9 +3528,7 @@ const initialState = {
3512
3528
  isDefinedBenefitsEligible: Option.none,
3513
3529
  campaignConnect: Option.none,
3514
3530
  superCampaignEnabled: false,
3515
- superCampaignState: {
3516
- promotedFundsShown: []
3517
- }
3531
+ superCampaignState: undefined
3518
3532
  };
3519
3533
 
3520
3534
  class SuperSelectionAppService {
@@ -3641,8 +3655,8 @@ class SuperSelectionAppService {
3641
3655
  this._state.campaignConnect = Option.fromNullable(campaignConnect);
3642
3656
  }
3643
3657
  }
3644
- setSuperCampaignPromotedFundsShown(shownFund) {
3645
- this._state.superCampaignState.promotedFundsShown = shownFund;
3658
+ setSuperCampaignPromotedFundsShown(shownFunds) {
3659
+ this._state.superCampaignState = new SuperCampaignState(shownFunds);
3646
3660
  }
3647
3661
  get superCampaignState() {
3648
3662
  return this._state.superCampaignState;
@@ -16806,6 +16820,12 @@ class MiscService {
16806
16820
  }
16807
16821
  const miscService = new MiscService();
16808
16822
 
16823
+ const Usi = {
16824
+ clean: (usi) => {
16825
+ return usi.replace(/ /g, '');
16826
+ }
16827
+ };
16828
+
16809
16829
  const SuperCampaignHost = class {
16810
16830
  constructor(hostRef) {
16811
16831
  registerInstance(this, hostRef);
@@ -16843,7 +16863,7 @@ const SuperCampaignHost = class {
16843
16863
  // eslint-disable-next-line no-console
16844
16864
  console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
16845
16865
  const promotedFundsShown = event.detail.shownFunds.map((f) => f.fundId);
16846
- superSelectionAppService.setSuperCampaignPromotedFundsShown(promotedFundsShown);
16866
+ superSelectionAppService.setSuperCampaignPromotedFundsShown(event.detail.shownFunds);
16847
16867
  await EventTrackingService.Instance.TrackSuperFundPanelViewedAsync({
16848
16868
  promotedFundsShown,
16849
16869
  defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi),
@@ -16857,10 +16877,10 @@ const SuperCampaignHost = class {
16857
16877
  if (eventDetails.sender == 'super-campaign') {
16858
16878
  // eslint-disable-next-line no-console
16859
16879
  console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
16860
- const promotedFundsShown = superSelectionAppService.superCampaignState.promotedFundsShown;
16880
+ const promotedFundsShown = this.SuperCampaignState.PromotedFundIds;
16861
16881
  const defaultFundUsiSet = Option.toUndefined(superSelectionAppService.defaultFundUsi);
16862
16882
  await Promise.all([
16863
- eventDetails.fundType == 'PromotedDefault'
16883
+ eventDetails.fundType == 'promoted-default'
16864
16884
  ? await EventTrackingService.Instance.TrackPromotedDefaultSuperFundDetailViewedAsync({
16865
16885
  fundUsi: (_b = eventDetails.fundUsi) !== null && _b !== void 0 ? _b : '',
16866
16886
  fundName: eventDetails.fundName,
@@ -16877,7 +16897,7 @@ const SuperCampaignHost = class {
16877
16897
  defaultFundUsiSet,
16878
16898
  superCampaignEnabled: true
16879
16899
  }),
16880
- miscService.trackClickPromotedTileAsync(eventDetails.fundType == 'PromotedDefault'
16900
+ miscService.trackClickPromotedTileAsync(eventDetails.fundType == 'promoted-default'
16881
16901
  ? {
16882
16902
  promotedDefault: {
16883
16903
  fundId: eventDetails.fundId
@@ -16922,13 +16942,127 @@ const SuperCampaignHost = class {
16922
16942
  });
16923
16943
  }
16924
16944
  };
16945
+ this.promotedFundJoined = async (event) => {
16946
+ var _a;
16947
+ if (event.detail.sender == 'super-campaign') {
16948
+ // eslint-disable-next-line no-console
16949
+ console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
16950
+ const fundJoinInfo = event.detail.fundJoinInfo;
16951
+ switch (fundJoinInfo.fundType) {
16952
+ case 'Promoted':
16953
+ this.handlePromotedFundJoined(fundJoinInfo);
16954
+ break;
16955
+ case 'DefinedBenefits':
16956
+ await this.handleDefinedBenefitsJoined(fundJoinInfo);
16957
+ break;
16958
+ case 'PromotedDefault':
16959
+ this.handlePromotedDefaultFundJoined(fundJoinInfo);
16960
+ break;
16961
+ case 'PromotedDefaultWithJoin':
16962
+ this.handlePromotedDefaultFundWithJoinWasJoined(fundJoinInfo);
16963
+ break;
16964
+ }
16965
+ }
16966
+ return Promise.resolve();
16967
+ };
16968
+ this.getFundName = (fundId) => {
16969
+ return _function.pipe(getFundNameByFundId(fundId), Option.getOrElse(() => ''));
16970
+ };
16971
+ this.stringIsNullOrEmtpty = (s) => {
16972
+ return !(typeof s === 'string' && s.trim().length > 0);
16973
+ };
16974
+ this.handlePromotedFundJoined = (data) => {
16975
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
16976
+ appInsights.trackErrorTrace('Super Campaign did not return (Promoted) memberNumber and/or usi');
16977
+ navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
16978
+ return;
16979
+ }
16980
+ const usi = Usi.clean(data.usi);
16981
+ const fundName = this.getFundName(data.fundId);
16982
+ const defaultFundUsiSet = Option.toUndefined(superSelectionAppService.defaultFundUsi);
16983
+ navigationService.navigateInternallyToStandardChoice({
16984
+ history: this.history,
16985
+ fundName,
16986
+ promotedFundId: data.fundId,
16987
+ fundDetails: {
16988
+ type: 'promoted',
16989
+ fundName,
16990
+ fundUsi: usi,
16991
+ memberNumber: data.memberNumber,
16992
+ promotedFundId: data.fundId
16993
+ },
16994
+ handleSubmitFn: async (standardChoiceFormSignature) => {
16995
+ if (data.fundId == fund$8.fundId) {
16996
+ await slateChoiceApi.submitSlateChoiceAsync(Object.assign({ memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, standardChoiceFormSignature,
16997
+ defaultFundUsiSet }, this.PromotedFundsConfig));
16998
+ }
16999
+ else {
17000
+ await promotedFundChoiceApi.submitChoiceAsync(Object.assign({ fundId: data.fundId, memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, usi,
17001
+ standardChoiceFormSignature,
17002
+ defaultFundUsiSet }, this.PromotedFundsConfig));
17003
+ }
17004
+ }
17005
+ });
17006
+ };
17007
+ this.handlePromotedDefaultFundJoined = (data) => {
17008
+ if (this.stringIsNullOrEmtpty(data.usi)) {
17009
+ appInsights.trackErrorTrace('Super Campaign did not return (PromotedDefault) usi');
17010
+ return;
17011
+ }
17012
+ const usi = Usi.clean(data.usi);
17013
+ const fundName = this.getFundName(data.fundId);
17014
+ navigationService.navigateInternallyToStandardChoice({
17015
+ history: this.history,
17016
+ fundName,
17017
+ promotedFundId: data.fundId,
17018
+ fundDetails: {
17019
+ type: 'promotedDefault',
17020
+ fundName,
17021
+ fundUsi: usi,
17022
+ promotedFundId: data.fundId
17023
+ },
17024
+ handleSubmitFn: (standardChoiceFormSignature) => promotedFundChoiceApi.submitDefaultChoiceAsync(Object.assign({ fundId: data.fundId, usi,
17025
+ standardChoiceFormSignature, defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi) }, this.PromotedFundsConfig))
17026
+ });
17027
+ };
17028
+ this.handlePromotedDefaultFundWithJoinWasJoined = (data) => {
17029
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
17030
+ appInsights.trackErrorTrace('Super Campaign did not return (PromotedDefaultWithJoin) memberNumber and/or usi');
17031
+ return;
17032
+ }
17033
+ const usi = Usi.clean(data.usi);
17034
+ const fundName = this.getFundName(data.fundId);
17035
+ navigationService.navigateInternallyToStandardChoice({
17036
+ history: this.history,
17037
+ fundName,
17038
+ promotedFundId: data.fundId,
17039
+ fundDetails: {
17040
+ type: 'promotedDefaultWithJoin',
17041
+ fundName,
17042
+ fundUsi: usi,
17043
+ memberNumber: data.memberNumber,
17044
+ promotedFundId: data.fundId
17045
+ },
17046
+ handleSubmitFn: (standardChoiceFormSignature) => promotedFundChoiceApi.submitDefaultChoiceWithJoinAsync(Object.assign({ fundId: data.fundId, memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, usi,
17047
+ standardChoiceFormSignature, defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi) }, this.PromotedFundsConfig))
17048
+ });
17049
+ };
17050
+ this.handleDefinedBenefitsJoined = async (data) => {
17051
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
17052
+ appInsights.trackErrorTrace('Super Campaign did not return (DefinedBenefits) memberNumber and/or usi');
17053
+ return;
17054
+ }
17055
+ await customFundChoiceApi.submitDefinedBenefitsChoiceAsync(Object.assign({ fundUsi: Usi.clean(data.usi), fundId: data.fundId, memberNumber: data.memberNumber, memberElectContributionRatePreTax: data.memberElectContributionRatePreTax, memberElectContributionRatePostTax: data.memberElectContributionRatePostTax }, this.PromotedFundsConfig));
17056
+ superSelectionAppService.markSuperSelectionAsSubmitted();
17057
+ };
16925
17058
  this.superCampaignEventHandlers = {
16926
17059
  'choose-another-fund-requested': this.chooseAnotherFundRequested.bind(this),
16927
17060
  'fund-panel-shown': this.fundPanelShown.bind(this),
16928
17061
  'fund-tile-clicked': this.fundTileClicked.bind(this),
16929
17062
  'fund-pds-viewed': this.fundPdsViewed.bind(this),
16930
17063
  'disclaimer-viewed': this.disclaimerViewed.bind(this),
16931
- 'disclaimer-accepted': this.disclaimerAccepted.bind(this)
17064
+ 'disclaimer-accepted': this.disclaimerAccepted.bind(this),
17065
+ 'promoted-fund-joined': this.promotedFundJoined.bind(this)
16932
17066
  };
16933
17067
  }
16934
17068
  async componentWillLoad() {
@@ -16965,6 +17099,18 @@ const SuperCampaignHost = class {
16965
17099
  const parsedUrl = new URL(url);
16966
17100
  return `${parsedUrl.protocol}//${parsedUrl.hostname}${parsedUrl.port.length > 0 ? `:${parsedUrl.port}` : ''}`;
16967
17101
  }
17102
+ get SuperCampaignState() {
17103
+ if (superSelectionAppService.superCampaignState != undefined)
17104
+ return superSelectionAppService.superCampaignState;
17105
+ throw new Error('Super campaign state has not been initialized');
17106
+ }
17107
+ get PromotedFundsConfig() {
17108
+ return {
17109
+ shownFunds: this.SuperCampaignState.PromotedFundIds,
17110
+ promotedDefaultFundPosition: this.SuperCampaignState.DefaultFundPosition,
17111
+ promotedFundsConfigSource: 'superCampaign'
17112
+ };
17113
+ }
16968
17114
  };
16969
17115
  injectHistory(SuperCampaignHost);
16970
17116