@flarehr/apollo-benefits 2.12.621 → 2.12.623
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.
- package/dist/assets/{datadog-e67865e6.js → datadog-14bd14a9.js} +1 -1
- package/dist/assets/{date-fns-94f47ff1.js → date-fns-36105733.js} +1 -1
- package/dist/assets/{framer-motion-f7acb51f.js → framer-motion-2104a442.js} +1 -1
- package/dist/assets/{index-cc7f56ac.js → index-347b392e.js} +4 -4
- package/dist/assets/index-d1052240.js +5 -0
- package/dist/assets/vendor-7d57579b.js +788 -0
- package/dist/index.html +5 -5
- package/package.json +2 -2
- package/dist/assets/index-b8dbaa26.js +0 -5
- package/dist/assets/vendor-3e032e25.js +0 -805
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var ma=Object.defineProperty;var ua=(a,t,s)=>t in a?ma(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var o=(a,t,s)=>(ua(a,typeof t!="symbol"?t+"":t,s),s);import{Q as Pe,m as ha,s as pa,E as ga,n as fa,t as Nt,o as Ve,r as e,S as He,u as p,v as re,x as ie,z as ye,A as Ae,B as Pt,C as J,D as ba,H as K,I as k,J as A,K as S,O as U,L as ya,l as g,p as u,M as Xe,F as At,N as h,P as Le,X as Ct,R as va,U as te,W as ue,w as le,Y as wa,q as Fe,T as Ze,Z as v,$ as Z,a0 as je,a1 as xa,a2 as ka,a3 as Na,a4 as Pa,a5 as Aa,h as X,a6 as et,a7 as Ca,a8 as Sa,a9 as Ia,aa as ve,ab as St,ac as Ta,ad as It,ae as he,af as pe,ag as tt,ah as at,ai as La,aj as Tt,ak as Ea,al as $a,am as Oa,an as _a,j as Ua,ao as Ba,ap as Ra,aq as Lt,ar as Et,as as H,at as Ma,au as Va,av as Ha,aw as Fa,ax as ja,ay as za,az as Wa,aA as Da}from"./vendor-7d57579b.js";import{O as de}from"./oidc-client-6f6e47c2.js";import{f as Q,p as Ga,a as st}from"./date-fns-36105733.js";import{m as nt}from"./framer-motion-2104a442.js";import{i as qa}from"./datadog-14bd14a9.js";import"./lodash-5d893f8c.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();Pe.prototype.selectCached=function(a,t=s=>null){return this.selectHasCache().pipe(ha(0),pa(s=>s?ga:fa(a()).pipe(Nt(t))))};class N{static setParameters(t,s){this._apiBaseUrl=t,this._jwt=s}static get instance(){return Ve(this._apiBaseUrl).headers({Authorization:`Bearer ${this._jwt}`,"X-APP-VERSION":"2.12.623"})}}o(N,"_apiBaseUrl"),o(N,"_jwt");class Qa extends N{}class _e extends N{}class se{static setParameters(t,s,n){this._apiBaseUrl=t,this._jwt=s,this._profileId=n}static get instance(){return Ve(this._apiBaseUrl).headers({Authorization:`Bearer ${this._jwt}`,"X-PROFILE-ID":this._profileId,"X-APP-VERSION":"2.12.623"})}}o(se,"_apiBaseUrl"),o(se,"_jwt"),o(se,"_profileId");const Ka=({size:a})=>e("svg",{className:`animate-spin h-${a??5} w-${a??5}`,viewBox:"0 0 24 24",fill:"none",children:[e("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),Ce=()=>e("div",{className:"flex justify-center items-center h-screen text-primary",children:[e(Ka,{size:5}),e("div",{className:"pl-3 text-xl font-light text-primary",children:"Loading..."})]}),$t="/benefits/app/assets/logo-a34e9b4b.png",Ya=()=>e("div",{className:"flex flex-col justify-center items-center h-screen text-grey-900",children:[e("img",{className:"block h-8 w-auto",src:$t,alt:"Flare Benefits"}),e("h1",{className:"mt-8",children:"You have been successfully logged out of Flare Benefits"})]});var rt,it;const we=["money","mind","body","work","life"];var Ot=(a=>(a.WellbeingHub="wellbeing",a.FlareApp="flareMobileApp",a.SalaryPackagingCars="salaryPackagingCars",a))(Ot||{});const Ja=["default","pba"];function Xa(){return{user:p,config:p,navTab:"benefits",appView:"employee",redirectPath:p,mode:"default",shopifyUrl:p}}let Za=(rt=re({name:"benefits-app",resettable:!0,producerFn:ie}),rt(it=class extends He{constructor(){super(Xa())}})||it);const R=new Za;class es extends Pe{constructor(s){super(s);o(this,"signedInUser$",this.select(s=>s.user));o(this,"appConfig$",this.select(s=>s.config));o(this,"navPage$",this.select(s=>s.navTab));o(this,"appView$",this.select(s=>s.appView));o(this,"signedInUserRole$",this.select(s=>ye.pipe(s.user,Ae(()=>"user",n=>n.benefitsProfile.role))));this.store=s}}const F=new es(R);function C(a,t){return Pt(a,ba(()=>t))}function G(a){return C(a,null)}function Ue(a,t="Option value is none."){if(J(a))throw new Error(t);return a.value}function lt(a,t){return Pt(a,Ae(()=>t===null,s=>s===t))}const ts=()=>{const a=async()=>{const n=await Ve(`${window.location.origin}/benefits/app/config.json`).get().json();R.update({config:K(n)})},t=()=>Ue(F.getValue().config);return{fetchConfigAsync:a,getConfig:t,getPublicBackendUrl:()=>t().apiBaseUrl.replace("backend","public")}},T=ts();function xe(a,t){const s=new URLSearchParams(t);return k(s.get(a))}function Ee(a,t){const s=new URLSearchParams(t.replace(/^#+/,""));return k(s.get(a))}const Be=a=>{if(a!=null&&a.startsWith(T.getConfig().apiGatewayBaseUrl+"/benefits/app/#"))return a.split("#")[1]},as=()=>{const a="redirectPath",t="mode",s=r=>{R.update({redirectPath:r})},n=r=>{R.update({mode:r})};return{extractRedirectPath:()=>{const r=xe(a,window.location.search);A(r)&&s(r)},extractMode(){const r=xe(t,window.location.search);A(r)&&Ja.includes(r.value)&&n(r.value)},redirectToPathIfExists(){const r=F.getValue().redirectPath;A(r)&&(s(p),S(r.value))}}},Re=as();class _t{constructor(t){o(this,"_value",p);this.factory=t}get value(){if(A(this._value))return this._value.value;const t=this.factory();return this._value=K(t),t}}var ct,ot,P=(a=>(a[a.Unauthorized=0]="Unauthorized",a[a.SignInPending=1]="SignInPending",a[a.Authenticated=2]="Authenticated",a[a.SignOutPending=3]="SignOutPending",a[a.Error=4]="Error",a))(P||{});function ss(){return{authStatus:0,jwt:p}}let ns=(ct=re({name:"authentication",resettable:!0,producerFn:ie}),ct(ot=class extends He{constructor(){super(ss())}})||ot);const D=new ns;var ge=(a=>(a.SignIn="callback",a.SignOut="logout",a.SilentRefresh="silent-refresh",a))(ge||{});class rs{constructor(){o(this,"userManager");o(this,"tokenQueryParameter","token");o(this,"b2cJwtQueryParameter","b2cJwt");o(this,"profileIdQueryParameter","profileId");o(this,"getHostOidcUrl",()=>`${window.location.origin}/benefits/app/#/oidc`);this.userManager=new _t(()=>{const t=new de.UserManager(this.userManagerSettings());return t.events.addAccessTokenExpired(()=>this.signOutRedirectAsync()),t.events.addUserLoaded(this.sessionUpdatedHandler),this.configureLogging(),t})}async refreshIfExpired(){const t=await this.userManager.value.getUser();t!=null&&t.expired&&this.userManager.value.signinSilent()}tokenExists(t){const s=xe(this.tokenQueryParameter,t);return U.isSome(s)}b2cJwtExists(t){const s=Ee(this.b2cJwtQueryParameter,t);return U.isSome(s)}isOidcRoute(t){return t.includes("callback")||t.includes("logout")||t.includes("silent-refresh")}async initFromB2cJwt(t,s){const n=Ue(Ee(this.b2cJwtQueryParameter,s),`"${this.b2cJwtQueryParameter}" fragment is required`),r=Ue(Ee(this.profileIdQueryParameter,s),`"${this.profileIdQueryParameter}" fragment is required`);se.setParameters(T.getConfig().workplaceBackendUrl,n,r);const i=await se.instance.url("token").get().json();window.location.href=t+"?token="+i.token}async initFromToken(t,s){if(this.isOidcRoute(t))return;const n=xe(this.tokenQueryParameter,s);if(U.isNone(n))throw D.update({authStatus:P.Error}),Error(`"${this.tokenQueryParameter}" URL query parameter is required`);await this.signInRedirectAsync(n)}signOutRedirectAsync(){return D.update({authStatus:P.SignOutPending}),this.userManager.value.signoutRedirect()}async signInRedirectCallbackAsync(){await this.userManager.value.signinRedirectCallback(window.location.href.replace("/oidc/callback?","")),D.update({authStatus:P.Authenticated})}async signOutRedirectCallbackAsync(){await this.userManager.value.signoutRedirectCallback(),ya()}async silentRefreshCallbackAsync(){await this.userManager.value.signinSilentCallback()}async signOut(){return D.update({authStatus:P.Unauthorized,jwt:U.none})}async signInRedirectAsync(t){D.update({authStatus:P.SignInPending}),await this.userManager.value.signinRedirect({extraQueryParams:{irt:t.value}})}sessionUpdatedHandler(t){D.update({jwt:U.fromNullable(t.access_token)})}userManagerSettings(){return{authority:T.getConfig().oidcAuthority,client_id:"apollo-benefits-ui",redirect_uri:`${this.getHostOidcUrl()}/callback?`,response_type:"id_token token",scope:"openid",post_logout_redirect_uri:`${this.getHostOidcUrl()}/logout?`,silent_redirect_uri:`${this.getHostOidcUrl()}/silent-refresh?`,automaticSilentRenew:!0,accessTokenExpiringNotificationTime:10,filterProtocolClaims:!0,loadUserInfo:!0,clockSkew:2592e3}}configureLogging(){de.Log.logger=console,de.Log.level=de.Log.DEBUG}}const L=new rs,is=({mode:a})=>{const[t,s]=g(!1);return u(()=>{(async()=>{switch(a){case ge.SignIn:await L.signInRedirectCallbackAsync(),window.location.hash="#",S("/"),Re.redirectToPathIfExists();break;case ge.SignOut:await L.signOutRedirectCallbackAsync(),s(!0);break;case ge.SilentRefresh:await L.silentRefreshCallbackAsync();break}})()},[]),t?e(Ya,{}):e(Ce,{})},ls=({fragment:a})=>(u(()=>{(async()=>await L.initFromB2cJwt(window.location.pathname,a))()},[]),e(Ce,{}));class cs extends Pe{constructor(s){super(s);o(this,"authState$",this.select());this.store=s}get isUnauthorized(){return this.getValue().authStatus===P.Unauthorized||this.getValue().authStatus===P.Error}get isAuthorized(){return this.getValue().authStatus===P.Authenticated}get jwt(){const s=this.getValue().jwt;return A(s)?s.value:""}}const Ut=new cs(D),os="/benefits/app/assets/external_link-599a0aec.svg";class ds{async getBenefitsAsync(){return N.instance.url("benefits").get().json()}async postDocumentAsync(t){return N.instance.url("document").addon(Xe).formData(t).post().badRequest(s=>{throw new Error(s.message)}).json()}async postImageAsync(t){return N.instance.url("image").addon(Xe).formData(t).post().badRequest(s=>{throw new Error(s.message)}).json()}async getShopifyUrl(){return N.instance.url("shopify-url").get().json()}}const Bt=new ds;class ms{async setShopifyUrl(){const t=await this.fetchShopifyUrl();R.update({shopifyUrl:t})}getShopifyUrl(){return F.getValue().shopifyUrl}async fetchShopifyUrl(){return k((await Bt.getShopifyUrl()).redirectUrl)}}const Se=new ms;class us{async postTrackEventAsync(t){return N.instance.url("benefits/track-event").post(t).res()}}const hs=new us;class ps{async trackAppLoadedAsync(){return this.trackEventAsync("appLoaded")}async trackBenefitsOpenedAsync(){return this.trackEventAsync("benefitsOpened")}async trackAppOfferViewedAsync(){return this.trackEventAsync("appOfferViewed")}async trackAppOfferAcceptedAsync(){return this.trackEventAsync("appOfferAccepted")}async trackWellbeingOpenedAsync(){return this.trackEventAsync("wellbeingOpened")}async trackAdminOpenedAsync(){return this.trackEventAsync("adminOpened")}async trackMarketplaceOfferViewedAsync(t,s,n){const r={offer:t,experiment:s,treatment:n};return this.trackEventAsync({marketplaceOfferViewed:r})}async trackMarketplaceOfferAcceptedAsync(t,s,n){const r={offer:t,experiment:s,treatment:n};return this.trackEventAsync({marketplaceOfferAccepted:r})}async trackPerksListViewedAsync(t){const s={pillar:t};return this.trackEventAsync({perksListViewed:s})}async trackEntriesListViewedAsync(t){const s={pillar:t};return this.trackEventAsync({entriesListViewed:s})}async trackFeaturePerkViewedAsync({benefitId:t,benefit:s}){const n={perkId:t,perkPillar:s.category,perkTitle:s.title,placement:"feature"};return this.trackEventAsync({perkViewed:n})}async trackExplorePerkViewedAsync({benefitId:t,benefit:s}){const n={perkId:t,perkPillar:s.category,perkTitle:s.title,placement:"explore"};return this.trackEventAsync({perkViewed:n})}async trackDocumentClickedAsync({benefitId:t,benefit:s}){const n={perkId:t,perkPillar:s.category,perkTitle:s.title,type:"document"};return this.trackEventAsync({attachmentOpened:n})}async trackPerkVisitedAsync({benefitId:t,benefit:s}){const n={perkId:t,perkPillar:s.category,perkTitle:s.title};return this.trackEventAsync({perkVisited:n})}async trackPerksListSearched(t){const s={query:t};return this.trackEventAsync({perksListSearched:s})}async trackRoleAssignedAsync(t){return this.trackEventAsync({roleAssigned:t})}async trackEntryViewed(t){return this.trackEventAsync({entryViewed:t})}async trackEntriesListSearchedAsync(t){const s={query:t};return this.trackEventAsync({entriesListSearched:s})}async trackCategoryOpenedAsync(t){if(t){const s={categoryId:t};return this.trackEventAsync({categoryOpened:s})}}async trackCategoryClosedAsync(t,s){if(t){const n={categoryId:t,screen:s};return this.trackEventAsync({categoryClosed:n})}}async trackDiscountsOpenedAsync(t){const s={categoryId:t};return this.trackEventAsync({discountsOpened:s})}async trackActivityStartedAsync(t){if(t){const s={categoryId:t};return this.trackEventAsync({activityStarted:s})}}async trackActivityCompletedAsync(t){const s={categoryId:t};return this.trackEventAsync({activityCompleted:s})}async trackBenefitsPlanViewedAsync(t){const s={categories:t};return this.trackEventAsync({benefitsPlanViewed:s})}async trackEventAsync(t){try{await hs.postTrackEventAsync({event:t})}catch{return}}}const b=new ps;function $(...a){return a.filter(Boolean).join(" ")}const gs=a=>`${a[0].toUpperCase()}${a.slice(1)}`,dt=({user:{featureFlags:a}})=>{const[t,s]=g(p),n=At(()=>{const r=new Map([["benefits","/"]]);return a.wellbeing&&r.set("wellbeing","/wellbeing-hub"),Array.from(r)},[]);return u(()=>{const r=[F.navPage$.subscribe(i=>{s(k(i))})];return()=>{r.map(i=>i.unsubscribe())}},[]),e("nav",{className:"-mb-px flex","aria-label":"Tabs",children:[n.map(([r,i])=>e("div",{onClick:async()=>{s(k(r)),S(i)},className:$(lt(t,r)?"border-primary text-primary":"border-transparent text-gray-500","cursor-pointer hover:text-gray-700 hover:border-gray-300 px-4 md:ml-4 flex-grow md:flex-grow-0","py-4 text-center border-b-4 text-base leading-6 font-semibold cursor-pointer capitalize"),"aria-current":lt(t,r)?"page":void 0,children:e("span",{children:r})},r)),e("div",{className:"border-transparent text-gray-500 cursor-pointer hover:text-gray-700 hover:border-gray-300 px-4 md:ml-4 flex-grow md:flex-grow-0 py-4 text-center border-b-4 text-base leading-6 font-semibold cursor-pointer capitalize",children:e("a",{className:"inline-flex",href:C(Se.getShopifyUrl(),"#"),target:"_blank",rel:"noreferrer",onClick:()=>{b.trackDiscountsOpenedAsync("discounts")},children:[e("span",{children:"discounts"}),e("img",{className:"ml-2",src:os})]})})]})},fs=()=>{const[a,t]=g("employee");return u(()=>{const s=[F.appView$.subscribe(t)];return()=>{s.map(n=>n.unsubscribe())}},[]),e("span",{className:"relative z-0 inline-flex shadow-sm rounded-md",children:[e("button",{type:"button",className:$(a==="admin"?"text-primary bg-white cursor-default":"text-gray-700 bg-gray-50","relative inline-flex items-center px-4 py-1 rounded-l-md border border-gray-300 text-sm font-medium hover:bg-white focus:z-10 focus:outline-none"),onClick:()=>{a!=="admin"&&S("/admin")},children:"Admin view"}),e("button",{type:"button",className:$(a==="employee"?"text-primary bg-white cursor-default":"text-gray-700 bg-gray-50","-ml-px relative inline-flex items-center px-4 py-1 rounded-r-md border border-gray-300 text-sm font-medium hover:bg-white focus:z-10 focus:outline-none"),onClick:()=>{a!=="employee"&&S("/")},children:"Employee view"})]})},bs=[{name:"Admin view",href:"#/admin"},{name:"Employee view",href:"#/"}],Rt=()=>e("span",{className:"inline-block h-8 w-8 rounded-full overflow-hidden bg-white border",children:e("svg",{className:"h-full w-full text-gray-300",fill:"currentColor",viewBox:"0 0 24 24",children:e("path",{d:"M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z"})})}),ys=({user:a})=>e(h,{children:e(te,{as:"div","data-dd-action-name":"User menu",className:"z-30 relative inline-block text-left",children:({open:t})=>e(h,{children:[e("div",{children:e(te.Button,{className:`max-w-xs bg-white flex items-center text-sm rounded-full hover:outline-none hover:ring-2 hover:ring-offset-2 hover:ring-primary ${t?"outline-none ring-2 ring-offset-2 ring-primary":""} `,children:e(Rt,{})})}),e(ue,{enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:e(te.Items,{className:"absolute right-0 mt-2 w-56 divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",children:e("div",{className:"px-1 py-1 ",children:[e(te.Item,{children:()=>e("div",{className:"mx-3 py-2",children:[e("div",{className:"text-base font-medium text-gray-800 dd-privacy-mask",children:a.basicProfile.firstName}),e("div",{className:"text-sm font-medium text-gray-500 dd-privacy-mask",children:a.basicProfile.email})]})}),e("div",{className:"border-t border-grey-900",children:e(te.Item,{children:({active:s})=>e("button",{onClick:()=>L.signOutRedirectAsync(),className:`${s?"bg-secondary text-primary rounded-md":"text-gray-900 "} group flex w-full items-center mt-2 mb-1 px-3 py-2 text-sm font-medium`,children:"Logout"})})})]})})})]})})}),ze=a=>{const t=a.user;if(J(t))return e(h,{});const[s,n]=g(!1),r=t.value.benefitsProfile.role!=="user";return u(()=>{const i=[F.appView$.subscribe(l=>{n(l==="employee")})];return()=>{i.map(l=>l.unsubscribe())}},[]),e(h,{children:e(Le,{as:"nav",className:"bg-gray-50 border-0 md:border-b md:border-gray-200",children:({open:i})=>e(h,{children:[e("div",{className:`mx-auto px-4 sm:px-6 lg:px-8 border-b border-gray-200 md:border-none ${r&&!s?"":"max-w-[90rem]"}`,children:e("div",{className:"flex justify-between h-16",children:[e("div",{className:"flex",children:e("a",{href:"#",onClick:()=>S("/"),className:"flex-shrink-0 flex items-center",children:e("img",{className:"block h-8 w-auto",src:$t,alt:"Flare Benefits"})})}),e("div",{className:"ml-10 flex flex-wrap flex-grow content-end",children:e("div",{className:"hidden sm:block",children:s&&e(dt,{user:t.value})})}),e("div",{className:"flex flex-wrap content-center",children:e("div",{className:"hidden md:block",children:r&&e(fs,{})})}),e("div",{className:"hidden md:ml-6 md:flex md:items-center",children:e(ys,{user:t.value})}),e("div",{className:"-mr-2 flex items-center md:hidden",children:e(Le.Button,{className:"bg-white inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary",children:[e("span",{className:"sr-only",children:"Open main menu"}),i?e(Ct,{className:"block h-6 w-6","aria-hidden":"true"}):e(va,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),e(Le.Panel,{className:"md:hidden",children:e("div",{className:"pt-4 pb-3 border-b border-gray-200",children:[e("div",{className:"flex items-center px-4",children:[e("div",{className:"flex-shrink-0",children:e(Rt,{})}),e("div",{className:"ml-3",children:[e("div",{className:"text-base font-medium text-gray-800 dd-privacy-mask",children:t.value.basicProfile.firstName}),e("div",{className:"text-sm font-medium text-gray-500 dd-privacy-mask",children:t.value.basicProfile.email})]})]}),e("div",{className:"mt-3 space-y-1",children:[r&&e(h,{children:bs.map(l=>e("a",{href:l.href,className:"block px-4 py-2 text-base font-medium text-gray-500 hover:text-primary hover:bg-secondary",children:l.name},l.name))}),e("a",{onClick:()=>L.signOutRedirectAsync(),className:"block cursor-pointer px-4 py-2 text-base font-medium text-gray-500 hover:text-primary hover:bg-secondary",children:"Logout"})]})]})}),s&&e("div",{className:"sm:hidden bg-white border-b border-gray-200",children:e(dt,{user:t.value})})]})})})};class vs{async getUserProfile(){return await N.instance.url("users/self").get().json()}async getBasicProfileByEmail(t){const s=await N.instance.url(`users?email=${t}`).get().notFound(()=>null).json();return k(s)}}const ws=new vs;class xs{constructor(){o(this,"basicProfile");o(this,"benefitsProfile");o(this,"featureFlags");o(this,"account")}static toDomain(t){return{basicProfile:t.basicProfile,benefitsProfile:t.benefitsProfile,featureFlags:t.featureFlags,accountName:t.account?t.account.name+(t.account.legalEntityName?" - "+t.account.legalEntityName:""):void 0}}}const q=class q{static get profileId(){if(J(this._profileId))throw Error("ProfileId is missing.");return this._profileId.value}static set profileId(t){this._profileId=k(t)}static set accountId(t){this._accountId=k(t)}static get profileIdOrDefault(){return C(this._profileId,"")}static get accountIdOrDefault(){return C(this._accountId,"")}static get partnerIdOrDefault(){return C(this._partnerId,"")}extractProfileId(t){const s=k(wa(t).sub);if(J(s))throw Error("profileId property is missing.");q.profileId=s.value}async loadSignedInUserProfileAsync(){const t=xs.toDomain(await ws.getUserProfile());q.accountId=t.basicProfile.accountId,R.update(s=>{s.user=k(t)})}};o(q,"_profileId",p),o(q,"_accountId",p),o(q,"_partnerId",p);let Me=q;const ee=le.createContext(p),Mt=le.createContext(!1),mt=new Me,ks=()=>{const a=Fe(ee),t=At(()=>G(a),[a]),s=Ze(r=>{if(!t)return!1;const{featureFlags:i}=t;return i[r]},[t]),n=Ze(()=>t?t.featureFlags:{},[t]);return{getTreatment:s,getAllTreatments:n}},Ns=()=>{const t=window.setInterval(async()=>{Se.setShopifyUrl()},12e4);return k(t)},Ps=()=>{u(()=>{let a=p;return(async()=>(await Se.setShopifyUrl(),a=Ns()))(),()=>{A(a)&&window.clearInterval(a.value)}},[])},As=()=>{const a=()=>F.getValue().mode;return{isDefault:()=>a()==="default",isPba:()=>a()==="pba"}},Vt=As(),Cs="/benefits/app/assets/workplace_link_banner-63babe3b.png",Ht=({bgImageUrl:a,className:t,children:s,excludeGradient:n})=>{const r=a?{backgroundImage:`url(${a})`}:{};return e("div",{className:$("relative w-full rounded-lg bg-cover bg-center",t??""),style:r,children:[!n&&e(h,{children:[e("div",{className:"absolute inset-0 rounded-lg bg-black bg-opacity-10"}),e("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-r from-black opacity-80"})]}),e("div",{className:"relative h-full rounded-lg overflow-hidden",children:s})]})},Ss=()=>(u(()=>{b.trackAppOfferViewedAsync()},[]),e(h,{children:e("div",{className:"flex flex-col md:flex-row",children:e(Ht,{excludeGradient:!0,className:"w-full bg-gray-50 text-gray-900 border-grey-100 border",children:e("div",{className:"md:flex md:flex-row w-full md:w-2/4 lg:w-4/5 xl:w-full pl-6 pr-8 md:pr-0 pt-0 md:pt-8",children:[e("div",{className:"flex flex-col pb-8 md:mr-8",children:[e("div",{className:"text-2xl leading-8 lg:text-3xl xl:text-4xl lg:leading-10 font-extrabold pt-4",children:"Workplace benefits in your pocket!"}),e("div",{className:"text-md md:text-lg leading-6 mt-2 font-medium max-w-lg",children:"Download the Flare app for easy access to your workplace benefits and much more."}),e("div",{className:"pt-5",children:e("a",{className:"uiid-browse-discounts-button",target:"_blank",children:e("button",{type:"button",className:"block w-full mx-auto md:w-auto text-center md:inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm leading-6 font-semibold rounded-md text-white bg-primary",onClick:()=>S("/workplace-link"),children:"Get Flare App"})})})]}),e("div",{className:"hidden md:block w-1/2 sm:w-1/4 lg:w-1/5",children:e("img",{className:"absolute object-contain object-bottom md:-bottom-0 lg:bottom-0 xl:-bottom-10 -right-[5%] lg:-right-[3%] xl:right-0 w-2/3 lg:w-1/2",src:Cs})})]})})})}));const Is=({children:a,className:t})=>e("div",{className:"gradient-tile "+t,children:a}),Ts=({title:a,subtitle:t,externalUrl:s,icon:n,onClick:r})=>e("a",{className:"w-full cursor-pointer",href:s,target:s&&"_blank"||void 0,onClick:r,children:e(Is,{className:"pl-6 pr-4 py-4 md:w-48 md:h-48 md:px-4 md:py-6 bg-white bg-opacity-50 hover:bg-opacity-100 shadow hover:shadow-lg border-2 rounded-md flex md:flex-col md:justify-items-center md:items-center",children:[e("div",{className:"flex justify-start item-center self-center",children:n}),e("div",{className:"ml-6 md:ml-0 md:text-center md:mt-auto",children:[e("div",{className:"text-blue-600 text-l md:text-xl font-bold leading-7",children:a}),e("div",{className:"text-gray-900 text-base font-medium leading-normal",children:t})]})]})}),Ls={renderText:a=>a.split(`
|
|
2
|
+
`).flatMap((t,s)=>[s>0&&e("br",{}),t]),renderNode:{[v.BLOCKS.PARAGRAPH]:(a,t)=>e("p",{className:"relative text-gray-500 text-sm font-normal leading-5",children:t}),[v.INLINES.HYPERLINK]:(a,t)=>e("a",{className:"text-blue-600",href:a.data.uri,target:"_blank",rel:"noopener noreferrer",children:t})}},Es=({body:a})=>e(h,{children:Z.documentToReactComponents(a,Ls)}),y=({height:a,width:t,className:s})=>e("div",{className:s,children:e("div",{className:"flex animate-pulse flex-row h-full",children:e("div",{style:{width:`${t?`${t}rem`:"100%"}`,height:`${a}rem`},className:"bg-gray-300 rounded"})})}),$s=()=>e(h,{children:[e(y,{className:"mb-1 md:mb-2",width:20,height:4}),e(y,{className:"mb-5 md:mb-10",width:40,height:2}),e("div",{className:"flex flex-col md:flex-row gap-3 md:gap-8 flex-wrap",children:[e(y,{className:"hidden md:block",width:12,height:12}),e(y,{className:"md:hidden block",height:6}),e(y,{className:"hidden md:block",width:12,height:12}),e(y,{className:"md:hidden block",height:6}),e(y,{className:"hidden md:block",width:12,height:12}),e(y,{className:"md:hidden block",height:6}),e(y,{className:"hidden md:block",width:12,height:12}),e(y,{className:"md:hidden block",height:6}),e(y,{className:"hidden md:block",width:12,height:12}),e(y,{className:"md:hidden block",height:6}),e(y,{className:"hidden md:block",width:12,height:12}),e(y,{className:"md:hidden block",height:6})]})]}),Os=({categories:a,content:t})=>(u(()=>{a&&a.length>0&&(async()=>b.trackBenefitsPlanViewedAsync(a.map(s=>s.trackingId)))()},[a]),e("div",{className:"relative",children:[e("div",{className:"bg-[linear-gradient(0deg,_#2E66F7_0%,_#0005D2_100%)] absolute w-full h-full blur-[250px] opacity-10"}),a&&(t!=null&&t.title)?e(h,{children:[e("div",{className:"text-gray-700 text-2xl md:text-4xl font-bold md:font-extrabold leading-loose md:leading-10 mb-1 md:mb-2",children:t.title}),t.subtitle&&e("div",{className:"text-black text-base md:text-2xl font-normal leading-normal md:leading-loose mb-5 md:mb-10",children:t.subtitle}),e("div",{className:"flex flex-col md:flex-row gap-3 md:gap-8 flex-wrap mb-6",children:a==null?void 0:a.map(s=>{var n;return e("div",{className:"category-container flex md:flex-col",children:e(Ts,{externalUrl:(n=s.landing)!=null&&n.component?"":s.externalUrl,title:s.displayTitle||s.title,subtitle:s.subtitle,icon:e("img",{src:s.iconUrl,className:"w-10 h-10 md:w-16 md:h-16"}),onClick:()=>S("/categories/"+s.title.toLocaleLowerCase())},s.trackingId)})})}),t.disclaimer&&e(Es,{body:t.disclaimer})]}):e($s,{})]})),_s="/benefits/app/assets/all_tab_color-548783b9.svg",Us="/benefits/app/assets/all_tab_gray-a5051313.svg",Ft={money:"text-blue-400",mind:"text-green-400",body:"text-red-400",work:"text-orange-400",life:"text-yellow-400"},ut=["all",...we],Bs=({children:a})=>e("nav",{className:"flex p-2 space-x-8 bg-gray-50","aria-label":"Tabs",children:a}),Rs=a=>{const{children:t,onClick:s,className:n,selected:r}=a;return e("div",{onClick:s,className:$(n??"",r?"bg-white shadow-md text-gray-800":"text-gray-600 hover:bg-gray-100","w-full py-2 capitalize text-base leading-6 font-semibold rounded-lg focus:outline-none","cursor-pointer flex items-center justify-center"),"aria-current":r?"page":void 0,children:t})},Ms=({currentTab:a,tabNameList:t,onTabClicked:s})=>e(h,{children:[e("label",{htmlFor:"tabs",className:"sr-only",children:"Select a tab"}),e("select",{id:"tabs",name:"tabs",className:"block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm rounded-md",value:a,onChange:n=>{const r=n.currentTarget.value;s(r)},children:t.map(n=>e("option",{value:n,children:gs(n)}))})]}),Vs={money:xa.faUsdSquare,mind:ka.faSpa,body:Na.faHeartbeat,work:Pa.faBriefcase,life:Aa.faUmbrellaBeach},jt=(a,t)=>e(je,{size:t??"lg",icon:Vs[a]}),zt=({currentTab:a,onTabClicked:t})=>{const s=l=>jt(l,"1x"),n=l=>e("div",{className:Ft[l],children:s(l)}),r={all:e("img",{className:"h-3.5 w-3.5",src:Us,alt:""}),...Object.fromEntries(we.map(l=>[l,s(l)]))},i={all:e("img",{className:"h-3.5 w-3.5",src:_s,alt:""}),...Object.fromEntries(we.map(l=>[l,n(l)]))};return e(h,{children:[e("div",{className:"sm:hidden",children:e(Ms,{currentTab:a,onTabClicked:l=>t(l),tabNameList:[...ut]})}),e("div",{className:"hidden sm:block",children:e(Bs,{children:ut.map(l=>e(Rs,{onClick:()=>{t(l)},selected:a===l,className:"uiid-explore-perks-tabs",children:[a===l?i[l]:r[l],e("span",{className:"uiid-explore-tab-name ml-3",children:l})]},l))})})]})},Wt=({onSearchEvent:a})=>{const t=X(null),s=X(null),[n,r]=g(!1);return u(()=>{const i=[t.current&&et(t.current,"input").pipe(Ca("target","value"),Nt(l=>{r(!!l)}),Sa(500)).subscribe(async l=>{a(l)}),s.current&&et(s.current,"click").subscribe(()=>{t.current.value="",r(!1),a("")})];return()=>{i.map(l=>l==null?void 0:l.unsubscribe())}},[]),e("div",{className:"flex relative rounded-md shadow-sm",children:[e("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none","aria-hidden":"true",children:e(Ia,{className:"mr-3 h-4 w-4 text-gray-400","aria-hidden":"true"})}),e("input",{type:"text",name:"search",id:"search",ref:t,placeholder:"Search perks",className:"uiid-search-bar-input block w-full pl-9 rounded-none rounded-md sm:text-sm border-gray-300"}),e("div",{className:$(n?"":"hidden","absolute inset-y-0 right-0 pr-3 flex items-center z-10 cursor-pointer"),ref:s,children:e(ve,{className:"h-5 w-5 text-gray-400 ","aria-hidden":"true"})})]})};var ht,pt;const Hs=()=>({all:[],money:[],mind:[],body:[],work:[],life:[]}),Fs=()=>({perksTab:"all",searchString:""});let js=(ht=re({name:"explore-perks",cache:{ttl:"3600000"},idKey:"benefitId",resettable:!0,producerFn:ie}),ht(pt=class extends St{constructor(){super(Fs())}})||pt);const ne=new js,zs=()=>({setTab:a=>{ne.update(t=>{t.perksTab=a})},searchPerks:a=>{ne.update(t=>{t.searchString=a,t.perksTab="all"})}}),$e=zs(),Dt=({children:a,className:t})=>e("div",{className:$(t??"","grid items-stretch sm:grid-cols-2 lg:grid-cols-3 gap-8"),children:a}),Gt=({children:a})=>e("div",{className:"uiid-preview-empty flex items-center justify-center sm:col-span-2 lg:col-span-3 justify-items-center content-center bg-gray-100 rounded-lg overflow-hidden h-72",children:e("div",{className:"text-xl font-medium text-gray-400 text-center",children:a})}),Ws="/benefits-plan/backend/v1.0/categories",Ds=(a,t)=>`/benefits-plan/backend/v1.0/categories/${a}/products/${t}`;class Gs{async getCategoriesAsync(){return _e.instance.url(Ws).get().json()}async getProductActivitesAsync(t,s){const n=Ds(t,s);return _e.instance.url(n).get().json()}}const gt=new Gs,We=async(a,t)=>{const[s]=await Promise.all([a,new Promise(n=>window.setTimeout(n,t))]);return s};class qs{constructor(){o(this,"client",new _t(()=>{const t=T.getConfig();return Ta({space:t.contentfulSpace,environment:t.contentfulEnvironment,accessToken:t.contentfulApiKey})}))}async loadCollectionsAsync(){return(await this.client.value.getEntries({content_type:"benefitsCollection"})).items.map(s=>{var r,i,l,d,m;const{fields:n}=s;return{id:s.sys.id,title:n.title,description:n.description,coverPhotoUrl:((l=(i=(r=n.coverPhoto)==null?void 0:r.fields)==null?void 0:i.file)==null?void 0:l.url)??"",pillar:((d=n.pillar)==null?void 0:d.toLowerCase())??"money",articles:((m=n.contentLibrary)==null?void 0:m.map(f=>({id:f.sys.id,title:f.fields.title,subtitle:f.fields.subtitle,coverPhotoUrl:f.fields.coverPhoto.fields.file.url,pillar:f.fields.pillar.toLowerCase(),primaryContentType:f.fields.primaryContentType.toLowerCase(),slug:"",externalLink:""})))??[],state:"visible"}})}async loadAvailableEntryPreviewsAsync(){return(await this.client.value.getEntries({"sys.contentType.sys.id[in]":"benefitsWellbeingArticle,benefitsExternalLink",select:"sys.id,fields"})).items.map(s=>{const{fields:n}=s;return{id:s.sys.id,title:n.title,subtitle:n.subtitle,coverPhotoUrl:n.coverPhoto.fields.file.url,pillar:n.pillar.toLowerCase(),primaryContentType:n.primaryContentType.toLowerCase(),slug:n.slug,externalLink:n.externalLink}})}async loadArticleAsync(t){const s=await this.client.value.getEntries({content_type:"benefitsWellbeingArticle",limit:1,include:10,"fields.slug":t});if(s.items.length===0)throw Error("Couldn't find this article");return s.items[0].fields}async loadBenefitsPlanCategoryAsync(){return(await this.client.value.getEntries({content_type:"benefitsPlanCategory"})).items.map(s=>s.fields)}async loadBenefitsPlanWebHomeAsync(){const t=await this.client.value.getEntries({content_type:"benefitsBenefitsPlanWeb",limit:1,"fields.slug":"home"});if(t.items.length===0)throw Error("Couldn't find benefits plan home.");return t.items[0].fields}async loadActivityAdvertisementAsync(t){return(await this.client.value.getEntry(t)).fields.webBenefitsContent.fields}}const ce=new qs,Qs=["Start","Get Estimate","View","Ineligible"],Ks=async()=>We(ce.loadBenefitsPlanCategoryAsync(),700),Ys=async()=>We(ce.loadBenefitsPlanWebHomeAsync(),700),Js=a=>{switch(a.component){case"cars-calculator-ungated":return"cars-calculator-ungated";case"cars-calculator-gated":return"cars-calculator-gated";case"typeform":return a.typeformId?"typeform":"none";case"shopify":return"shopify";case"external-link":return"external-link";case"activity-advertisement":return"activity-advertisement";default:return"none"}},qt=(a,t,s)=>{var l;const n=Js(t),r=n!="none"?{modalBody:t.landingModal,disclaimer:t.landingDisclaimer,heroImageDesktop:t.heroImageDesktop,heroImageMobile:t.heroImageMobile,buttonText:t.landingButtonText,component:n,typeformId:t.typeformId,activities:{advertisements:s.map(d=>qt(a,d,[]))}}:void 0,i=((l=t.link)==null?void 0:l.replace(/\s+/g,""))||void 0;return{id:"",title:t.title,displayTitle:t.displayTitle,trackingId:t.trackingId,subtitle:t.subtitle,iconUrl:a.iconUrl,tileImage:t.tileImage,externalUrl:i,order:t.positionInList,landing:r}},Xs=async()=>{try{const a=await gt.getCategoriesAsync(),t=await Ks();return(await Promise.all(a.categories.filter(n=>t.find(i=>i.title.toLowerCase()===n.title.toLowerCase())&&Qs.includes(n.status)).map(async n=>{try{const r=t.find(d=>d.title.toLowerCase()===n.title.toLowerCase()),i=r.component.startsWith("activity")&&n.products.length>0?await gt.getProductActivitesAsync(n.id,n.products[0].id):{activities:[]},l=await Promise.all(i.activities.filter(d=>d.activityType==="Advertisement").map((d,m)=>ce.loadActivityAdvertisementAsync(i.activities[m].articleId)));return qt(n,r,l)}catch{return}}))).filter(n=>!!n).sort((n,r)=>n.order-r.order)}catch{return[]}},Zs=async()=>{try{return await Ys()}catch{return{}}},en="/workplace-link";class V extends It{constructor(s){super(s);o(this,"perksTab$",this.select(s=>s.perksTab));o(this,"all$",he([this.selectAll()]).pipe(pe(([s])=>V.filterPerks(s,"","all"))));o(this,"classifiedPerks$",he([this.selectAll(),this.select(s=>s.searchString)]).pipe(pe(([s,n])=>{const r=n?V.searchPerks(s,n):s;return V.classifyPerks(r)})));o(this,"perksOnStage$",he([this.selectAll(),this.select(s=>s.searchString),this.select(s=>s.perksTab)]).pipe(pe(([s,n,r])=>this.getHasCache()?U.fromNullable(V.filterPerks(s,n,r)):p)));this.store=s}static filterPerks(s,n,r){const i=V.searchPerks(s,n).filter(l=>r==="all"||l.benefit.category===r);return V.excludeLocalPerk(i,en)}static searchPerks(s,n){return s.filter(r=>r.benefit.title.toLowerCase().includes(n.toLowerCase())||r.benefit.subtitle.toLowerCase().includes(n.toLowerCase()))}static classifyPerks(s){const n=Hs();return s.forEach(r=>{const i=r.benefit.category;n[i].push(r)}),n.all=s,n}static findLocalPerk(s,n){const r=s.filter(i=>{var l;return(l=Be(i.benefit.url))==null?void 0:l.startsWith(n)});return r.length===0?void 0:r[0]}static excludeLocalPerk(s,n){return s.filter(i=>{var l;return!((l=Be(i.benefit.url))!=null&&l.startsWith(n))})}}const ke=new V(ne);var ft,bt;function tn(){return{loading:!1,featuredPerks:p,viewPerk:{isOpen:!1,perk:p},viewCategory:{isOpen:!1,category:p},categories:void 0,benefitsPlanHome:void 0}}let an=(ft=re({name:"home-page",resettable:!0,producerFn:ie}),ft(bt=class extends He{constructor(){super(tn())}})||bt);const M=new an;class sn extends Pe{constructor(s){super(s);o(this,"homePageState$",this.select(s=>s.featuredPerks));o(this,"viewPerkState$",this.select(s=>s.viewPerk));o(this,"viewCategoryState$",this.select(s=>s.viewCategory));o(this,"categoryState$",this.select(s=>s.categories));o(this,"benefitsPlanHomeState$",this.select(s=>s.benefitsPlanHome));this.store=s}}const Y=new sn(M),nn=()=>({getViewPageState:()=>{const a=t=>{M.update(s=>{s.featuredPerks=k(t)}),ne.set(t.availableBenefits)};return ke.selectCached(()=>Bt.getBenefitsAsync(),a)},getMarketplaceCategoryState:()=>{const a=t=>{M.update(s=>{s.categories=t})};return Y.selectCached(()=>Xs(),a)},getBenefitsPlanHome:()=>{const a=t=>{M.update(s=>{s.benefitsPlanHome=t})};return Y.selectCached(()=>Zs(),a)},reloadViewPageState:()=>{ne.setHasCache(!1)},openPerk:a=>{M.update(t=>{t.viewCategory.isOpen=!1,t.viewPerk={isOpen:!0,perk:K(a)}})},closePerk:()=>{M.update(a=>{a.viewPerk.isOpen=!1})},openCategory:a=>{M.update(t=>{t.viewPerk.isOpen=!1,t.viewCategory={isOpen:!0,category:K(a)}})},closeCategory:()=>{M.update(a=>{a.viewCategory.isOpen=!1})}}),B=nn(),Qt="/benefits/app/assets/default_backdrop-fdd955b8.png",De=a=>{const t=e(h,{children:[e("div",{className:"flex-shrink-0",children:e("img",{className:$(a.imageClassName??"h-48 w-full object-cover"),src:a.imageUrl,alt:""})}),e("div",{className:"flex-1 bg-white p-4 flex flex-col justify-between",children:a.children})]});return e("div",{onClick:a.onClick,className:$(a.className??"",a.onClick?"cursor-pointer":"","flex flex-col rounded-lg shadow-lg overflow-hidden"),children:a.externalLink?e("a",{href:a.externalLink,target:"_blank",rel:"noopener noreferrer",children:t}):t})},rn=a=>tt.match(a.toLowerCase()).with("body",()=>"bg-pink-100 text-pink-800").with("life",()=>"bg-yellow-100 text-yellow-800").with("mind",()=>"bg-green-100 text-green-800").with("money",()=>"bg-blue-100 text-blue-800").with("work",()=>"bg-orange-100 text-orange-800").with(tt.__,()=>"bg-gray-100 text-gray-800").exhaustive(),Ge=a=>{const t=rn(a.name),s=a.size==="xs"?"text-xs":"text-sm";return e("div",{className:$(a.className??"","capitalize inline-flex items-center px-2 py-0.5 rounded font-medium",t,s),children:a.name})},Kt=({perk:a,onClick:t,className:s})=>{var n;return e(De,{className:s,imageUrl:((n=a.backdrop)==null?void 0:n.downloadUrl)??Qt,onClick:t,children:e("div",{className:"flex-1 pt-2 pb-7 px-2",children:[e(Ge,{className:"uiid-perk-tag",name:a.category}),e("div",{className:"block mt-2",children:[e("p",{className:"uiid-perk-item-title text-xl font-semibold text-gray-900",children:a.title}),e("p",{className:"uiid-perk-item-subtitle mt-1 text-sm text-gray-500",children:a.subtitle})]})]})})},Yt=()=>e("div",{className:"flex flex-col animate-pulse shadow-lg rounded-lg overflow-hidden",children:[e("div",{className:"flex-shrink-0",children:e("div",{className:"h-48 bg-gray-300"})}),e("div",{className:"flex-1 bg-white p-6 pb-9 flex flex-col justify-between",children:e("div",{className:"flex-1",children:[e("div",{className:"h-6 bg-gray-300 rounded w-12"}),e("div",{className:"block mt-2",children:[e("div",{className:"h-4 mt-4 bg-gray-300 rounded w-1/2"}),e("div",{className:"h-4 mt-2 bg-gray-300 rounded w-3/4"})]})]})})]}),Jt=()=>e(h,{children:[...Array(3).keys()].map((a,t)=>e(Yt,{},t))}),ln=()=>{const[a,t]=g(p);u(()=>{const r=[ke.perksOnStage$.subscribe(t)];return()=>{r.map(i=>i.unsubscribe())}},[]);const s=async r=>{B.openPerk(r),await b.trackExplorePerkViewedAsync(r)},n=C(a,[]).length>0?C(a,[]).map(r=>{const{benefit:i,benefitId:l}=r;return e(Kt,{className:"uiid-explore-perk",perk:i,onClick:()=>s(r)},l)}):e(Gt,{children:[e("p",{children:"Sorry, no entries were found matching your search request."}),e("p",{children:"Please try another search."})]});return e(Dt,{className:"uiid-perks-grid",children:J(a)?e(Jt,{}):n})},cn=()=>{const[a,t]=g(0),[s,n]=g("all");u(()=>{(async()=>b.trackPerksListViewedAsync(s))();const i=[ke.all$.subscribe(l=>{t(l.length)}),ke.perksTab$.subscribe(n)];return()=>{i.map(l=>l.unsubscribe())}},[]),u(()=>()=>{$e.searchPerks("")},[]);const r=async i=>{$e.setTab(i),await b.trackPerksListViewedAsync(i)};return e("div",{className:"flex flex-col",style:{minHeight:window.innerHeight},children:[e("div",{className:"sm:flex sm:items-center sm:justify-between",children:[e("div",{className:"flex",children:[e("div",{className:"text-2xl md:text-4xl font-bold md:font-extrabold leading-loose md:leading-10 text-gray-700",children:"Explore other perks"}),e("div",{className:"text-2xl md:text-4xl font-bold md:font-extrabold leading-loose md:leading-10 text-gray-500 ml-2",children:["(",a,")"]})]}),e("div",{className:"mt-4 sm:mt-0",children:e(Wt,{onSearchEvent:async i=>{$e.searchPerks(i),i&&await b.trackPerksListSearched(i)}})})]}),e("div",{className:"mt-4",children:e(zt,{currentTab:s,onTabClicked:r})}),e("div",{className:"mt-6",children:e(ln,{})})]})},on=a=>{const{perks:t}=a,[s,n]=g(!0);u(()=>{n(J(t))},[t]);const r=async l=>{B.openPerk(l),await b.trackFeaturePerkViewedAsync(l)},i=C(t,[]).map(l=>{const{benefit:d,benefitId:m}=l;return e(Kt,{className:"uiid-featured-perk",perk:d,onClick:()=>r(l)},m)});return e("div",{className:"flex flex-col",children:[e("div",{className:"text-2xl md:text-4xl font-bold md:font-extrabold leading-loose md:leading-10 text-gray-700",children:"Featured Perks"}),e("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-8 pt-6",children:s?e(Jt,{}):i})]})},Xt=({isOpen:a,fullWidthMobile:t,onClose:s,children:n})=>e(ue.Root,{show:a,as:h,children:e(at,{as:"div",static:!0,className:"modal fixed z-40 inset-0 overflow-y-auto",open:a,onClose:s,children:e("div",{className:`flex items-center justify-center min-h-screen md:max-h-screen mt-auto text-center ${t?"w-screen md:w-auto md:p-4":"p-4"}`,children:[e(ue.Child,{as:h,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:e(at.Overlay,{className:"fixed inset-0 bg-black bg-opacity-75 transition-opacity"})}),e("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),e(ue.Child,{as:h,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:e("div",{className:`inline-block align-bottom transition-all md:align-middle bg-white text-left shadow-xl transform ${t?"mt-auto md:mb-auto md:rounded-lg overflow-visible":"rounded-lg overflow-hidden"}`,children:n})})]})})}),dn=/^\+?(614|6104|04)([0-9]{2})([0-9]{3})([0-9]{3})$/,mn=a=>{if(!a)return;const t=a.replace(/\s/g,""),s=a.replace(/\s/g,"").match(dn);return s==null?t:`04${s[2]} ${s[3]} ${s[3]}`},un=({formId:a,profile:t,categoryId:s})=>{const n=()=>{b.trackActivityCompletedAsync(s)};let r={};return t&&(r={email:t.email,first_name:t.firstName,last_name:t.lastName,mobile:mn(t.mobilePhone),profile_id:t.profileId,account_id:t.accountId,partner_id:t.partnerId,campaign_class:"Platform",campaign_source:"Flare",campaign_medium:"Web Benefits",campaign_name:"Benefits Assessment",skip_welcome:"true"}),e(La.Widget,{id:a,className:"mx-auto w-screen h-screen md:h-[40rem] md:w-[95vw] md:max-w-[70rem]",hidden:r,inlineOnMobile:!0,onSubmit:n})},hn=(a,t)=>{var l,d,m;const s=Fe(ee),n=A(s)?s.value.basicProfile:void 0,r=A(s)?s.value.accountName:void 0;let i={};switch(n&&(i={email:n.email,"first-name":n.firstName,"last-name":n.lastName,mobile:n.mobilePhone,"employer-name":r,"profile-id":n.profileId,"account-id":n.accountId,"partner-id":n.partnerId,"sf-class":"Platform","sf-source":"Flare","sf-medium":"Web Benefits","sf-name":"Benefits Assessment"}),(l=a==null?void 0:a.landing)==null?void 0:l.component){case"cars-calculator-ungated":return e("div",{className:"md:p-1",children:e("cars-calculator",{"datadog-disabled":!0,...i,"backend-url":t,"hide-employer-name":!0})});case"cars-calculator-gated":return e("div",{className:"md:p-1",children:e("cars-calculator",{"datadog-disabled":!0,...i,"backend-url":t,"is-gated":!0,"hide-employer-name":!0})});case"typeform":return(d=a==null?void 0:a.landing)!=null&&d.typeformId?e(un,{formId:(m=a==null?void 0:a.landing)==null?void 0:m.typeformId,profile:n,categoryId:a.trackingId??a.title}):e(h,{});default:return e(h,{})}},pn=({categoryData:a,apolloBaseUrl:t})=>hn(a,t),Zt=a=>{const t=Be(a.href);return e(h,{children:t?e("a",{className:a.className,onClick:a.onClick,href:`/benefits/app/#${t}`,children:a.children}):e("a",{href:a.href,className:a.className,onClick:a.onClick,target:"_blank",rel:"noopener noreferrer",children:a.children})})},ea=({url:a,children:t,className:s,onClick:n})=>{const r=`block w-full mx-auto md:w-auto md:ml-0 text-center px-4 py-2 border border-transparent shadow-sm
|
|
3
|
+
text-sm leading-6 font-semibold rounded-md text-white bg-primary ${s}`;return a?e(Zt,{className:r,href:a,onClick:n,children:t}):e("button",{type:"button",className:r,onClick:n,children:t})},gn={renderText:a=>a.split(`
|
|
4
|
+
`).flatMap((t,s)=>[s>0&&e("br",{}),t]),renderNode:{[v.BLOCKS.PARAGRAPH]:(a,t)=>e("p",{className:"text-xs leading-4 font-normal text-gray-600",children:t}),[v.INLINES.HYPERLINK]:(a,t)=>e("a",{className:"text-blue-600",href:a.data.uri,target:"_blank",rel:"noopener noreferrer",children:t}),[v.BLOCKS.LIST_ITEM]:(a,t)=>Z.documentToReactComponents(a,{renderNode:{[v.BLOCKS.PARAGRAPH]:(s,n)=>e("p",{className:"text-gray-600 leading-5 text-sm ",children:n}),[v.BLOCKS.LIST_ITEM]:(s,n)=>e("li",{className:"flex gap-2",children:[e(je,{className:"text-primary w-3 h-5",icon:Tt}),n]})}})}},fn=({body:a})=>e(h,{children:Z.documentToReactComponents(a,gn)}),bn={renderText:a=>a.split(`
|
|
5
|
+
`).flatMap((t,s)=>[s>0&&e("br",{}),t]),renderNode:{[v.BLOCKS.HEADING_1]:(a,t)=>e("h1",{className:"text-2xl leading-8 font-bold pb-2",children:t}),[v.BLOCKS.PARAGRAPH]:(a,t)=>e("p",{className:"text-base leading-6 font-normal text-gray-600 pb-4",children:t}),[v.BLOCKS.UL_LIST]:(a,t)=>e("ul",{className:"py-4 px-3 md:px-8 rounded-lg border-gray-200 border-2 shadow-sm flex flex-col space-y-2 mb-4",children:t}),[v.BLOCKS.LIST_ITEM]:(a,t)=>Z.documentToReactComponents(a,{renderNode:{[v.BLOCKS.PARAGRAPH]:(s,n)=>e("p",{className:"text-gray-600 leading-5 text-sm ",children:n}),[v.BLOCKS.LIST_ITEM]:(s,n)=>e("li",{className:"flex gap-2",children:[e(je,{className:"text-primary w-3 h-5",icon:Tt}),n]})}})}},yn=({body:a})=>e(h,{children:Z.documentToReactComponents(a,bn)}),vn=({data:a,onClick:t,onClose:s,onPrevious:n})=>{var i,l,d,m,f,j,z,W;let r;return((i=a==null?void 0:a.landing)==null?void 0:i.component)==="shopify"?r=C(Se.getShopifyUrl(),"#"):((l=a==null?void 0:a.landing)==null?void 0:l.component)==="external-link"&&(a!=null&&a.externalUrl)&&(r=a==null?void 0:a.externalUrl),e("div",{className:n?"absolute md:relative bg-white rounded-lg":"rounded-lg",children:e("div",{className:"relative",children:[s&&e("div",{className:"absolute top-0 right-0 pt-4 pr-4 z-30",children:e("button",{type:"button",className:"uiid-perk-details-close-button focus:outline-none bg-white rounded-md text-gray-500",onClick:s,children:[e("span",{className:"sr-only",children:"Close"}),e(ve,{className:"h-6 w-6 border-0","aria-hidden":"true"})]})}),n&&e("div",{className:"absolute top-0 left-0 pl-4 pt-4 md:pl-10 md:pt-5 lg:pl-16 lg:pt-8 xl:pl-20 xl:pt-12 z-30",children:e("button",{type:"button",className:"uiid-perk-details-close-button focus:outline-none bg-white rounded-md text-gray-500",onClick:n,children:e("span",{className:"inline-flex text-sm leading-5 font-medium text-gray-600",children:[e(Ea,{className:"h-5 w-5 border-0 mr-2","aria-hidden":"true"}),"Back"]})})}),a&&e("div",{className:"w-full grid grid-cols-1 md:grid-cols-2 md:gap-10 lg:gap-14 xl:gap-16 p-0 md:p-10 lg:p-16 xl:p-20 md:relative",children:[((d=a.landing)==null?void 0:d.heroImageDesktop)&&e("img",{src:`${(m=a.landing)==null?void 0:m.heroImageDesktop.fields.file.url}?fm=jpg&q=90&w=640&h=480`,className:"mx-auto w-full order-2 self-center hidden md:block"}),((f=a.landing)==null?void 0:f.heroImageMobile)&&e("img",{src:`${(j=a.landing)==null?void 0:j.heroImageMobile.fields.file.url}?fm=jpg&q=90&w=640&h=480`,className:"mx-auto w-full self-center block md:hidden"}),e("div",{className:"flex flex-col self-center p-4 md:p-0 md: mt-4",children:[e(yn,{body:a.landing.modalBody}),e(ea,{className:"mb-6",onClick:t,url:r,children:(z=a.landing)==null?void 0:z.buttonText}),((W=a.landing)==null?void 0:W.disclaimer)&&e(fn,{body:a.landing.disclaimer})]})]})]})})},wn=({items:a,onClick:t})=>e("div",{className:"mx-auto w-screen md:h-auto md:w-[95vw] md:max-w-[70rem] lg:px-16 px-6 py-6 md:py-16",children:[e("h1",{className:"text-2xl leading-8 font-bold text-gray-600 text-center",children:"Offers available"}),e("div",{className:"w-full mx-auto flex flex-wrap justify-center gap-8 gap-y-4 md:gap-x-24 py-10",children:a.map((s,n)=>e(De,{imageUrl:s.imageUrl,className:`md:w-80 ${n%2,"md:place-self-center"}`,imageClassName:"h-32 w-full object-cover",children:[e("h2",{className:"text-lg font-bold text-gray-900 pb-0",children:s.title}),e("h3",{className:"text-sm text-gray-600 pb-2",children:s.subtitle}),e("div",{className:"flex pb-4",children:e("div",{className:"w-auto px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800",children:s.type})}),e(ea,{className:"md:w-full mx-0 mb-1",onClick:()=>t(s.id),children:s.buttonText})]},s.id))})]}),xn=()=>{const[a,t]=g(!1),[s,n]=g(p),[r,i]=g(p),[l,d]=g([]),[m,f]=g("SELECTION"),j=X(null),z=X(null),W=X(null),I=()=>{var c;return(c=j.current)==null?void 0:c.scrollIntoView({behavior:"smooth",block:"end"})},w=()=>{var c;return(c=z.current)==null?void 0:c.scrollIntoView({behavior:"smooth",block:"start"})},la=()=>{var c;return(c=W.current)==null?void 0:c.scrollIntoView({behavior:"smooth",block:"start"})},Qe=()=>m==="SELECTION",Ke=()=>m==="LANDING",Ie=()=>m==="ACTION",ca=()=>{var x,O;const c=G(r);Ie()?w():((x=c==null?void 0:c.landing)==null?void 0:x.component)!=="shopify"&&((O=c==null?void 0:c.landing)==null?void 0:O.component)!=="external-link"&&f("ACTION"),b.trackActivityStartedAsync((c==null?void 0:c.trackingId)??(c==null?void 0:c.title))};u(()=>{Ie()&&w(),Ke()&&la(),Qe()&&I()},[m,r]),u(()=>{A(r)&&setTimeout(()=>f("LANDING"),100)},[r]),u(()=>{a&&(l.length==0?(i(s),f("LANDING")):l.length==1?(i(K(l[0])),f("LANDING")):f("SELECTION"))},[a,l,s]),u(()=>{const c=G(s);a&&b.trackCategoryOpenedAsync(c==null?void 0:c.trackingId)},[s,a]),u(()=>{const c=[Y.viewCategoryState$.subscribe(({isOpen:x,category:O})=>{const _=G(O);if(_!=null&&_.landing)t(x),n(K(_)),i(p),_.landing.component==="activity-advertisement"?d(_.landing.activities.advertisements||[]):d([]);else if(x)throw new Error("Category is not configured for view: "+(_==null?void 0:_.title))})];return()=>{c.map(x=>x.unsubscribe())}},[]);const oe=()=>{const c=G(r);b.trackCategoryClosedAsync(c==null?void 0:c.trackingId,m),S("/")},Ye=G(r),oa=c=>{const x=l.filter(O=>O.title===c)[0];i(K(x))},Je=l.map(c=>{var x,O;return{title:c.displayTitle,id:c.title,subtitle:c.subtitle,buttonText:((x=c.landing)==null?void 0:x.buttonText)||"Learn more",type:"Advertisement",imageUrl:`${(O=c.tileImage)==null?void 0:O.fields.file.url}?fm=jpg&q=90&w=640&h=480`}}),Te=Je.length>1,da=()=>{f("SELECTION")};return e(Xt,{isOpen:a,fullWidthMobile:!0,onClose:oe,children:e("div",{className:"w-screen md:w-auto md:max-w-[70rem] md:rounded-lg",children:[e("div",{className:`${a?"block":"hidden"} absolute top-0 right-0 pt-4 pr-4 z-30`,children:e("button",{type:"button",className:"uiid-perk-details-close-button focus:outline-none bg-white rounded-md text-gray-500",onClick:oe,children:[e("span",{className:"sr-only",children:"Close"}),e(ve,{className:"h-6 w-6 border-0","aria-hidden":"true"})]})}),Te&&e("div",{ref:j,className:Qe()?"md:grid":"md:hidden",children:e(wn,{items:Je,onClick:oa})}),e("div",{ref:W,className:Ke()?"md:grid":"md:hidden",children:e(vn,{data:Ye,onClick:ca,onClose:Te&&oe||void 0,onPrevious:Te&&da||void 0})}),e("div",{ref:z,className:`${Ie()?"block":"hidden"} h-screen md:h-auto absolute md:relative md:rounded-lg bg-white`,children:e("div",{className:"m-auto relative",children:[e("div",{className:"md:hidden absolute top-0 right-0 pt-4 pr-4 z-30",children:e("button",{type:"button",className:"uiid-perk-details-close-button focus:outline-none bg-white rounded-md text-gray-500",onClick:oe,children:[e("span",{className:"sr-only",children:"Close"}),e(ve,{className:"h-6 w-6 border-0","aria-hidden":"true"})]})}),e(pn,{apolloBaseUrl:T.getConfig().apolloBaseUrl,categoryData:Ye})]})})]})})},ta="dd/MM/yyyy",aa="hh:mm a",Oe="ccc d MMM",kn="p",Nn=(a,t,s)=>{if(a.data.dateRange){const n=E(s,!1),r=E(new Date(a.data.dateRange.end),a.data.dateRange.allDay);switch(t){case"Upcoming":return a.type==="customEvent"&&n<=r;case"Past":return a.type==="customEvent"&&n>r;case"Library":return a.type==="eventTemplate"}}else switch(t){case"Library":return a.type==="eventTemplate"}return!1},lr=(a,t)=>a.filter(s=>Nn(s,t,new Date)),E=(a,t)=>t?new Date(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),0,0,0,0):new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0,0),cr=(a,t)=>{const s=new Date,n=Ga(`${a} ${t||"12:00 AM"}`,`${ta} ${aa}`,s);return t?st(n):(s.setUTCFullYear(n.getFullYear()),s.setUTCMonth(n.getMonth()),s.setUTCDate(n.getDate()),s.setUTCHours(0,0,0,0),st(s))},or=(a,t)=>({date:Q(E(a,t),ta),time:t?void 0:Q(a,aa)}),dr=(a,t,s)=>{if(!a.data.dateRange)return 1;if(!t.data.dateRange)return-1;if(a.data.dateRange&&t.data.dateRange){const n=E(new Date(a.data.dateRange.start),a.data.dateRange.allDay),r=E(new Date(t.data.dateRange.start),t.data.dateRange.allDay),i=n<r?-1:1;return s.filter==="Past"?i*-1:i}else return 0},Pn=(a,t,s)=>{const n=E(new Date(a),s),r=E(new Date(t),s),i=n.getTime()===r.getTime()?Q(n,Oe):`${Q(n,Oe)} - ${Q(r,Oe)}`,l=s?"":`, ${Q(new Date(a),kn)}`;return`${i}${l}`},mr=(a,t)=>t?a?a.getMonth()!==t.getMonth()?yt(a):void 0:"More":a?yt(a):void 0,ur=(a,t)=>a&&t?a.getFullYear()!==t.getFullYear()?a.getFullYear().toString():void 0:a==null?void 0:a.getFullYear().toString(),hr=(a,t,s)=>{const n=a[t],r=a[t-1];if(t===0){if(n.data.dateRange){const i=E(new Date(n.data.dateRange.start),n.data.dateRange.allDay);return s(i,void 0)}}else if(r.data.dateRange){const i=E(new Date(r.data.dateRange.start),r.data.dateRange.allDay);if(n.data.dateRange){const l=E(new Date(n.data.dateRange.start),n.data.dateRange.allDay);return s(l,i)}else return s(void 0,i)}},yt=a=>a.toLocaleString("default",{month:"long"})+" "+(a==null?void 0:a.getFullYear().toString()),An=({actionButton:a,item:t,itemId:s,onClose:n})=>{var l,d;const r=((l=t.backdrop)==null?void 0:l.downloadUrl)??Qt,i=(d=t.icon)==null?void 0:d.downloadUrl;return e("div",{className:"uiid-perk-details md:w-160 first-letter:overflow-hidden",children:[e("div",{className:"absolute top-0 right-0 pt-4 pr-4 z-30",children:e("button",{type:"button",className:"uiid-perk-details-close-button focus:outline-none bg-white rounded-md text-gray-500",onClick:n,children:[e("span",{className:"sr-only",children:"Close"}),e(Ct,{className:"h-6 w-6 border-0","aria-hidden":"true"})]})}),a&&e("div",{className:"absolute top-0 left-0 pt-4 pl-4 z-30",children:a}),e("div",{className:"relative bg-cover bg-center",style:`background-image: url(${r})`,children:[e("div",{className:"absolute inset-0 bg-gradient-to-t from-black opacity-90"}),e("div",{className:"relative flex items-end py-4 px-8 h-64",children:e("div",{className:"flex items-center",children:[!t.dateRange&&e("div",{className:"h-24 w-24 flex-shrink-0",children:e("div",{className:"bg-gray-200 rounded-lg",children:i?e("img",{className:"h-24 w-24 object-contain rounded-lg",src:i,alt:""}):e("div",{className:"h-24 w-24 rounded-lg text-gray-800 grid",children:e("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-12 w-12 place-self-center",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M12 8v13m0-13V6a2 2 0 112 2h-2zm0 0V5.5A2.5 2.5 0 109.5 8H12zm-7 4h14M5 12a2 2 0 110-4h14a2 2 0 110 4M5 12v7a2 2 0 002 2h10a2 2 0 002-2v-7"})})})})}),e("div",{className:`text-white ${t.dateRange?"":"pl-4"}`,children:[e("div",{className:"uiid-perk-details-title text-xl leading-6 md:text-3xl md:leading-9 font-extrabold",children:t.title}),e("div",{className:"relative text-sm leading-4 md:text-base md:leading-6 font-medium",children:[t.dateRange?Pn(t.dateRange.start,t.dateRange.end,t.dateRange.allDay):t.subtitle,t.dateRange&&t.location&&e(h,{children:[e("span",{className:"pipe pipe-white pipe-medium mx-3"}),e("span",{children:t.location})]})]}),e(Ge,{className:"uiid-perk-details-tag",name:t.category,size:"xs"})]})]})})]}),e("div",{className:"flex flex-col p-8",children:[e("div",{className:"flex-grow",children:[t.dateRange&&e("p",{className:"text-lg leading-8 font-semibold mb-4",children:t.subtitle}),e("p",{className:"whitespace-pre-wrap",children:t.description}),t.linkLabel&&t.url&&e(Zt,{href:t.url,onClick:()=>s&&b.trackPerkVisitedAsync({benefit:t,benefitId:s}),className:"w-auto mt-6 inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 text-sm leading-5 font-medium",children:t.linkLabel})]}),t.attachments&&t.attachments.length>0&&e("div",{className:"border border-gray-200 rounded-md mt-8",children:e("div",{className:"pl-3 pr-4 py-3 flex items-center justify-between text-sm",children:[e("div",{className:"w-0 flex-1 flex items-center",children:[e($a,{className:"flex-shrink-0 h-5 w-5 text-gray-400","aria-hidden":"true"}),e("span",{className:"ml-2 flex-1 w-0 truncate",children:t.attachments[0].title})]}),e("div",{className:"ml-4 flex-shrink-0",children:e("a",{href:t.attachments[0].downloadUrl,target:"_blank",className:"font-medium text-primary",onClick:()=>s&&b.trackDocumentClickedAsync({benefit:t,benefitId:s}),children:"View"})})]})})]})]})},Cn=()=>{const[a,t]=g(!1),[s,n]=g(p);u(()=>{const i=[Y.viewPerkState$.subscribe(({isOpen:l,perk:d})=>{t(l),n(d)})];return()=>{i.map(l=>l.unsubscribe())}},[]);const r=G(s);return r?e(Xt,{isOpen:a,onClose:B.closePerk,children:e(An,{item:r.benefit,itemId:r.benefitId,onClose:B.closePerk})}):e("div",{})},vt=({category:a})=>{const t=le.useContext(ee),[s,n]=g(p),[r,i]=g(),[l,d]=g();Ps(),u(()=>{b.trackBenefitsOpenedAsync();const I=[Y.homePageState$.subscribe(w=>{n(w)}),Y.categoryState$.subscribe(w=>{i(w)}),Y.benefitsPlanHomeState$.subscribe(w=>{d(w)}),B.getViewPageState().subscribe(),B.getMarketplaceCategoryState().subscribe(),B.getBenefitsPlanHome().subscribe()];return()=>{I.map(w=>w.unsubscribe())}},[]),u(()=>{const I=r==null?void 0:r.find(w=>w.title.toLocaleLowerCase()===(a==null?void 0:a.toLocaleLowerCase()));I?B.openCategory(I):B.closeCategory()},[r,a]);const m=ye.pipe(s,Oa(I=>I.promotedBenefits)),f=ye.pipe(m,Ae(()=>!1,I=>I.length>0)),j=Vt.isPba(),{getTreatment:z}=ks(),W=z(Ot.FlareApp);return e(h,{children:[!j&&e(ze,{user:t}),e("div",{className:"max-w-[90rem] min-w-5xl mx-auto py-8 px-4 sm:px-6 lg:px-8",children:[W&&e("div",{className:"md:mb-16 mb-5",children:e(Ss,{})}),(!r||!l||r.length>0&&l.title)&&e("div",{className:"md:mb-16 mb-5",children:e(Os,{categories:r,content:l})}),f&&e("div",{className:"md:mb-16 mb-5",children:e(on,{perks:m})}),e("div",{children:e(cn,{})})]}),e(Cn,{}),e(xn,{})]})};const fe=()=>{const a=Fe(ee);return u(()=>{b.trackAppOfferAcceptedAsync()},[]),e(h,{children:[e(ze,{user:a}),e("div",{className:"p-4",children:e("workplace-link",{"access-token":Ut.jwt,"backend-url":T.getConfig().apiGatewayBaseUrl})})]})},sa=()=>{const a=_a(),t=a.startsWith("state")||a.startsWith("code")||a.startsWith("error");return e(h,{children:t?e(fe,{}):e("div",{className:"notfound",children:[e("h1",{children:"Error 404"}),e("p",{children:"That page doesn't exist."}),e("a",{href:"#/",children:e("h4",{children:"Back to Home"})})]})})};function me(a){return le.useContext(Mt)?Ua(a.component,a):e(Ce,{})}const na=a=>({listen:t=>a.listen(({location:s})=>t(s)),location:a.location,push:a.push,replace:a.replace}),ra=(a,t,s)=>{u(()=>{let n=!0;return a(()=>n),()=>{n=!1,ye.pipe(t,Ae(()=>{},r=>r()))}},s)};var wt,xt;const Sn=()=>({all:[],money:[],mind:[],body:[],work:[],life:[]}),In=()=>({currentTab:"all",searchString:""});let Tn=(wt=re({name:"explore-wellbeing",cache:{ttl:"3600000"},resettable:!0,producerFn:ie}),wt(xt=class extends St{constructor(){super(In())}})||xt);const be=new Tn;class Ne extends It{constructor(s){super(s);o(this,"currentTab$",this.select(s=>s.currentTab));o(this,"previewsOnStage$",he([this.selectAll(),this.select(s=>s.searchString),this.select(s=>s.currentTab)]).pipe(pe(([s,n,r])=>this.getHasCache()?U.fromNullable(Ne.filterPreviews(s,n,r)):p)));this.store=s}get isPreviewsLoaded(){var s;return(((s=this.getValue().ids)==null?void 0:s.length)??0)>0}static filterPreviews(s,n,r){return Ne.searchPreviews(s,n).filter(i=>r==="all"||i.pillar===r)}static searchPreviews(s,n){return s.filter(r=>r.title.toLowerCase().includes(n.toLowerCase())||r.subtitle.toLowerCase().includes(n.toLowerCase()))}static classifyPreviews(s){const n=Sn();return s.forEach(r=>{const i=r.pillar;n[i].push(r)}),n.all=s,n}}const qe=new Ne(be),Ln=()=>({setTab:a=>{be.update(t=>{t.currentTab=a})},searchPreviews:a=>{be.update(t=>{t.searchString=a,t.currentTab="all"})},loadEntryPreviews:()=>qe.selectCached(()=>ce.loadAvailableEntryPreviewsAsync(),a=>be.set(a))}),ae=Ln(),En=()=>e(h,{children:[...Array(3).keys()].map((a,t)=>e(Yt,{},t))}),$n=()=>{const[a,t]=g(p);u(()=>{const r=[qe.previewsOnStage$.subscribe(t)];return()=>{r.map(i=>i.unsubscribe())}},[]);const s=async r=>{r.externalLink||S(`/wellbeing-hub/articles/${r.slug}`),b.trackEntryViewed({contentId:r.id,contentTitle:r.slug,contentType:r.primaryContentType,contentPillar:r.pillar})},n=C(a,[]).length>0?C(a,[]).map(r=>e(De,{className:"uiid-preview-item",imageUrl:`${r.coverPhotoUrl}?fm=jpg&q=50&w=640&h=480`,externalLink:r.externalLink,onClick:()=>s(r),children:e("div",{className:"flex-1 pb-7 pt-2 px-2",children:[e("div",{className:"flex items-center",children:[e(Ge,{className:"uiid-preview-tag",name:r.pillar}),e("div",{className:"text-sm leading-5 font-normal px-2 text-gray-300",children:"|"}),e("div",{className:"text-xs leading-4 font-semibold tracking-wider uppercase text-gray-400",children:r.primaryContentType}),e("div",{className:"flex-grow"}),r.externalLink&&e(Ba,{className:"h-5 w-5 text-gray-400 border-0"})]}),e("div",{className:"block mt-2",children:[e("p",{className:"uiid-preview-item-title text-xl font-semibold text-gray-900",children:r.title}),e("p",{className:"uiid-preview-item-subtitle mt-1 text-sm text-gray-500",children:r.subtitle})]})]})},r.id)):e(Gt,{children:[e("p",{children:"Sorry, no entries were found matching your search request."}),e("p",{children:"Please try another search."})]});return e(Dt,{className:"uiid-preview-grid",children:J(a)?e(En,{}):n})},On=()=>{const[a,t]=g("all");u(()=>{const r=[qe.currentTab$.subscribe(t),ae.loadEntryPreviews().subscribe()];return()=>{r.map(i=>i.unsubscribe())}},[]),u(()=>()=>{ae.searchPreviews("")},[]);const s=async r=>{ae.setTab(r),S(`/wellbeing-hub/${r}`),b.trackEntriesListViewedAsync(r)},n=async r=>{ae.searchPreviews(r),b.trackEntriesListSearchedAsync(r)};return e("div",{className:"flex flex-col",style:{minHeight:window.innerHeight},children:[e("div",{className:"sm:flex sm:items-center sm:justify-between",children:[e("div",{className:"flex",children:e("div",{className:"text-3xl leading-9 font-semibold text-gray-700",children:"Explore the 5 pillars of wellness"})}),e("div",{className:"mt-4 sm:mt-0",children:e(Wt,{onSearchEvent:n})})]}),e("div",{className:"mt-4",children:e(zt,{currentTab:a,onTabClicked:s})}),e("div",{className:"mt-6",children:e($n,{})})]})},_n="/benefits/app/assets/wellbeing_banner-6903d615.png",Un=({children:a})=>e("div",{className:"relative filter inline-flex items-center w-12 h-12 rounded-lg text-md font-medium bg-black bg-opacity-40 text-gray-800",children:[e("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-b from-black bg-opacity-50"}),e("div",{className:"relative h-full w-full flex flex-wrap content-center justify-center",children:a})]}),Bn=()=>e("div",{className:"flex gap-4",children:we.map(a=>e(Un,{children:e("div",{className:Ft[a],children:jt(a)})}))}),Rn=()=>e(Ht,{className:"h-full",bgImageUrl:_n,children:e("div",{className:"px-4 py-10 md:px-8 md:py-24 text-white",children:[e("div",{className:"text-2xl leading-8 font-bold",children:"Wellbeing Hub"}),e("div",{className:"max-w-sm text-md md:text-lg leading-6 mt-1 font-medium hidden md:block",children:"Providing education, support and tools to help you live a healthier and happier life!"}),e("div",{className:"pt-4 hidden md:block",children:e(Bn,{})})]})}),kt=({pillarFilter:a})=>{const t=X(null);return ra(async()=>{await b.trackWellbeingOpenedAsync()},U.none,[]),u(()=>{var s;ae.setTab(a??"all"),b.trackEntriesListViewedAsync(a??"all"),a&&((s=t.current)==null||s.scrollIntoView({behavior:"smooth"}))},[a,t]),e("div",{className:"max-w-7xl min-w-5xl mx-auto px-4 py-8 sm:px-6 lg:px-8 mb-20",children:[e("div",{className:"flex flex-col md:flex-row",children:e("div",{className:"w-full",children:e(Rn,{})})}),e("div",{className:"mt-8 pt-4",ref:t,children:e(On,{})})]})},Mn=({pages:a,homePageUrl:t})=>e("nav",{className:"bg-white border-b border-gray-200 flex","aria-label":"Breadcrumb",children:e("ol",{role:"list",className:"max-w-screen-xl w-full mx-auto px-4 flex space-x-4 sm:px-6 lg:px-8",children:[e("li",{className:"flex",children:e("div",{className:"flex items-center",children:e("a",{href:t??"#",className:"text-gray-400 hover:text-gray-500",children:[e(Ra,{className:"flex-shrink-0 h-5 w-5","aria-hidden":"true"}),e("span",{className:"sr-only",children:"Home"})]})})}),a.map((s,n)=>e("li",{className:"flex",children:e("div",{className:"flex items-center",children:[e("svg",{className:"flex-shrink-0 w-6 h-full text-gray-200",viewBox:"0 0 24 44",preserveAspectRatio:"none",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M.293 0l22 22-22 22h1.414l22-22-22-22H.293z"})}),e("a",{href:s.href,className:"ml-4 text-sm font-medium text-gray-500 hover:text-gray-700","aria-current":a.length===n+1?"page":void 0,children:s.name})]})},s.name))]})}),Vn=(a,t)=>{u(()=>{window.scrollTo(a)},t)},Hn=(a,t)=>{Vn({top:0,...a},t)},Fn={renderNode:{[v.BLOCKS.EMBEDDED_ASSET]:a=>{const{title:t,description:s,file:n}=a.data.target.fields;return e("figure",{children:[e("img",{src:`${n.url}?fm=jpg&q=90&w=640&h=480`,alt:t}),e("figcaption",{children:s})]})}}},jn=({body:a})=>e("article",{className:"prose prose-lg prose-indigo",children:Z.documentToReactComponents(a,Fn)}),zn=()=>e("div",{className:"max-w-3xl mx-auto py-6 px-4 sm:py-10 sm:px-6 lg:px-8 animate-pulse",children:[e("div",{class:"h-8 bg-gray-200 rounded w-2/3"}),e("div",{className:"flex space-x-3 mt-4",children:[e("div",{className:"flex-shrink-0",children:e("div",{class:"rounded-full bg-gray-200 h-10 w-10 mr-1"})}),e("div",{className:"min-w-0 flex flex-col justify-between flex-1",children:[e("div",{class:"h-4 bg-gray-200 rounded w-1/3"}),e("div",{class:"h-4 bg-gray-200 rounded w-1/4"})]})]}),e("div",{className:"mt-8",children:e("div",{class:"flex-1 space-y-8 py-1",children:[e("div",{class:"h-8 bg-gray-200 rounded w-3/4"}),e("div",{class:"h-48 bg-gray-200 rounded w-full"}),e("div",{class:"h-24 bg-gray-200 rounded w-3/4"}),e("div",{class:"h-36 bg-gray-200 rounded w-full"}),e("div",{class:"h-12 bg-gray-200 rounded w-1/4"})]})})]}),Wn=({articleSlug:a})=>{const[t,s]=g();if(ra(async r=>{const i=await We(ce.loadArticleAsync(a),700);r()&&s(i)},U.none,[a]),Hn(),!t)return e(nt.div,{initial:{opacity:0},animate:{opacity:1},children:e(zn,{})},"loading");const n=[{name:t==null?void 0:t.pillar,href:`#/wellbeing-hub/${t==null?void 0:t.pillar.toLowerCase()}`}];return e(h,{children:[e(Mn,{pages:n,homePageUrl:"#/wellbeing-hub"}),e(nt.div,{initial:{opacity:0},animate:{opacity:1},children:e("div",{className:"max-w-3xl mx-auto py-6 px-4 sm:py-10 sm:px-6 lg:px-8",children:[e("h2",{className:"text-4xl leading-10 font-extrabold tracking-tight",children:t.title}),e("div",{className:"flex space-x-3 mt-4",children:[e("div",{className:"flex-shrink-0",children:e("img",{className:"h-10 w-10 rounded-full",src:`${t.author.fields.avatar.fields.file.url}?fm=jpg&q=90&w=640&h=480`,alt:""})}),e("div",{className:"min-w-0 flex-1",children:[e("p",{className:"text-sm font-medium text-gray-900",children:t.author.fields.name}),e("p",{className:"text-sm text-gray-500",children:Q(new Date(t.originalPublicationDate),"dd MMM yyyy")})]})]}),e("div",{className:"mt-8",children:e(jn,{body:t.articleBody})})]})},"article")]})},Dn=()=>{const a=le.useContext(ee),t=Vt.isPba();return e(h,{children:[!t&&e(ze,{user:a}),e(Lt,{history:na(Et()),children:[e(H,{path:"/wellbeing-hub",component:kt}),e(H,{path:"/wellbeing-hub/:pillarFilter",component:kt}),e(H,{path:"/wellbeing-hub/articles/:articleSlug",component:Wn})]})]})},ia=a=>{analytics.identify(a.basicProfile.profileId,{profile:a.basicProfile.profileId,account:a.basicProfile.accountId,partner:a.basicProfile.partnerId,benefitsRole:a.benefitsProfile.role})},Gn=a=>{const t=`${a.eventName} ${a.eventAction}`,s={...a};delete s.eventName,delete s.eventAction,analytics.track(t,s)},qn=a=>()=>{},gr={identifyUser:ia,trackEvent:Gn,handleTrackingOnClick:qn},Qn=Ma(()=>Va(()=>import("./index-347b392e.js"),["assets/index-347b392e.js","assets/vendor-7d57579b.js","assets/lodash-5d893f8c.js","assets/framer-motion-2104a442.js","assets/date-fns-36105733.js","assets/oidc-client-6f6e47c2.js","assets/datadog-14bd14a9.js"])),Kn=()=>{const[a,t]=g({user:p}),[s,n]=g(!1),[r,i]=g(!1);if(typeof window<"u"&&window.location.pathname.replace("/benefits/app","")!=="/")return window.location.pathname="/benefits/app/",null;u(()=>{(async()=>{if(await T.fetchConfigAsync(),Re.extractRedirectPath(),Re.extractMode(),L.tokenExists(window.location.search)){await L.signOut(),await L.initFromToken(window.location.pathname,window.location.search);return}i(!0)})();const d=[F.signedInUser$.subscribe(m=>{t({user:m}),A(m)&&ia(m.value)}),Ut.authState$.subscribe(async({authStatus:m,jwt:f})=>{A(f)&&m===P.Authenticated?(await L.refreshIfExpired(),N.setParameters(T.getConfig().apiBaseUrl,f.value),_e.setParameters(T.getConfig().apolloBaseUrl,f.value),Qa.setParameters(T.getConfig().apiV2BaseUrl,f.value),mt.extractProfileId(f.value),await mt.loadSignedInUserProfileAsync(),n(m===P.Authenticated)):n(!1)})];return()=>{d.map(m=>m.unsubscribe())}},[]);const l=d=>{switch(d.url.replace(/^\/+/,"").split("/")[0]){case"":R.update({appView:"employee",navTab:"benefits"});break;case"admin":R.update({appView:"admin",navTab:"benefits"});break;case"wellbeing-hub":R.update({appView:"employee",navTab:"wellbeing"});break}};return u(()=>{r&&s&&b.trackAppLoadedAsync()},[r,s]),r?e("div",{id:"preact_root",className:"min-h-screen",children:e(Mt.Provider,{value:s,children:e(ee.Provider,{value:a.user,children:e(Lt,{history:na(Et()),onChange:l,children:[e(me,{path:"/",component:vt}),e(me,{path:"/categories/:category",component:vt}),e(me,{path:"/wellbeing-hub/:subroute*",component:Dn}),e(me,{path:"/admin/:subroute*",component:Qn}),e(H,{path:"/oidc/:mode*",component:is}),e(H,{path:"/b2c/:fragment",component:ls}),e(H,{path:"/workplace-link",component:fe}),e(H,{path:"state=:fragment*",component:fe}),e(H,{path:"/code*",component:fe}),e(sa,{default:!0})]})})})}):e(Ce,{})};typeof window<"u"&&(Ha({storage:window.sessionStorage,key:"benefits-client-v2"}),Fa(),ja.polyfill(),qa());za(e(Da,{children:e(Wa,{fallback:sa,children:e(Kn,{})})}),document.body);export{na as A,N as B,Qt as D,ze as H,An as I,Ka as L,Xt as M,Ge as P,xs as U,Ue as a,b,$ as c,ee as d,Qa as e,ce as f,G as g,gs as h,we as i,E as j,Pn as k,hr as l,gr as m,ur as n,mr as o,cr as p,Nn as q,dr as r,or as s,lr as t,ws as u,B as v,We as w,Bt as x,ks as y,$t as z};
|