PageSourceSearch

https://wbk-assets.webook.com/0.7.8.2/assets/vouchers-BxK9UJED.js

js webook.com collected 2026-10-03 20:45:23 UTC 6,937 bytes, 1 lines download raw bytes

1import{j as e,e as j}from"./@wbk/hooks-FtCTMeyH.js";import{L as h,r as b}from"./vendor-Cc9w-i99.js";import{T as r,l as N,R as y,$ as _,B as c,D as w,f as S}from"./@wbk/ui-DZdD23Ta.js";import{ck as P}from"./@wbk/queue-8-09eRJS.js";import{u as m,g as L,G as k,A as C,S as T}from"./index-DZ2Htu0z.js";import{bm as G,am as R,y as E}from"./@wbk/svg-Bua7FxzL.js";import{useAuth as f}from"./@wbk/auth-Djoddyo0.js";import{C as x}from"./@wbk/currency-BxlCDaIM.js";import{cG as V}from"./@wbk/api-DFKMxA3e.js";import{u as d}from"./react-i18next-Dxy0wzdl.js";import"./@wbk/config-DuwrGB8a.js";import"./@wbk/logger-DfNVpG3P.js";import"./react-hook-form-D_m77UuM.js";import"./i18next-Ce0fiPMx.js";import"./i18next-http-backend-C2uFdLra.js";import"./i18next-browser-languagedetector-Bv2FoO1s.js";import"./react-helmet-BcOPeyN0.js";import"./@wbk/analytics-B-_ZPhJq.js";import"./@wbk/contentful-C-wfS48z.js";import"./@wbk/ticketing-Og7zkUfp.js";import"./@wbk/payment-cL5x8D1N.js";import"./@wbk/flights-Cjxxns74.js";import"./@wbk/hotels-CFdSoV_6.js";import"./@smc/ads-C1pDiBF5.js";import"./@wbk/auction-CsNezADS.js";const A=({voucherOrder:s})=>{var i;const{t:a}=d("profile"),{user:l}=f(),t=s.transfer_status===V.PENDING,o=((i=s.sender)==null?void 0:i._id)===(l==null?void 0:l._id);return t?e.jsx(I,{variant:o?"sending":"pending",title:a(o?"profile:vouchers.sending":"profile:vouchers.pending")}):null},I=({variant:s,title:a})=>{const l=s==="sending"?e.jsx(G,{className:"h-3 w-3 object-contain"}):e.jsx(R,{className:"h-3 w-3 object-contain"}),t=s==="sending"?"#0B2365":"#894B00";return e.jsxs("div",{className:"rounded-S flex w-fit items-center gap-1 px-2 py-1",style:{backgroundColor:t},children:[l,e.jsx("div",{children:e.jsx(r,{variant:"label-XS",children:a})})]})},M=({voucherOrder:s})=>{const{user:a}=f(),{locale:l}=m(),{t}=d("profile"),o=Number(s.voucher.points)>0?Math.min(100,s.useable_balance/Number(s.voucher.points)*100):0;return e.jsxs("div",{className:"rounded-M bg-body-level-1 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-4 p-5",children:[e.jsx(N,{src:s.voucher.poster,alt:"voucher-order-poster",className:"rounded-XS aspect-1 h-12 w-12 object-cover"}),e.jsxs("div",{children:[e.jsx(r,{variant:"label-M",children:s.voucher.name}),e.jsx(r,{variant:"body-XS",color:"text-secondary",children:t("profile:vouchers.expiry_date",{date:j(s.voucher.expiry_date,l,{dateStyle:"long"})})})]})]}),e.jsxs("div",{className:"relative flex flex-col gap-4 p-5",children:[e.jsx(B,{}),s.status==="active"&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-1",children:[e.jsx(r,{variant:"label-XS",color:"text-secondary",children:t("profile:vouchers.balance",{text:s.useable_balance>=Number(s.voucher.points)?t("profile:vouchers.totally_used"):s.voucher.usage==="multiple"?t("profile:vouchers.multi_use"):s.voucher.usage==="single"?t("profile:vouchers.single_use"):""})}),e.jsxs("div",{className:"text-text-secondary flex items-center gap-1",children:[e.jsx(x,{originalPrice:s.useable_balance,currency:s.voucher.currency,priceClassName:"text-sm"}),e.jsx("span",{children:"/"}),e.jsx(x,{originalPrice:s.voucher.points,currency:s.voucher.currency,priceClassName:"text-sm"})]})]}),e.jsx("div",{className:"bg-action/20 relative h-0.5 w-full overflow-hidden",children:e.jsx("div",{className:"bg-primary absolute top-0 h-full w-full transition-all duration-300 ease-in-out ltr:left-0 rtl:right-0",style:{width:`${o}%`}})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"min-h-1 grow",children:e.jsx(A,{voucherOrder:s})}),e.jsx(y,{size:"4xl",title:t("profile:vouchers.how_to_access"),cancel:!1,action:!1,render:({open:i})=>e.jsx(c,{onClick:i,theme:"action",shape:"text",className:"p-0.5",children:e.jsx(r,{variant:"link-S",children:t("profile:vouchers.view_voucher")})}),body:()=>e.jsx(_,{appstore:C,playstore:k,huawei:L,email:a==null?void 0:a.email,withTitle:!1,padding:20})})]})]})]})},B=()=>e.jsxs("div",{className:"absolute left-0 top-0 w-full px-7",children:[e.jsx(w,{className:"border-body w-full border-dashed"}),e.jsx("div",{className:"bg-body absolute -left-5 top-0 h-7 w-7 -translate-y-1/2 rotate-45 rounded-sm"}),e.jsx("div",{className:"bg-body absolute -right-5 top-0 h-7 w-7 -translate-y-1/2 rotate-45 rounded-sm"})]}),D=({vouchersOrders:s=[]})=>{const{locale:a}=m(),{t:l}=d("profile");return s.length?e.jsx("div",{className:"space-y-5",children:s.map((t,o)=>e.jsx(M,{voucherOrder:t},o))}):e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 lg:py-6",children:[e.jsx(E,{className:"h-12 w-12 shrink-0"}),e.jsx(r,{variant:"heading-S",className:"lg:text-heading-M text-center font-semibold",children:l("profile:vouchers.no_vouchers")}),e.jsx(c,{as:h,to:`/${a}/vouchers`,shape:"text",type:"button",theme:"action",children:e.jsx(r,{variant:"link-M",children:l("profile:vouchers.explore")})})]})},U=()=>e.jsx("div",{className:"rounded-M bg-body-level-1 animate-pulse pb-24",children:e.jsxs("div",{className:"flex items-center gap-2.5 p-5",children:[e.jsx("div",{className:"rounded-XS bg-paper-level-2 aspect-[1] h-12 w-12"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("div",{className:"bg-paper-level-2 h-3 w-32 rounded"}),e.jsx("div",{className:"bg-paper-level-2 h-2 w-24 rounded"})]})]})}),pe=()=>{const{locale:s}=m(),{t:a}=d(["profile","common"]),[l,t]=b.useState("available"),{data:o,isLoading:i,error:n,fetchNextPage:v,hasNextPage:p,isFetchingNextPage:g}=P({lang:s,status:l});return n?e.jsx("section",{className:"mx-auto max-w-lg py-20",children:e.jsxs("div",{className:"bg-body-level-1 flex flex-col items-center justify-center space-y-8 rounded-lg p-10 text-center",children:[e.jsx(r,{variant:"label-L",color:"error",children:(n==null?void 0:n.message)||a("common:unknown_error")}),e.jsx(c,{as:h,to:`/${s}`,theme:"white",shape:"outlined",className:"w-full text-lg",children:a("common:go_home")})]})}):e.jsxs(e.Fragment,{children:[e.jsx(T,{title:a("profile:vouchers.vouchers")}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(r,{variant:"heading-L",as:"h1",children:a("profile:vouchers.vouchers")}),e.jsx(S,{label:"",type:"single",value:l,disabled:i,onChange:u=>{u&&t(u)},options:[{text:a("profile:vouchers.available"),value:"available"},{text:a("profile:vouchers.past"),value:"past"}],groupClassName:"border-b border-paper",className:"data-[state=on]:border-paper-level-3 max-w-fit justify-start rounded-none border-x-0 border-t-0 bg-none text-start data-[state=off]:border-0 data-[state=on]:border-b-2 data-[state=on]:bg-transparent"}),i?e.jsx(U,{}):e.jsxs(e.Fragment,{children:[e.jsx(D,{vouchersOrders:o==null?void 0:o.vouchers}),e.jsx("div",{className:"text-center",children:e.jsx(c,{theme:"action",shape:"outlined",className:"w-full max-w-[200px]",loading:g,disabled:!p,onClick:()=>v(),children:a(p?"common:load_more":"common:no_load_more")})})]})]})]})};export{pe as default};

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.