PageSourceSearch

https://parcdelaluge.re/_next/static/chunks/pages/paques/staff-22fbbc935523e6ef.js

js parcdelaluge.re collected 2026-10-02 23:08:45 UTC 34,087 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[972],{1541:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var a=r(7876),s=r(4232),n=r(6489),i=r(4010),l=r(1480),o=r(787),d=r(3299);let c="admin-field-drawer",u=e=>{let{title:t,currentPath:r,roles:u,children:m=null}=e,[p,x]=(0,s.useState)(!1),g=(0,i.YC)(u),f=()=>x(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("header",{className:"sticky top-0 z-40 border-b border-border bg-card",children:(0,a.jsxs)("div",{className:"mx-auto flex w-full max-w-3xl items-center gap-3 px-4 py-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>x(!0),"aria-label":"Ouvrir la navigation back-office","aria-controls":c,"aria-expanded":p,"aria-haspopup":"dialog",className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-lg border border-border text-foreground transition hover:bg-accent",children:(0,a.jsx)(n.A,{name:"menu",className:"h-5 w-5"})}),(0,a.jsx)("p",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-foreground",children:t}),m?(0,a.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:m}):null]})}),(0,a.jsx)(o.A,{open:p,onClose:f,id:c,label:"Navigation back-office (exploitation)",fullViewport:!0,children:(0,a.jsxs)("div",{className:"flex h-full flex-col",children:[(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:(0,a.jsx)(d.A,{groups:g,currentPath:r,collapsed:!1,navLabel:"Navigation back-office (exploitation)",onNavigate:f})}),(0,a.jsx)("div",{className:"border-t border-border p-3",children:(0,a.jsx)(l.A,{})})]})})]})}},6060:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/paques/staff",function(){return r(8057)}])},8057:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>P});var a=r(7876),s=r(7328),n=r.n(s),i=r(2010),l=r(8230),o=r.n(l),d=r(4232),c=r(1541),u=r(6547),m=r(4990);let p=e=>{let{reward:t,isRedeeming:r,onRedeem:s}=e;if(!t)return null;let n="issued"===t.status,i="redeemed"===t.status?{shell:"border-amber-300 bg-amber-50",badge:"bg-amber-600 text-white",title:"Gain d\xe9j\xe0 utilis\xe9",subtitle:"Ce lot a d\xe9j\xe0 \xe9t\xe9 remis. V\xe9rifiez les informations avant toute nouvelle action.",button:"bg-slate-300 text-slate-600"}:{shell:"border-emerald-300 bg-emerald-50",badge:"bg-emerald-600 text-white",title:"Gain valide",subtitle:"Le lot peut \xeatre remis d\xe8s maintenant si tout correspond.",button:"bg-emerald-600 text-white hover:bg-emerald-700"},l=Array.isArray(t.pickupLocationLabels)&&t.pickupLocationLabels.length>0?t.pickupLocationLabels.join(", "):t.pickupLocation||"Voir l’organisation sur place";return(0,a.jsxs)("section",{className:"overflow-hidden rounded-[2rem] border p-0 shadow-sm ".concat(i.shell),children:[(0,a.jsx)("div",{className:"border-b border-black/5 px-6 py-6",children:(0,a.jsxs)("div",{className:"flex flex-col gap-5 lg:flex-row lg:items-start lg:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"inline-flex rounded-full px-4 py-2 text-xs font-semibold uppercase tracking-[0.24em] ".concat(i.badge),children:(0,m._J)(t.status)}),(null==t?void 0:t.isTest)?(0,a.jsx)("span",{className:"ml-2 inline-flex rounded-full bg-sky-600 px-4 py-2 text-xs font-semibold uppercase tracking-[0.24em] text-white",children:"Test"}):null,(0,a.jsx)("h2",{className:"mt-4 text-3xl font-semibold text-slate-950",children:i.title}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-slate-700",children:i.subtitle}),(null==t?void 0:t.isTest)?(0,a.jsx)("p",{className:"mt-2 text-xs font-semibold uppercase tracking-[0.18em] text-sky-800",children:"Non valable en exploitation"}):null]}),(0,a.jsx)("button",{type:"button",onClick:s,disabled:!n||r,className:"rounded-full px-6 py-3 text-sm font-semibold transition disabled:cursor-not-allowed ".concat(i.button),children:r?"Validation...":n?"Marquer comme remis":"D\xe9j\xe0 trait\xe9"})]})}),(0,a.jsxs)("div",{className:"grid gap-4 px-6 py-6 sm:grid-cols-2 xl:grid-cols-4",children:[(0,a.jsxs)("article",{className:"rounded-2xl border border-white/60 bg-white/80 p-4",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Code 
1cadeau"}),(0,a.jsx)("p",{className:"mt-2 text-3xl font-semibold text-slate-950",children:t.rewardCode})]}),(0,a.jsxs)("article",{className:"rounded-2xl border border-white/60 bg-white/80 p-4",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Lot"}),(0,a.jsx)("p",{className:"mt-2 text-lg font-semibold text-slate-950",children:t.rewardLabel}),(null==t?void 0:t.isSubstituted)?(0,a.jsxs)("p",{className:"mt-2 text-xs font-semibold uppercase tracking-[0.18em] text-slate-600",children:["Lot de remplacement \xb7 lot initial : ",t.sourceRewardLabel||"Lot nominal"]}):null,(null==t?void 0:t.substitutionMessage)?(0,a.jsx)("p",{className:"mt-2 text-xs text-slate-600",children:t.substitutionMessage}):null]}),(0,a.jsxs)("article",{className:"rounded-2xl border border-white/60 bg-white/80 p-4",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Partie"}),(0,a.jsx)("p",{className:"mt-2 text-lg font-semibold text-slate-950",children:(0,m.fH)(t.sessionStatus)})]}),(0,a.jsxs)("article",{className:"rounded-2xl border border-white/60 bg-white/80 p-4",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Email"}),(0,a.jsx)("p",{className:"mt-2 text-lg font-semibold text-slate-950",children:t.claimEmailMasked||"Non v\xe9rifi\xe9"})]}),(0,a.jsxs)("article",{className:"rounded-2xl border border-white/60 bg-white/80 p-4 sm:col-span-2 xl:col-span-4",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Lieu de retrait"}),(0,a.jsx)("p",{className:"mt-2 text-lg font-semibold text-slate-950",children:l})]})]}),(0,a.jsxs)("div",{className:"border-t border-black/5 px-6 py-4 text-sm text-slate-600",children:[t.createdAt?(0,a.jsxs)("p",{children:["\xc9mis le ",new Date(t.createdAt).toLocaleString("fr-FR")]}):null,t.redeemedAt?(0,a.jsxs)("p",{children:["Remis le ",new Date(t.redeemedAt).toLocaleString("fr-FR")]}):null]})]})},x=e=>{let{isOpen:t,view:r,isBooting:s,videoElementRef:n,errorMessage:i,onClose:l,onRetry:o}=e;if(!t)return null;let d="blocked"===r;return(0,a.jsx)("div",{className:"fixed inset-0 z-50 bg-slate-950",role:"dialog","aria-modal":"true",children:(0,a.jsxs)("div",{className:"relative flex h-full flex-col",children:[(0,a.jsx)("video",{ref:n,className:"absolute inset-0 h-full w-full object-cover ".concat(d?"hidden":"block"),muted:!0,playsInline:!0,autoPlay:!0}),(0,a.jsx)("div",{className:"pointer-events-none absolute inset-0 bg-[linear-gradient(180deg,rgba(2,6,23,0.86)_0%,rgba(2,6,23,0.18)_28%,rgba(2,6,23,0.16)_72%,rgba(2,6,23,0.92)_100%)]"}),d?null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"pointer-events-none absolute inset-x-6 bottom-36 top-24 rounded-[2rem] border-[3px] border-dashed border-emerald-300/95 shadow-[0_0_0_9999px_rgba(2,6,23,0.22)]","aria-hidden":"true"}),(0,a.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-[42%] h-0.5 bg-emerald-300/80 shadow-[0_0_20px_rgba(110,231,183,0.95)]","aria-hidden":"true"})]}),(0,a.jsxs)("div",{className:"relative flex items-center justify-between px-5 pt-5",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.28em] text-emerald-200",children:"Contr\xf4le des gains"}),(0,a.jsx)("h2",{className:"mt-2 text-2xl font-bold text-white",children:"Scanner un QR code client"})]}),(0,a.jsx)("button",{type:"button",onClick:l,className:"rounded-full border border-white/20 bg-white/10 px-4 py-2 text-sm font-semibold text-white backdrop-blur transition hover:bg-white/15",children:"Fermer"})]}),(0,a.jsx)("div",{className:"relative mt-auto px-5 pb-6",children:(0,a.jsx)("div",{className:"rounded-[2rem] border border-white/10 bg-slate-950/78 p-5 text-white backdrop-blur",children:d?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-sm font-semibold uppercase tracking-[0.24em] text-amber-200",children:"Cam\xe9ra indisponible"}),(0,a.jsx)("p",{className:"mt-3 text-base leading-7 text-slate-100",children:i}),(0,a.jsxs)("div",{className:"mt-5 flex flex-col gap-3 sm:flex-row",children:[(0,a.jsx)("button",{type:"button",onClick:o,className:"rounded-full bg-amber-300 px-5 py-3 text-sm font-semibold text-slate-950 transition hover:bg-amber-200",children:"R\xe9essayer"}),(0,a.jsx)("button",{type:"button",onClick:l,className:"rounded-full border border-white/20 bg-white/10 px-5 py-3 text-sm font-semibold text-white transition hover:bg-white/15",children:"Revenir \xe0 la saisie du code"})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-base font-semibold text-white",children:s?"Autorisez la cam\xe9ra si le navigateur le demande.":"Cadrez le QR code du client."}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-slate-300",children:"D\xe8s qu’il est reconnu, le r\xe9sultat s’affiche en plein \xe9cran avec le bon statut de remise."}),i?(0,a.jsx)("div",{className:"mt-4 rounded-[1.4rem] border border-red-300/40 bg-red-500/10 px-4 py-3 text-sm text-red-100",children:i}):null]})})})]})})},g=/^(?:\d{6}|T\d{6})$/,f=e=>{let{rewardCode:t,isLoading:r,submitLabel:s="Verifier",onChange:n,onSubmit:i}=e;return(0,a.jsxs)("section",{className:"rounded-3xl border border-slate-200 bg-white p-6 shadow-sm",children:[(0,a.jsx)("h2",{className:"text-2xl font-semibold text-slate-900",children:"Saisir un code de gain"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-slate-600",children:"Entrez le code communiqu\xe9 au client pour v\xe9rifier son statut avant remise."}),(0,a.jsxs)("div",{className:"mt-5 flex flex-col gap-4 sm:flex-row",children:[(0,a.jsx)("input",{type:"text",inputMode:"text",pattern:"(?:[0-9]{6}|T[0-9]{6})",value:t,onChange:e=>n(e.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,7)),placeholder:"123456",className:"flex-1 rounded-2xl border border-slate-300 px-4 py-3 text-sm tracking-[0.25em] text-slate-900 outline-none transition focus:border-slate-500 focus:ring-2 focus:ring-slate-100"}),(0,a.jsx)("button",{type:"button",onClick:i,disabled:r||!g.test(t.trim().toUpperCase()),className:"rounded-full bg-slate-900 px-5 py-3 text-sm font-semibold text-white transition hover:bg-slate-800 disabled:cursor-not-allowed disabled:bg-slate-300",children:s})]})]})},h=e=>{let{activeSessionsToday:t,isLoading:r=!1,errorMessage:s=""}=e;return(0,a.jsxs)("section",{className:"rounded-3xl border border-amber-200 bg-[linear-gradient(180deg,#fff7ed_0%,#ffffff_100%)] p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-amber-700",children:"Affluence \xe0 anticiper"}),(0,a.jsx)("h2",{className:"mt-2 text-xl font-semibold text-slate-950",children:"Sessions en cours aujourd'hui"}),(0,a.jsx)("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-slate-600",children:"Compte les parties cr\xe9\xe9es aujourd'hui qui n'ont pas encore \xe9t\xe9 r\xe9clam\xe9es. Cela aide l'\xe9quipe \xe0 anticiper la pr\xe9paration des lots avant l'arriv\xe9e en caisse."})]}),(0,a.jsxs)("div",{className:"rounded-[1.6rem] bg-white px-5 py-4 text-center shadow-sm ring-1 ring-amber-100",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-slate-500",children:"En cours"}),(0,a.jsx)("p",{className:"mt-2 text-4xl font-semibold text-slate-950",children:r?"…":t})]})]}),s?(0,a.jsx)("p",{className:"mt-4 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700",children:s}):null]})};
1var b=r(1239),v=r(238),w=r(9890),j=r(4734);let y=e=>({"Content-Type":"application/json",Authorization:"Bearer ".concat(e)}),N=e=>String(e||"").trim().toUpperCase(),k=e=>{let t=N(e),r=/^(?:\d{6}|T\d{6})$/;if(r.test(t))return t;try{let e=new URL(t),a=N(e.searchParams.get("rewardCode"));if(r.test(a))return a;let s=e.pathname.split("/").filter(Boolean),n=N(s[s.length-1]);if(r.test(n))return n}catch(e){}return null},S=async e=>{let{rewardCode:t,accessToken:r}=e,a=await fetch("/api/paques/staff/reward/".concat(encodeURIComponent(t)),{method:"GET",headers:y(r)});if(!a.ok)throw Error(await (0,j.V)(a,"Impossible de verifier ce code."));return a.json()},C=async e=>{let{rewardCode:t,accessToken:r}=e,a=await fetch("/api/paques/staff/redeem",{method:"POST",headers:y(r),body:JSON.stringify({rewardCode:t})});if(!a.ok)throw Error(await (0,j.V)(a,"Impossible de valider ce gain."));return a.json()},L=(e,t,r)=>{var a,s,n;try{null==(a=e.current)||a.stop()}catch(e){}e.current=null,t.current&&(0,w.T$)(t.current),t.current=null,r.current&&(null==(s=(n=r.current).pause)||s.call(n),"srcObject"in r.current&&(r.current.srcObject=null))},R=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,d.useRef)(null),r=(0,d.useRef)(null),a=(0,d.useRef)(null),s=(0,d.useRef)(0),n=(0,d.useRef)(!1),i=(0,d.useRef)(e.onCodeDetected),l=(0,d.useRef)(e.onInvalidCodeDetected),[o,c]=(0,d.useState)({isOpen:!1,view:"opening",errorMessage:"",attempt:0});(0,d.useEffect)(()=>{i.current=e.onCodeDetected},[e.onCodeDetected]),(0,d.useEffect)(()=>{l.current=e.onInvalidCodeDetected},[e.onInvalidCodeDetected]);let u=(0,d.useCallback)((e,t)=>{c(r=>r.attempt!==e?r:t(r))},[]),m=(0,d.useCallback)(()=>{s.current+=1,n.current=!1,L(t,r,a),c({isOpen:!1,view:"opening",errorMessage:"",attempt:s.current})},[]),p=(0,d.useCallback)(async()=>{s.current+=1,n.current=!1,L(t,r,a),c({isOpen:!0,view:"opening",errorMessage:"",attempt:s.current})},[]),x=(0,d.useCallback)(async()=>{await p()},[p]);return(0,d.useEffect)(()=>{if(!o.isOpen||!a.current)return;let e=o.attempt,d=a.current,m=!1;return(async()=>{try{let o=await (0,w.aF)();if(m||s.current!==e)return void(0,w.T$)(o.stream);if(!o.ok||!o.stream){let t=o.reason||"start_failed",r=(0,w.gZ)(t);u(e,e=>({...e,view:"blocked",errorMessage:r}));return}if(r.current=o.stream,await (0,w.Uy)(d,o.stream),m||s.current!==e)return void L(t,r,a);let p=await (0,w.YM)();if(m||s.current!==e)return void L(t,r,a);let{BrowserQRCodeReader:x,BarcodeFormat:g}=p,f=new x(void 0,{delayBetweenScanAttempts:35,delayBetweenScanSuccess:90,tryPlayVideoTimeout:8e3});f.possibleFormats=[g.QR_CODE];let h=await f.decodeFromVideoElement(d,async(a,o,d)=>
1{if(!n.current&&!m&&s.current===e){if(a){let e="function"==typeof a.getText?a.getText():String((null==a?void 0:a.text)||""),s=k(e);n.current=!0,d.stop(),t.current=null,(0,w.T$)(r.current),r.current=null,c(e=>({...e,isOpen:!1,view:"opening",errorMessage:""}));try{var p,x;if(!s)return void await (null==(x=l.current)?void 0:x.call(l,e));await (null==(p=i.current)?void 0:p.call(i,s))}finally{n.current=!1}return}o&&!(0,w.CL)(o)&&u(e,e=>({...e,errorMessage:"Approchez le QR code et gardez-le bien dans le cadre."}))}});if(m||s.current!==e){h.stop(),L(t,r,a);return}t.current=h,u(e,e=>({...e,view:"scanning",errorMessage:""}))}catch(l){if(m||s.current!==e)return;let n=(0,w.Fo)(l),i=(0,w.gZ)(n);L(t,r,a),u(e,e=>({...e,view:"blocked",errorMessage:i}))}})(),()=>{m=!0,L(t,r,a)}},[o.attempt,o.isOpen,u]),{videoElementRef:a,isOpen:o.isOpen,view:o.view,isBooting:o.isOpen&&"opening"===o.view,errorMessage:o.errorMessage,openScanner:p,closeScanner:m,retryScanner:x}};var E=r(552);let M=async e=>{if(await (0,E.Km)(),"success"===e){await (0,E.qv)("tier"),(0,E.RJ)("tier");return}await (0,E.qv)("duplicate"),(0,E.RJ)("duplicate")},T=e=>{let t=String(e||"").toLowerCase();return t.includes("autre point de retrait")||t.includes("n'a pas encore de lieu")?"unauthorized":t.includes("d\xe9j\xe0")||t.includes("deja")?"already_redeemed":t.includes("introuvable")||t.includes("invalide")?"invalid":"technical_error"},A=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",[t,r]=(0,d.useState)({reward:null,isLoading:!1,isRedeeming:!1,errorMessage:"",result:null}),a=(0,d.useCallback)(async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=((e,t,r)=>{let a=Array.isArray(null==t?void 0:t.pickupLocationLabels)&&t.pickupLocationLabels.length>0?t.pickupLocationLabels.join(", "):(null==t?void 0:t.pickupLocation)||"Voir l’organisation sur place";return"redeemed"===e?{type:"redeemed",tone:"success",title:"Gain remis",message:r||"Le lot peut \xeatre remis \xe0 ".concat(a,"."),reward:t,canRedeemManually:!1}:"manual"===e?{type:"manual",tone:"success",title:"Gain valide",message:r||"Le lot est autoris\xe9 pour ".concat(a,". Confirmez la remise pour finaliser le contr\xf4le."),reward:t,canRedeemManually:!0}:"already_redeemed"===e?{type:"already_redeemed",tone:"warning",title:"Gain d\xe9j\xe0 remis",message:r||"Ce lot a d\xe9j\xe0 \xe9t\xe9 trait\xe9. V\xe9rifiez les informations avant toute nouvelle action.",reward:t,canRedeemManually:!1}:"unauthorized"===e?{type:"unauthorized",tone:"danger",title:"Point de retrait non autoris\xe9",message:r||"Ce gain doit \xeatre remis \xe0 un autre point de retrait.",reward:t,canRedeemManually:!1}:"invalid"===e?{type:"invalid",tone:"danger",title:"Code invalide",message:r||"Ce QR code ou ce code manuel ne correspond pas \xe0 un gain valide.",reward:null,canRedeemManually:!1}:{type:"technical_error",tone:"danger",title:"Op\xe9ration \xe0 relancer",message:r||"Une erreur technique emp\xeache de finaliser ce contr\xf4le pour le moment.",reward:t,canRedeemManually:!1}})(e,t,a);r(e=>({...e,result:s,errorMessage:"danger"===s.tone?s.message:""})),await M(s.tone)},[]),s=(0,d.useCallback)(async t=>{if(!e)throw Error("Session staff expir\xe9e.");r(e=>({...e,isLoading:!0,errorMessage:""}));try{let s=(await S({rewardCode:t,accessToken:e})).reward||null;if(!s)throw Error("Impossible de v\xe9rifier ce gain.");if(r(e=>({...e,reward:s,isLoading:!1,errorMessage:""})),"redeemed"===s.status)return await a("already_redeemed",s),s;if(!s.isAuthorizedPickupLocation)return await a("unauthorized",s,"missing_staff_permission"===s.authorizationReason?"Ce compte staff n'a pas encore de lieu de retrait autoris\xe9.":"missing_reward_location"===s.authorizationReason?"Ce gain n'a pas de lieu de retrait configur\xe9.":"Ce gain doit \xeatre remis \xe0 un autre point de retrait."),s;return await a("manual",s),s}catch(s){let e=s instanceof Error?s.message:"Impossible de v\xe9rifier ce gain.",t=T(e);throw r(t=>({...t,reward:null,isLoading:!1,isRedeeming:!1,errorMessage:e})),await a(t,null,e),s}finally{r(e=>({...e,isLoading:!1}))}},[e,a]),n=(0,d.useCallback)(async e=>{let t=k(e);if(!t){let e="Ce QR code ne correspond pas \xe0 un gain valide.";return r(t=>({...t,reward:null,errorMessage:e})),await a("invalid",null,e),null}return s(t)},[s,a]),i=(0,d.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Ce QR code ne correspond pas \xe0 un gain valide.";r(t=>({...t,reward:null,isRedeeming:!1,errorMessage:e})),await a("invalid",null,e)},[a]),l=(0,d.useCallback)(async s=>{if(!e)throw Error("Session staff expir\xe9e.");r(e=>({...e,isRedeeming:!0,errorMessage:""}));try{let n=await C({rewardCode:s,accessToken:e}),i=t.reward?{...t.reward,status:n.reward.status,redeemedAt:n.reward.redeemedAt,pickupLocation:n.reward.pickupLocation||t.reward.pickupLocation,pickupLocationSlugs:n.reward.pickupLocationSlugs||t.reward.pickupLocationSlugs,pickupLocationLabels:n.reward.pickupLocationLabels||t.reward.pickupLocationLabels}:n.reward;return r(e=>({...e,reward:i,isRedeeming:!1,errorMessage:""})),await a("redeemed",i,n.message||"R\xe9compense valid\xe9e."),n}catch(n){let e=n instanceof Error?n.message:"Impossible de valider ce gain.",s=T(e);throw r(t=>({...t,isRedeeming:!1,errorMessage:e})),await a(s,t.reward,e),n}}
1,[e,a,t.reward]),o=(0,d.useCallback)(()=>{r(e=>({...e,result:null,errorMessage:""}))},[]);return{reward:t.reward,isLoading:t.isLoading,isRedeeming:t.isRedeeming,errorMessage:t.errorMessage,result:t.result,lookupReward:s,lookupScannedReward:n,handleInvalidScan:i,redeemReward:l,closeResult:o}},_=async e=>{let{eventSlug:t,accessToken:r}=e,a=await fetch("/api/paques/admin/stats?eventSlug=".concat(encodeURIComponent(t)),{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)}});if(!a.ok)throw Error(await (0,j.V)(a,"Impossible de charger le flux des sessions."));return a.json()};var I=r(2120);let O=e=>{let{adminAccess:t}=e,[r,s]=(0,d.useState)(""),[n,i]=(0,d.useState)(!1),{profile:l,session:m}=t,g=(null==m?void 0:m.access_token)||"",{reward:w,isLoading:j,isRedeeming:y,result:N,lookupReward:k,lookupScannedReward:S,handleInvalidScan:C,redeemReward:L,closeResult:E}=A(g),M=R({onCodeDetected:async e=>{s(e),await S(e)},onInvalidCodeDetected:async()=>{await C()}}),T=!!w,O=(0,d.useMemo)(()=>j?"V\xe9rification...":"V\xe9rifier le gain",[j]),D=(e=>{let{eventSlug:t,accessToken:r=""}=e,[a,s]=(0,d.useState)({activeSessionsToday:0,isLoading:!!r,errorMessage:""}),n=(0,d.useCallback)(async()=>{if(!r||!t)return 0;s(e=>({...e,isLoading:!0,errorMessage:""}));try{var e;let a=await _({eventSlug:t,accessToken:r}),n=Number((null==a||null==(e=a.stats)?void 0:e.activeSessionsToday)||0);return s({activeSessionsToday:n,isLoading:!1,errorMessage:""}),n}catch(t){let e=t instanceof Error?t.message:"Impossible de charger le flux des sessions.";return s(t=>({...t,isLoading:!1,errorMessage:e})),0}},[r,t]);return(0,d.useEffect)(()=>{if(!r||!t)return;let e=window.setTimeout(()=>{n()},0);return()=>{window.clearTimeout(e)}},[r,t,n]),{activeSessionsToday:a.activeSessionsToday,isLoading:a.isLoading,errorMessage:a.errorMessage,refreshTraffic:n}})({eventSlug:I.Il,accessToken:g}),P=(null==l?void 0:l.roles)||(null==l?void 0:l.role)||[],U=(null==l?void 0:l.role)==="admin"?{href:"/paques/admin",label:"Retour admin P\xe2ques"}:{href:"/admin/dashboard",label:"Retour dashboard"};return(0,a.jsxs)("div",{className:"min-h-screen bg-slate-100 pb-10",children:[(0,a.jsx)(c.A,{title:"Staff P\xe2ques — Contr\xf4le des gains",currentPath:"/paques/staff",roles:P}),(0,a.jsxs)("div",{className:"mx-auto flex max-w-5xl flex-col gap-6 px-4 pt-10 sm:px-6",children:[(0,a.jsx)("section",{className:"rounded-3xl border border-slate-200 bg-white p-6 shadow-sm",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold text-slate-900",children:"Contr\xf4le des gains"}),(0,a.jsx)("p",{className:"mt-2 max-w-3xl text-sm text-slate-600",children:"Scannez le QR code du client ou saisissez directement son code \xe0 6 chiffres. Le r\xe9sultat s’affiche en plein \xe9cran avec le lot, le statut et le bon lieu de retrait."})]}),(0,a.jsx)(o(),{href:U.href,className:"rounded-full border border-slate-300 px-4 py-2 text-sm font-semibold text-slate-800 transition hover:border-slate-400",children:U.label})]})}),(0,a.jsx)(h,{activeSessionsToday:D.activeSessionsToday,isLoading:D.isLoading,errorMessage:D.errorMessage}),(0,a.jsxs)("section",{className:"rounded-3xl border border-slate-200 bg-white p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-end lg:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Contr\xf4le rapide"}),(0,a.jsx)("h2",{className:"mt-2 text-2xl font-semibold text-slate-950",children:"Scanner ou saisir, sans changer de mode"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-slate-600",children:"Le scan reste l’action principale. La saisie manuelle reste disponible juste en dessous si besoin."})]}),(0,a.jsx)("button",{type:"button",onClick:()=>void M.openScanner(),className:"inline-flex min-h-14 items-center justify-center rounded-full bg-slate-950 px-7 py-4 text-base font-semibold text-white transition hover:bg-slate-800",children:"Scanner le QR code client"})]}),(0,a.jsxs)("div",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[(0,a.jsxs)("article",{className:"rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-4",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-emerald-700",children:"Option 1"}),(0,a.jsx)("p",{className:"mt-2 text-sm font-semibold text-emerald-950",children:"Ouvrir le scanner"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-emerald-900/80",children:"Le code 
1client est reconnu sans quitter la page staff."})]}),(0,a.jsxs)("article",{className:"rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4",children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Option 2"}),(0,a.jsx)("p",{className:"mt-2 text-sm font-semibold text-slate-950",children:"Saisir le code"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-slate-600",children:"Pratique si le QR est difficile \xe0 lire ou si la cam\xe9ra n’est pas disponible."})]})]})]}),(0,a.jsx)(f,{rewardCode:r,isLoading:j,onChange:s,onSubmit:()=>k(r),submitLabel:O}),(0,a.jsx)(p,{reward:w,isRedeeming:y,onRedeem:()=>L((null==w?void 0:w.rewardCode)||r)}),(0,a.jsxs)("section",{className:"rounded-3xl border border-dashed border-slate-300 bg-slate-50 p-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-slate-500",children:"V\xe9rifications internes"}),(0,a.jsx)("h2",{className:"mt-2 text-lg font-semibold text-slate-900",children:"Tests et bac \xe0 sable"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-600",children:"Les sc\xe9narios de test sont r\xe9serv\xe9s aux v\xe9rifications internes et n’alt\xe8rent pas l’exploitation r\xe9elle."})]}),(0,a.jsx)("button",{type:"button",onClick:()=>i(e=>!e),className:"rounded-full border border-slate-300 bg-white px-5 py-3 text-sm font-semibold text-slate-800 transition hover:border-slate-400",children:n?"Masquer les tests internes":"Afficher les tests internes"})]}),n?(0,a.jsx)("div",{className:"mt-5",children:(0,a.jsx)(v.A,{eventSlug:I.Il,accessToken:g})}):null]}),(0,a.jsx)(b.A,{eventSlug:I.Il,sourceRoute:"/paques/staff",accessToken:g,session:null,extraContext:{page:"staff",rewardCodeInput:r,currentRewardCode:(null==w?void 0:w.rewardCode)||"",currentRewardStatus:(null==w?void 0:w.status)||"",lastResultType:(null==N?void 0:N.type)||""},initialCategory:"staff_issue",title:"Support technique staff",intro:"Si le contr\xf4le caisse pose probl\xe8me, d\xe9crivez la situation. Le support re\xe7oit aussi les informations de diagnostic utiles."}),T?(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)("button",{type:"button",onClick:()=>void M.openScanner(),className:"rounded-full border border-slate-300 px-5 py-3 text-sm font-semibold text-slate-800 transition hover:border-slate-400",children:"Scanner un autre QR code"})}):null]}),(0,a.jsx)(x,{isOpen:M.isOpen,view:M.view,isBooting:M.isBooting,videoElementRef:M.videoElementRef,errorMessage:M.errorMessage,onClose:M.closeScanner,onRetry:M.retryScanner}),(0,a.jsx)(u.A,{result:N,isRedeeming:y,onClose:E,onRedeem:e=>void L(e)})]})};var D=r(3117);let P=()=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(n(),{children:[(0,a.jsx)("title",{children:"Staff P\xe2ques - Parc de la Luge du Ma\xefdo"}),(0,a.jsx)("meta",{name:"robots",content:"noindex, nofollow"}),(0,a.jsx)("link",{rel:"canonical",href:"https://www.parcdelaluge.re/paques/staff"})]}),(0,a.jsx)(i.A,{requiredRoles:D.bk,children:e=>(0,a.jsx)(O,{adminAccess:e})})]})},9890:(e,t,r)=>{"use strict";r.d(t,{CL:()=>f,Fo:()=>g,MD:()=>m,T$:()=>l,Uy:()=>x,YM:()=>i,aF:()=>p,fv:()=>u,gZ:()=>h,jT:()=>o,wl:()=>d});let a={UNSUPPORTED:"unsupported",INSECURE_CONTEXT:"insecure_context",PERMISSION_DENIED:"permission_denied",CAMERA_UNAVAILABLE:"camera_unavailable",INVALID_QR:"invalid_qr",START_FAILED:"start_failed"},s=/back|rear|environment|world|trase|trasera|arriere|arrière|hinten|ambiente|trás|traseira/i,n=[{audio:!1,video:{facingMode:{ideal:"environment"},width:{ideal:1280},height:{ideal:720},frameRate:{ideal:24,max:30},advanced:[{focusMode:"continuous"}]}},{audio:!1,video:{facingMode:{ideal:"environment"},width:{ideal:960},height:{ideal:540},advanced:[{focusMode:"continuous"}]}},{audio:!1,video:{facingMode:"environment"}}],i=()=>r.e(556).then(r.bind(r,2556)),l=e=>{e&&"function"==typeof e.getTracks&&e.getTracks().forEach(e=>{try{e.stop()}catch(e){}})},o=e=>{if(!e||"function"!=typeof e.getVideoTracks)return{active:!1,trackCount:0,readyStates:[],label:"",settings:null};let t=e.getVideoTracks(),r=t[0]||null,a=r&&"function"==typeof r.getSettings?r.getSettings():{};return{active:"boolean"==typeof e.active?e.active:t.some(e=>"live"===e.readyState),trackCount:t.length,readyStates:t.map(e=>String(e.readyState||"unknown")),label:String((null==r?void 0:r.label)||""),settings:r?{deviceId:String(a.deviceId||""),facingMode:String(a.facingMode||""),width:Number(a.width||0),height:Number(a.height||0),frameRate:Number(a.frameRate||0)}:null}},d=e=>e?{readyState:Number(e.readyState||0),paused:!!e.paused,currentTime:Number(e.currentTime||0),videoWidth:Number(e.videoWidth||0),videoHeight:Number(e.videoHeight||0),hasSrcObject:!!e.srcObject,autoplay:!!e.autoplay,playsInl
1ine:!!e.playsInline,muted:!!e.muted}:{readyState:0,paused:!0,currentTime:0,videoWidth:0,videoHeight:0,hasSrcObject:!1,autoplay:!1,playsInline:!1,muted:!1},c=e=>"string"!=typeof e?null:e.trim()||null,u=e=>{let t="string"==typeof e?e.trim():"";if(!t)return null;for(let e of[t,t.startsWith("/")?"https://parcdelaluge.re".concat(t):null].filter(Boolean))try{let t=new URL(e),r=c(t.searchParams.get("scanToken"));if(!r)continue;return{scanToken:r,eventSlug:c(t.searchParams.get("eventSlug"))}}catch(e){}if(t.includes("scanToken=")){let e=new URLSearchParams(t.includes("?")?t.slice(t.indexOf("?")+1):t),r=c(e.get("scanToken"));if(r)return{scanToken:r,eventSlug:c(e.get("eventSlug"))}}return null},m=function(){var e,t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"undefined"!=typeof navigator?navigator:void 0,n=!!(null==r||null==(t=r.matchMedia)||null==(e=t.call(r,"(display-mode: standalone)"))?void 0:e.matches)||(null==s?void 0:s.standalone)===!0;return r&&s?!1===r.isSecureContext?{isSupported:!1,reason:a.INSECURE_CONTEXT,isStandalone:n}:s.mediaDevices&&"function"==typeof s.mediaDevices.getUserMedia?{isSupported:!0,reason:null,isStandalone:n}:{isSupported:!1,reason:a.UNSUPPORTED,isStandalone:n}:{isSupported:!1,reason:a.UNSUPPORTED,isStandalone:n}},p=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"!=typeof navigator?navigator:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window,r=m(t,e);if(!r.isSupported)return{ok:!1,reason:r.reason,stream:null};let a=null,i=null;try{let t=await e.mediaDevices.getUserMedia({audio:!1,video:{facingMode:{ideal:"environment"}}});i=(e=>{var t;if(!Array.isArray(e)||!e.length)return null;let r=e.filter(e=>(null==e?void 0:e.kind)==="videoinput");if(!r.length)return null;let a=r.find(e=>s.test(e.label||""));return(null==a?void 0:a.deviceId)||(null==(t=r[0])?void 0:t.deviceId)||null})(await e.mediaDevices.enumerateDevices()),l(t)}catch(e){a=e}for(let t of i?[{audio:!1,video:{deviceId:{exact:i},width:{ideal:1280},height:{ideal:720},frameRate:{ideal:24,max:30},advanced:[{focusMode:"continuous"}]}},...n]:n)try{let r=await e.mediaDevices.getUserMedia(t),a="function"==typeof(null==r?void 0:r.getVideoTracks)&&r.getVideoTracks()[0]||null;if(a&&"function"==typeof a.applyConstraints)try{await a.applyConstraints({advanced:[{focusMode:"continuous"}]})}catch(e){}return{ok:!0,reason:null,stream:r}}catch(e){a=e}return{ok:!1,reason:g(a),stream:null}},x=async function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;if(!e)throw Error("Missing video element.");e.muted=!0,e.autoplay=!0,e.playsInline=!0,e.setAttribute("muted","true"),e.setAttribute("autoplay","true"),e.setAttribute("playsinline","true"),e.srcObject=t,await new Promise((t,a)=>{var s,n;let i=!1,l=null,o=()=>{null!==l&&(null==r?void 0:r.clearTimeout)&&r.clearTimeout(l),e.removeEventListener("loadedmetadata",d),e.removeEventListener("loadeddata",d),e.removeEventListener("canplay",d),e.removeEventListener("playing",d)},d=()=>{e.videoWidth>0&&e.videoHeight>0&&(i||(i=!0,o(),t()))};l=null==r||null==(s=r.setTimeout)?void 0:s.call(r,()=>{let e=Error("Camera preview timed out.");e.name="TimeoutError",o(),a(e)},8e3),e.addEventListener("loadedmetadata",d),e.addEventListener("loadeddata",d),e.addEventListener("canplay",d),e.addEventListener("playing",d);let c=null==(n=e.play)?void 0:n.call(e);c&&"function"==typeof c.then&&c.then(d).catch(a),d()})},g=e=>{let t=e&&"object"==typeof e&&"name"in e?String(e.name):"",r=e&&"object"==typeof e&&"message"in e?String(e.message).toLowerCase():"";return"NotAllowedError"===t||"PermissionDeniedError"===t||r.includes("permission")||r.includes("denied")||r.includes("notallowed")?a.PERMISSION_DENIED:"NotFoundError"===t||"OverconstrainedError"===t||"TimeoutError"===t||r.includes("camera")||r.includes("device")||r.includes("track")||r.includes("timed out")?a.CAMERA_UNAVAILABLE:a.START_FAILED},f=e=>{let t=e&&"object"==typeof e&&"name"in e?String(e.name):"";return"NotFoundException"===t||"ChecksumException"===t||"FormatException"===t},h=e=>{switch(e){case a.INSECURE_CONTEXT:return"Le scanner a besoin d'une page s\xe9curis\xe9e en HTTPS.";case a.UNSUPPORTED:return"Le scanner n'est pas pris en charge sur ce navigateur.";case a.PERMISSION_DENIED:return"Autorisez la cam\xe9ra pour cette page, puis r\xe9essayez.";case a.CAMERA_UNAVAILABLE:return"La cam\xe9ra ne parvient pas \xe0 afficher une image exploitable.";case a.INVALID_QR:return"Ce QR code n'appartient pas \xe0 cette chasse aux œufs virtuelle.";default:return"Le scanner ne d\xe9marre pas correctement."}}}},e=>{e.O(0,[749,410,308,914,818,238,636,593,792],()=>e(e.s=6060)),_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.