(window.webpackJsonp=window.webpackJsonp||[]).push([[20],{"IU/9":function(t,e,i){"use strict";i.d(e,"a",function(){return r});class r{constructor(t,e,i){this.linkUrl="",this.fbUrl="",this.lineUrl="",this.linkUrl=t||this.linkUrl,this.fbUrl=e||this.fbUrl,this.lineUrl=i||this.lineUrl}}},fh0P:function(t,e,i){"use strict";i.d(e,"a",function(){return U});var r=i("HDdC"),o=i("cp0P"),s=i("+nbM"),l=i("d1QB"),a=i("/z64"),n=i("IU/9");class d{constructor(t=null){this.usage=0,this.validity=180,this.aboId="",this.affCode=s.g.toLowerCase(),this.acctsubtype="Business Owner",this.data={},this.fullUrl="",this.partyId="",this.title="",this.type="",t&&(this.usage=t.usage?t.usage:this.usage,this.validity=t.validity?t.validity:this.validity,this.aboId=t.aboId?t.aboId:this.aboId,this.acctsubtype=t.acctsubtype?t.acctsubtype:this.acctsubtype,this.fullUrl=t.fullUrl?t.fullUrl:this.fullUrl,this.partyId=t.partyId?t.partyId:this.partyId,this.title=t.title?t.title:this.title,this.type=t.type?t.type:this.type,this.data=t.data?t.data:this.data)}}var h=i("fXoL"),c=i("XIVI"),p=i("1g50"),u=i("/XnW"),g=i("EP1h"),f=i("yydN");let U=(()=>{class t{constructor(t,e,i,r,o){this.apiConfigService=t,this.httpHandlerService=e,this.loggerService=i,this.localStorage=r,this.sessionStorage=o,this.generatedUrls=[]}getShopInfoFromSession(){return this.sessionStorage.getItem(a.q)||{}}getSkuIds(t){const e=[];return t.entries.forEach(t=>{e.push(t.code)}),e.join(",")}getDataJSON(t,e,i){const r=this.getShopInfoFromSession();let o={creatorShopUid:"",shopListUid:"",productIds:"",channel:""};return t&&t.uid?o={creatorShopUid:r&&r.shopUid?r.shopUid:"",shopListUid:t&&t.uid?t.uid:r&&r.shoplistUid?r.shoplistUid:"",productIds:this.getSkuIds(t),channel:"web"}:e&&e.pdpAliasCode?o={creatorShopUid:r&&r.shopUid?r.shopUid:"",productIds:e.pdpAliasCode,channel:"web"}:i&&i.shopUid&&(o={creatorShopUid:i&&i.shopUid?i.shopUid:"",shopListUid:"",productIds:"",channel:"web"}),o}getTinyUrl(t,e){return new r.a(i=>{const r=this.getSavedTinyUrl({shoplist:t,platform:e});if(r)i.next(r),i.complete();else{const r=this.apiConfigService.getAPIPath(l.V),o=this.localStorage.getItem(a.k),n=this.getDataJSON(t,null,null),h=this.createFullurl({shoplist:t,platform:e}),c=new d({aboId:null==o?void 0:o.aboid,partyId:null==o?void 0:o.partyId,data:JSON.stringify(n),fullUrl:h,title:t.name,type:s.S}),p=s.e.link===e?"Copy":e;this.httpHandlerService.callServerPOST(r,null,c).subscribe(t=>{const e=t&&t.data?t.data:"";e?(this.generatedUrls.push({fullUrl:c.fullUrl,tinyUrl:e,data:n,title:c.title}),this.loggerService.logInfo(p+" Share link : "+e),i.next(e)):(this.loggerService.logInfo(p+" Share link failed"),i.error()),i.complete()},t=>{this.loggerService.logInfo(p+" Share link failed"),i.error(t),i.complete()})}})}getTinyUrlFor3EProduct(t,e){return new r.a(i=>{const r=this.getSavedTinyUrl({product:t,platform:e});if(r)i.next(r),i.complete();else{const r=this.apiConfigService.getAPIPath(l.V),o=this.getShopInfoFromSession(),n=this.getDataJSON(null,t,null),h=this.localStorage.getItem(a.k),c=new d({aboId:null==h?void 0:h.aboid,partyId:null==h?void 0:h.partyId,data:JSON.stringify(n),fullUrl:`${window.location.origin}/mylist/${o.shopUid}/products/${t.pdpAliasCode}?utm_source=${e}&utm_medium=sharebar&utm_campaign=${s.o.toLowerCase()}_${s.o.toLowerCase()}_`+t.pdpAliasCode,title:t.pdpAliasCode,type:s.N}),p=s.e.link===e?"Copy":e;this.httpHandlerService.callServerPOST(r,null,c).subscribe(t=>{const e=t&&t.data?t.data:"";e?(this.generatedUrls.push({fullUrl:c.fullUrl,tinyUrl:e,data:n,title:c.title}),this.loggerService.logInfo(p+" Share link : "+e),i.next(e)):(this.loggerService.logInfo(p+" Share link failed"),i.error()),i.complete()},t=>{this.loggerService.logInfo(p+" Share link failed"),i.error(t),i.complete()})}})}decodeTinyUrl(t){return new r.a(e=>{const i=this.apiConfigService.getAPIPath(l.s);this.httpHandlerService.callServerPOST(i,null,{id:t}).subscribe(t=>{e.next(new d(t&&t.data?t.data:null)),e.complete()},t=>{e.error(t),e.complete()})})}getShareUrls(t,e,i){return new r.a(r=>{let l=[];l=i&&i.shopUid?[this.getTinyUrlForShop(i,s.e.link),this.getTinyUrlForShop(i,s.e.fb),this.getTinyUrlForShop(i,s.e.line)]:t&&t.pdpAliasCode?[this.getTinyUrlFor3EProduct(t,s.e.link),this.getTinyUrlFor3EProduct(t,s.e.fb),this.getTinyUrlFor3EProduct(t,s.e.line)]:[this.getTinyUrl(e,s.e.link),this.getTinyUrl(e,s.e.fb),this.getTinyUrl(e,s.e.line)],Object(o.a)(l).subscribe(t=>{if(t&&t.length>0){const[e,i,o]=t;r.next(new n.a(e,i,o)),r.complete()}},t=>{r.error(t),r.complete()})})}getTinyUrlForShop(t,e){return new r.a(i=>{const r=this.getSavedTinyUrl({platform:e,shopInf:t});if(r)i.next(r),i.complete();else{const r=this.apiConfigService.getAPIPath(l.V),o=this.getShopInfoFromSession(),n=this.getDataJSON(null,null,t),h=this.localStorage.getItem(a.k),c=new d({aboId:null==h?void 0:h.aboid,partyId:null==h?void 0:h.partyId,data:JSON.stringify(n),fullUrl:`${window.location.origin}/mylist/${o.shopUid}?utm_source=${e}&utm_medium=sharebar&utm_campaign=${s.o.toLowerCase()}_${s.o.toLowerCase()}`,title:t.shopName,type:s.T}),p=s.e.link===e?"Copy":e;this.httpHandlerService.callServerPOST(r,null,c).subscribe(t=>{const e=t&&t.data?t.data:"";e?(this.generatedUrls.push({fullUrl:c.fullUrl,tinyUrl:e,data:n,title:c.title}),this.loggerService.logInfo(p+" Share link : "+e),i.next(e)):(this.loggerService.logInfo(p+" Share link failed"),i.error()),i.complete()},t=>{this.loggerService.logInfo(p+" Share link failed"),i.error(t),i.complete()})}})}getSavedTinyUrl({shoplist:t,platform:e,product:i,shopInf:r}){const o=this.createFullurl({shoplist:t,platform:e,product:i,shopInf:r}),s=this.getDataJSON(t,i,r);let l="";l=r?r.shopName:t?t.name:i?i.pdpAliasCode:"";const a=this.generatedUrls.find(e=>{let i=e.fullUrl===o&&e.title===l;if(i=i&&e.data.creatorShopUid===s.creatorShopUid,i=i&&(!t||e.data.shopListUid===t.uid),e.data.productIds.length&&s.productIds.length){const t=s.productIds.split(",");i=i&&e.data.productIds.length===s.productIds.length&&!e.data.productIds.split(",").some(e=>-1===t.indexOf(e))}else i=i&&e.data.productIds.length===s.productIds.length;return i});return a?a.tinyUrl:""}createFullurl({shoplist:t,platform:e,product:i,shopInf:r}){let o="";const l=this.getShopInfoFromSession();return t?(o=`${window.location.origin}/mylist/${l.shopUid}/${t.uid}?utm_source=${e}&utm_medium=sharebar&utm_campaign=`,o+=encodeURI(`${s.o.toLowerCase()}_${s.o.toLowerCase()}_${l.shopName}_${t.name}`)):i?o=`${window.location.origin}/mylist/${l.shopUid}/products/${i.pdpAliasCode}?utm_source=${e}&utm_medium=sharebar&utm_campaign=${s.o.toLowerCase()}_${s.o.toLowerCase()}_`+i.pdpAliasCode:r&&(o=`${window.location.origin}/mylist/${r.shopUid}?utm_source=${e}&utm_medium=sharebar&utm_campaign=${s.o.toLowerCase()}_${s.o.toLowerCase()}`),o}}return t.\u0275fac=function(e){return new(e||t)(h.Xb(c.a),h.Xb(p.a),h.Xb(u.a),h.Xb(g.a),h.Xb(f.a))},t.\u0275prov=h.Jb({token:t,factory:t.\u0275fac,providedIn:"root"}),t})()},"mhU+":function(t,e,i){"use strict";i.r(e),i.d(e,"ShareRedirectModule",function(){return U});var r=i("sYmb"),o=i("PCNd"),s=i("tyNb"),l=i("DQpe"),a=i("/z64"),n=i("fXoL"),d=i("fh0P"),h=i("3Yxx"),c=i("/XnW"),p=i("yydN"),u=i("668k");const g=[{path:"",component:(()=>{class t{constructor(t,e,i,r,o,s){this.router=t,this.service=e,this.uiHelper=i,this.route=r,this.logger=o,this.sessionStorageService=s,this.tinyUrlKey="",this.loading=!1}ngOnInit(){const t=this.route.snapshot.paramMap.get("value");this.sessionStorageService.setItem(a.o,t),this.sessionStorageService.setSessionInfo(),this.fetchDecodedUrl(t)}fetchDecodedUrl(t){t&&(this.loading=!0,this.service.decodeTinyUrl(t).subscribe(e=>{if(this.loading=!1,e.fullUrl){this.logger.logInfo("ShareURL: "+t+", fullURL: "+e.fullUrl);let r="";try{r=decodeURI(e.fullUrl)}catch(i){r=e.fullUrl}let o=r.substring(r.indexOf("mylist/")+7);if(o){o=encodeURI(o),this.sessionStorageService.setItem(a.p,o);const t=this.uiHelper.parse(o);this.router.navigateByUrl(t)}else this.router.navigateByUrl(l.a.NO_CONTENT)}else this.logger.logInfo("ShareURL: "+t+", fullURL fetch failed."),this.router.navigateByUrl(l.a.NO_CONTENT)},t=>{this.loading=!1,this.router.navigateByUrl(l.a.NO_CONTENT)}))}}return t.\u0275fac=function(e){return new(e||t)(n.Nb(s.g),n.Nb(d.a),n.Nb(h.a),n.Nb(s.a),n.Nb(c.a),n.Nb(p.a))},t.\u0275cmp=n.Hb({type:t,selectors:[["app-share-redirect"]],decls:4,vars:1,consts:[[1,"amway-main-layout","step-creator"],[1,"amway-main-layout__content"],[1,"amway-shop-content-area"],[3,"visible"]],template:function(t,e){1&t&&(n.Tb(0,"div",0),n.Tb(1,"div",1),n.Tb(2,"div",2),n.Ob(3,"app-loader",3),n.Sb(),n.Sb(),n.Sb()),2&t&&(n.Ab(3),n.gc("visible",e.loading))},directives:[u.a],styles:[""]}),t})()}];let f=(()=>{class t{}return t.\u0275mod=n.Lb({type:t}),t.\u0275inj=n.Kb({factory:function(e){return new(e||t)},imports:[[s.i.forChild(g)],s.i]}),t})(),U=(()=>{class t{}return t.\u0275mod=n.Lb({type:t}),t.\u0275inj=n.Kb({factory:function(e){return new(e||t)},imports:[[f,r.b.forChild(),o.a]]}),t})()}}]);