1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[592],{712:e=>{e.exports={containerPackageCarousel:"packageCarousel_containerPackageCarousel__15Rc7",cardPackages:"packageCarousel_cardPackages__Wqq9k",titleRow:"packageCarousel_titleRow__G_tCt",title:"packageCarousel_title__vaMXj",voucherButtonContainer:"packageCarousel_voucherButtonContainer__H7zzK",rowSectionFeature:"packageCarousel_rowSectionFeature__aBenr",columnFeatureLeft:"packageCarousel_columnFeatureLeft__C3VJE",columnFeatureRight:"packageCarousel_columnFeatureRight__cF2Iz",titlePackage:"packageCarousel_titlePackage__mppW6",columnFeaturePrice:"packageCarousel_columnFeaturePrice__C4mH9",discountedPriceContainer:"packageCarousel_discountedPriceContainer__wQvKp",originalPrice:"packageCarousel_originalPrice__537gX",voucherDiscount:"packageCarousel_voucherDiscount__qzD1r",finalPrice:"packageCarousel_finalPrice__nSDfi",packageHovered:"packageCarousel_packageHovered__FM6LR",packagenotHovered:"packageCarousel_packagenotHovered__E6QFs",bounceHint:"packageCarousel_bounceHint__6p406"}},768:e=>{e.exports={voucherSection:"voucherButton_voucherSection__Ryals",voucherButton:"voucherButton_voucherButton__7a920",voucherIcon:"voucherButton_voucherIcon__B8QS5",voucherText:"voucherButton_voucherText__ZFIAQ",arrowIcon:"voucherButton_arrowIcon__xDBEb",appliedVoucherRow:"voucherButton_appliedVoucherRow__hgtY4",voucherInfo:"voucherButton_voucherInfo__kLoJw",voucherDetails:"voucherButton_voucherDetails__MlpYK",voucherCode:"voucherButton_voucherCode__ACJRk",voucherSavings:"voucherButton_voucherSavings__PzepH",removeButton:"voucherButton_removeButton__YRy4f"}},1845:(e,o,a)=>{"use strict";var t=a(9563);o.A=void 0;var n=t(a(1405)),r=a(7876);o.A=(0,n.default)((0,r.jsx)("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm-3.06 16L7.4 14.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L10.94 18zM13 9V3.5L18.5 9H13z"}),"Task")},3011:(e,o,a)=>{"use strict";var t=a(9563);o.A=void 0;var n=t(a(1405)),r=a(7876);o.A=(0,n.default)([(0,r.jsx)("path",{d:"M9 3 7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2h-3.17L15 3H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z"},"0"),(0,r.jsx)("path",{d:"m12 17 1.25-2.75L16 13l-2.75-1.25L12 9l-1.25 2.75L8 13l2.75 1.25z"},"1")],"CameraEnhance")},3242:(e,o,a)=>{"use strict";a.r(o),a.d(o,{__N_SSP:()=>X,default:()=>Z});var t=a(7876),n=a(4232),r=a(1105);a(7328),a(3780);var s=a(9279);a(8230);var l=a(7972);a(5063);var c=a(712),i=a.n(c),d=a(4501),u=a(670),m=a(9995),g=a(4697),h=a(1118),p=a(8602),v=a(5879),_=a(7951);function k(e){return(0,v.Ay)("MuiCardContent",e)}(0,_.A)("MuiCardContent",["root"]);let f=["className","component"],x=(0,h.Ay)("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,o)=>o.root})(()=>({padding:16,"&:last-child":{paddingBottom:24}})),C=n.forwardRef(function(e,o){let a=(0,p.A)({props:e,name:"MuiCardContent"}),{className:n,component:r="div"}=a,s=(0,u.A)(a,f),l=(0,d.A)({},a,{component:r}),c=(e=>{let{classes:o}=e;return(0,g.A)({root:["root"]},k,o)})(l);return(0,t.jsx)(x,(0,d.A)({as:r,className:(0,m.A)(c.root,n),ownerState:l,ref:o},s))});function j(e){return(0,v.Ay)("MuiCardMedia",e)}(0,_.A)("MuiCardMedia",["root","media","img"]);let y=["children","className","component","image","src","style"],S=(0,h.Ay)("div",{name:"MuiCardMedia",slot:"Root",overridesResolver:(e,o)=>{let{ownerState:a}=e,{isMediaComponent:t,isImageComponent:n}=a;return[o.root,t&&o.media,n&&o.img]}})(e=>{let{ownerState:o}=e;return(0,d.A)({display:"block",backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"},o.isMediaComponent&&{width:"100%"},o.isImageComponent&&{objectFit:"cover"})}),N=["video","audio","picture","iframe","img"],P=["picture","img"],w=n.forwardRef(function(e,o){let a=(0,p.A)({props:e,name:"MuiCardMedia"}),{children:n,className:r,component:s="div",image:l,src:c,style:i}=a,h=(0,u.A)(a,y),v=-1!==N.indexOf(s),_=!v&&l?(0,d.A)({backgroundImage:'url("'.concat(l,'")')},i):i,k=(0,d.A)({},a,{component:s,isMediaComponent:v,isImageComponent:-1!==P.indexOf(s)}),f=(e=>{let{classes:o,isMediaComponent:a,isImageComponent:t}=e;return(0,g.A)({root:["root",a&&"media",t&&"img"]},j,o)})(k);return(0,t.jsx)(S,(0,d.A)({className:(0,m.A)(f.root,r),as:s,role:!v&&l?"img":void 0,ref:o,style:_,ownerState:k,src:v?l||c:void 0},h,{children:n}))});
1var A=a(3011),M=a(1845),b=a(7883),D=a(8323),B=a(7276),I=a.n(B);function R(e){let{onClose:o,onVoucherApplied:a,onVoucherRemoved:r,orderAmount:s,partnerCode:l,appliedVoucher:c=null,packages:i=[]}=e,[d,u]=(0,n.useState)(""),[m,g]=(0,n.useState)(!1),[h,p]=(0,n.useState)(""),[v,_]=(0,n.useState)(null);(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&o()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[o]);let k=e=>new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR",minimumFractionDigits:0}).format(e),f=async()=>{if(!d.trim())return void p("Masukkan kode voucher");if(!s||!l)return void p("Data order tidak lengkap");g(!0),p(""),_(null);try{console.log("\uD83D\uDD0D Validating voucher:",d,"for partner:",l,"amount:",s);let a=await fetch("/api/voucher/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({voucherCode:d.toUpperCase().trim(),partnerCode:l,orderAmount:s})}),t=await a.json();if(console.log("\uD83D\uDCCB Voucher validation result:",t),t.isValid){var e,o;if(t.isStaffTest){console.log("\uD83E\uDDEA Staff testing code detected - setting up test session");let e={orderCode:t.testOrderId,orderId:t.testOrderId,transactionStatus:"settlement",paymentStatus:"settlement",isStaffTest:!0,testMode:!0,packageData:{id:"staff-test",name:"Staff Testing Package",sellingPrice:0,totalPhotoSlot:4,description:"Testing package for staff"}};localStorage.setItem("staffTestSession",JSON.stringify(e)),localStorage.setItem("selectedPackageData",JSON.stringify(e.packageData)),localStorage.setItem("isStaffTestMode","true"),localStorage.setItem("durationInSecond","860"),console.log("\uD83E\uDDEA Staff test session data set up:",e);let o="/payment/notification?order_id=".concat(t.testOrderId,"&transaction_status=settlement&payment_status=settlement&staff_test=true");console.log("\uD83D\uDD04 Redirecting to:",o),window.location.href=o;return}let a=(null==(e=t.voucher)?void 0:e.minPurchaseAmount)||0,n=i.filter(e=>e.sellingPrice>=a),r={voucherCode:d.toUpperCase().trim(),voucherName:(null==(o=t.voucher)?void 0:o.voucherName)||"Voucher Diskon",discountAmount:t.discountAmount,finalAmount:t.finalAmount,originalAmount:s,minPurchaseAmount:a,qualifyingPackages:n.length,totalPackages:i.length};_(r),p(""),console.log("â
Voucher validated successfully:",r),console.log("\uD83D\uDCE6 ".concat(n.length," of ").concat(i.length," packages qualify for this voucher"))}else p(t.message||"Kode voucher tidak valid"),_(null),console.warn("â Voucher validation failed:",t.message)}catch(e){console.error("â Error validating voucher:",e),p("Terjadi kesalahan saat memvalidasi voucher"),_(null)}finally{g(!1)}},x=()=>{v&&a&&a(v)};return(0,t.jsx)("div",{className:I().modalOverlay,onClick:e=>{e.target===e.currentTarget&&o()},children:(0,t.jsxs)("div",{className:I().modalContent,children:[(0,t.jsxs)("div",{className:I().modalHeader,children:[(0,t.jsx)("h3",{children:"\uD83C\uDFAB Gunakan Voucher"}),(0,t.jsx)("button",{className:I().closeButton,onClick:o,children:"â"})]}),(0,t.jsx)("div",{className:I().modalBody,children:(0,t.jsxs)("div",{className:I().inputSection,children:[(0,t.jsx)("label",{className:I().inputLabel,children:"Kode Voucher"}),(0,t.jsx)(D.A,{value:d,placeholder:"Masukkan kode voucher (contoh: WELCOME20)",onKeyPress:e=>u(o=>o+e),onBackspace:()=>u(e=>e.slice(0,-1)),onClear:()=>u(""),onEnter:v?x:f,disabled:m,uppercase:!0}),(0,t.jsx)("div",{className:I().validateButtonContainer,children:(0,t.jsx)("button",{onClick:f,disabled:m||!d.trim(),className:I().validateButton,children:m?"Cek...":"Cek"})}),h&&(0,t.jsxs)("div",{className:I().errorMessage,children:["â ï¸ ",h]}),v&&(0,t.jsxs)("div",{className:I().successSection,children:[(0,t.jsxs)("div",{className:I().discountInfo,children:[(0,t.jsxs)("div",{className:I().discountHeader,children:["â
",(0,t.jsx)("strong",{children:v.voucherName})]}),(0,t.jsxs)("div",{className:I().discountDetails,children:["Kode: ",(0,t.jsx)("strong",{children:v.voucherCode}),(0,t.jsx)("br",{}),"Berlaku untuk: ",(0,t.jsxs)("strong",{children:[v.qualifyingPackages," dari ",v.totalPackages," paket"]}),v.minPurchaseAmount>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("br",{}),"Min. pembelian: ",(0,t.jsx)("strong",{children:k(v.minPurchaseAmount)})]})]})]}),(0,t.jsxs)("div",{className:I().priceBreakdown,children:[(0,t.jsxs)("div",{className:I().priceRow,children:[(0,t.jsx)("span",{children:"Harga Asli:"}),(0,t.jsx)("span",{children:k(v.originalAmount)})]}),(0,t.jsxs)("div",{className:I().priceRow+" "+I().discount,children:[(0,t.jsx)("span",{children:"Diskon:"}),(0,t.jsxs)("span",{children:["-",k(v.discountAmount)]})]}),(0,t.jsxs)("div",{className:I().priceRow+" "+I().final,children:[(0,t.jsx)("span",{children:(0,t.jsx)("strong",{children:"Total Bayar:"})}),(0,t.jsx)("span",{children:(0,t.jsx)("strong",{children:k(v.finalAmount)})})]})]})]})]})}),(0,t.jsx)("div",{className:I().modalFooter,children:v?(0,t.jsxs)("div",{className:I().footerButtons,children:[(0,t.jsx)("button",{className:I().cancelButton,onClick:()=>{u(""),_(null),p(""),r&&r()},children:"Batal"}),(0,t.jsx)("button",{className:I().applyButton,onClick:x,children:"Gunakan Voucher"})]}):(0,t.jsx)("div",{className:I().modalHint,children:"\uD83D\uDCA1 Masukkan kode voucher untuk mendapatkan diskon"})})]})})}var O=a(768),F=a.n(O);function T(e){let o,{onVoucherApplied:a,onVoucherRemoved:r,orderAmount:s,partnerCode:l,appliedVoucher:c=null,packages:i=[]}
1=e,[d,u]=(0,n.useState)(!1),m=()=>{u(!1),r&&r()};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:F().voucherSection,children:c?(0,t.jsxs)("div",{className:F().appliedVoucherRow,children:[(0,t.jsxs)("div",{className:F().voucherInfo,children:[(0,t.jsx)("span",{className:F().voucherIcon,children:"\uD83C\uDFAB"}),(0,t.jsxs)("div",{className:F().voucherDetails,children:[(0,t.jsx)("div",{className:F().voucherCode,children:c.voucherCode}),(0,t.jsxs)("div",{className:F().voucherSavings,children:["Hemat ",(o=c.discountAmount,new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR",minimumFractionDigits:0}).format(o))]})]})]}),(0,t.jsx)("button",{className:F().removeButton,onClick:m,title:"Hapus voucher",children:"â"})]}):(0,t.jsxs)("button",{className:F().voucherButton,onClick:()=>{u(!0)},children:[(0,t.jsx)("span",{className:F().voucherIcon,children:"\uD83C\uDFAB"}),(0,t.jsx)("span",{className:F().voucherText,children:"Gunakan Voucher"}),(0,t.jsx)("span",{className:F().arrowIcon,children:"âº"})]})}),d&&(0,t.jsx)(R,{onClose:()=>{u(!1)},onVoucherApplied:e=>{u(!1),a&&a(e)},onVoucherRemoved:m,orderAmount:s,partnerCode:l,appliedVoucher:c,packages:i})]})}function E(e){let{onSelectPackage:o,packages:a,onPackageSelectedData:r,oncreateOrder:s,appliedVoucher:l,finalOrderAmount:c,onVoucherApplied:d,onVoucherRemoved:u,packageSelected:m,packageSelectedData:g,partnerCode:h,orderCreationInProgress:p=!1}=e,[v,_]=(0,n.useState)(0),[k,f]=(0,n.useState)(0);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:i().titleRow,children:[(0,t.jsx)("h3",{className:i().title,children:"Silahkan pilih paket kamu"}),(0,t.jsx)("div",{className:i().voucherButtonContainer,children:(0,t.jsx)(T,{onVoucherApplied:d,onVoucherRemoved:u,orderAmount:(null==a?void 0:a.length)>0?Math.max(...a.map(e=>e.sellingPrice)):5e4,partnerCode:h,appliedVoucher:l,packages:a})})]}),(0,t.jsx)("div",{className:i().containerPackageCarousel,children:a.map(e=>{let a=v===e.packageCode;return(0,t.jsxs)("div",{onClick:()=>(e=>{let a=Date.now(),t=a-k;o(!0),_(e.packageCode),r(e),console.log("\uD83D\uDCE6 Storing selected package to localStorage:",e),localStorage.setItem("selectedPackageData",JSON.stringify(e)),console.log("â
Package data stored successfully"),t<300&&v===e.packageCode?(console.log("\uD83C\uDFAF Double click detected - triggering payment for:",e.name),s&&!p?s():p&&console.log("â ï¸ Order creation in progress, ignoring double click")):v===e.packageCode&&(console.log("\uD83C\uDFAF Selected package clicked again - triggering payment for:",e.name),s&&!p?s():p&&console.log("â ï¸ Order creation in progress, ignoring click")),f(a)})(e),className:"".concat(i().cardPackages," ").concat(a?i().packageHovered:i().packagenotHovered),children:[(0,t.jsx)(w,{component:"img",alt:"Paket",height:"220",image:e.imageUrl,style:{objectFit:"cover",width:"100%",flexShrink:0}}),(0,t.jsxs)(C,{style:{flex:"1",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[(0,t.jsx)("h5",{className:i().titlePackage,children:e.name}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:i().rowSectionFeature,children:[(0,t.jsx)("div",{className:i().columnFeatureLeft,children:(0,t.jsx)(A.A,{})}),(0,t.jsxs)("div",{className:i().columnFeatureRight,children:[e.numOfShoot,"x Shoot"]})]}),e.isDigitalCopy&&(0,t.jsxs)("div",{className:i().rowSectionFeature,children:[(0,t.jsx)("div",{className:i().columnFeatureLeft,children:(0,t.jsx)(M.A,{})}),(0,t.jsx)("div",{className:i().columnFeatureRight,children:"Free File Digital"})]}),(0,t.jsxs)("div",{className:i().rowSectionFeature,children:[(0,t.jsx)("div",{className:i().columnFeatureLeft,children:(0,t.jsx)(b.A,{})}),(0,t.jsxs)("div",{className:i().columnFeatureRight,children:[e.numOfPrint," Photo Print"]})]}),(0,t.jsx)("div",{className:i().rowSectionFeature,children:(0,t.jsx)("div",{className:i().columnFeaturePrice,children:l&&e.sellingPrice>=(l.minPurchaseAmount||0)?(0,t.jsxs)("div",{className:i().discountedPriceContainer,children:[(0,t.jsxs)("div",{className:i().originalPrice,children:["Rp. ",e.sellingPrice.toLocaleStr
1ing()]}),(0,t.jsxs)("div",{className:i().voucherDiscount,children:["-Rp. ",l.discountAmount.toLocaleString()]}),(0,t.jsxs)("div",{className:i().finalPrice,children:["Rp. ",(e.sellingPrice-l.discountAmount).toLocaleString()]})]}):(0,t.jsxs)(t.Fragment,{children:["Rp. ",e.sellingPrice.toLocaleString()]})})})]})]})]},e.packageCode)})})]})}var H=a(4798),L=a(9099),V=a(5409),z=a.n(V);a(9999),a(6564),a(8216);var W=a(5105),q=a.n(W),J=a(2066);let K={production:{clientKey:"Mid-client-JVWVPAII3jRKuyL4",snapUrl:"https://app.midtrans.com/snap/snap.js"}};var U=a(789),G=a(7415),Y=a.n(G);let Q=e=>{let{isVisible:o,message:a="Membuat pesanan...",submessage:r="Mohon tunggu sebentar",timeoutSeconds:s=30,onTimeout:l=null}=e,[c,i]=(0,n.useState)(s);return((0,n.useEffect)(()=>{if(!o)return void i(s);let e=setInterval(()=>{i(o=>o<=1?(clearInterval(e),l&&(console.log("â° Loading timeout reached, triggering callback"),l()),0):o-1)},1e3);return()=>clearInterval(e)},[o,s,l]),o)?(0,t.jsx)("div",{className:Y().overlay,children:(0,t.jsxs)("div",{className:Y().modal,children:[(0,t.jsx)("div",{className:Y().spinner,children:(0,t.jsx)("div",{className:Y().spinnerRing})}),(0,t.jsxs)("div",{className:Y().content,children:[(0,t.jsx)("h3",{className:Y().title,children:a}),(0,t.jsx)("p",{className:Y().subtitle,children:r}),c>0&&(0,t.jsxs)("div",{className:Y().timerContainer,children:[(0,t.jsxs)("p",{className:Y().timerText,children:["Otomatis kembali ke halaman utama dalam ",(0,t.jsx)("span",{className:Y().timerNumber,children:c})," detik"]}),(0,t.jsx)("div",{className:Y().timerBar,children:(0,t.jsx)("div",{className:Y().timerProgress,style:{width:"".concat(c/s*100,"%"),transition:"width 1s linear"}})})]}),(0,t.jsxs)("div",{className:Y().progressDots,children:[(0,t.jsx)("span",{className:Y().dot}),(0,t.jsx)("span",{className:Y().dot}),(0,t.jsx)("span",{className:Y().dot})]})]})]})}):null};var X=!0;function Z(){let e=(0,L.useRouter)(),o=(0,r.wA)(),[a,c]=(0,n.useState)(!1),[i,d]=(0,n.useState)(null),[u,m]=(0,n.useState)(!1),[g,h]=(0,n.useState)(!1),[p,v]=(0,n.use
1State)(!1),[_,k]=(0,n.useState)(new Set),[f,x]=(0,n.useState)(0),[C,j]=(0,n.useState)(!1),[y,S]=(0,n.useState)(null),[N,P]=(0,n.useState)(null),[w,A]=(0,n.useState)(null),M=function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((t,n)=>{if(console.log("\uD83D\uDCB3 Attempting Snap payment (attempt ".concat(a+1,"/").concat(3,"):"),e),!window.snap){console.error("â Midtrans Snap not available"),n(Error("Midtrans Snap not loaded"));return}try{window.snap.pay(e,{onSuccess:async function(e){if(console.log("â
Payment success:",e),h(!1),x(0),j(!1),"settlement"===e.transaction_status&&N){console.log("\uD83D\uDCCA Recording voucher usage for settlement payment:",e.order_id);try{let o=await fetch("/api/voucher/record-usage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderCode:e.order_id})}),a=await o.json();a.success?console.log("â
Voucher usage recorded successfully"):console.warn("â ï¸ Failed to record voucher usage:",a.message)}catch(e){console.error("â Error recording voucher usage:",e)}}let a=w||i.sellingPrice,n={orderCode:e.order_id,digitalCopy:i.isDigitalCopy,email:"[email protected]",numOfPrint:i.numOfPrint,numOfShoot:i.numOfShoot,packageCode:i.packageCode,paymentStatus:e.transaction_status,paymentMethod:e.payment_type,paid:!0,phoneNumber:"081910298293",productStatus:"active",totalAmount:a,partnerCode:b()};N&&(n.originalAmount=N.originalAmount,n.discountAmount=N.discountAmount,n.voucherCode=N.voucherCode),o((0,J.Kv)(n));{let o="/payment/notification?order_id="+e.order_id+"&transaction_status="+e.transaction_status,a=(0,U.L0)(o);console.log("\uD83C\uDFE2 Payment success redirect with partner code:",a),window.location=a}t(e)},onPending:function(e){console.log("â³ Payment pending:",e),h(!1),t(e)},onError:function(o){console.error("â Payment error:",o),h(!1),a<2?(console.log("\uD83D\uDD04 Retrying payment (".concat(a+1,"/").concat(3,")")),setTimeout(()=>{M(e,a+1).then(t).catch(n)},(a+1)*2e3)):(console.error("â Max retry attempts reached"),S(e),x(a+1),j(!0),n(Error("Payment failed after maximum retries")))},onClose:function(){console.log("\uD83D\uDEAA Payment popup closed by user"),h(!1),t({closed:!0})}})}catch(o){console.error("â Error calling window.snap.pay:",o),a<2?(console.log("\uD83D\uDD04 Retrying payment due to error (".concat(a+1,"/").concat(3,")")),setTimeout(()=>{M(e,a+1).then(t).catch(n)},(a+1)*2e3)):(console.error("â Max retry attempts reached after error"),S(e),x(a+1),j(!0),n(o))}})},b=()=>e.query.partner_code?e.query.partner_code:localStorage.getItem("selfieku_partner_code")||"PARTNERCAFESENUS",{isLoading:D,packages:B,transactionToken:I,order:R}=(0,r.d4)(e=>e),{q:O,type:F}=e.query,[T,V]=(0,n.useState)(180),W=K.production;(0,n.useEffect)(()=>{{let e=localStorage.getItem("resetPackageTimer"),o=localStorage.getItem("packageSelectionCountdown");"true"===e?(console.log("\uD83D\uDD04 Resetting package selection timer to 180 seconds"),V(180),localStorage.removeItem("resetPackageTimer"),localStorage.setItem("packageSelectionCountdown","180")):o&&parseInt(o)>0?(console.log("â° Continuing package selection timer from",o,"seconds"),V(parseInt(o))):(console.log("\uD83C\uDD95 Starting fresh package selection timer"),V(180),localStorage.setItem("packageSelectionCountdown","180"))}},[]),(0,n.useEffect)(()=>{localStorage.setItem("packageSelectionCountdown",T)},[T]),(0,n.useEffect)(()=>{let e=setInterval(()=>{V(e=>e-1)},1e3);return()=>clearInterval(e)},[]);let G=async()=>{if(p)return void console.log("â ï¸ Order creation already in progress, ignoring duplicate request");v(!0),console.log("\uD83C\uDD95 Starting order creation process");try{localStorage.removeItem("packageSelectionCountdown"),k(new Set),h(!1),console.log("\uD83C\uDD95 Creating new order - cleared processed tokens");let e=w||i.sellingPrice,a={digitalCopy:i.isDigitalCopy,email:"[email protected]",numOfPrint:i.numOfPrint,numOfShoot:i.numOfShoot,packageCode:i.packageCode,paid:!1,phoneNumber:"081910298293",productStatus:"active",totalAmount:e,partnerCode:b()};N&&(a.originalAmount=N.originalAmount,a.discountAmount=N.discountAmount,a.voucherCode=N.voucherCode,console.log("\uD83C\uDFAB Order includes voucher:",{voucherCode:N.voucherCode,originalAmount:N.originalAmount,discountAmount:N.discountAmount,finalAmount:e})),console.log("\uD83D\uDCE6 Creating order with payload:",a),o((0,J.BF
1)(a))}catch(e){console.error("â Error during order creation:",e),v(!1)}};return(0,n.useEffect)(()=>{(async()=>{if(console.log("\uD83D\uDD04 Transaction token changed:",I),console.log("\uD83C\uDF0D Window available:",!0),console.log("\uD83D\uDCB3 Snap available:",window.snap),console.log("\uD83D\uDEAB Payment in progress:",g),console.log("\uD83D\uDCDD Processed tokens:",Array.from(_)),I&&window.snap&&!g&&!_.has(I.token)){if(console.log("â
All conditions met, processing voucher and opening Snap payment with token:",I.token),!I.token){console.error("â Transaction token is missing the actual token value"),alert("Terjadi kesalahan: Token pembayaran tidak valid. Silakan coba lagi.");return}if(k(e=>new Set([...e,I.token])),h(!0),v(!1),N&&I.orderCode){console.log("\uD83C\uDFAB Applying voucher to order before payment:",I.orderCode);try{let e=await fetch("/api/voucher/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({voucherCode:N.voucherCode,orderCode:I.orderCode,partnerCode:b(),orderAmount:N.originalAmount})}),o=await e.json();o.success?console.log("â
Voucher applied successfully to order"):console.warn("â ï¸ Failed to apply voucher to order:",o.message)}catch(e){console.error("â Error applying voucher to order:",e)}}try{await M(I.token)}catch(e){console.error("â Payment failed after all retries:",e)}}else console.log("â ï¸ Payment conditions not met:",{hasToken:!!I,hasWindow:!0,hasSnap:!!window.snap,paymentInProgress:g,tokenAlreadyProcessed:I&&_.has(I.token)})})()},[I,_,N]),(0,n.useEffect)(()=>{if(p){let e=setTimeout(()=>{console.log("â° Order creation timeout - resetting flag"),v(!1)},15e3);return()=>clearTimeout(e)}},[p]),(0,t.jsxs)(s.A,{type:"homepage",children:[(0,t.jsx)(l.A,{page:"PACKAGES",durationInSecond:T,setDurationInSecond:V}),(0,t.jsx)("div",{className:z().clearfix}),(0,t.jsx)("div",{className:z().containerPage,children:(0,t.jsx)(E,{onPackageSelectedData:e=>{d(e),I&&(console.log("\uD83E\uDDF9 Clearing existing transaction token for new package selection"),o((0,J.f6)()),k(new Set)),N&&e.sellingPrice>=(N.minPurchaseAmount||0)?A(e.sellingPrice-N.discountAmount):A(e.sellingPrice)},packages:B,onSelectPackage:e=>c(e),oncreateOrder:G,appliedVoucher:N,finalOrderAmount:w,onVoucherApplied:e=>{console.log("\uD83C\uDFAB Voucher applied:",e),P(e),A(e.finalAmount)},onVoucherRemoved:()=>{console.log("\uD83D\uDDD1ï¸ Voucher removed"),P(null),A(null)},packageSelected:a,packageSelectedData:i,partnerCode:b(),orderCreationInProgress:p})}),(0,t.jsx)(H.A,{pageName:"package",packageSelected:a,oncreateOrder:G,onClickNext:()=>m(!0),prevUrl:"/",nextUrl:"#",orderCreationInProgress:p}),u&&(0,t.jsx)("div",{className:z().modalOverlay,onClick:()=>m(!1),"aria-labelledby":"modal-modal-title","aria-describedby":"modal-modal-description",children:(0,t.jsxs)("div",{className:z().modalBox,onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("h2",{id:"modal-modal-title",className:z().modalTitle,children:"Hallo, Maaf Yaa..."}),(0,t.jsx)("p",{id:"modal-modal-description",className:z().modalDe
1scription,children:"Silahkan Pilih Paket Terlebih Dahulu."})]})}),(0,t.jsx)(q(),{type:"text/javascript",src:W.snapUrl,"data-client-key":W.clientKey,onLoad:()=>{console.log("â
Midtrans Snap loaded successfully for ".concat(W.clientKey.includes("SB-")?"SANDBOX":"PRODUCTION"," environment"))},onError:()=>{console.error("â Failed to load Midtrans Snap script"),j(!0),x(1),S((null==I?void 0:I.token)||"script_load_failed")}}),(0,t.jsx)(Q,{isVisible:p,message:"Membuat Pesanan...",submessage:"Mohon tunggu sebentar, jangan menutup halaman ini",timeoutSeconds:30,onTimeout:()=>{console.log("â° Loading modal timeout reached - redirecting to landing page"),v(!1),P(null),A(null),c(!1),d(null),o((0,J.f6)()),k(new Set),h(!1),localStorage.removeItem("selectedPackageData"),localStorage.removeItem("packageSelectionCountdown");let e=(0,U.L0)("/");console.log("\uD83C\uDFE0 Redirecting to landing page due to timeout:",e),window.location.href=e}}),C&&(0,t.jsx)("div",{className:z().modalOverlay,children:(0,t.jsxs)("div",{className:z().modalBox,children:[(0,t.jsx)("h2",{className:z().modalTitle,children:"\uD83D\uDCB3 Pembayaran Gagal"}
1),(0,t.jsxs)("p",{className:z().modalDescription,children:["Popup pembayaran Midtrans tidak muncul atau gagal dimuat.",(0,t.jsx)("br",{}),(0,t.jsx)("br",{}),(0,t.jsx)("strong",{children:"Percobaan:"})," ",f,"/",3,(0,t.jsx)("br",{}),(0,t.jsx)("br",{}),"Silakan coba lagi atau batalkan untuk kembali ke halaman utama."]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"12px",justifyContent:"center",marginTop:"20px"},children:[(0,t.jsx)("button",{onClick:()=>{console.log("\uD83D\uDD04 User initiated payment retry"),j(!1),x(0),y&&(k(e=>{let o=new Set(e);return o.delete(y),o}),h(!1),console.log("\uD83D\uDD04 Retrying payment with token:",y))},style:{backgroundColor:"#28a745",color:"white",border:"none",borderRadius:"8px",padding:"12px 24px",fontSize:"16px",fontWeight:"600",cursor:"pointer",transition:"all 0.3s ease"},onMouseOver:e=>e.target.style.backgroundColor="#218838",onMouseOut:e=>e.target.style.backgroundColor="#28a745",children:"\uD83D\uDD04 Coba Lagi"}),(0,t.jsx)("button",{onClick:()=>{console.log("â User cancelled payment retry"),j(!1),x(0),S(null);let e=(0,U.L0)("/");window.location.href=e},style:{backgroundColor:"#dc3545",color:"white",border:"none",borderRadius:"8px",padding:"12px 24px",fontSize:"16px",fontWeight:"600",cursor:"pointer",transition:"all 0.3s ease"},onMouseOver:e=>e.target.style.backgroundColor="#c82333",onMouseOut:e=>e.target.style.backgroundColor="#dc3545",children:"â Batalkan"})]})]})})]})}},4735:(e,o,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/selfieku/packages",function(){return a(3242)}])},5409:e=>{e.exports={clearfix:"package_clearfix__8iOS4",containerPage:"package_containerPage__sNuuz",modalOverlay:"package_modalOverlay__SNFlZ",modalBox:"package_modalBox__J7MA6",modalTitle:"package_modalTitle__5trvw",modalDescription:"package_modalDescription___GSdc"}},7276:e=>{e.exports={modalOverlay:"voucherModal_modalOverlay__ZHeN7",modalContent:"voucherModal_modalContent__3WwPc",modalSlideIn:"voucherModal_modalSlideIn__51LNf",modalHeader:"voucherModal_modalHeader__DRJYC",closeButton:"voucherModal_closeButton__jC9JT",modalBody:"voucherModal_modalBody__s1_LR",inputSection:"voucherModal_inputSection__DKLxw",validateButtonContainer:"voucherModal_validateButtonContainer__ldzLl",inputLabel:"voucherModal_inputLabel__Dwfx0",inputGroup:"voucherModal_inputGroup__jmo7Z",voucherInput:"voucherModal_voucherInput__1d9hV",validateButton:"voucherModal_validateButton__IWtsT",errorMessage:"voucherModal_errorMessage__sE7_f",successSection:"voucherModal_successSection__77Ia_",discountInfo:"voucherModal_discountInfo__bxWF0",discountHeader:"voucherModal_discountHeader__n8RP_",discountDetails:"voucherModal_discountDetails__okWgc",priceBreakdown:"voucherModal_priceBreakdown__yTQGw",priceRow:"voucherModal_priceRow__1idZ_",discount:"voucherModal_discount__r3kAR",final:"voucherModal_final__24N3d",modalFooter:"voucherModal_modalFooter__CRWFo",footerButtons:"voucherModal_footerButtons__cqul3",cancelButton:"voucherModal_cancelButton__HJDtd",applyButton:"voucherModal_applyButton__1cBMT",modalHint:"voucherModal_modalHint__odqG4"}},7415:e=>{e.exports={overlay:"loadingModal_overlay__eOlGH",fadeIn:"loadingModal_fadeIn__xd__U",modal:"loadingModal_modal__E3WPs",slideUp:"loadingModal_slideUp__7Jab2",spinner:"loadingModal_spinner__asrcN",spinnerRing:"loadingModal_spinnerRing__AWBMg",spin:"loadingModal_spin__2Oje7",content:"loadingModal_content__1RAhN",title:"loadingModal_title__w6mpH",subtitle:"loadingModal_subtitle__VM9rL",timerContainer:"loadingModal_timerContainer__uHsWh",timerText:"loadingModal_timerText__q_3HW",timerNumber:"loadingModal_timerNumber__lYtNO",timerBar:"loadingModal_timerBar__b_3ml",timerProgress:"loadingModal_timerProgress__OhWfq",progressDots:"loadingModal_progressDots__9amOs",dot:"loadingModal_dot__k1H6C",pulse:"loadingModal_pulse__BqErr"}},7883:(e,o,a)=>{"use strict";var t=a(9563);o.A=void 0;var n=t(a(1405)),r=a(7876);o.A=(0,n.default)((0,r.jsx)("path",{d:"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"}),"Print")}},e=>{e.O(0,[92,170,972,292,984,636,593,792],()=>e(e.s=4735)),_N_E=e.O()}]);
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.