PageSourceSearch

https://www.saxoinvestor.com.au/sim/static/sc.ashx/any/investor/modules-feature-autoinvest.74d85229ac9417fa.js

js saxoinvestor.com.au collected 2026-10-08 20:52:03 UTC 43,347 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunk_trader||=[]).push([[3583],{662607(e,t,n){n.d(t,{A:()=>s});let s={gradient:"gradient_TyCLq","glass-background":"glass-background_fncJM",slider:"slider","slider--disabled":"slider--disabled","slider-handle-content":"slider-handle-content","slider-rail":"slider-rail","slider-track":"slider-track","slider--fill":"slider--fill slider--fill_CwKNB","slider--dragging":"slider--dragging","slider--tiny":"slider--tiny","slider-with-marks":"slider-with-marks","slider--small":"slider--small","slider--medium":"slider--medium","slider--large":"slider--large","slider-mark-text":"slider-mark-text","slider-dot":"slider-dot","slider-handle":"slider-handle","slider-handle-value":"slider-handle-value"}},4636(e,t,n){n.d(t,{Au:()=>x,Eh:()=>d,Gn:()=>i,HY:()=>m,Ov:()=>u,WC:()=>l,_C:()=>o,gz:()=>s,ou:()=>c,t4:()=>a});let s=100,i="Cash",o=10,a=5,l="feature-autoinvest-exante-cost",r=new Set(["EUR","DKK","CHF","PLN","SGD"]),c=e=>r.has(e),d="Savings Plan",u="5",m="PeriodicInvestment",x="Monthly"},279505(e,t,n){n.d(t,{MW:()=>r,cg:()=>o,ox:()=>i,pB:()=>a,zX:()=>l});var s=n(772646);let i=(0,s.VP)("featureBasedAutoInvest/triggerRemoveInstrument"),o=(0,s.VP)("featureBasedAutoInvest/triggerSplitEqually"),a=(0,s.VP)("featureBasedAutoInvest/triggerAllocateTargetPercentage"),l=(0,s.VP)("featureBasedAutoInvest/triggerMergeCartInstruments"),r=(0,s.VP)("featureBasedAutoInvest/triggerSubmitPlan")},129653(e,t,n){n.r(t),n.d(t,{default:()=>F,onAllocateTargetPercentage:()=>_,onMergeCartInstruments:()=>w,onRemoveInstrument:()=>D,onSplitEqually:()=>S,onSubmitPlan:()=>E}
1);var s=n(557197),i=n(637183),o=n(462807),a=n(330122),l=n(858259),r=n(677447),c=n(367225),d=n(236347),u=n(171438),m=n(756359),x=n(763422),p=n(342317),y=n(78136),g=n(258104),h=n(279505),A=n(274961),j=n(564826),f=n(186411),v=n(719446);let I=(0,f.XE)("featureBasedAutoInvest.requests"),C=async(e,t)=>(0,v.A)().rest.post("mp","v1/models",null,{body:e}).then(e=>(I.serverInfo("Plan created successfully for accountId - ",t),j.$sd(j.Zbs,"Plan created successfully",{accountId:t}),e.response)).catch(t=>(I.error("Creating model post call failed",{investmentPlanRequest:e,error:t}),{isError:!0,error:t})),T=async e=>(0,v.A)().rest.post("mp","v1/accountconnections",null,{body:e}).then(e=>({response:e.response,isError:!1})).catch(t=>(I.error("Saving model data post call failed",{params:e,error:t}),{response:t,isError:!0}));var b=n(687339);let D=(0,g.Xl)(h.ox,e=>{let t,n,s,a,l,r,c,d,{payload:u}=e,{uic:m}=u;t=(0,g.Gu)(),n=i.getDraftConstituentInstruments(t),s=i.getSelectedAccountId(t),a=n.filter(e=>e.Uic!==m),a=A.h(a),(0,g.JD)(o.iD({constituentInstruments:a,accountId:s})),l=(0,g.Gu)(),r=i.getSelectedAccountId(l),d=(c=i.getCartInstruments(l)).filter(e=>e.Uic!==m),c.length!==d.length&&(0,g.JD)(o.Gq({cartInstruments:d,accountId:r})),(e=>{let t=(0,g.Gu)(),n=i.getSelectedAccountId(t),s=i.getConstituentInstruments(t),a=!1;if(s.forEach(t=>{t.Uic===e&&(a=!0)}),a&&e){let s={...i.getSoftRemovedConstituents(t),[e]:!0};(0,g.JD)(o.QG({softRemovedConstituents:s,accountId:n}))}})(m)}),P=e=>!!e.IsTradable&&m.isInstrumentValidForAutoInvest(e),S=(0,g.Xl)(h.cg,()=>{var e;let t,n,s;e=i.getDraftMonthlyContribution((0,g.Gu)()),t=i.getDraftConstituentInstruments((0,g.Gu)()),n=i.getSelectedAccountId((0,g.Gu)()),s=A.PL(t,P).map(t=>({...t,TargetAmount:A.jg(e,t.AllocationPct)})),s=A.h(s),(0,g.JD)(o.iD({constituentInstruments:s,accountId:n}))}),_=(0,g.Xl)(h.pB,e=>{let{payload:t}=e,{uic:n,allocationPct:s}=t,a=i.getSelectedAccountId((0,g.Gu)()),l=i.getDraftConstituentInstruments((0,g.Gu)()),r=i.getDraftMonthlyContribution((0,g.Gu)()),c=l.map(e=>{let t={...e};return e.Uic===n&&(t.AllocationPct=s,t.TargetAmount=A.jg(r,s)),t});c=A.h(c),(0,g.JD)(o.iD({constituentInstruments:c,accountId:a}))}),w=(0,g.Xl)(h.zX,async()=>{let e=(0,g.Gu)(),t=i.getSelectedAccountId(e);if(!t)return;let n=i.getDraftConstituentInstruments(e,t),s=i.getConstituentInstruments(e),a=i.getCartInstruments(e,t),l=i.getSoftRemovedConstituents(e),{instrumentsToFetch:r,instrumentsToConcat:c}=A.TG(n,a,s,l),d=[];r.length>0&&(d=(await Promise.all(r.map(async e=>{let t=x.getKeyFromId(x.createInstrumentId(e.Uic,e.AssetType)),n=await u.fetchInstrument({instrumentKey:t});return n?{...n,AllocationPct:0,Description:x.getDescription(n)}:null}))).filter(e=>null!==e)),0!==(d=[...d,...n,...c]).length&&(0,g.JD)(o.iD({constituentInstruments:d,accountId:t}))}),E=(0,g.Xl)(h.MW,async e=>{let{payload:{componentId:t}}=e,n=(0,g.Gu)(),u=i.getSelectedAccountId(n);if(!u)return;let m=d.getClientKey(n),x=i.getDraftConstituentInstruments(n,u),h=i.getDraftMonthlyContribution(n,u),j=i.getClientCurrency(n),f=i.getAccountCurrency(n)??j,v=d.getClientCountryOfResidence(n,m);(0,g.JD)(o.t3({status:p.eG,accountId:u}));let I=A.fP({monthlyContribution:h,clientKey:m,accountCurrency:f,draftConstituentInstruments:x,countryOfResidence:v}),D=await C(I,u);if(D.isError)return void(0,g.JD)(o.t3({status:p.ff,accountId:u}));let P=JSON.parse(y.get("autoInvestAccountsWithoutPlan")??"{}");if(P[u]){let e={...P};delete e[u],y.setRequired("autoInvestAccountsWithoutPlan",e)}let S=c.getStoreAccountById(n,u,m);(await T({ModelId:D.ModelId,AccountKey:S?.AccountKey,ClientKey:m,CountryOfResidence:v})).isError?(0,g.JD)(o.t3({status:p.ff,accountId:u})):((0,g.JD)(o.t3({status:p.qO,accountId:u})),(0,g.JD)(s.yy({accountId:u,clientKey:m,forceFetch:!0})),(0,g.JD)(o.px({accountId:u})),(0,g.JD)(b.resetJourney()),(0,g.JD)(a.eP(t)),(0,g.JD)(l.P5({route:r.cO(A.q5())})))}),F=[D,S,_,w,E]},832840(e,t,n){n.r(t),n.d(t,{default:()=>tC});var s=n(988814),i=n(174003),o=n(120558),a=n(732401),l=n(246205),r=n(918358),c=n(803574),d=n(43311),u=n(109323),m=n(592844);let x=e=>{let{testId:t,title:n,description:i,isNew:o}=e;return(0,s.jsx)(a.A,{children:(0,s.jsx)(l.A,{children:(0,s.jsxs)(r.s,{flexDirection:"column","data-test-id":t,children:[(0,s.jsxs)(c.Z,{children:[(0,s.jsx)(u.A,{children:n}),o&&(0,s.jsx)(u.A,{"data-test-id":`${t}-new-tag`,children:m.Ay.getText("FeatureAutoInvest_PlanType_New_Tag")})]}),(0,s.jsx)(c.Z,{children:i})]})})})},p=()=>(0,s.jsxs)(r.s,{flexDirection:"column","data-test-id":"plan-type-selection",children:[(0,s.jsx)(c.Z,{children:(0,s.jsx)(d.A,{type:"secondary",children:m.Ay.getText("FeatureAutoInvest_PlanType_Title")})}),(0,s.jsx)(c.Z,{children:(0,s.jsx)(x,{testId:"plan-type-selection-
1prebuilt",title:m.Ay.getText("FeatureAutoInvest_PlanType_PreBuilt_Title"),description:m.Ay.getText("FeatureAutoInvest_PlanType_PreBuilt_Description"),isNew:!0})}),(0,s.jsx)(c.Z,{children:(0,s.jsx)(x,{testId:"plan-type-selection-own",title:m.Ay.getText("FeatureAutoInvest_PlanType_Own_Title"),description:m.Ay.getText("FeatureAutoInvest_PlanType_Own_Description")})})]}),y=()=>{let[e]=(0,o.useState)("plan-type-selection");return"plan-type-selection"===e?(0,s.jsx)(p,{}):null};var g=n(824722),h=n(648647),A=n(269678),j=n(687724),f=n(777055),v=n(462807),I=n(886444),C=n(484083),T=n(155735),b=n(796007),D=n(232133),P=n(478409),S=n(521979),_=n(92664),w=n(458359),E=n(844003),F=n(767059),G=n(886188),B=n(181893),k=n(604175),z=n(37611),N=n(791165),R=n(129599),M=n(4636),$=n(274961);let K={EUR:100,DKK:500,CHF:100,PLN:250,SGD:100},O={EUR:[250,500,1e3,2500],DKK:[500,1e3,2500,5e3],CHF:[250,500,1e3,2500],PLN:[250,500,1e3,2500],SGD:[500,1e3,2500,5e3]},U=e=>K[e],J=e=>{let{value:t,currency:n,onChange:i,showAmountChips:o=!1,dataTestId:a="amount-input"}=e,l=(0,M.ou)(n)?n:void 0;return(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:4,children:[(0,s.jsxs)(k.M,{"aria-label":m.Ay.getText("FeatureAutoInvest_AmountSelection_AmountFieldLabel"),children:[(0,s.jsx)(z.o,{isBlock:!0,"aria-label":m.Ay.getText("FeatureAutoInvest_AmountSelection_AmountFieldLabel"),placeholder:m.Ay.getText("FeatureAutoInvest_AmountSelection_AmountFieldPlaceholder"),value:t,onChange:e=>{let{value:t}=e;return i(t??void 0)},minValue:(0,$.BE)(),"data-test-id":`${a}-field`}),(0,s.jsx)(B.$,{variant:"outline",size:"large",leadingVisual:(0,s.jsx)(D.I,{type:"plus"}),"aria-label":m.Ay.getText("FeatureAutoInvest_AmountSelection_IncreaseButtonLabel"),onPress:()=>{l&&i((t??0)+U(l))},"data-test-id":`${a}-increment`}),(0,s.jsx)(B.$,{variant:"outline",size:"large",leadingVisual:(0,s.jsx)(D.I,{type:"minus"}),"aria-label":m.Ay.getText("FeatureAutoInvest_AmountSelection_DecreaseButtonLabel"),onPress:()=>{l&&i(Math.max((0,$.BE)(),(t??0)-U(l)))},"data-test-id":`${a}-decrement`})]}),o&&l&&(0,s.jsx)(R.W,{variant:"pill",selectionMode:"single",hasHorizontalScroll:!0,selectedKeys:t?String(t):null,onSelectionChange:e=>{e&&i(Number(e))},children:O[l].map(e=>(0,s.jsx)(N.f,{id:String(e),variant:"secondary",size:"large",isRounded:!0,"data-test-id":`${a}-suggested-amount-${e}`,children:`${(0,G.format)(e,0)} ${l}`},e))})]})};var W=n(370638),L=n(773897);let V=e=>{let{onBack:t,onNext:n,isNextDisabled:i=!1,nextLabel:o,backLabel:a,dataTestId:l="feature-auto-invest-footer"}=e;return(0,s.jsxs)(W.g,{orientation:"horizontal","data-test-id":l,children:[(0,s.jsx)(L.S,{variant:"secondary",isBlock:!0,onPress:t,"data-test-id":`${l}-back-button`,children:a??m.Ay.getText("FeatureAutoInvest_Back")}),(0,s.jsx)(L.S,{variant:"primary",isBlock:!0,onPress:n,disabled:i,"data-test-id":`${l}-next-button`,children:o??m.Ay.getText("FeatureAutoInvest_Next")})]})};var H=n(637183),q=n(367225),X=n(236347),Z=n(309732);let Y=e=>e.featureBasedAutoInvest.selectedAccountKey,Q=e=>e.featureBasedAutoInvest.isCreatingNewAccount,ee=e=>e.featureBasedAutoInvest.monthlyAmount,et=e=>e.featureBasedAutoInvest.returnStep,en=()=>{let e=q.createGetAccountByKey();return t=>{let n=Y(t);if(!n)return;let s=X.getClientKey(t);return e(t,n,s)?.BaseCurrency}},es=()=>{let e=q.createGetAccountByKey();return t=>{let n=Y(t);if(!n)return;let s=X.getClientKey(t);return e(t,n,s)?.AccountId}},ei=()=>{let e=q.createGetAccountByKey();return t=>{let n=Y(t);if(!n)return"-";let s=X.getClientKey(t);return e(t,n,s)?.DisplayName??n}},eo=()=>{let e=q.createGetAccountByKey(),t=t=>{let n=Y(t);if(!n)return;let s=X.getClientKey(t);return e(t,n,s)};return(0,Z.Mz)(e=>H.getDraftConstituentInstruments(e,t(e)?.AccountId),t,(e,t)=>(0,$.OV)(e,t))};var ea=n(687339);let el=e=>{let{onBack:t,onNext:n}=e,i=(0,F.wA)(),o=(0,F.rF)(en),a=(0,F.rF)(es),l=(0,F.d4)(ee);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(P.s,{paddingTop:3,paddingBottom:3,children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{paddingStart:4,paddingEnd:4,children:(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:4,"data-test-id":"amount-selection-apex",children:[(0,s.jsx)(b.D,{level:1,children:m.Ay.getText("FeatureAutoInvest_AmountSelection_Title")}),(0,s.jsx)(J,{value:l,currency:o,onChange:e=>{i(ea.setMonthlyAmount(e)),a&&void 0!==e&&i(v.KD({monthlyContribution:e??0,accountId:a}))},showAmountChips:!0,dataTestId:"amount-selection-amount"}),(0,s.jsx)(I.m,{variant:"default",children:(0,s.jsx)(C.M,{children:(0,s.jsx)(P.s,{children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{children:(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",columnGap:2,children:[(0,s.jsx)(D.I,{type:"checkmark-filled",color:"success",size:"4"}),(0,s.jsx)(E.E,{size:"md",children:m.Ay.getText("FeatureAutoInvest_AmountSelection_ReassuranceText")})]})})})})})})})]})})})})}),(0,s.jsx)(V,{onBack:t,onNext:n,isNextDisabled:!l||l<$.BE(),dataTestId:"amount-selection-actions"})]})};var er=n(771243),ec=n(364393),ed=n(869689),eu=n(155112),em=n(103764),ex=n(992027),ep=n(
1557197),ey=n(724484),eg=n(480806),eh=n(666763),eA=n(386796);let ej=e=>eh.isAutoInvestAccount(e),ef=e=>!!e&&e!==eg.Vg,ev=(e,t)=>{let n=eh.getAccountId(e);return!!ef(n)&&!!ej(e)&&t[n]!==ey.U.Existing},eI=(e,t)=>{let n=eh.getAccountId(e);if(ef(n))return{kind:"account",account:e,id:n,accountKey:e.AccountKey,isSubRow:t}},eC=(e,t,n)=>{for(let s of t){let t=eI(s,n);t&&e.push(t)}},eT=(e,t)=>{if(1===e.Accounts.length||e.IndividualMargining){let e=[];return eC(e,t,!1),e}let n=[{kind:"group",group:e,id:e.id,accountKey:t[0].AccountKey}];return eC(n,t,!0),n},eb="__create_new_account__",eD=(e,t)=>{if(!e)return null;let n=er.s7(e);return er.Ds(e)?(0,s.jsx)(ec.e,{countryCode:n,size:t}):(0,s.jsx)(ec.e,{commodity:n,size:t})},eP=e=>{let{group:t}=e;return(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",columnGap:3,"data-test-id":`choose-account-group-row-${t.id}`,children:[eD(t.BaseCurrency,"6"),(0,s.jsx)(T.s,{display:"flex",alignItems:"center",columnGap:2,flexGrow:1,children:(0,s.jsx)(E.E,{size:"sm",color:"color-text-primary",fontWeight:"semibold",children:t.DisplayName||t.AccountGroupName})})]})},eS=e=>{let{account:t,isSubRow:n,id:i}=e,o=t.DisplayName??i;return n?(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",columnGap:2,"data-test-id":`choose-account-sub-row-${i}`,children:[(0,s.jsx)(D.I,{type:"dot-small",color:"neutral",size:"3"}),eD(t.BaseCurrency,"3"),(0,s.jsx)(E.E,{size:"sm",color:"color-text-primary",children:o})]}):(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",columnGap:3,flexGrow:1,"data-test-id":`choose-account-row-${i}`,children:[eD(t.BaseCurrency,"6"),(0,s.jsx)(E.E,{size:"sm",color:"color-text-primary",fontWeight:"semibold",children:o})]})},e_=()=>(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",columnGap:3,"data-test-id":"choose-account-create-new-row",children:[(0,s.jsx)(ec.e,{icon:(0,s.jsx)(D.I,{type:"plus"}),size:"6",backgroundColor:"neutral"}),(0,s.jsx)(E.E,{size:"sm",color:"color-text-primary",fontWeight:"semibold",children:m.Ay.getText("FeatureAutoInvest_ChooseAccount_CreateNewAccount")})]}),ew=e=>{let t,n,i,a,l,r,c,d,{onBack:u,onNext:x}=e,p=(0,F.wA)(),y=(0,F.d4)(Y),g=(0,F.d4)(Q),{rowEntries:h,isLoadingPlans:A}=(t=(0,F.wA)(),n=(0,F.d4)(X.getClientKey),i=(0,F.rF)(q.createGetAccountGroups),(0,o.useEffect)(()=>{t(ep.yy({clientKey:n}))},[n,t]),a=(e=>{let t=[];for(let n of e)for(let e of n.Accounts){let n=eh.getAccountId(e);ef(n)&&ej(e)&&t.push(n)}return t})(i),l=(0,F.d4)(e=>a.map(t=>H.getPlanStatus(e,t)),eA.bN),r=(0,F.d4)(e=>a.map(t=>H.getFetchInstrumentsStatus(e,t)),eA.bN),c={},a.forEach((e,t)=>{c[e]=l[t]??ey.U.None}),d=a.length>0&&r.some(e=>e===ey.D.Loading||e===ey.D.None),{rowEntries:((e,t)=>{if(1===e.length){let n=[];return eC(n,e[0].Accounts.filter(e=>ev(e,t)),!1),n}let n=[];for(let s of e){let e=s.Accounts.filter(e=>ev(e,t));0!==e.length&&n.push(...eT(s,e))}return n})(i,c),isLoadingPlans:d}),j=g?eb:y;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(P.s,{paddingTop:3,paddingBottom:3,children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{paddingStart:4,paddingEnd:4,children:(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:4,"data-test-id":"choose-account-apex",children:[(0,s.jsx)(b.D,{level:1,children:m.Ay.getText("FeatureAutoInvest_ChooseAccount_Title")}),(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:4,children:[(0,s.jsx)(E.E,{size:"sm",color:"color-text-secondary",fontWeight:"semibold",children:m.Ay.getText("FeatureAutoInvest_ChooseAccount_SectionHeader")}),(0,s.jsx)(em.z,{value:j,onChange:e=>{if(e===eb)return;p(ea.setSelectedAccountKey(e));let t=h.find(t=>t.accountKey===e&&"account"===t.kind);t&&p(v.k9({selectedAccountId:t.id}))},"data-test-id":"choose-account-radio-group",children:(0,s.jsxs)(ed.b,{isLoading:A,useSpinnerLoading:!0,spinnerSize:"medium",children:[h.map(e=>(0,s.jsxs)(o.Fragment,{children:["group"===e.kind?(0,s.jsx)(ex.s,{value:e.accountKey,"data-test-id":`choose-account-radio-group-${e.id}`,children:(0,s.jsx)(eP,{group:e.group})}):(0,s.jsx)(ex.s,{value:e.accountKey,"data-test-id":`choose-account-radio-${e.id}`,children:(0,s.jsx)(eS,{account:e.account,isSubRow:e.isSubRow,id:e.id})}),(0,s.jsx)(eu.c,{size:"md"})]}
1,e.id)),(0,s.jsx)(ex.s,{value:eb,disabled:!0,"data-test-id":"choose-account-radio-create-new",children:(0,s.jsx)(e_,{})})]})})]})]})})})})}),(0,s.jsx)(V,{onBack:u,onNext:()=>{y&&x(y)},isNextDisabled:!y,dataTestId:"choose-account-actions"})]})};var eE=n(330122),eF=n(858259),eG=n(677447),eB=n(191829),ek=n(279505);let ez=new Set(["plan-type-selection","choose-account","amount-selection","plan-composition","summary"]),eN=e=>"string"==typeof e&&ez.has(e);var eR=n(990544),eM=n(767189),e$=n(62878),eK=n(417368);let eO=[0,10,20,30,40,50,60,70,80,90,100],eU=e=>e.Symbol.charAt(0).toUpperCase(),eJ=()=>(0,s.jsx)(T.s,{display:"flex",justifyContent:"space-between",children:eO.map(e=>(0,s.jsx)(E.E,{size:"xs",color:"color-text-tertiary",children:e},e))}),eW=e=>{let{instruments:t,onAllocationChange:n,onRemove:i,dataTestId:o}=e;return(0,s.jsx)(T.s,{display:"flex",flexDirection:"column",rowGap:3,"data-test-id":o,children:t.map(e=>{let t=e.Description;return(0,s.jsx)(I.m,{variant:"default",paddingSize:"sm","data-test-id":`instrument-allocation-card-row-${e.Uic}`,children:(0,s.jsx)(C.M,{children:(0,s.jsx)(P.s,{paddingTop:4,paddingBottom:4,children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{children:(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:5,children:[(0,s.jsxs)(T.s,{display:"flex",alignItems:"flex-start",columnGap:3,children:[(0,s.jsx)(ec.e,{size:"10",backgroundColor:"neutral",children:eU(e)}),(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:1,flexGrow:1,children:[(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",columnGap:2,children:[(0,s.jsx)(E.E,{size:"sm",color:"color-text-primary",fontWeight:"semibold",children:e.Symbol}),(0,s.jsx)(eK.v,{color:"default",shape:"pill",size:"small",isSubtle:!0,children:e.AssetType})]}),(0,s.jsx)(E.E,{size:"xs",color:"color-text-secondary",children:t})]}),(0,s.jsx)(B.$,{variant:"ghost",size:"small",leadingVisual:(0,s.jsx)(D.I,{type:"delete"}),"aria-label":`${m.Ay.getText("FeatureAutoInvest_PlanComposition_RemoveInstrument")} ${t}`,onPress:()=>i(e.Uic),"data-test-id":`instrument-allocation-card-remove-${e.Uic}`})]}),(0,s.jsx)(E.E,{size:"sm",color:"color-text-primary",fontWeight:"semibold",textAlign:"end","data-test-id":`instrument-allocation-card-value-${e.Uic}`,children:`${e.AllocationPct} %`}),(0,s.jsx)(e$.A,{value:e.AllocationPct,onChange:t=>n(e.Uic,t),min:0,max:100,step:1,isFill:!0}),(0,s.jsx)(eJ,{})]})})})})})})},e.Uic)})})};var eL=n(315727);let eV=[4,28],eH=()=>{var e;let t,n=(0,F.wA)(),i=(e=(0,eL.pd)("TraderGO.FeatureAutoInvestInvestmentDate","investmentDate"),t=e?.split(",").map(e=>e.trim()).filter(e=>e.length>0&&!Number.isNaN(Number(e))).map(Number),t?.length?t:eV),o=(0,F.d4)(H.getDraftInvestmentDay),a=(0,F.d4)(H.getSelectedAccountId);return(0,s.jsx)(I.m,{variant:"default",children:(0,s.jsx)(C.M,{children:(0,s.jsx)(P.s,{children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{children:(0,s.jsxs)(T.s,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[(0,s.jsx)(E.E,{size:"sm",fontWeight:"semibold",children:m.Ay.getText("FeatureAutoInvest_PlanComposition_InvestmentDate")}),(0,s.jsx)(R.W,{selectionMode:"single",variant:"outline",disallowEmptySelection:!0,selectedKeys:null==o?null:String(o),onSelectionChange:e=>{n(v.Mj({investmentDay:null===e?null:Number(e),accountId:a}))},"data-test-id":"plan-composition-investment-date-toggle",children:i.map(e=>(0,s.jsx)(N.f,{id:String(e),variant:"outline",size:"medium",children:e},e))})]})})})})})})})},eq=e=>{let{totalAllocationPct:t,onSplitEqually:n}=e;return(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:4,children:[(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,s.jsx)(b.D,{level:1,children:m.Ay.getText("FeatureAutoInvest_PlanComposition_Title")}),(0,s.jsx)(B.$,{variant:"outline",size:"medium",onPress:n,"data-test-id":"plan-composition-split-equally",children:m.Ay.getText("FeatureAutoInvest_PlanComposition_SplitEqually")})]}),(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:1,children:[(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,s.jsx)(E.E,{size:"sm",color:"color-text-primary",fontWeight:"semibold",children:m.Ay.getText("FeatureAutoInvest_PlanComposition_AllocationLabel")}),(0,s.jsx)(E.E,{size:"sm",color:"color-text-primary",fontWeight:"semibold","data-test-id":"plan-composition-total-value",children:`${t}%`})]}),(0,s.jsx)(eM.z,{value:t,maxValue:M.gz,color:t===M.gz?"positive":"information","aria-label":m.Ay.getText("FeatureAutoInvest_PlanComposition_AllocationTotalLabel"),"data-test-id":"plan-composition-total"})]})]})},eX=e=>{let{onAddMore:t,onNext:n}=e,i=(0,F.wA)(),a=(0,F.rF)(es),l=(0,F.d4)(e=>H.getDraftConstituentInstruments(e,a));(0,o.useEffect)(()=>{i(ek.zX())},[i]);let r=$.wT(l);return 0===l.length?(0,s.jsx)(P.s,{paddingTop:3,paddingBottom:3,children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{paddingStart:4,paddingEnd:4,children:(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:4,"data-test-id":"plan-composition-apex",children:[(0,s.jsx)(b.D,{level:1,children:m.Ay.getText("FeatureAutoInvest_PlanComposition_Title")}),(0,s.jsx)(eR.S,{avatar:"portfolio",title:m.Ay.getText("FeatureAutoInvest_PlanComposition_EmptyStateTitle"),description:m.Ay.getText("FeatureAutoInvest_PlanComposition_EmptyStateDescription"),ctaLabel:m.Ay.getText("FeatureAutoInvest_PlanComposition_FindInvestments"),onCtaPress:t,"data-test-id":"plan-composition-empty-state"})]})})})})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(P.s,{paddingTop:3,paddingBottom:3,children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{paddingStart:4,paddingEnd:4,children:(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:4,"data-test-id":"plan-composition-apex",children:[(0,s.jsx)(eH,{}),(0,s.jsx)(eq,{totalAllocationPct:r,onSplitEqually:()=>{i(ek.cg())}}),(0,s.jsx)(eW,{instruments:l,onAllocationChange:(e,t)=>
1{i(ek.pB({uic:e,allocationPct:t}))},onRemove:e=>{i(ek.ox({uic:e}))},dataTestId:"plan-composition-allocation"})]})})})})}),(0,s.jsxs)(W.g,{orientation:"horizontal","data-test-id":"plan-composition-actions",children:[(0,s.jsx)(L.S,{variant:"secondary",isBlock:!0,leadingVisual:(0,s.jsx)(D.I,{type:"add-circle"}),onPress:t,"data-test-id":"plan-composition-actions-add-more-button",children:m.Ay.getText("FeatureAutoInvest_PlanComposition_AddMore")}),(0,s.jsx)(L.S,{variant:"primary",isBlock:!0,disabled:!$.fw(l),onPress:n,"data-test-id":"plan-composition-actions-next-button",children:m.Ay.getText("FeatureAutoInvest_Next")})]})]})};var eZ=n(343463);let eY=e=>{let{testId:t,iconType:n,title:i,description:o,isNew:a,onPress:l}=e;return(0,s.jsx)(eZ.Z,{onPress:l,paddingSize:"lg","data-test-id":t,children:(0,s.jsx)(P.s,{children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{children:(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",columnGap:3,children:[(0,s.jsx)(ec.e,{icon:(0,s.jsx)(D.I,{type:n}),size:"10",backgroundColor:"neutral"}),(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:1,flexGrow:1,children:[(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",columnGap:2,children:[(0,s.jsx)(E.E,{size:"sm",color:"color-text-primary",fontWeight:"semibold",children:i}),a&&(0,s.jsx)(eK.v,{color:"information",shape:"pill",size:"small",isSubtle:!0,"data-test-id":`${t}-new-tag`,children:m.Ay.getText("FeatureAutoInvest_PlanType_New_Tag")})]}),(0,s.jsx)(E.E,{size:"xs",color:"color-text-secondary",children:o})]}),(0,s.jsx)(D.I,{type:"chevron-right",color:"neutral",size:"5"})]})})})})})})},eQ=e=>{let{onSelect:t}=e,n=(0,F.wA)(),i=e=>{n(ea.setPlanType(e)),t()};return(0,s.jsx)(P.s,{paddingTop:3,paddingBottom:3,children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{children:(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:4,"data-test-id":"plan-type-selection-apex",children:[(0,s.jsx)(b.D,{level:1,children:m.Ay.getText("FeatureAutoInvest_PlanType_Title")}),(0,s.jsx)(eY,{testId:"plan-type-selection-prebuilt",iconType:"portfolio",title:m.Ay.getText("FeatureAutoInvest_PlanType_PreBuilt_Title"),description:m.Ay.getText("FeatureAutoInvest_PlanType_PreBuilt_Description"),isNew:!0,onPress:()=>i("prebuilt")}),(0,s.jsx)(eY,{testId:"plan-type-selection-own",iconType:"user",title:m.Ay.getText("FeatureAutoInvest_PlanType_Own_Title"),description:m.Ay.getText("FeatureAutoInvest_PlanType_Own_Description"),onPress:()=>i("own")})]})})})})})};var e0=n(300243),e4=n(342317),e1=n(150954),e3=n(707581),e7=n(22220),e2=n(16709),e5=n(141500),e6=n(763422);let e8={showUnderlay:!0,popupOptions:{width:e5.Ay.isTraderApp?400:880,top:50,bottom:50},isFullHeight:!0,type:"popup",isModal:!0},e9=e=>{let{instrument:t}=e,n=(0,F.d4)(X.getClientKey),i=(0,F.d4)(H.getSelectedAccountId),a=(0,o.useCallback)(()=>{t&&e2.Ay.open(e7.TRADING_CONDITIONS_DIALOG,{instrumentId:e6.getId(t),accountId:i,clientKey:n,currencyAccountId:i,dialogProps:e8,skipDependencies:!0,componentProps:{isAccountSelectorEnabled:!1,isClientCardShown:!1,isHouseSelectorShown:!1,isHeaderShown:!0,showAutoInvestTradingRates:!0},inputUserSettings:{isAccountAndInstrumentShown:!0,isInstrumentsLocked:!0}})},[i,n,t]);return(0,s.jsx)(e3.A,{childRef:e7.TRADING_CONDITIONS_LINK,componentProps:{accountId:i,clientKey:n,instrumentId:e6.getId(t),onDataLoaded:a,linkContent:(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",columnGap:1,children:[(0,s.jsx)(D.I,{type:"information",size:"4"}),m.Ay.getText("TC_TradingConditions")]})}})};var te=n(432350),tt=n(576077),tn=n(614491),ts=n(990127),ti=n(815261),to=n(314946),ta=n(748376),tl=n(26746),tr=n(651311),tc=n(322149),td=n(662795),tu=n(310799),tm=n(975389);let tx=(e,t)=>G.format(e,0===e?0:t),tp=(e,t)=>(0,s.jsx)(tu.m,{content:t,children:(0,s.jsx)(tm.S,{children:e})}),ty=e=>{let{instrument:t}=e,n=$.xt(t),i=(0,F.d4)(e=>te.getData(e,n)),o=i&&$.QD(i,tt.r4);if(!o)return null;let a=o.investmentServiceCost.total-o.investmentServiceCostCommissionOpen.total,l=o.thirdPartyPaymentCost.total+o.investmentServiceCostCommissionOpen.total,r=er.e_({CurrencyCode:t.CurrencyCode}
1),c=1===o.holdingPeriodInDays?m.Ay.getText("ExAnteCosts_OneDayHoldingCost"):(0,tn.J)(m.Ay.getText("ExAnteCosts_NumDaysHoldingCost"),o.holdingPeriodInDays),d=[{id:"investment-service",label:tp(m.Ay.getText("ExAnteCosts_InvestmentServiceCosts"),m.Ay.getText("ExAnteCosts_InvestmentServiceCosts_Tooltip")),total:a,totalPct:o.investmentServiceCost.totalPct,isSubRow:!1},{id:"investment-service-commission",label:m.Ay.getText("ExAnteCosts_IncludingCommissionOpen"),total:o.investmentServiceCostCommissionOpen.total,totalPct:o.investmentServiceCostCommissionOpen.totalPct,isSubRow:!0},{id:"financial-instrument",label:tp(m.Ay.getText("ExAnteCosts_FinancialInstrumentCosts"),m.Ay.getText("ExAnteCosts_FinancialInstrumentCosts_Tooltip")),total:o.financialInstrumentCost.total,totalPct:o.financialInstrumentCost.totalPct,isSubRow:!1},{id:"third-party-payment",label:tp(m.Ay.getText("ExAnteCosts_ThirdPartyPaymentCosts"),m.Ay.getText("ExAnteCosts_ThirdPartyPaymentCosts_Tooltip")),total:l,totalPct:o.thirdPartyPaymentCost.totalPct,isSubRow:!1}],u=[{id:"label",name:c,minWidth:160,isGrow:!0,type:"text",isRowHeader:!0},{id:"amount",name:t.CurrencyCode,minWidth:{sm:80,md:40,lg:40,xl:40,xxl:40},type:"number"},{id:"pct",name:"%",minWidth:{sm:60,md:40,lg:40,xl:40,xxl:40},type:"number"}];return(0,s.jsxs)(ts.b,{size:"tight","aria-label":m.Ay.getText("ExAnteCosts_Breakdown"),"data-test-id":"adjusted-cost-table",items:d,getRowKey:e=>e.id,hasRowDividers:!1,hasInlinePadding:!1,estimateSize:td.A,children:[(0,s.jsx)(ti.G,{columns:u,children:e=>(0,s.jsx)(to.p,{minWidth:e.minWidth,isGrow:e.isGrow,type:e.type,isRowHeader:e.isRowHeader,children:"amount"===e.id||"pct"===e.id?(0,s.jsx)(E.E,{size:"md",textAlign:"end","data-aligned":"end",children:e.name}):e.name})}),(0,s.jsx)(ta.z,{columns:u,children:e=>(0,s.jsx)(tl.J,{columns:u,isSubRow:e.isSubRow,"data-test-id":`adjusted-cost-row-${e.id}`,children:t=>(0,s.jsxs)(tr.B,{minWidth:t.minWidth,isGrow:t.isGrow,type:t.type,children:["label"===t.id&&(0,s.jsx)(E.E,{size:"md",color:"color-text-secondary",children:e.label}),"amount"===t.id&&(0,s.jsx)(td.y,{children:tx(e.total,r)}),"pct"===t.id&&(0,s.jsx)(td.y,{children:tx(e.totalPct,3)})]})})}),(0,s.jsx)(tc.a,{columns:u,children:e=>(0,s.jsxs)(tr.B,{minWidth:e.minWidth,isGrow:e.isGrow,type:e.type,children:["label"===e.id&&(0,s.jsx)(E.E,{size:"md",fontWeight:"semibold",children:m.Ay.getText("ExAnteCosts_Total")}),"amount"===e.id&&(0,s.jsx)(td.y,{children:tx(o.total,r)}),"pct"===e.id&&(0,s.jsx)(td.y,{children:tx(o.totalPct,3)})]})})]})},tg=e=>{let{instrument:t}=e,n=(0,eL.aX)("TraderGO.ShowAutoInvestExante");return(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:2,"data-test-id":`summary-instrument-row-${t.Uic}`,children:[(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",justifyContent:"space-between",columnGap:3,children:[(0,s.jsxs)(T.s,{display:"flex",alignItems:"center",columnGap:3,children:[(0,s.jsx)(ec.e,{size:"6",backgroundColor:"neutral",children:eU(t)}),(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",children:[(0,s.jsx)(E.E,{size:"sm",fontWeight:"semibold",children:t.Symbol}),(0,s.jsx)(E.E,{size:"sm",color:"color-text-secondary",children:t.Description})]})]}),(0,s.jsx)(T.s,{flexShrink:0,children:(0,s.jsx)(E.E,{size:"sm",fontWeight:"semibold",children:`${t.AllocationPct} %`})})]}),n&&(0,s.jsx)(ty,{instrument:t}),(0,s.jsx)(e3.A,{childRef:e7.PDF_REPORT,componentProps:{isApex:!0,kid:{instrument:t,text:m.Ay.getText("KeyInformationDocument"),isKidList:!0}}}),n&&(0,s.jsx)(e9,{instrument:t})]})},th=e=>{let{instruments:t}=e;return(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:3,"data-test-id":"summary-instruments-list",children:[(0,s.jsx)(b.D,{level:2,children:m.Ay.getText("FeatureAutoInvest_Summary_InvestmentsHeading")}),(0,s.jsx)(I.m,{variant:"default",paddingSize:"sm",children:(0,s.jsx)(C.M,{children:(0,s.jsx)(P.s,{paddingTop:4,paddingBottom:4,children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{children:(0,s.jsx)(T.s,{display:"flex",flexDirection:"column",rowGap:3,children:t.filter(e=>e.AssetType!==M.Gn).map((e,t,n)=>(0,s.jsxs)(o.Fragment,{children:[(0,s.jsx)(tg,{instrument:e}),t<n.length-1&&(0,s.jsx)(eu.c,{size:"md"})]},e.Uic))})})})})})})})]})};var tA=n(627605);let tj=e=>{let{label:t,tooltip:n,value:i}=e;return(0,s.jsxs)(T.s,{display:"flex",justifyContent:"space-between",children:[(0,s.jsx)(E.E,{size:"sm",children:n?(0,s.jsx)(tu.m,{content:n,children:(0,s.jsx)(tm.S,{
1children:t})}):t}),i]})},tf=()=>{let e=(0,F.d4)(H.getDraftMonthlyContribution),t=(0,F.d4)(H.getDraftInvestmentDay),n=(0,F.rF)(ei),i=(0,F.d4)(H.getAccountCurrency),o=(0,eL.pd)("TraderGO.SavingsPlanCommissions","Value");return(0,s.jsx)(I.m,{variant:"default",paddingSize:"sm","data-test-id":"summary-top-card",children:(0,s.jsx)(C.M,{children:(0,s.jsx)(P.s,{paddingTop:4,paddingBottom:4,children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{children:(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:6,children:[(0,s.jsx)(tj,{label:m.Ay.getText("FeatureAutoInvest_Summary_InvestEachMonth"),value:(0,s.jsx)(tA.A,{currency:i,decimals:0,"data-test-id":"summary-monthly-target-amount",children:e})}),null!=t&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tj,{label:m.Ay.getText("FeatureAutoInvest_Summary_InvestmentDay"),value:(0,s.jsx)(E.E,{size:"sm","data-test-id":"summary-investment-day",children:t})}),(0,s.jsx)(tj,{label:m.Ay.getText("FeatureAutoInvest_Summary_NextInvestment"),value:(0,s.jsx)(E.E,{size:"sm","data-test-id":"summary-next-investment-date",children:(0,$.rM)(t)})})]}),(0,s.jsx)(tj,{label:m.Ay.getText("FeatureAutoInvest_Summary_Account"),value:(0,s.jsx)(E.E,{size:"sm","data-test-id":"summary-account-name",children:n})}),!!o&&(0,s.jsx)(tj,{label:m.Ay.getText("FeatureAutoInvest_Summary_Commissions"),value:(0,s.jsx)(tA.A,{currency:i,decimals:0,"data-test-id":"summary-commissions",children:Number(o)})})]})})})})})})})},tv=e=>{let{onBack:t,onNext:n}=e,i=(0,F.wA)(),a=(0,F.rF)(es),l=(0,F.d4)(e=>H.getDraftConstituentInstruments(e,a)),r=(0,F.rF)(eo),c=(0,F.d4)(e=>H.getSavePlanStatus(e,a)),d=c===e4.eG,u=c===e4.ff;return(0,o.useEffect)(()=>{let e=r??[];return e.length&&i(e0.Xm({batch:e})),()=>{i(e0.N7(e.map(e=>{let{id:t}=e;return{id:t}})))}},[i,r]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(P.s,{paddingTop:3,paddingBottom:3,children:(0,s.jsx)(S.$,{children:(0,s.jsx)(_.J,{children:(0,s.jsx)(w.t,{paddingStart:4,paddingEnd:4,children:(0,s.jsxs)(T.s,{display:"flex",flexDirection:"column",rowGap:4,"data-test-id":"summary-apex",children:[(0,s.jsx)(b.D,{level:1,children:m.Ay.getText("FeatureAutoInvest_Summary_Title")}),u&&(0,s.jsx)(e1.F,{variant:"danger","data-test-id":"summary-submit-error",children:m.Ay.getText("FeatureAutoInvest_Summary_SubmitError")}),(0,s.jsx)(tf,{}),(0,s.jsx)(th,{instruments:l})]})})})})}),(0,s.jsx)(V,{onBack:t,onNext:n,dataTestId:"summary-actions",isNextDisabled:d})]})},tI=e=>{let{componentId:t}=e,{step:n,closeDialog:i,goToNextStep:a,goToPreviousStep:l,navigateToFindInvestments:r,backButtonContextValue:c}=(e=>{let t=(0,F.wA)(),n=(0,F.d4)(et),s=(0,F.d4)(e=>eB.getRouteParamsByLocation(e).searchParams?.returnStep),[i,a]=(0,o.useState)("plan-type-selection");(0,o.useEffect)(()=>{eN(n)?(a(n),t(ea.setReturnStep(void 0))):eN(s)&&a(s)},[t,n,s]);let l=(0,o.useCallback)(()=>{t(eE.eP(e))},[t,e]),r=(0,o.useCallback)(()=>{l(),t(eF.P5({route:eG.cO($.kx())}))},[t,l]),c=(0,o.useCallback)(e=>{t(ea.setReturnStep(e)),l(),t(eF.P5({route:eG.cO($.ll())}))},[t,l]),d=(0,o.useCallback)(()=>{({"plan-type-selection":()=>a("choose-account"),"choose-account":()=>a("amount-selection"),"amount-selection":()=>c("amount-selection"),"plan-composition":()=>a("summary"),summary:()=>{t(ek.MW({componentId:e}))}})[i]()},[t,e,i,c]),u=(0,o.useCallback)(()=>{({"plan-type-selection":r,"choose-account":()=>a("plan-type-selection"),"amount-selection":()=>a("choose-account"),"plan-composition":()=>c("amount-selection"),summary:()=>a("plan-composition")})[i]()},[i,r,c]),x=(0,o.useMemo)(()=>({"aria-label":m.Ay.getText("Back"),onBackNavigation:u,shouldTriggerPageTransition:!1}),[u]);return{step:i,setStep:a,closeDialog:l,goToNextStep:d,goToPreviousStep:u,navigateToFindInvestments:c,backButtonContextValue:x}})(t);return(0,s.jsxs)(h.R,{value:c,children:[(0,s.jsx)(A.g,{defaultCollapsed:!0,children:(0,s.jsx)(j.d,{children:(0,s.jsx)(f.T,{children:(0,s.jsx)(g.D,{"aria-label":m.Ay.getText("Apex_Close"),onPress:i,"data-test-id":"feature-based-auto-invest-close"})})})}),"plan-type-selection"===n&&(0,s.jsx)(eQ,{onSelect:a}),"choose-account"===n&&(0,s.jsx)(ew,{onBack:l,onNext:a}),"amount-selection"===n&&(0,s.jsx)(el,{onBack:l,onNext:a}),"plan-composition"===n&&(0,s.jsx)(eX,{onAddMore:()=>r("plan-composition"),onNext:a}),"summary"===n&&(0,s.jsx)(tv,{onBack:l,onNext:a})]})};function tC(e){return(0,i.Ju)()?(0,s.jsx)(tI,{componentId:e.componentId}):(0,s.jsx)(y,{})}},718298(e,t,n){n.r(t),n.d(t,{default:()=>h});var s=n(988814),i=n(490436),o=n(637183),a=n(858259),l=n(677447),r=n(592844),c=n(181893),d=n(155735),u=n(478409),m=n(521979),x=n(92664),p=n(458359),y=n(844003);n(120558);var g=n(767059);function h(e){let{onClose:t,onDone:n}=e,h=(0,g.wA)(),A=(0,g.d4)(o.getSelectedAccountId),j=(0,g.d4)(e=>o.getCartInstruments(e,A)).length;return(0,s.jsx)(u.s,{paddingTop:3,paddingBottom:3,children:(0,s.jsx)(m.$,{children:(0,s.jsx)(x.J,{children:(0,s.jsx)(p.t,{paddingStart:4,paddingEnd:4,children:(0,s.jsxs)(d.s,{display:"flex",justifyContent:"flex-end",alignItems:"center",columnGap:4,children:[(0,s.jsxs)(d.s,{display:"flex",flexDirection:"column",rowGap:1,alignItems:"flex-end",children:[(0,s.jsx)(y.E,{size:"md",fontWeight:"medium",color:"color-text-primary",children:`${r.Ay.getCatalogText("AutoInvest","Selected")}: ${j}`}),(0,s.jsx)(y.E,{size:"sm",color:"color-text-secondary",children:r.Ay.getCatalogText("AutoInvest","Selected_Description")})]}),(0,s.jsx)(c.$,{variant:0===j?"secondary":"primary",size:"medium",disabled:0===j,onPress:()=>{t?.(),n?n():h(a.P5({route:l.cO(i.rT,{returnStep:"plan-composition"})}))},"data-test-id":"feature-autoinvest-done-button",children:r.Ay.getCatalogText("AutoInvest","Done")})]})})})})})}},274961(e,t,n){n.d(t,{BE:()=>c,OV:()=>S,PL:()=>j,QD:()=>D,TG:()=>f,fP:()=>T,fw:()=>A,h:()=>C,jg:()=>v,kx:()=>y,ll:()=>p,q5:()=>x,rM:()=>b,wT:()=>h,xt:()=>P});var s=n(490436),i=n(141500),o=n(666763),a=n(149270),l=n(886188),r=n(4636);let c=()=>r._C,d=s.AH,u=s.OD,m=s.fg,x=()=>i.Ay.isInvestorApp?m:"/portfolio",p=()=>i.Ay.isInvestorApp?d:"/portfolio/find-investments",y=()=>i.Ay.isInvestorApp?u:"/portfolio/start-autoinvest",g=e=>e.AssetType!==r.Gn,h=e=>e.filter(e=>g(e)).reduce((e,t)=>
1e+t.AllocationPct,0),A=e=>e.length>0&&h(e)===r.gz,j=(e,t)=>{void 0===t&&(t=g);let n=e.filter(e=>t(e)).length;if(0===n)return e.map(e=>({...e,AllocationPct:0}));let s=Math.floor(r.gz/n),i=r.gz-s*n,o=0;return e.map(e=>{if(!t(e))return{...e,AllocationPct:0};let n=+(o<i);return o+=1,{...e,AllocationPct:s+n}})},f=(e,t,n,s)=>{let i=[...t,...n],o=[],a=[],l={};return e.forEach(e=>{l[e.Uic]=!0}),i.forEach(e=>{s[e.Uic]||l[e.Uic]||(e.Description||e.AssetType===r.Gn?a.push(e):o.push(e))}),{instrumentsToFetch:o,instrumentsToConcat:a}},v=(e,t)=>Number(Math.round(t/100*e)),I=e=>l.parse(l.format(e,2)),C=e=>e.map(e=>({...e,MinAllocation:Math.max(I(e.AllocationPct-r.t4),0),MaxAllocation:Math.min(I(e.AllocationPct+r.t4),100)})),T=e=>{let{monthlyContribution:t,clientKey:n,accountCurrency:s,draftConstituentInstruments:i,countryOfResidence:o}=e;return{Description:r.Eh,ModelName:r.Eh,MaxFunding:t,MinFunding:l.parse(l.format(.1*t,2)),OwnerKey:n,DefaultCurrency:s,RebalancingDay:5,RebalancingFrequency:r.Au,ManagementTypeId:r.Ov,Type:r.HY,ConstituentInstruments:i.map(e=>{let{TargetAmount:t,ColorIndex:n,...s}=e;return s}),CountryOfResidence:o}},b=e=>{let t=a.A.now(),n=t.getUserDayOfMonth(),s=a.A.firstDateOfMonth(t),i=a.A.createMutableDate(s);return(4===e&&n>4||28===e&&n>28)&&(i=i.nextMonth()),(i=i.addDays(e-1)).formatDate({showYear:!0})},D=(e,t)=>{let n=((e,t)=>{if("Buy"===t)return e.ExAnteDirectCost?.ExAnteDirectCostBuy;let n=e.ExAnteDirectCost?.ExAnteDirectCostBuy,s=e.ExAnteDirectCost?.ExAnteDirectCostSell;if("None"===t)return(n?.Total??0)>(s?.Total??0)?n:s})(e,t);if(n)return{financialInstrumentCost:{total:n.FinancialInstrumentCost.Total,totalPct:n.FinancialInstrumentCost.TotalPercentage},investmentServiceCost:{total:n.InvestmentServiceCost.Total,totalPct:n.InvestmentServiceCost.TotalPercentage},investmentServiceCostCommissionOpen:{total:n.InvestmentServiceCost.Open?.Commissions??0,totalPct:n.InvestmentServiceCost.Open?.CommissionsPercentage??0},investmentServiceCostCommissionClose:{total:n.InvestmentServiceCost.Close?.Commissions??0,totalPct:n.InvestmentServiceCost.Close?.CommissionsPercentage??0},thirdPartyPaymentCost:{total:n.ThirdPartyPaymentCost.Total,totalPct:n.ThirdPartyPaymentCost.TotalPercentage},total:n.Total,totalPct:n.TotalPercentage,holdingPeriodInDays:n.HoldingPeriodInDays}},P=e=>{let{Uic:t,AssetType:n}=e;return`${r.WC}-${n}-${t}`},S=(e,t)=>e.filter(e=>e.AssetType!==r.Gn).map(e=>{let{Uic:n,AssetType:s,CurrencyCode:i}=e;return{id:P(e),args:{AssetType:s,Uic:n,Amount:e.TargetAmount,AmountType:"CashAmount",BuySell:"Buy",FieldGroups:["ExAnteCosts","PriceInfoDetails","Quote"],...o.getAccountKeyArg(t),...t&&i&&t.BaseCurrency!==i&&{AccountCurrency:t.BaseCurrency}}}})},687339(e,t,n){n.r(t),n.d(t,{default:()=>x,initialState:()=>i,reducer:()=>m,resetJourney:()=>u,setIsCreatingNewAccount:()=>r,setMonthlyAmount:()=>c,setPlanType:()=>a,setReturnStep:()=>d,setSelectedAccountKey:()=>l});var s=n(772646);let i={planType:void 0,selectedAccountKey:void 0,isCreatingNewAccount:!1,monthlyAmount:void 0,returnStep:void 0},o=(0,s.Z0)({name:"modules/assetManagement/featureBasedAutoInvest",initialState:i,reducers:{setPlanType(e,t){let{payload:n}=t;return{...e,planType:n}},setSelectedAccountKey(e,t){let{payload:n}=t;return{...e,selectedAccountKey:n,isCreatingNewAccount:!1}},setIsCreatingNewAccount(e,t){let{payload:n}=t;return{...e,isCreatingNewAccount:n,selectedAccountKey:n?void 0:e.selectedAccountKey}},setMonthlyAmount(e,t){let{payload:n}=t;return{...e,monthlyAmount:n}},setReturnStep(e,t){let{payload:n}=t;return{...e,returnStep:n}},resetJourney:()=>i}}),{setPlanType:a,setSelectedAccountKey:l,setIsCreatingNewAccount:r,setMonthlyAmount:c,setReturnStep:d,resetJourney:u}=o.actions,{reducer:m}=o,x={featureBasedAutoInvest:m}},874560(e,t,n){n.r(t),n.d(t,{default:()=>c,onCreateEffect:()=>r});var s=n(557197),i=n(196498),o=n(22220),a=n(137215),l=n(258104);let r=i.dP(o.UPDATE_FEATURE_BASED_AUTO_INVEST_INSTRUMENTS,async()=>{a.getBooleanFlag((0,l.Gu)(),"TraderGO.FeatureBasedAutoInvest")&&(0,l.JD)(s.yy({}))}),c=[r]},636653(e,t,n){n.r(t),n.d(t,{default:()=>I});var s,i=n(988814),o=n(564826),a=n(557197),l=n(637183),r=n(832020),c=n(287594),d=n(330122),u=n(16709),m=n(22220),x=n(994807),p=n(120558),y=n(340970),g=n(767059),h=n(279505),A=n(592844),j=((s={}).Add="Add",s.Remove="Remove",s.Added="Added",s),f=n(23291);let v={aptAcceptanceDialog:"fbai-apt-acceptance-dialog",aptAcceptanceDialogBody:"fbai-apt-acceptance-dialog-body",aptAcceptanceDialogAcceptBtn:"fbai-apt-acceptance-dialog-accept-btn",ckacarTestDialog:"fbai-ckacar-test-dialog",ckacarTestDialogBody:"fbai-ckacar-test-dialog-body",ckacarTestText:"fbai-ckacar-test-text",ckacarGoToTestButton:"fbai-go-to-test-button",ckacarHelpUrl:"fbai-ckaCar-help-url",instrumentAlreadyInPlanDialog:"fbai-instrument-in-plan-dialog",instrumentAlreadyInPlanFooter:"fbai-instrument-already-in-plan-dialog-footer",kidValidationDialog:"fbai-kid-validation-dialog",kidValidationBodyText:"fbai-kid-validation-bodytext",maxInstrumentsPopup:"fbai-max-instruments-popup",maxInstrumentsPopupFooter:"fbai-max-instruments-popup-footer"};function I(e){let t,{uic:n,assetType:s,isNavigatedThroughPlanner:I,isTradable:C=!0,parentContainerRef:T,isNavigatedThroughDedicatedAutoInvest:b,nonTradableReason:D}=e,[P,S]=(0,p.useState)(void 0),_=(0,g.wA)(),w=(0,g.d4)(l.getConstituentInstruments),E=w.some(e=>e.Uic===n),F=(0,g.d4)(l.getCartInstruments),G=["Etf","MutualFund","Fund","Etn","Etc"].includes(s),B=w.find(e=>e.Uic===n)?j.Added:F.find(e=>e.Uic===n)?j.Remove:j.Add,k=()=>{u.Ay.open(m.FEATURE_BASED_AUTO_INVEST)},z=()=>{let e=x.getCurrentRoute(),t=e?.params?.pageUrl;o.$sd(o.Zbs,"Instrument added to plan",{pageUrl:t,uic:n}),n&&_((0,a.Fz)({uic:n,assetType:s})),b&&(_(d.LC(m.DYNAMIC_PRODUCT_PAGE)),k())},N=e=>{switch(e.stopPropagation(),B){case j.Add:if("ETFsWithoutKIIDs"===D||"WithoutKIIDs"===D)return void S(f.k.KidValidation);z();break;case j.Remove:_(h.ox({uic:n}));break;case j.Added:S(f.k.InstrumentAlreadyInPlan)}},R=B===j.Added?"check":B===j.Remove?"close":"plus",M="plus"===R?"primary":"secondary",$=b?E?A.Ay.getCatalogText("AutoInvest","Manage"):A.Ay.getCatalogText("AutoInvest","Add"):B===j.Added?A.Ay.getCatalogText("AutoInvest","Added"):B===j.Remove?A.Ay.getCatalogText("AutoInvest","Remove"):A.Ay.getCatalogText("AutoInvest","Add");return t=b?(0,i.jsx)(r.$,{disabled:!C||!G,onClick:E?()=>{u.Ay.open(m.FEATURE_BASED_AUTO_INVEST),_(d.LC(m.DYNAMIC_PRODUCT_PAGE))}:N,variant:"primary","data-test-id":"add-to-planner-btn-featureBasedAutoInvest",children:$}):I?(0,i.jsx)(r.$,{disabled:!C||!G,onClick:N,variant:M,icon:{type:R,position:"inline-start"},"data-test-id":"add-to-planner-btn-featureBasedAutoInvest",children:$}):(0,i.jsx)(r.$,{disabled:!C||!G,onClick:N,variant:M,"data-test-id":`add-to-planner-${R}-btn-featureBasedAutoInvest`,children:(0,i.jsx)(c.A,{isBlock:!0,type:R})}),(0,i.jsxs)(i.Fragment,{children:[t,P&&(0,i.jsx)(y.A,{uic:n,dialogType:P,onClose:()=>{S(void 0)},onAddInstrument:z,onGoToPlan:k,onSeeSelected:()=>u.Ay.open(m.FEATURE_BASED_AUTO_INVEST),isTradable:C,parentContainerRef:T,assetType:s,testIds:v})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.