@flarehr/apollo-super-selection 4.57.45667 → 4.59.46171

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.59.46171';
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 {
@@ -3551,6 +3565,9 @@ class SuperSelectionAppService {
3551
3565
  return this._state.appBaseUrl.value;
3552
3566
  }
3553
3567
  get promotedFunds() {
3568
+ if (this.state.superCampaignEnabled && this.superCampaignState !== undefined) {
3569
+ return this.superCampaignState.PromotedFundIds;
3570
+ }
3554
3571
  if (this._state.campaignConnectEnabled && Option.isSome(this._state.campaignConnect)) {
3555
3572
  return this._state.campaignConnect.value.promotedFunds.map((v) => v.fundId);
3556
3573
  }
@@ -3560,6 +3577,9 @@ class SuperSelectionAppService {
3560
3577
  return this._state.promotedFunds.value;
3561
3578
  }
3562
3579
  get promotedDefaultFundPosition() {
3580
+ if (this.state.superCampaignEnabled && this.superCampaignState !== undefined) {
3581
+ return Option.fromNullable(this.superCampaignState.DefaultFundPosition);
3582
+ }
3563
3583
  if (this._state.campaignConnectEnabled && Option.isSome(this._state.campaignConnect)) {
3564
3584
  const index = this._state.campaignConnect.value.promotedFunds.findIndex((v) => (v.type = 'promoted-default'));
3565
3585
  if (index == -1) {
@@ -3575,9 +3595,11 @@ class SuperSelectionAppService {
3575
3595
  return {
3576
3596
  shownFunds: this.promotedFunds,
3577
3597
  promotedDefaultFundPosition: Option.toUndefined(this.promotedDefaultFundPosition),
3578
- promotedFundsConfigSource: Option.isSome(this._state.campaignConnect)
3579
- ? 'campaignConnect'
3580
- : 'superSelection'
3598
+ promotedFundsConfigSource: this.isUsingSuperCampaign
3599
+ ? 'superCampaign'
3600
+ : Option.isSome(this._state.campaignConnect)
3601
+ ? 'campaignConnect'
3602
+ : 'superSelection'
3581
3603
  };
3582
3604
  }
3583
3605
  get definedBenefitsFundId() {
@@ -3641,12 +3663,15 @@ class SuperSelectionAppService {
3641
3663
  this._state.campaignConnect = Option.fromNullable(campaignConnect);
3642
3664
  }
3643
3665
  }
3644
- setSuperCampaignPromotedFundsShown(shownFund) {
3645
- this._state.superCampaignState.promotedFundsShown = shownFund;
3666
+ setSuperCampaignPromotedFundsShown(shownFunds) {
3667
+ this._state.superCampaignState = new SuperCampaignState(shownFunds);
3646
3668
  }
3647
3669
  get superCampaignState() {
3648
3670
  return this._state.superCampaignState;
3649
3671
  }
3672
+ get isUsingSuperCampaign() {
3673
+ return this.state.superCampaignEnabled && this.superCampaignState !== undefined;
3674
+ }
3650
3675
  }
3651
3676
  const superSelectionAppService = new SuperSelectionAppService();
3652
3677
 
@@ -16806,6 +16831,12 @@ class MiscService {
16806
16831
  }
16807
16832
  const miscService = new MiscService();
16808
16833
 
16834
+ const Usi = {
16835
+ clean: (usi) => {
16836
+ return usi.replace(/ /g, '');
16837
+ }
16838
+ };
16839
+
16809
16840
  const SuperCampaignHost = class {
16810
16841
  constructor(hostRef) {
16811
16842
  registerInstance(this, hostRef);
@@ -16843,7 +16874,7 @@ const SuperCampaignHost = class {
16843
16874
  // eslint-disable-next-line no-console
16844
16875
  console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
16845
16876
  const promotedFundsShown = event.detail.shownFunds.map((f) => f.fundId);
16846
- superSelectionAppService.setSuperCampaignPromotedFundsShown(promotedFundsShown);
16877
+ superSelectionAppService.setSuperCampaignPromotedFundsShown(event.detail.shownFunds);
16847
16878
  await EventTrackingService.Instance.TrackSuperFundPanelViewedAsync({
16848
16879
  promotedFundsShown,
16849
16880
  defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi),
@@ -16857,10 +16888,10 @@ const SuperCampaignHost = class {
16857
16888
  if (eventDetails.sender == 'super-campaign') {
16858
16889
  // eslint-disable-next-line no-console
16859
16890
  console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
16860
- const promotedFundsShown = superSelectionAppService.superCampaignState.promotedFundsShown;
16891
+ const promotedFundsShown = this.SuperCampaignState.PromotedFundIds;
16861
16892
  const defaultFundUsiSet = Option.toUndefined(superSelectionAppService.defaultFundUsi);
16862
16893
  await Promise.all([
16863
- eventDetails.fundType == 'PromotedDefault'
16894
+ eventDetails.fundType == 'promoted-default'
16864
16895
  ? await EventTrackingService.Instance.TrackPromotedDefaultSuperFundDetailViewedAsync({
16865
16896
  fundUsi: (_b = eventDetails.fundUsi) !== null && _b !== void 0 ? _b : '',
16866
16897
  fundName: eventDetails.fundName,
@@ -16877,7 +16908,7 @@ const SuperCampaignHost = class {
16877
16908
  defaultFundUsiSet,
16878
16909
  superCampaignEnabled: true
16879
16910
  }),
16880
- miscService.trackClickPromotedTileAsync(eventDetails.fundType == 'PromotedDefault'
16911
+ miscService.trackClickPromotedTileAsync(eventDetails.fundType == 'promoted-default'
16881
16912
  ? {
16882
16913
  promotedDefault: {
16883
16914
  fundId: eventDetails.fundId
@@ -16922,13 +16953,127 @@ const SuperCampaignHost = class {
16922
16953
  });
16923
16954
  }
16924
16955
  };
16956
+ this.promotedFundJoined = async (event) => {
16957
+ var _a;
16958
+ if (event.detail.sender == 'super-campaign') {
16959
+ // eslint-disable-next-line no-console
16960
+ console.log(`$handling super-campaign event: ${(_a = event.detail) === null || _a === void 0 ? void 0 : _a.type}`);
16961
+ const fundJoinInfo = event.detail.fundJoinInfo;
16962
+ switch (fundJoinInfo.fundType) {
16963
+ case 'Promoted':
16964
+ this.handlePromotedFundJoined(fundJoinInfo);
16965
+ break;
16966
+ case 'DefinedBenefits':
16967
+ await this.handleDefinedBenefitsJoined(fundJoinInfo);
16968
+ break;
16969
+ case 'PromotedDefault':
16970
+ this.handlePromotedDefaultFundJoined(fundJoinInfo);
16971
+ break;
16972
+ case 'PromotedDefaultWithJoin':
16973
+ this.handlePromotedDefaultFundWithJoinWasJoined(fundJoinInfo);
16974
+ break;
16975
+ }
16976
+ }
16977
+ return Promise.resolve();
16978
+ };
16979
+ this.getFundName = (fundId) => {
16980
+ return _function.pipe(getFundNameByFundId(fundId), Option.getOrElse(() => ''));
16981
+ };
16982
+ this.stringIsNullOrEmtpty = (s) => {
16983
+ return !(typeof s === 'string' && s.trim().length > 0);
16984
+ };
16985
+ this.handlePromotedFundJoined = (data) => {
16986
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
16987
+ appInsights.trackErrorTrace('Super Campaign did not return (Promoted) memberNumber and/or usi');
16988
+ navigationService.navigateInternally(this.history, SuperSelectionAppRoutes.ChoicePage);
16989
+ return;
16990
+ }
16991
+ const usi = Usi.clean(data.usi);
16992
+ const fundName = this.getFundName(data.fundId);
16993
+ const defaultFundUsiSet = Option.toUndefined(superSelectionAppService.defaultFundUsi);
16994
+ navigationService.navigateInternallyToStandardChoice({
16995
+ history: this.history,
16996
+ fundName,
16997
+ promotedFundId: data.fundId,
16998
+ fundDetails: {
16999
+ type: 'promoted',
17000
+ fundName,
17001
+ fundUsi: usi,
17002
+ memberNumber: data.memberNumber,
17003
+ promotedFundId: data.fundId
17004
+ },
17005
+ handleSubmitFn: async (standardChoiceFormSignature) => {
17006
+ if (data.fundId == fund$8.fundId) {
17007
+ await slateChoiceApi.submitSlateChoiceAsync(Object.assign({ memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, standardChoiceFormSignature,
17008
+ defaultFundUsiSet }, this.PromotedFundsConfig));
17009
+ }
17010
+ else {
17011
+ await promotedFundChoiceApi.submitChoiceAsync(Object.assign({ fundId: data.fundId, memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, usi,
17012
+ standardChoiceFormSignature,
17013
+ defaultFundUsiSet }, this.PromotedFundsConfig));
17014
+ }
17015
+ }
17016
+ });
17017
+ };
17018
+ this.handlePromotedDefaultFundJoined = (data) => {
17019
+ if (this.stringIsNullOrEmtpty(data.usi)) {
17020
+ appInsights.trackErrorTrace('Super Campaign did not return (PromotedDefault) usi');
17021
+ return;
17022
+ }
17023
+ const usi = Usi.clean(data.usi);
17024
+ const fundName = this.getFundName(data.fundId);
17025
+ navigationService.navigateInternallyToStandardChoice({
17026
+ history: this.history,
17027
+ fundName,
17028
+ promotedFundId: data.fundId,
17029
+ fundDetails: {
17030
+ type: 'promotedDefault',
17031
+ fundName,
17032
+ fundUsi: usi,
17033
+ promotedFundId: data.fundId
17034
+ },
17035
+ handleSubmitFn: (standardChoiceFormSignature) => promotedFundChoiceApi.submitDefaultChoiceAsync(Object.assign({ fundId: data.fundId, usi,
17036
+ standardChoiceFormSignature, defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi) }, this.PromotedFundsConfig))
17037
+ });
17038
+ };
17039
+ this.handlePromotedDefaultFundWithJoinWasJoined = (data) => {
17040
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
17041
+ appInsights.trackErrorTrace('Super Campaign did not return (PromotedDefaultWithJoin) memberNumber and/or usi');
17042
+ return;
17043
+ }
17044
+ const usi = Usi.clean(data.usi);
17045
+ const fundName = this.getFundName(data.fundId);
17046
+ navigationService.navigateInternallyToStandardChoice({
17047
+ history: this.history,
17048
+ fundName,
17049
+ promotedFundId: data.fundId,
17050
+ fundDetails: {
17051
+ type: 'promotedDefaultWithJoin',
17052
+ fundName,
17053
+ fundUsi: usi,
17054
+ memberNumber: data.memberNumber,
17055
+ promotedFundId: data.fundId
17056
+ },
17057
+ handleSubmitFn: (standardChoiceFormSignature) => promotedFundChoiceApi.submitDefaultChoiceWithJoinAsync(Object.assign({ fundId: data.fundId, memberNumber: data.memberNumber, memberFirstName: data.memberFirstName, memberFamilyName: data.memberFamilyName, usi,
17058
+ standardChoiceFormSignature, defaultFundUsiSet: Option.toUndefined(superSelectionAppService.defaultFundUsi) }, this.PromotedFundsConfig))
17059
+ });
17060
+ };
17061
+ this.handleDefinedBenefitsJoined = async (data) => {
17062
+ if (this.stringIsNullOrEmtpty(data.memberNumber) || this.stringIsNullOrEmtpty(data.usi)) {
17063
+ appInsights.trackErrorTrace('Super Campaign did not return (DefinedBenefits) memberNumber and/or usi');
17064
+ return;
17065
+ }
17066
+ await customFundChoiceApi.submitDefinedBenefitsChoiceAsync(Object.assign({ fundUsi: Usi.clean(data.usi), fundId: data.fundId, memberNumber: data.memberNumber, memberElectContributionRatePreTax: data.memberElectContributionRatePreTax, memberElectContributionRatePostTax: data.memberElectContributionRatePostTax }, this.PromotedFundsConfig));
17067
+ superSelectionAppService.markSuperSelectionAsSubmitted();
17068
+ };
16925
17069
  this.superCampaignEventHandlers = {
16926
17070
  'choose-another-fund-requested': this.chooseAnotherFundRequested.bind(this),
16927
17071
  'fund-panel-shown': this.fundPanelShown.bind(this),
16928
17072
  'fund-tile-clicked': this.fundTileClicked.bind(this),
16929
17073
  'fund-pds-viewed': this.fundPdsViewed.bind(this),
16930
17074
  'disclaimer-viewed': this.disclaimerViewed.bind(this),
16931
- 'disclaimer-accepted': this.disclaimerAccepted.bind(this)
17075
+ 'disclaimer-accepted': this.disclaimerAccepted.bind(this),
17076
+ 'promoted-fund-joined': this.promotedFundJoined.bind(this)
16932
17077
  };
16933
17078
  }
16934
17079
  async componentWillLoad() {
@@ -16965,6 +17110,14 @@ const SuperCampaignHost = class {
16965
17110
  const parsedUrl = new URL(url);
16966
17111
  return `${parsedUrl.protocol}//${parsedUrl.hostname}${parsedUrl.port.length > 0 ? `:${parsedUrl.port}` : ''}`;
16967
17112
  }
17113
+ get SuperCampaignState() {
17114
+ if (superSelectionAppService.superCampaignState != undefined)
17115
+ return superSelectionAppService.superCampaignState;
17116
+ throw new Error('Super campaign state has not been initialized');
17117
+ }
17118
+ get PromotedFundsConfig() {
17119
+ return superSelectionAppService.promotedFundsConfig;
17120
+ }
16968
17121
  };
16969
17122
  injectHistory(SuperCampaignHost);
16970
17123