PageSourceSearch

https://eraspace.com/_next/static/chunks/8393-2cb459c723cb264c.js

js eraspace.com collected 2026-10-03 20:38:17 UTC 46,146 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8393],{45452:function(e,a,l){l.d(a,{ey:function(){return g},f6:function(){return x},Wi:function(){return y},Hd:function(){return j},$W:function(){return b},dq:function(){return f}});var n=l(89788),s=l(87801),i=l(70468),t=l(49358);let r=(0,s.Z)({baseURL:"".concat("https://jeanne.eraspace.com/partners","/v1"),config:{includeEpochArticle:!0,includeSignatureArticle:!0,includeDeviceInfoArticle:!0,includeSource:!0,isAuth:!0}}),o=async e=>{let{limit:a,category_id:l,search:s,unlocked:i,locked:o,tier:d}=e,u=(0,t.yI)({limit:a,size:100,categoryId:l,name:s,unlocked:i,locked:o,tier:d});return(0,n.ZP)(()=>r.get("/vouchers".concat(u)))},d=async e=>{let{limit:a,category_id:l,search:s}=e,i=(0,t.yI)({limit:a,category_id:l,keyword:s});return(0,n.ZP)(()=>r.get("/vouchers/me".concat(i)))},u=async()=>(0,n.ZP)(()=>r.get("/vouchers/categories")),c=()=>(0,n.ZP)(()=>r.get("/crm/voucher/list")),m=()=>(0,n.ZP)(()=>r.get("/vouchers/count")),h=async e=>{let{page:a,size:l,start_date:s,end_date:o,category:d}=e,u=(0,t.yI)({page:a,size:l,startDate:s,endDate:o,type:d});return(0,n.ZP)(()=>r.get("/point/history".concat(u),{headers:{Platform:"".concat(i.Hx,"-web")}}))};var v=l(36492);let p={all:["partners"],get voucherCategories(){return[...this.all,"voucher-categories"]},vouchers(e){return[...this.all,"vouchers",e]},vouchersCRM(){return[...this.all,"vouchers-crm"]},vouchersTotal(){return[...this.all,"total-voucher"]}},x=e=>(0,v.a)(p.vouchers(e),()=>o(e)),g=e=>(0,v.a)(p.vouchers(e),()=>d(e),{retryOnMount:!1,staleTime:1/0}),b=()=>(0,v.a)(p.voucherCategories,()=>u()),f=()=>(0,v.a)(p.vouchersCRM(),()=>c()),j=()=>(0,v.a)(p.vouchersTotal(),()=>m()),y=e=>(0,v.a)({queryKey:["PointHistory",e],queryFn:()=>h(e),enabled:!!e.category})},62904:function(e,a,l){l.d(a,{QC:function(){return u},YT:function(){return c},yT:function(){return m}});var n=l(87801),s=l(89788),i=l(70468);let t=(0,n.Z)({baseURL:"".concat("https://jeanne.eraspace.com/promos","/v1/promo"),config:{isAuth:!0,includeXSource:!0,includePlatform:!0,includeSource:!0,includeSignature:!0,includeDeviceInfo:!0,includeEpoch:!0}}),r=(0,n.Z)({baseURL:"".concat("https://jeanne.eraspace.com/promos","/v2/promo"),config:{isAuth:!0,includeXSource:!0,includePlatform:!0,includeSource:!0,includeDeviceInfo:!0,includeEpoch:!0,includeSignature:!0}}),o=(0,n.Z)({baseURL:"".concat("https://jeanne.eraspace.com/promos","/v2.1/"),config:{isAuth:!0,includeXSource:!0,includePlatform:!0,includeSource:!0,includeDeviceInfo:!0,includeEpoch:!0,includeSignature:!0}}),d={"X-Auth-Signature":i.Wp},u=e=>(0,s.ZP)(()=>r.post("/list",{sku:e},{headers:d})),c=e=>(0,s.ZP)(()=>t.get("/".concat(e,"?v=2"),{headers:d})),m=e=>(0,s.ZP)(()=>o.get("/vouchers/pmp",{params:e,headers:d}))},12855:function(e,a,l){l.d(a,{Z:function(){return h}});var n=l(85893),s=l(15188),i=l(23866),t=l(38568),r=l(94341),o=l(71077),d=l(97570),u=l(8206),c=l(41664),m=l.n(c);function h(){let e=(0,u.Z)();return(0,n.jsx)(r.Z,{size:e?"xs":"lg",isOpen:!0,className:"flex items-center justify-center p-6 !h-fit pt-10",classNameContent:"p-0 w-full",children:(0,n.jsxs)(i.Z,{dir:"column",gap:8,className:"text-center w-full",children:[(0,n.jsx)(o.Z,{src:"/illustration/waktu-transaksi-habis.svg",width:182,height:182,alt:"Checkout error",className:"mx-auto"}),(0,n.jsxs)(i.Z,{dir:"column",gap:4,className:"text-center w-full",children:[(0,n.jsx)(t.Z,{className:"text-xl font-bold text-center",children:"Waktu Transaksi Habis"}),(0,n.jsx)(d.Z,{className:"text-sm text-center","data-testid":"qa-pagesuccess-orderexpired",children:"Maaf, waktu pembayaran transaksi sudah habis. Silakan ulangi pemesanan kamu."})]}),(0,n.jsx)(m(),{href:"/",children:(0,n.jsx)(s.Z,{size:"large",variant:"primary",className:"w-full",children:"Kembali ke Halaman Utama"})})]})})}},42659:function(e,a,l){var n=l(85893),s=l(97570),i=l(67294),t=l(17124),r=l(8206),o=l(98388);a.Z=(0,i.memo)(function(e){let{children:a,expired:l,onFinish:d,idTest:u,className:c=""}=e,m=(0,r.Z)(),[h,v]=(0,i.useState)(null),[p,x]=(0,i.useState)(0),[g,b]=(0,i.useState)(0),[f,j]=(0,i.useState)(0),y=e=>{let a=new Date(e).getTime();a-new Date().getTime()<0?v(!1):v(!0);let l=setInterval(()=>{let e=a-new Date().getTime();x(Math.floor(e/36e5%24)),b(Math.floor(e%36e5/6e4)),j(Math.floor(e%6e4/1e3)),e<0&&(clearInterval(l),v(!1),b(0),j(0))},1e3)};return(0,i.useEffect)(()=>{l&&y(l)},[l]),(0,i.useEffect)(()=>{!1===h&&d&&d()}
1,[h]),(0,n.jsxs)(t.xu,{className:(0,o.m6)("flex w-full ".concat(m?"flex-col":"justify-between items-center"),c),children:[a,(0,n.jsxs)(s.Z,{className:"font-bold text-sm shrink-0","data-testid":u,children:[p>0&&"".concat(p," jam")," ",g<10?"0".concat(g," menit"):"".concat(g," menit")," ",f<10?"0".concat(f," detik"):"".concat(f," detik")]})]})})},80934:function(e,a,l){l.d(a,{Z:function(){return ex}});var n=l(85893),s=l(45793),i=l(41704),t=l(15188),r=l(97689),o=l(23866),d=l(94341),u=l(5740),c=l(97570),m=l(47919),h=l(8206),v=l(48583),p=l(67294),x=l(91341),g=l(5778),b=l(40669),f=l(89788),j=l(87801);let y=(0,j.Z)({baseURL:"".concat("https://jeanne.eraspace.com/orders","/v1/crm"),config:{isAuth:!0,includeXSource:!0}}),k=(0,j.Z)({baseURL:"".concat("https://jeanne.eraspace.com/orders","/v2/crm"),config:{isAuth:!0,includeXSource:!0,includePlatform:!0}}),N=e=>(0,f.ZP)(()=>y.post("/voucher/redeem/",e)),Z=e=>(0,f.ZP)(()=>y.post("/voucher/release/",e)),_=e=>(0,f.ZP)(()=>k.post("/promo/redeem",e)),w=e=>(0,f.ZP)(()=>k.post("/promo/release",e)),C=e=>(0,f.ZP)(()=>y.post("/point/redeem",e)),S=e=>(0,f.ZP)(()=>y.post("/point/release",e)),L=e=>(0,f.ZP)(()=>y.post("/giftcard/validate",e)),M=e=>(0,f.ZP)(()=>y.post("/giftcard/redeem",e)),P=e=>(0,f.ZP)(()=>y.delete("/giftcard/release/".concat(e.reference_id,"?order_number=").concat(e.order_number)));var O=l(48228);function q(){return(0,O.D)(e=>N(e))}function D(){return(0,O.D)(e=>Z(e))}function z(){return(0,O.D)(e=>_(e))}function E(){return(0,O.D)(e=>w(e))}var R=l(20472),I=l(70468),F=l(19511),Q=l(64640),A=l(87536);function T(e){let{data:a,isLoading:l,error:s,onRelease:i}=e;return(0,n.jsxs)(o.Z,{dir:"column",gap:1,className:"border border-stroke rounded-sm pt-3 pb-2 px-3",children:[(0,n.jsxs)(o.Z,{items:"center",justify:"between",children:[(0,n.jsx)(o.Z,{dir:"column",children:(0,n.jsxs)(o.Z,{dir:"column",children:[(0,n.jsx)(c.Z,{className:"text-gray",children:"Kode Giftcard"}),(0,n.jsx)(c.Z,{className:"text-sm font-semibold",children:a.card_number})]})}),(0,n.jsx)(o.Z,{dir:"column",children:(0,n.jsxs)(o.Z,{dir:"column",children:[(0,n.jsx)(c.Z,{className:"text-gray",children:"Diskon yang Didapat"}),(0,n.jsx)(c.Z,{className:"text-sm font-semibold",children:(0,Q.b7)(a.amount)})]})}),(0,n.jsx)(t.Z,{isLoading:l,onClick:()=>i(a.id),variant:"outline",children:"Batalkan"})]}),s&&(0,n.jsx)(c.Z,{className:"text-danger",children:s})]})}var B=(0,p.memo)(function(e){var a,l,s,i;let{redeemedGiftCards:r,orderDetail:d,onSetRedeemed:u}=e,m=(0,F.w)(null==d?void 0:d.id),h=(0,O.D)(e=>L(e)),v=(0,O.D)(e=>M(e)),x=(0,O.D)(e=>P(e)),{watch:g,control:b,reset:f,handleSubmit:j}=(0,A.cI)({mode:"onTouched",defaultValues:{code:"",pin:""}}),y=g("code"),k=g("pin"),N=e=>{d&&v.mutate({code:y,pin:k,order_number:d.order_number,redeem_amount:e.available_amount,bill_amount:e.max_amount},{onSuccess:e=>{let{data:a}=e;u("add",a),f(),m()}})};(0,p.useEffect)(()=>{h.isSuccess&&h.data.data&&N({available_amount:h.data.data.available_amount,max_amount:h.data.data.max_amount})},[h.isLoading,h.data]);let Z=(0,p.useCallback)(e=>{d&&x.mutate({order_number:d.order_number,reference_id:e.id},{onSuccess:()=>{u("remove",e),m()}})},[r,d]),_=(0,p.useMemo)(()=>[{name:"code",label:"Kode Gift Card",placeholder:"Masukkan Kode Gift Card"},{name:"pin",label:"PIN",placeholder:"Masukkan PIN"}],[]);return(0,n.jsxs)(o.Z,{dir:"column",gap:3,children:[(v.error||x.error)&&(0,n.jsx)(c.Z,{className:"text-danger",children:(null===(a=x.error)||void 0===a?void 0:a.message)||(null===(l=v.error)||void 0===l?void 0:l.message)}),(null==h?void 0:null===(s=h.error)||void 0===s?void 0:s.message)&&(0,n.jsx)(c.Z,{"data-testid":"qa-order-alertgc",className:"text-danger",children:null==h?void 0:null===(i=h.error)||void 0===i?void 0:i.message}),(0,n.jsxs)("form",{onSubmit:j(e=>{if(!d)return;let{code:a,pin:l}=e;h.mutate({code:a,pin:l,order_number:d.order_number})}),children:[(0,n.jsx)(o.Z,{dir:"column",gap:2,className:"mb-4",children:_.map(e=>(0,n.jsx)(A.Qr,{control:b,name:e.name,render:a=>{var l,s;let{field:i,fieldState:t}=a;return(0,n.jsx)(R.Z,{"data-testid":"code"===e.name?"qa-order-inputkodegc":"qa-order-inputpingc",disabled:h.isLoading||v.isLoading||x.isLoading,error:null===(l=t.error)||void 0===l?void 0:l.message,isInvalid:!!(null===(s=t.error)||void 0===s?void 0:s.message),size:"small",label:e.label,placeholder:e.placeholder,isRequired:!0,...i,onChange:e=>{let{value:a}=e.target;if(""!==a&&!1===I.AQ.test(a)){i.onChange("");return}i.onChange(a)}})},rules:{required:{value:!0,message:"Wajib diisi"},pattern:{value:I.AQ,message:"Inputan harus berupa daftar angka"}}},e.name))}),(0,n.jsx)(t.Z,{"data-testid":"qa-order-buttongunakan",disabled:!y||!k,className:"self-end",isLoading:h.isLoading||v.isLoading,type:"submit",size:"small",variant:"default",children:"Gunakan"})]}),r.length>0&&r.map(e=>{var a,l,s;return(0,n.jsx)(T,{data:e,isLoading:e.id===(null===(a=x.variables)||void 0===a?void 0:a.reference_id)&&x.isLoading,error:e.id===(null===(l=x.variables)||void 0===l?void 0:l.reference_id)&&(null===(s=x.error)||void 0===s?void 0:s.message)||"",onRelease:()=>Z(e)},e.id)})]})}),K=l(18847),V=l(60483),X=l(70439);let U={required:{value:!0,message:"Wajib diisi"},pattern:{value:I.AQ,message:"Inputan harus berupa angka"}};var H=(0,p.memo)(function(e){var a,l,s,d;
1let{orderDetail:m,redeemMutation:h,releaseMutation:v}=e,p=(0,F.w)(null==m?void 0:m.id),x=(0,X.JP)(),b=(0,X.KH)(),{watch:f,control:j,resetField:y,handleSubmit:k,formState:{errors:N}}=(0,A.cI)({mode:"onTouched",defaultValues:{point:0}}),Z=(0,V.Z)(!0),_=f("point"),w=e=>{m&&"number"==typeof e.point&&h.mutate({order_number:m.order_number,point:e.point},{onSuccess:()=>{p(),b()}})},C=()=>{m&&v.mutate({order_number:m.order_number},{onSuccess:()=>{h.reset(),p(),b()}})},S=()=>{var e,a;return(0,n.jsxs)("form",{onSubmit:k(w),children:[(0,n.jsxs)(o.Z,{gap:2,className:"w-full",children:[(0,n.jsx)(A.Qr,{control:j,name:"point",render:e=>{var a;let{field:l,fieldState:s}=e;return(0,n.jsx)(R.Z,{dataTestIdLabel:"qa-order-inputpoint",disabled:h.isLoading||v.isLoading,isInvalid:!!(null===(a=s.error)||void 0===a?void 0:a.message),size:"small",label:"Isi Poin yang akan digunakan",isRequired:!0,...l,onChange:e=>{let{value:a}=e.target;if(""!==a&&!I.AQ.test(a))return;let n=parseInt(a);l.onChange(Number.isNaN(n)?"":n)},onFocus:()=>{0===l.value&&y("point",{defaultValue:0})},onBlur:e=>{""===e.target.value&&y("point",{defaultValue:0})}})},rules:U}),(0,n.jsx)(t.Z,{"data-testid":"qa-order-buttongunakan",disabled:!_,className:"self-end",isLoading:h.isLoading,type:"submit",size:"small",variant:"default",children:"Gunakan"})]}),(null===(e=N.point)||void 0===e?void 0:e.message)&&(0,n.jsx)(c.Z,{className:"text-danger",children:null===(a=N.point)||void 0===a?void 0:a.message})]})};return(0,n.jsxs)(o.Z,{dir:"column",gap:3,children:[(0,n.jsxs)(o.Z,{justify:"between",children:[(0,n.jsx)(c.Z,{className:"text-sm",children:"Poin Saya"}),x.isLoading?(0,n.jsx)(r.Z,{width:100,height:21}):(0,n.jsx)(c.Z,{"data-testid":"qa-order-customerpoint",className:"text-sm font-semibold",children:(0,Q.uf)(null===(l=x.data)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:a.memberPoint)})]}),(0,n.jsx)(u.Z,{}),(()=>{if(h.data){var e;return(0,n.jsx)(i.Z,{className:"border border-stroke rounded-sm p-3",children:(0,n.jsxs)(o.Z,{items:"center",justify:"between",children:[(0,n.jsxs)(o.Z,{dir:"column",gap:1,children:[(0,n.jsx)(c.Z,{className:"text-gray",children:"Jumlah poin yang digunakan"}),(0,n.jsx)(c.Z,{className:"text-sm font-semibold",children:null===(e=h.data.data)||void 0===e?void 0:e.point_redeemed})]}),(0,n.jsx)(t.Z,{isLoading:v.isLoading,variant:"outline",onClick:C,children:"Batalkan"})]})})}return S()})(),(0,n.jsx)(c.Z,{"data-testid":"qa-order-alertpoint",className:"text-danger",children:(null===(s=h.error)||void 0===s?void 0:s.message)||(null===(d=v.error)||void 0===d?void 0:d.message)}),(0,n.jsxs)(o.Z,{dir:"column",children:[(0,n.jsxs)(o.Z,{justify:"between",children:[(0,n.jsx)(c.Z,{className:"font-semibold",children:"Syarat & Ketentuan"}),(0,n.jsx)(K.Z,{ariaLabel:"Toggle",size:"x-small",variant:"unstyled",icon:(0,n.jsx)(g.Z,{name:Z.isOpen?"chevron-up":"chevron-down"}),onClick:Z.onToggle})]}),Z.isOpen&&(0,n.jsxs)("ul",{className:"list-disc list-inside",children:[(0,n.jsx)("li",{children:"Poin akan berkurang setelah Anda klik tombol “Gunakan Poin”."}),(0,n.jsx)("li",{children:"Pastikan Anda melanjutkan transaksi sampai pembayaran jika sudah menggunakan poin."}),(0,n.jsx)("li",{children:"Silakan klik tombol “Batalkan” untuk membatalkan penggunaan poin."}),(0,n.jsx)("li",{children:"Poin akan otomatis kembali jika status transaksi Anda “Batal”. Jika poin tidak kembali silahkan hubungi customer care."})]})]})]})}),G=l(17124),J=l(98388);function W(e){let{type:a="pmp",title:l="[title]",expired_at:s="Berlaku hingga [expired at]",disabled:i=!1,onOpenDetail:t=()=>null,isRedeemed:r=!1,isLoadingComponent:o=!1,isLoadingMutation:d=!1,onRedeem:u=()=>null,onRelease:c=()=>null,loading:m=null}=e;return o?m:(0,n.jsxs)(G.kC,{dir:"row",gap:0,items:"center",tabIndex:0,className:(0,J.m6)("overflow-clip rounded-lg w-full shadow-[0_4px_8px_0px_#33353814,0_1px_4px_0_#3335381F]",r?"bg-primary-light border-2 border-primary":"bg-white border border-[#D9D9D9]","pmp"===a?i?"bg-[#F7F7F7] h-[153px]":"h-[110px]":"h-fit"),children:[(0,n.jsx)(G.xu,{className:"bg-primary w-1 self-stretch"}),(0,n.jsxs)(G.kC,{dir:"column",className:"w-full h-full",children:[(0,n.jsxs)(G.kC,{dir:"row",gap:0,items:"center",justify:"between",className:"w-full h-full px-4 py-3",children:[(0,n.jsxs)(G.kC,{dir:"column",gap:3,className:"w-full",children:[(0,n.jsxs)(G.kC,{dir:"row",gap:3,items:"center",className:"w-full",children:[(0,n.jsx)("img",{src:"/icons/ticket-voucher.svg",width:27.76,alt:"Badge Discount"}),(0,n.jsxs)(G.kC,{dir:"column",children:[(0,n.jsx)(G.X6,{as:"h1",className:"text-dark",size:"sm",children:l}),(0,n.jsx)(G.xv,{className:"text-xs text-dark",children:s})]})]}),"pmp"===a&&(0,n.jsx)(G.zx,{type:"button",variant:"ghost",className:"w-fit px-0 min-w-0",onClick:t,children:(0,n.jsx)(G.xv,{className:"text-xs font-bold text-primary",children:"Lihat Detail"})})]}),(0,n.jsx)(G.zx,{type:"button",variant:"ghost",className:(0,J.m6)("px-4 py-[6.5px] bg-white text-xs font-bold disabled:!text-line disabled:border-[#
1E7E7E7]",r?"hover:!text-dark/70 !text-dark border-2 border-[#E7E7E7]":"hover:!text-primary/70 !text-primary border-2 border-primary"),disabled:i||d,isLoading:d,onClick:r?c:u,children:r?"Batalkan":"Pakai"})]}),i&&(0,n.jsx)(G.Z0,{className:"my-3 bg-stroke m-0 mx-auto max-w-[calc(100%-24px)]"}),i&&(0,n.jsx)(G.xv,{asParagraph:!0,className:"text-danger text-xs p-3",children:"Tidak dapat digabung dengan promo yang dipilih."})]})]})}var Y=l(60998),$=l(42659),ee=l(1491),ea=l(13701),el=l(25675),en=l.n(el),es=l(85945),ei=l(99039),et=l(45452);function er(e){var a,l,s,i;let{orderDetail:t,data:r,listParams:o,isOpen:u,isLoading:c,onClose:m,onOpenVoucherDetail:g,onCountdownFinished:b,withBackButton:f=!0,className:j=""}=e,y=(0,h.Z)(),k=(0,es.NL)(),N=(0,F.w)(null==t?void 0:t.id),Z=(0,F.Km)(null==t?void 0:t.id),_=z(),w=E(),C=q(),S=D(),{data:L}=(0,X.Zo)(),M=(0,et.dq)(),P=(0,v.b9)(Y.YU),[O,R]=(0,v.KO)(x.nX),[I,T]=(0,v.KO)(x.tu),B=(0,v.b9)(Y.VD),[K,V]=(0,p.useState)(!0),[U,H]=(0,p.useState)(!1),[el,er]=(0,p.useState)(!1),[eo,ed]=(0,p.useState)(null),[eu,ec]=(0,p.useState)(null),[em,eh]=(0,p.useState)({redeemed:"",release:""}),{watch:ev,handleSubmit:ep,register:ex,formState:{errors:eg},setValue:eb,clearErrors:ef}=(0,A.cI)({mode:"onSubmit"}),ej=ev("voucher_code"),ey=(0,p.useMemo)(()=>{var e,a,l;return null!==(l=null===(a=M.data)||void 0===a?void 0:null===(e=a.data)||void 0===e?void 0:e.items)&&void 0!==l?l:[]},[null===(a=M.data)||void 0===a?void 0:a.data]),ek=(0,p.useMemo)(()=>el?ey:null==ey?void 0:ey.slice(0,2),[el,ey]),eN=(0,p.useMemo)(()=>null!=r?r:[],[r]),eZ=(0,p.useMemo)(()=>U?eN:null==eN?void 0:eN.slice(0,2),[U,eN]),e_=(0,p.useCallback)((e,a)=>{var l,n;let s=null!==(l=null==e?void 0:e.message)&&void 0!==l?l:"";"input"===a?eh(e=>({...e,redeemed:s})):B({isShow:!0,message:null!==(n=null==e?void 0:e.message)&&void 0!==n?n:"",variant:"error"})},[B]),ew=(0,p.useCallback)(function(e,a){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t&&(ed({type:a,code:e}),_.mutate({order_number:t.order_number,voucher_code:e},{onSuccess:s=>{var i,r,o;if(N(),(0,ei.xQ)(t),null==s?void 0:s.data){let n=O.input,i=O.option;o={voucher_code:e,is_combinable:l,...null==s?void 0:s.data},"input"===a?n.set(null==o?void 0:o.voucher_code,o):i.set(null==o?void 0:o.voucher_code,o),R({input:n,option:i})}eh(()=>({release:"",redeemed:""})),eb("voucher_code",""),n||B({isShow:!0,message:null!==(r=null==s?void 0:null===(i=s.data)||void 0===i?void 0:i.success_message)&&void 0!==r?r:"Voucher berhasil di-redeem.",variant:"default"})},onError:e=>{e_(e,a)},onSettled:async()=>{ed(null),await Promise.all(o.map(e=>k.invalidateQueries({queryKey:["promo","checkout","list",e]})))}}))},[e_,o,t,k,_,O.input,O.option,N,R,eb,B]),eC=(0,p.useCallback)((e,a)=>{t&&(ed({type:a,code:e}),w.mutate({voucher_code:e,order_number:t.order_number},{onSuccess:l=>{var n,s;let i=O.input,t=O.option;"input"===a?i.delete(e):t.delete(e),N(),R({input:i,option:t}),eh(()=>({release:"",redeemed:""})),eb("voucher_code",""),B({isShow:!0,message:null!==(s=null==l?void 0:null===(n=l.data)||void 0===n?void 0:n.success_message)&&void 0!==s?s:"Voucher berhasil di-release.",variant:"default"})},onError:e=>{e_(e,a)},onSettled:async()=>{ed(null),_.reset(),await Promise.all(o.map(e=>k.invalidateQueries({queryKey:["promo","checkout","list",e]})))}}))},[e_,o,t,k,_,O.input,O.option,N,w,R,eb,B]),eS=(0,p.useCallback)(e=>{t&&ew(null==e?void 0:e.voucher_code,"input",!0)},[ew,t]),eL=(0,p.useCallback)(e=>{var a;if(!t)return;let l={code:e,order_number:t.order_number,email:(null==L?void 0:null===(a=L.data)||void 0===a?void 0:a.email)||""};S.reset(),ec(e),C.mutate(l,{onSuccess:a=>{var l,n;N(),(null==a?void 0:a.data)&&T({...null==a?void 0:a.data,voucher_code:e}),B({isShow:!0,message:null!==(n=null==a?void 0:null===(l=a.data)||void 0===l?void 0:l.message)&&void 0!==n?n:"Voucher berhasil di-redeem.",variant:"default"})},onError:e=>{var a;B({isShow:!0,message:null!==(a=null==e?void 0:e.message)&&void 0!==a?a:"",variant:"error"})},onSettled:()=>{ec(null)}})},[null==L?void 0:null===(l=L.data)||void 0===l?void 0:l.email,t,C,N,S,T,B]),eM=(0,p.useCallback)(e=>{var a;t&&(ec(e),S.mutate({code:e,order_number:t.order_number,email:(null==L?void 0:null===(a=L.data)||void 0===a?void 0:a.email)||""},{onSuccess:e=>{var a,l;T(null),N(),C.reset(),B({isShow:!0,message:null!==(l=null==e?void 0:null===(a=e.data)||void 0===a?void 0:a.message)&&void 0!==l?l:"Voucher berhasil di-release.",variant:"default"})},onSettled:()=>{ec(null)}}))},[null==L?void 0:null===(s=L.data)||void 0===s?void 0:s.email,t,C,N,S,T,B]),eP=(0,p.useCallback)(e=>{g(),P(e),y||m()},[g,m,P,y]),eO=(0,p.useCallback)(()=>{ef("voucher_code"),_.reset(),C.reset(),m()},[ef,m,C,_]);(0,p.useEffect)(()=>
1{if(!K||!(null==eZ?void 0:eZ.length)||O.option.size)return;let e=null==eZ?void 0:eZ.at(0);e&&(ew(null==e?void 0:e.voucher_code,"option",null==e?void 0:e.is_combinable,!0),V(!1))},[eZ,O.option.size,K]);let eq=(0,p.useMemo)(()=>{if(Z()||c&&!(null==eZ?void 0:eZ.length))return(0,n.jsx)(n.Fragment,{children:Array.from([,,,,,].keys()).map(e=>(0,n.jsx)(G.pO,{height:110,isRounded:!0,className:"w-full"},e))});let e=O.option,a=O.input,l=e.size,s=Array.from(e.values()).some(e=>!e.is_combinable);return null==eZ?void 0:eZ.map(i=>{let t=null==i?void 0:i.voucher_code,r=e.has(t),o=null==i?void 0:i.is_combinable,d=a.has(null==i?void 0:i.voucher_code),u=(null==eo?void 0:eo.type)==="option"&&(null==eo?void 0:eo.code)===(null==i?void 0:i.voucher_code);return(0,n.jsx)(W,{type:"pmp",title:null==i?void 0:i.title,expired_at:null==i?void 0:i.end_period,onOpenDetail:()=>eP(i),disabled:d||l>0&&(s?!r:!o),isLoadingMutation:u&&(_.isLoading||w.isLoading),isRedeemed:r,onRedeem:()=>ew(null==i?void 0:i.voucher_code,"option",o),onRelease:()=>eC(null==i?void 0:i.voucher_code,"option")},null==i?void 0:i.id)})},[ew,eC,Z,c,eP,null==eo?void 0:eo.code,null==eo?void 0:eo.type,_.isLoading,O.input,O.option,w.isLoading,eZ]),eD=(0,p.useMemo)(()=>M.isLoading?(0,n.jsx)(n.Fragment,{children:Array.from([,,,].keys()).map(e=>(0,n.jsx)(G.pO,{height:92,isRounded:!0},e))}):null==ek?void 0:ek.map(e=>{var a,l,s;let i=null==e?void 0:null===(a=e.valid_till)||void 0===a?void 0:a.split(" "),t=null!==(l=null==i?void 0:i.at(0))&&void 0!==l?l:"",r=null!==(s=(0,ee.p6)(t,"dd MMM yyyy"))&&void 0!==s?s:"",o=(null==e?void 0:e.code)===(null==I?void 0:I.code),d=eu===(null==e?void 0:e.code);return(0,n.jsx)(W,{type:"capi",title:null==e?void 0:e.series_name,expired_at:r?"Berlaku hingga ".concat(r):"",disabled:!!I&&!o,isLoadingMutation:d&&(C.isLoading||S.isLoading),isRedeemed:o,onRedeem:()=>eL(null==e?void 0:e.code),onRelease:()=>eM(null==e?void 0:e.code)},null==e?void 0:e.id)}),[eL,eM,eu,C.isLoading,I,S.isLoading,ek,M.isLoading]),ez=(0,p.useMemo)(()=>{var e;return(null==O?void 0:null===(e=O.input)||void 0===e?void 0:e.size)?Array.from(null==O?void 0:O.input,e=>{let[a,l]=e;return(0,n.jsx)(G.xu,{className:"border border-stroke rounded-sm p-3",children:(0,n.jsxs)(G.kC,{items:"center",justify:"between",children:[(0,n.jsxs)(G.kC,{dir:"column",gap:1,children:[(0,n.jsx)(G.xv,{className:"text-gray",children:"Diskon yang Didapat"}),(0,n.jsx)(G.xv,{className:"text-sm font-semibold",children:(null==l?void 0:l.voucher_amount_formatted)||""})]}),(0,n.jsx)(G.zx,{isLoading:w.isLoading,variant:"outline",onClick:()=>eC(a,"input"),className:"px-4 py-[6.5px] border-[1.5px]",children:"Batalkan"})]})},a)}):null},[eC,O,w.isLoading]),eE=(0,p.useMemo)(()=>(0,n.jsxs)(n.Fragment,{children:[f&&(0,n.jsx)(G.xu,{onClick:eO,"aria-hidden":"true",className:"absolute top-3 left-3 hover:cursor-pointer",children:(0,n.jsx)(ea.Z,{className:"w-6 text-dark"})}),(0,n.jsx)(G.xu,{children:(0,n.jsx)(G.X6,{as:"h1",size:"lg",children:"List Voucher"})})]}),[f,eO]),eR=(0,p.useMemo)(()=>{var e,a;let l=Array.from(O.input.values()),s=Array.from(O.option.values()),i=l.reduce((e,a)=>e+a.voucher_amount,0),r=s.reduce((e,a)=>e+a.voucher_amount,0),o=null!==(e=null==t?void 0:t.discount_pwp_amount)&&void 0!==e?e:0;return i||r||(null==I?void 0:I.amount)||o?(0,n.jsxs)(G.kC,{dir:"row",items:"center",justify:"between",className:"px-6 py-4 shadow-[0px_-1px_1px_0px_rgba(0 0,0,0.04)] border-t border-[#F1F1F1]",children:[(0,n.jsxs)(G.kC,{dir:"column",children:[(0,n.jsx)(G.X6,{as:"h2",className:"text-xs font-normal",children:"Kamu dapat potongan"}),(0,n.jsx)(G.X6,{as:"h3",size:"sm",children:(0,Q.b7)(i+r+(null!==(a=null==I?void 0:I.amount)&&void 0!==a?a:0)+o)})]}),(0,n.jsx)(G.zx,{variant:"primary",className:"py-[9px] px-6 h-full",onClick:m,children:(0,n.jsx)(G.X6,{as:"h3",className:"text-sm font-semibold leading-[22.4px]",children:"Lanjut Belanja"})})]}):null},[m,null==I?void 0:I.amount,O,null==t?void 0:t.discount_pwp_amount]),eI=(0,p.useMemo)(()=>{var e,a,l,s;let i=_.isLoading,r=!ej||!!(null===(e=eg.voucher_code)||void 0===e?void 0:e.message)||!!(null==em?void 0:em.redeemed)||i;return(0,n.jsxs)(G.kC,{dir:"column",className:(0,J.m6)("h-max bg-white",y&&"min-h-[calc(0.8*(100vh-52px))]"),children:[(0,n.jsxs)(G.kC,{className:"w-full bg-white",dir:"column",children:[(0,n.jsxs)(G.kC,{gap:2,className:(0,J.m6)("py-2 bg-warning-light",y?"px-3":"px-4"),items:"center",children:[(0,n.jsx)(G.PJ,{name:"card",className:"w-6 h-6"}),(0,n.jsx)($.Z,{expired:null==t?void 0:t.order_expired,onFinish:b,children:(0,n.jsx)(G.xv,{className:"md:text-sm",children:"Pilih metode pembayaran sebelum"})})]}),(0,n.jsxs)(G.kC,{dir:"column",gap:5,className:(0,J.m6)("w-full p-6",y&&"px-5"),children:[(0,n.jsx)("form",{onSubmit:ep(eS),children:(0,n.jsxs)(G.kC,{gap:2,className:"w-full",children:[(0,n.jsx)(G.Eg,{className:"h-10",errorDataTestId:"qa-order-alertvoucherpmp","data-testid":"qa-order-inputvoucherpmp",error:(null===(a=eg.voucher_code)||void 0===a?void 0:a.message)||(null==em?void 0:em.redeemed)||(null==em?void 0:em.release)||"",isInvalid:!(null==O?void 0:null===(l=O.input)||void 0===l?void 0:l.size)&&!!(null===(s=eg.voucher_code)||void 0===s?void 0:s.message),size:"small",placeholder:"Masukkan kode voucher",...ex("voucher_code",{required:{value:!0,message:"Wajib diisi"}}),onChange:e=>{var a;null===(a=ex("voucher_code"))||void 0===a||a.onChange(e),eh(()=>({release:"",redeemed:""}))}}),(0,n.jsx)(G.zx,{className:"h-10 border-2 border-primary bg-white text-sm font-bold text-primary hover:bg-stroke/20","data-testid":"qa-order-buttongunakan",isLoading:(null==eo?void 0:eo.type)==="input"&&(null==eo?void 0:eo.code)===ej&&_.isLoading,disabled:r,type:"submit",size:"small",variant:"default",children:"Gunakan"})]})}),ez]})]}),(0,n.jsx)(G.xu,{className:"h-1 w-full bg-line"}),(0,n.jsxs)(G.kC,{dir:"column",className:(0,J.m6)("h-full w-full bg-white"),children:[!!(null==eZ?void 0:eZ.length)&&(0,n.jsxs)(G.kC,{dir:"column",gap:y?4:5,className:(0,J.m6)("h-full w-full bg-white p-6",y&&"px-5"),children:[(0,n.jsx)(G.X6,{as:"h2",size:"lg",children:"Voucher Pilihan"}),eq,(null==eN?void 0:eN.length)>2&&(0,n.jsx)(G.kC,{dir:"column",items:"center",className:(0,J.m6)("w-full"),children:(0,n.jsx)(G.zx,{variant:"ghost",onClick:()=>H(e=>!e),className:"!text-primary w-fit px-4 py-[6.5px]",children:(0,n.jsxs)(G.kC,{gap:2,className:"w-fit",items:"center",children:[(0,n.jsx)(G.PJ,{name:U?"chevron-up":"chevron-down"}),(0,n.jsx)(G.X6,{className:"!font-bold text-xs",children:U?"Sembunyikan":"Lihat Lebih Banyak"})]})})})]}),!!(null==ey?void 0:ey.length)&&(0,n.jsx)(G.xu,{className:"h-1 w-full bg-line"}),!!(null==ey?void 0:ey.length)&&(0,n.jsxs)(G.kC,{dir:"column",gap:y?4:5,className:(0,J.m6)("h-full w-full bg-white p-6",y&&"px-5"),children:[(0,n.jsx)(G.X6,{as:"h2",size:"lg",children:"Voucher Khusus Untukmu"}),eD,(null==ey?void 0:ey.length)>2&&(0,n.jsx)(G.kC,{dir:"column",items:"center",className:(0,J.m6)("w-full"),children:(0,n.jsx)(G.zx,{variant:"ghost",onClick:()=>er(e=>!e),className:"!text-primary w-fit px-4 py-[6.5px]",children:(0,n.jsxs)(G.kC,{gap:2,className:"w-fit",items:"center",children:[(0,n.jsx)(G.PJ,{name:el?"chevron-up":"chevron-down"}),(0,n.jsx)(G.X6,{className:"!font-bold text-xs",children:el?"Sembunyikan":"Lihat Lebih Banyak"})]})})})]}),(!c||M.isLoading)&&!(null==eZ?void 0:eZ.length)&&!(null==ey?void 0:ey.length)&&(0,n.jsxs)(G.kC,{dir:"column",items:"center",justify:"center",gap:y?4:5,className:"w-full h-full bg-white py-6",children:[(0,n.jsx)(en(),{src:"/illustration/voucher-list-empty.svg",height:180,width:180,alt:"voucher-list-empty-icon"}),(0,n.jsx)(G.X6,{as:"h1",className:"text-dark text-sm leading-[22.4px] font-normal",children:"Kamu Belum Memiliki Voucher, nih"})]})]})]})},[_.isLoading,O,ej,null===(i=eg.voucher_code)||void 0===i?void 0:i.message,y,null==t?void 0:t.order_expired,b,ep,eS,null==em?void 0:em.redeemed,null==em?void 0:em.release,ex,null==eo?void 0:eo.type,null==eo?void 0:eo.code,ez,null==eZ?void 0:eZ.length,eq,null==eN?void 0:eN.length,U,null==ey?void 0:ey.length,eD,el,c,M.isLoading]);return y?(0,n.jsx)(d.W,{isOpen:u,onClose:eO,header:{label:"List Voucher",icon:"close",iconOnClick:eO},footer:eR,fullscreen:!0,blocking:!0,className:"p-0",headerClassName:"py-4 px-1",children:eI}
1):(0,n.jsx)(G.u_,{isOpen:u,onClose:eO,header:eE,footer:eR,widthSize:"lg",heightSize:"xl",className:(0,J.m6)("relative",j),headerClassName:"px-2 py-4 pt-0",headerContainerClassName:"pt-14 border-b border-[#F1F1F1]",bodyContainerClassName:"pb-0",footerClassName:"sticky bottom-0 bg-white",classNameContent:"px-0 pt-0",closeOnOverlayClick:!0,children:eI})}var eo=l(22754),ed=l(75577),eu=function(e){var a,l;let s=(0,h.Z)(),{isOpen:i,onBack:t,withBackButton:r=!0,className:o=""}=e,[u]=(0,v.KO)(Y.YU),{data:c,isLoading:m}=(0,eo.fD)(null!==(l=null==u?void 0:u.id)&&void 0!==l?l:0),x=null==c?void 0:null===(a=c.data)||void 0===a?void 0:a.term_and_condition,g=(0,p.useMemo)(()=>(0,n.jsxs)(n.Fragment,{children:[r&&(0,n.jsx)(G.xu,{onClick:t,"aria-hidden":"true",className:"absolute top-3 left-3 hover:cursor-pointer",children:(0,n.jsx)(ea.Z,{className:"w-6 text-dark"})}),(0,n.jsxs)(G.xu,{children:[u?(0,n.jsx)(G.X6,{as:"h1",size:"lg",children:null==u?void 0:u.title}):(0,n.jsx)(G.pO,{height:36,isRounded:!0,className:"w-4/5"}),u?(0,n.jsx)(G.xv,{className:"text-sm",children:null==u?void 0:u.end_period}):(0,n.jsx)(G.pO,{height:14,isRounded:!0,className:"w-3/5"})]})]}),[u,r,t]),b=(0,p.useMemo)(()=>{var e;return(0,n.jsx)(G.kC,{dir:"column",gap:5,className:(0,J.m6)("h-full",s?"min-h-[calc(0.8*(100vh-52px))]":"py-5 px-2"),children:(0,n.jsxs)(G.kC,{dir:"column",gap:2,children:[(0,n.jsx)(G.X6,{as:"h2",className:"text-sm",children:"Syarat dan Ketentuan:"}),m?null===(e=[,,,,,].fill(0))||void 0===e?void 0:e.map((e,a)=>(0,n.jsx)(G.pO,{height:14,isRounded:!0,className:"w-2/3"},"key_".concat(a))):(0,n.jsx)("div",{className:"w-full h-full text-sm [&>ol]:list-decimal [&>ul]:list-disc [&>ol]:list-inside [&>ul]:list-inside",dangerouslySetInnerHTML:(0,ed.rg)(null!=x?x:"")})]})})},[x,s,m]);return s?(0,n.jsx)(d.W,{isOpen:i,onClose:t,header:{label:(0,n.jsxs)(G.kC,{dir:"column",children:[u?(0,n.jsx)(G.X6,{as:"h1",size:"lg",className:"w-fit text",children:null==u?void 0:u.title}):(0,n.jsx)(G.pO,{height:36,isRounded:!0,className:"w-4/5"}),u?(0,n.jsx)(G.xv,{className:"w-fit text-xs",children:null==u?void 0:u.end_period}):(0,n.jsx)(G.pO,{height:14,isRounded:!0,className:"w-3/5"})]}),icon:"close",iconOnClick:t},fullscreen:!0,blocking:!0,children:b}):(0,n.jsx)(G.u_,{isOpen:i,onClose:t,header:g,widthSize:"lg",heightSize:"xl",className:(0,J.m6)("relative",o),headerClassName:"px-2 pb-4 pt-10",headerContainerClassName:"border-b border-[#F1F1F1]",closeOnOverlayClick:!0,children:b})},ec=l(62904),em=l(87669);function eh(e){let{orderDetail:a}=e,l=(0,h.Z)(),s=(0,V.Z)(),i=(0,V.Z)(),t=(0,p.useMemo)(()=>{var e;return null!==(e=null==a?void 0:a.items)&&void 0!==e?e:[]},[null==a?void 0:a.items]),r=(0,p.useMemo)(()=>{var e;return null!==(e=null==a?void 0:a.voucher_redeemed)&&void 0!==e?e:[]},[null==a?void 0:a.voucher_redeemed]),o=(0,p.useMemo)(()=>r.reduce((e,a)=>e+a.amount,0),[r]),d=(0,p.useMemo)(()=>{var e;return null!==(e=null==r?void 0:r.length)&&void 0!==e?e:0},[r]),u=(0,p.useMemo)(()=>t.reduce((e,a)=>e+a.total_price,0),[t]),c=(0,p.useMemo)(()=>{var e,l;let n=new Map((null!==(e=null==a?void 0:a.items)&&void 0!==e?e:[]).map(e=>[e.sku,e]));return Object.entries((null!==(l=null==a?void 0:a.item_groups)&&void 0!==l?l:[]).flatMap(e=>{var a;return(null!==(a=null==e?void 0:e.items)&&void 0!==a?a:[]).map(a=>{var l,s;let i=n.get(a.sku);return{bu_code:e.merchant_code,item:{...i,...a,CategoryIds:null!==(s=null!==(l=a.CategoryIds)&&void 0!==l?l:null==i?void 0:i.CategoryIds)&&void 0!==s?s:[]},shipping_method:null==e?void 0:e.merchant_shipping_code}})}).reduce((e,a)=>{let l=a.bu_code;return e[l]||(e[l]=[]),e[l].push(a),e},{})).map(e=>{let[a,l]=e;return{bu_code:a,items:null==l?void 0:l.map(e=>{let{item:a,shipping_method:l}=e;return{...a,shipping_method:l}})}})},[a]),m=(0,p.useCallback)(e=>{var l,n,s,i,t,r,o,d,c,m,h,v,p,x,g,b,f,j,y,k,N,Z,_,w,C,S,L;let M=null!==(y=null==e?void 0:null===(n=e.items)||void 0===n?void 0:null===(l=n.map(e=>{var a;return null!==(a=null==e?void 0:e.brand)&&void 0!==a?a:""}))||void 0===l?void 0:l.join(","))&&void 0!==y?y:"",P=null!==(k=null==e?void 0:null===(t=e.items)||void 0===t?void 0:null===(i=t.flatMap(e=>null==e?void 0:e.CategoryIds))||void 0===i?void 0:null===(s=i.filter(e=>null!==e||void 0!==e))||void 0===s?void 0:s.join(","))&&void 0!==k?k:"",O=null!==(N=null==e?void 0:null===(d=e.items)||void 0===d?void 0:null===(o=d.map(e=>null==e?void 0:e.sku))||void 0===o?void 0:null===(r=o.filter(e=>!!e))||void 0===r?void 0:r.join(","))&&void 0!==N?N:"",q=null!==(Z=null==e?void 0:null===(h=e.items)||void 0===h?void 0:null===(m=h.map(e=>
1null==e?void 0:e.qty))||void 0===m?void 0:null===(c=m.filter(e=>!!e))||void 0===c?void 0:c.join(","))&&void 0!==Z?Z:"",D=null!==(_=null==e?void 0:null===(x=e.items)||void 0===x?void 0:null===(p=x.map(e=>null==e?void 0:e.weight))||void 0===p?void 0:null===(v=p.filter(e=>!!e))||void 0===v?void 0:v.join(","))&&void 0!==_?_:"";return{brand:M,category_id:P,sku:O,qty:q,bu_code:null!==(w=null==e?void 0:e.bu_code)&&void 0!==w?w:"",weight:D,shipping_method:null!==(C=null==e?void 0:null===(f=e.items)||void 0===f?void 0:null===(b=f.map(e=>null==e?void 0:e.shipping_method))||void 0===b?void 0:null===(g=b.filter(e=>!!e))||void 0===g?void 0:g.join(","))&&void 0!==C?C:"",grand_total:null!==(S=null==u?void 0:u.toString())&&void 0!==S?S:"",sub_total:null!==(L=null==a?void 0:null===(j=a.subtotal)||void 0===j?void 0:j.toString())&&void 0!==L?L:""}},[u,null==a?void 0:a.subtotal]),v=(0,p.useMemo)(()=>null==c?void 0:c.map(e=>m(e)),[m,c]),x=(0,em.h)({queries:null==v?void 0:v.map(e=>{var a;return{queryKey:["promo","checkout","list",e],queryFn:()=>(0,ec.yT)(e),enabled:null===(a=Object.values(e))||void 0===a?void 0:a.some(e=>!!e)}})}),g=(0,p.useMemo)(()=>x.some(e=>e.isLoading),[x]),b=(0,p.useMemo)(()=>{var e;return null!==(e=null==x?void 0:x.map(e=>null==e?void 0:e.data).filter(e=>!!e))&&void 0!==e?e:[]},[x]),f=(0,p.useMemo)(()=>{let e=null==b?void 0:b.flatMap(e=>{var a;return null!==(a=null==e?void 0:e.data)&&void 0!==a?a:[]}),a=new Map;return e.forEach(e=>{a.has(e.id)||a.set(e.id,e)}),Array.from(a.values())},[b]);return(0,n.jsxs)(n.Fragment,{children:[g?(0,n.jsx)(G.pO,{height:l?68:48,isRounded:!0,className:"w-full"}):(0,n.jsxs)("button",{onClick:()=>{null==s||s.onOpen()},className:(0,J.m6)("w-full flex gap-2 justify-between items-center rounded-lg border relative p-3",o?"bg-success/20 border-success":"bg-info-light border-info"),children:[(0,n.jsxs)(G.kC,{dir:"row",gap:2,items:"center",children:[(0,n.jsx)(G.PJ,{name:o?"success":"sale",className:(0,J.m6)("w-6 h-6",o&&"text-success")}),(0,n.jsx)(G.xv,{className:(0,J.m6)("font-bold text-sm text-left",o?"text-success":"text-[#002347]"),children:o?"Yay, kamu dapat potongan ".concat((0,Q.b7)(o)," (").concat(d," Voucher)"):"Yuk, pakai voucher biar belanjamu lebih hemat!"})]}),(0,n.jsx)(G.PJ,{name:"chevron-right",className:(0,J.m6)("w-5 h-5",o&&"text-success")})]}),(0,n.jsx)(er,{data:f,isOpen:null==s?void 0:s.isOpen,isLoading:g,onClose:null==s?void 0:s.onClose,onOpenVoucherDetail:null==i?void 0:i.onOpen,listParams:v,...e}),(0,n.jsx)(eu,{isOpen:null==i?void 0:i.isOpen,onBack:()=>{null==i||i.onClose(),null==s||s.onOpen()}})]})}var ev=(0,p.memo)(function(e){let{orderDetail:a,onCountdownFinished:l}=e;return(0,n.jsx)(o.Z,{className:"w-full",children:(0,n.jsx)(eh,{orderDetail:a,onCountdownFinished:l})})}),ep=(0,p.memo)(function(e){let{orderDetail:a,dataTestIdTabs:l,onCountdownFinished:s}=e,[i,t]=(0,p.useState)(1),[r,d]=(0,p.useState)([]),u=z(),m=E(),h=q(),f=D(),j=(0,O.D)(e=>C(e)),y=(0,O.D)(e=>S(e)),[k,N]=(0,v.KO)(x.hv),Z=(0,v.b9)(x.W9),_=(0,v.Dv)(x.tu),w=(e,a)=>{d("add"===e?[a,...r]:r.filter(e=>e.id!==a.id))},L=(0,p.useMemo)(()=>[{header:(0,n.jsxs)(o.Z,{gap:1,items:"center",justify:"center",children:[(0,n.jsx)(g.Z,{name:"poin"}),(0,n.jsx)(c.Z,{children:"Poin Saya"})]}),content:(0,n.jsx)(H,{orderDetail:a,redeemMutation:j,releaseMutation:y})},{header:(0,n.jsxs)(o.Z,{gap:1,items:"center",justify:"center",children:[(0,n.jsx)(g.Z,{name:"voucher"}),(0,n.jsx)(c.Z,{"data-testid":l,children:"Voucher Saya"})]}),content:(0,n.jsx)(ev,{orderDetail:a,onCountdownFinished:s})},{header:(0,n.jsxs)(o.Z,{gap:1,items:"center",justify:"center",children:[(0,n.jsx)(g.Z,{name:"gift-card"}),(0,n.jsx)(c.Z,{children:"Gift Card"})]}),content:(0,n.jsx)(B,{orderDetail:a,redeemedGiftCards:r,onSetRedeemed:w})}],[a,r,u,m,h,f,j,y]);return(0,p.useEffect)(()=>{Z(k),_||(N(""),Z(""))},[i]),(0,n.jsx)(b.Z,{dataTestId:l,defaultIndex:i,list:L,onTabChanged:t})}),ex=(0,p.memo)(function(e){let{orderDetailQuery:a,orderPaymentQuery:l,onExpiredOrder:g,onContinuePayment:b,isEraExpress:f}=e,j=(0,h.Z)(),y="fetching"===l.fetchStatus&&l.isLoading,k=(0,p.useMemo)(()=>{var e;return null===(e=a.data)||void 0===e?void 0:e.data},[a.data]),[N,Z]=(0,v.KO)(x.nX),_=(0,v.b9)(x.tu);(0,p.useEffect)(()=>()=>{Z({option:new Map,input:new Map}),_(null)},[]),(0,p.useEffect)(()=>{k&&(0,ei.D7)(k)},[k]);let w=(0,p.useMemo)(()=>{var e,l,s,d,u,m;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(o.Z,{dir:"column",gap:4,children:[(0,n.jsx)(c.Z,{className:"text-lg font-bold",children:"Ringkasan Belanja"}),(0,n.jsxs)(o.Z,{gap:3,dir:"column",children:[(0,n.jsxs)(o.Z,{justify:"between",children:[(0,n.jsxs)(c.Z,{className:"text-gray text-sm",children:["Total Pesanan (",Number((null==k?void 0:k.items.length)||0)+Number((null==k?void 0:null===(e=k.items.find(e=>Array.isArray(e.bundling)))||void 0===e?void 0:e.bundling.length)||0)," ","Barang)"]}),a.isLoading?(0,n.jsx)(r.Z,{width:100,height:21}):(0,n.jsx)(c.Z,{"data-testid":"qa-ordersummary-subtotal",className:"text-sm",children:(0,Q.b7)(Number(((null==k?void 0:k.subtotal)||0)+((null==k?void 0:k.discount_pwp_amount)||0)))})]}),!!(null==k?void 0:k.emeterai_amount_total)&&(0,n.jsxs)(o.Z,{justify:"between",children:[(0,n.jsx)(c.Z,{className:"text-gray text-sm",children:"Biaya e-Meterai"}),(0,n.jsx)(c.Z,{className:"text-sm",children:null==k?void 0:k.emeterai_amount_total_formated})]}),(0,n.jsxs)(o.Z,{justify:"between",children:[(0,n.jsx)(c.Z,{className:"text-gray text-sm",children:"Biaya Pengiriman"}),a.isLoading?(0,n.jsx)(r.Z,{width:100,height:21}):(0,n.jsx)(c.Z,{"data-testid":"qa-ordersummary-shipping",className:"text-sm",children:null==k?void 0:k.shipping_amount_total_formated})]}),!f&&(0,n.jsxs)(o.Z,{justify:"between",children:[(0,n.jsx)(c.Z,{className:"text-gray text-sm",children:"Asuransi Pengiriman"}),(0,n.jsx)(c.Z,{className:"text-sm text-success font-semibold",children:"Gratis"})]}),null==k?void 0:null===(l=k.voucher_redeemed)||void 0===l?void 0:l.map(e=>(0,n.jsxs)(o.Z,{justify:"between",children:[(0,n.jsxs)(c.Z,{asParagraph:!0,className:"text-gray text-sm",children:["Diskon Voucher ",(0,n.jsxs)(c.Z,{className:"font-bold",children:["(",null==e?void 0:e.code,")"]})]}),(0,n.jsxs)(c.Z,{"data-testid":"voucher"===e.type?"qa-ordersummary-vouchercapi":"qa-ordersummary-voucherpmp",className:"text-sm text-success font-semibold",children:["- ",null==e?void 0:e.amount_formated]})]},null==e?void 0:e.id)),(null!==(s=null==k?void 0:k.gift_card_amount)&&void 0!==s?s:0)>0&&(0,n.jsxs)(o.Z,{justify:"between",children:[(0,n.jsx)(c.Z,{className:"text-gray text-sm",children:"Diskon Giftcard"}),(0,n.jsx)(c.Z,{"data-testid":"qa-ordersummary-gc",className:"text-sm text-success font-semibold",children:"- ".concat(null==k?void 0:k.gift_card_amount_formated)})]}),(null!==(d=null==k?void 0:k.discount_point_amount)&&void 0!==d?d:0)>0&&(0,n.jsxs)(o.Z,{justify:"between",children:[(0,n.jsx)(c.Z,{className:"text-gray text-sm",children:"Potongan Poin"}),(0,n.jsx)(c.Z,{"data-testid":"qa-ordersummary-point",className:"text-sm text-success font-semibold",children:"- ".concat(null==k?void 0:k.discount_point_amount_formated)})]}),(null!==(u=null==k?void 0:k.tradein_amount)&&void 0!==u?u:0)>0&&(0,n.jsxs)(o.Z,{justify:"between",children:[(0,n.jsx)(c.Z,{className:"text-gray text-sm",children:"Diskon Trade In"}),(0,n.jsx)(c.Z,{"data-testid":"qa-ordersummary-tradein",className:"text-sm text-success font-semibold",children:"- ".concat(null==k?void 0:k.tradein_amount_formated)})]}),(null!==(m=null==k?void 0:k.discount_pwp_amount)&&void 0!==m?m:0)>0&&(0,n.jsxs)(o.Z,{justify:"between",children:[(0,n.jsx)(c.Z,{className:"text-gray text-sm",children:"Ekstra Potongan"}),(0,n.jsx)(c.Z,{"data-testid":"qa-ordersummary-pwp",className:"text-sm text-success font-semibold",children:"- ".concat(null==k?void 0:k.discount_pwp_amount_formated)})]})]})]}),(0,n.jsx)(i.Z,{className:"h-[64px]"}),(0,n.jsx)(i.Z,{className:"absolute w-full flex items-center h-[74px] bottom-0 left-0 bg-white border-t border-stroke",children:(0,n.jsxs)(o.Z,{items:"center",justify:"between",className:"w-full px-6",children:[(0,n.jsxs)(o.Z,{dir:"column",children:[(0,n.jsx)(c.Z,{className:"md:text-sm",children:"Total Pembayaran"}),(0,n.jsx)(c.Z,{"data-testid":"qa-ordersummary-grandtotal",className:"text-sm md:text-base text-[#F4991D] font-bold",children:null==k?void 0:k.grand_total_formated})]}),(0,n.jsx)(t.Z,{"data-testid":"qa-button-pilihpembayaran",isLoading:y,disabled:y,onClick:b,size:j?"small":"large",id:"mcis-ch
1oose-payment-button",children:"Pilih Pembayaran"})]})})]})},[k,a.isLoading,N,j,l.isLoading]),C=(0,p.useMemo)(()=>(0,n.jsxs)(o.Z,{dir:"column",gap:4,className:"overflow-auto pb-24",children:[l.isError&&(0,n.jsx)(s.Z,{variant:"danger",children:(0,n.jsx)(c.Z,{"data-testid":"qa-promopage-alerterror",className:"md:text-sm",children:l.error.message})}),(0,n.jsxs)(o.Z,{dir:"column",gap:3,className:"mb-3",children:[(0,n.jsx)(c.Z,{"data-testid":"qa-orderreceived",className:"md:text-sm",children:"Pesananmu berhasil diterima. Mohon segera melakukan pembayaran."}),(0,n.jsx)(s.Z,{variant:"warning",children:(0,n.jsx)($.Z,{expired:null==k?void 0:k.order_expired,onFinish:g,children:(0,n.jsx)(c.Z,{className:"md:text-sm",children:"Pilih metode pembayaran sebelum"})})})]}),(0,n.jsxs)(o.Z,{dir:"column",gap:4,className:"mb-3",children:[(0,n.jsxs)(c.Z,{className:"text-xl font-bold",children:["Gunakan Potongan Pembayaran ",(0,n.jsx)(c.Z,{className:"font-normal text-gray",children:"(Opsional)"})]}),(0,n.jsx)(u.Z,{}),(0,n.jsxs)(c.Z,{className:"text-sm",children:["Potongan pembayaran dapat digunakan bersamaan. ",(0,n.jsx)("br",{}),"Minimal menyisakan pembayaran Rp10.000."]}),(0,n.jsx)(u.Z,{})]}),(0,n.jsx)(ep,{dataTestIdTabs:"qa-order-tab",orderDetail:k,onCountdownFinished:g}),(0,n.jsx)(u.Z,{}),w]}),[k,w,l.isError,l.error]);return j?(0,n.jsx)(m.Z,{isOpen:!0,header:"Informasi Pembayaran",center:!1,closeable:!1,className:"px-5",children:C}):(0,n.jsxs)(d.Z,{size:"xl",isOpen:!0,classNameContent:"!pt-0",children:[(0,n.jsx)(i.Z,{className:"sticky top-0 z-20 py-4 -mx-6 px-6 mb-4 bg-white border-gray-200 border-b font-bold text-lg",children:"Informasi Pembayaran"}),C]})})},22754:function(e,a,l){l.d(a,{fD:function(){return i},u:function(){return t}});var n=l(62904),s=l(36492);let i=(e,a)=>{var l;return(0,s.a)(["promo","detail",e],()=>(0,n.YT)(e),{...a,enabled:!!e&&(null===(l=null==a?void 0:a.enabled)||void 0===l||l)})},t=(e,a)=>{var l;return(0,s.a)(["promo","list",e],()=>(0,n.QC)(e),{...a,enabled:!!(null==e?void 0:e.length)&&(null===(l=null==a?void 0:a.enabled)||void 0===l||l)})}},87669:function(e,a,l){l.d(a,{h:function(){return p}});var n=l(67294),s=l(32161),i=l(30081),t=l(52924),r=l(33989);class o extends r.l{constructor(e,a){super(),this.client=e,this.queries=[],this.result=[],this.observers=[],this.observersMap={},a&&this.setQueries(a)}onSubscribe(){1===this.listeners.size&&this.observers.forEach(e=>{e.subscribe(a=>{this.onUpdate(e,a)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.observers.forEach(e=>{e.destroy()})}setQueries(e,a){this.queries=e,i.V.batch(()=>{let e=this.observers,l=this.findMatchingObservers(this.queries);l.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions,a));let n=l.map(e=>e.observer),i=Object.fromEntries(n.map(e=>[e.options.queryHash,e])),t=n.map(e=>e.getCurrentResult()),r=n.some((a,l)=>a!==e[l]);(e.length!==n.length||r)&&(this.observers=n,this.observersMap=i,this.result=t,this.hasListeners()&&((0,s.e5)(e,n).forEach(e=>{e.destroy()}),(0,s.e5)(n,e).forEach(e=>{e.subscribe(a=>{this.onUpdate(e,a)})}),this.notify()))})}getCurrentResult(){return this.result}getQueries(){return this.observers.map(e=>e.getCurrentQuery())}getObservers(){return this.observers}getOptimisticResult(e){return this.findMatchingObservers(e).map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions))}
1findMatchingObservers(e){let a=this.observers,l=new Map(a.map(e=>[e.options.queryHash,e])),n=e.map(e=>this.client.defaultQueryOptions(e)),s=n.flatMap(e=>{let a=l.get(e.queryHash);return null!=a?[{defaultedQueryOptions:e,observer:a}]:[]}),i=new Set(s.map(e=>e.defaultedQueryOptions.queryHash)),r=n.filter(e=>!i.has(e.queryHash)),o=new Set(s.map(e=>e.observer)),d=a.filter(e=>!o.has(e)),u=e=>{let a=this.client.defaultQueryOptions(e),l=this.observersMap[a.queryHash];return null!=l?l:new t.z(this.client,a)},c=r.map((e,a)=>{if(e.keepPreviousData){let l=d[a];if(void 0!==l)return{defaultedQueryOptions:e,observer:l}}return{defaultedQueryOptions:e,observer:u(e)}});return s.concat(c).sort((e,a)=>n.indexOf(e.defaultedQueryOptions)-n.indexOf(a.defaultedQueryOptions))}onUpdate(e,a){let l=this.observers.indexOf(e);-1!==l&&(this.result=(0,s.Rc)(this.result,l,a),this.notify())}notify(){i.V.batch(()=>{this.listeners.forEach(({listener:e})=>{e(this.result)})})}}var d=l(464),u=l(85945),c=l(37122),m=l(91784),h=l(91670),v=l(38381);function p({queries:e,context:a}){let l=(0,u.NL)({context:a}),s=(0,c.S)(),t=(0,m._)(),r=n.useMemo(()=>e.map(e=>{let a=l.defaultQueryOptions(e);return a._optimisticResults=s?"isRestoring":"optimistic",a}),[e,l,s]);r.forEach(e=>{(0,v.Fb)(e),(0,h.pf)(e,t)}),(0,h.JN)(t);let[p]=n.useState(()=>new o(l,r)),x=p.getOptimisticResult(r);(0,d.$)(n.useCallback(e=>s?()=>void 0:p.subscribe(i.V.batchCalls(e)),[p,s]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),n.useEffect(()=>{p.setQueries(r,{listeners:!1})},[r,p]);let g=x.some((e,a)=>(0,v.SB)(r[a],e,s))?x.flatMap((e,a)=>{let l=r[a],n=p.getObservers()[a];if(l&&n){if((0,v.SB)(l,e,s))return(0,v.j8)(l,n,t);(0,v.Z$)(e,s)&&(0,v.j8)(l,n,t)}return[]}):[];if(g.length>0)throw Promise.all(g);let b=p.getQueries(),f=x.find((e,a)=>{var l,n;return(0,h.KJ)({result:e,errorResetBoundary:t,useErrorBoundary:null!=(l=null==(n=r[a])?void 0:n.useErrorBoundary)&&l,query:b[a]})});if(null!=f&&f.error)throw f.error;return x}}}]);

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.