1import{r as C,c as v,d as R,b as a,e as d,F as L,f as x,t as m,u as t,i as n,h as _,l as S,_ as M,o as U,q as w,x as Q,y as j,g as N,D as J,A as X}from"./_plugin-vue_export-helper.js";import{d as G,s as V,c as Z}from"./pinia.js";import{o as Y,i as ee,E as te}from"./theme.js";import{u as z}from"./globalConfigStore.js";import{g as ae}from"./getVouchers.js";import{v as re,a as E}from"./prizeUtils.js";import{v as K}from"./validateConfigId.js";import{L as se}from"./LoadingIndicator.js";import{U as $}from"./UnknownError.js";import{P as oe,a as H}from"./PrizeCardTemplate.js";import{u as le}from"./userProfileStore.js";import{u as ie}from"./ModalDialog.js";import{S as ne}from"./ShowMore.js";import{R as ce,_ as de,C as ue,N as O,T as pe}from"./TermsAndConditions.js";import"./PrizeContentTemplate.js";import"./useBxSvgIcon.js";import"./ngpsStore.js";import"./vue-router.js";import"./dataLayer.js";import"./promotionStore.js";import"./loginModalStore.js";const k=G("vouchersStore",()=>{const p=z(),e=p.getLabels,{googleWallet:o,ngpsConfig:s,reCaptchaSiteKey:i}=p.getConfigData,r=C(),l=C([]),c=C([]),u=C("LOADING"),b=v(()=>c.value),I=v(()=>u.value),D=g=>{if(!r.value?.filteringEnabled)return g;const y=r.value?.statuses??[],P=y.includes("expired");return g.filter(f=>E(f.expiryDate)?P:y.includes(f.voucherStatus))},W=g=>[...g].sort((y,P)=>{const f=E(y.expiryDate),T=E(P.expiryDate);return f===T?0:f?1:-1});return{getVouchers:b,getState:I,fetchVouchers:async()=>{if(u.value="LOADING",!K()){u.value="ERROR";return}const g=await ae(s,i);switch(g.type){case"QUERY_VOUCHERS_SUCCESS":let y=D(g.data.vouchers);l.value?.length>0&&(y=y.filter(f=>!l.value.includes(f.prizeId)));const P=y?.map(f=>re(o.themes,e.redemptionModalTitle)(f));c.value=W(P),u.value="READY";break;case"QUERY_VOUCHERS_UNKNOWN_RESPONSE":default:u.value="ERROR";break}},updateStoreData:g=>{r.value=g.filteringVouchersByStatus,l.value=g.filteringPrizeIDs}}}),q=G("prizeStore",()=>{const p=C(null),e=C(null),o=v(()=>p.value),s=v(()=>e.value),i=v(()=>[e.value.name,e.value.voucherCode,e.value.prizeId].every(Boolean)),r=c=>{p.value=c;const{name:u,voucherCode:b,prizeId:I,brandTag:D}=c;l({name:u,voucherCode:b,prizeId:I,brandTag:D})},l=c=>{e.value=c};return{updatePrizeCard:r,getPrize:o,getWalletCard:s,isWalletCardValid:i}}),me={class:"prize-details__name"},_e={key:0,class:"prize-details__expire"},ge={key:1,class:"prize-details__voucher"},he=["innerHTML"],ve=R({__name:"ClaimedPrizeContent",setup(p){const{getPrize:e,getWalletCard:o}=V(q()),{expiresLabel:s,voucherCodeLabel:i,redeemPrizeLabel:r}=z().getLabels,l=v(()=>e.value?.expiryDate?Y(e.value?.expiryDate):"");return(c,u)=>(a(),d(L,null,[x("h2",me,m(t(e).name),1),l.value?(a(),d("p",_e,m(`${t(s)} ${l.value}`),1)):n("",!0),t(i)&&t(e).voucherCode?(a(),d("p",ge,m(`${t(i)} ${t(e).voucherCode}`),1)):n("",!0),t(e).description?(a(),d("div",{key:2,class:"prize-details__description",innerHTML:t(e).description},null,8,he)):n("",!0),t(e).redeemDescription?(a(),_(ce,{key:3,"redeem-description":t(e).redeemDescription},null,8,["redeem-description"])):n("",!0),S(de,{class:"prize-main-action",link:t(e).redemptionLink,label:t(r),"prize-id":t(e).prizeId},null,8,["link","label","prize-id"]),t(e).voucherCode?(a(),_(ue,{key:4,"prize-id":t(e).prizeId,"copy-content":t(e).voucherCode,"display-on-top":""},null,8,["prize-id","copy-content"])):n("",!0),S(O,{"wallet-type":"google","wallet-card":t(o),show:""},null,8,["wallet-card"]),S(O,{"wallet-type":"apple","wallet-card":t(o),show:""},null,8,["wallet-card"]),S(pe)],64))}}),fe=M(ve,[["__scopeId","data-v-4b9ccb17"]]),be={key:0,class:"prize-details__title"},ye={key:1,class:"prize-details__username"},Ce={class:"prize-card__title"},ze={key:0,class:"prize-card__expiry-date"},Ie={key:1,class:"prize-card__description"},De={class:"prize-card__action"},we=["disabled"],Pe=R({__name:"PrizeCard",props:{cardItem:{}},setup(p){const e=p,{updatePrizeCard:o}=q(),{getUserFullName:s}=V(le()),{getConfigData:i,getLabels:r}=z(),l=v(()=>E(e.cardItem.expiryDate)),c=v(()=>e.cardItem.expiryDate?Y(e.cardItem.expiryDate):""),u=C(0),b=()=>{u.value+=1};U(()=>{b()});const{modalVisible:I,requestCloseModal:D,requestOpenModal:W}=ie({name:"prize-details",priority:"manual"}),A=()=>{o(e.cardItem),W()};
1return(h,g)=>(a(),_(oe,{"modal-visible":t(I),"close-modal":t(D),"close-modal-label":t(r).closeRewardModalLabel,"image-src":h.cardItem.image,"barcode-url":h.cardItem.barcodeUrl,"images-metadata":h.cardItem.imagesMetadata,name:h.cardItem.name,"is-expired":l.value},{"modal-header":w(()=>[h.cardItem.detailsTitle?(a(),d("h3",be,m(h.cardItem.detailsTitle),1)):n("",!0),t(s)&&t(i)?.enableUserDetailsOnVoucher?(a(),d("h4",ye,m(t(s)),1)):n("",!0)]),"modal-content":w(()=>[S(fe)]),"card-header":w(()=>[x("h3",Ce,m(h.cardItem.name),1)]),"card-content":w(()=>[l.value?(a(),d("span",ze,m(t(r).prizeExpiredLabel)+": "+m(c.value),1)):n("",!0),!l.value&&h.cardItem.description?(a(),d("div",Ie,[(a(),_(ne,{key:u.value,"text-content":h.cardItem.description},null,8,["text-content"]))])):n("",!0),x("div",De,[Q(x("button",{class:"button-secondary",disabled:l.value,onClick:A},m(t(r).digitalWalletRewardsClaimRewardLabel),9,we),[[j,t(r).digitalWalletRewardsClaimRewardLabel]])])]),_:1},8,["modal-visible","close-modal","close-modal-label","image-src","barcode-url","images-metadata","name","is-expired"]))}}),F=M(Pe,[["__scopeId","data-v-595d0b9a"]]),Se=["href"],B=3,ke=R({__name:"DigitalWalletPrizes",setup(p){const{getVouchers:e}=V(k()),o=z(),{getLabels:s}=o,{allPrizes:i}=o.getConfigData?.urls||{};return(r,l)=>(a(),d(L,null,[t(e).length?(a(),_(H,{key:0},{default:w(()=>[(a(!0),d(L,null,N(t(e).slice(0,B),c=>(a(),_(F,{key:c.prizeId,"card-item":c},null,8,["card-item"]))),128))]),_:1})):n("",!0),t(e).length>B?(a(),d("a",{key:1,href:t(i),class:"button-secondary digital-wallet-prizes__button"},m(t(s).digitalWalletRewardsViewAllRewardsLabel),9,Se)):n("",!0)],64))}}),Le=9,Re=6,Ve=R({__name:"DigitalWalletAllPrizes",setup(p){const{getLabels:e}=z(),{getVouchers:o}=V(k()),s=ee()?Le:Re,i=C(s),r=()=>{i.value+=s};return(l,c)=>(a(),d(L,null,[t(o).length?(a(),_(H,{key:0},{default:w(()=>[(a(!0),d(L,null,N(t(o).slice(0,i.value),u=>(a(),_(F,{key:u.prizeId,"card-item":u},null,8,["card-item"]))),128))]),_:1})):n("",!0),t(o).length>i.value?(a(),d("button",{key:1,class:"button--secondary-black digital-wallet-all-prizes__button",onclick:r},m(t(e).digitalWalletRewardsLoadMoreRewardsLabel),1)):n("",!0)],64))}}),xe={key:0,class:"digital-wallet-prizes"},Ee={key:0,class:"digital-wallet-prizes__title"},We={key:1,class:"digital-wallet-prizes__description"},Me=R({__name:"App",props:{globalProps:{},vouchersStoreProps:{}},setup(p){const e=p;z().updateConfigData(e.globalProps),k().updateStoreData(e.vouchersStoreProps);const o=z(),{getLabels:s}=o,{fetchVouchers:i}=k(),{getState:r,getVouchers:l}=V(k()),c=v(()=>l.value.length?s.digitalWalletRewardsDescription:s.digitalWalletRewardsNoPrizesMessage),u=v(()=>e.globalProps?.prizesPreviewMode?ke:Ve),b=K();return U(()=>{b&&i()}),(I,D)=>t(b)?(a(),d("div",xe,[t(s).digitalWalletRewardsTitle?(a(),d("h2",Ee,m(t(s).digitalWalletRewardsTitle),1)):n("",!0),c.value?(a(),d("p",We,m(c.value),1)):n("",!0),t(r)==="READY"?(a(),_(J(u.value),{key:2})):n("",!0),t(r)==="LOADING"?(a(),_(se,{key:3})):n("",!0),t(r)==="ERROR"?(a(),_($,{key:4})):n("",!0)])):(a(),_($,{key:1}))}}),Ae=M(Me,[["__scopeId","data-v-a2211cbb"]]),st=async p=>{const{parsedGeneralData:e,promoPlusConfig:o}=te(p),s=p.getAttribute("id"),i={globalProps:{labels:e.labels||{},ngpsConfig:o,enableDynamicConfigurationIds:e.enableDynamicConfigurationIds,enableExpiringWallet:e.enableExpiringWallet,enableAppleWallet:e.enableAppleWallet,enableGoogleWallet:e.enableGoogleWallet,enableUserDetailsOnVoucher:e.enableUserDetailsOnVoucher,appId:s,reCaptchaSiteKey:e.reCaptchaSiteKey,appleWallet:e.appleWallet,googleWallet:e.googleWallet,allowedConfigurationIds:e.allowedConfigurationIds,promoDescription:e.promoDescription,prizesPreviewMode:e.prizesPreviewMode,urls:e.urls},vouchersStoreProps:{filteringVouchersByStatus:e.filteringVouchersByStatus,filteringPrizeIDs:e.filteringPrizeIDs}},r=X(Ae,i),l=Z();r.use(l),r.mount(`#${s}`)};export{st as init};
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.