bitsnap-react 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -0
- package/dist/CartProvider-HXLGQ4EX.mjs +2 -0
- package/dist/CartProvider-OHHYOMSG.js +2 -0
- package/dist/CartProvider-OHHYOMSG.js.map +1 -0
- package/dist/analytics.d.mts +45 -0
- package/dist/analytics.d.ts +45 -0
- package/dist/analytics.js +2 -0
- package/dist/analytics.js.map +1 -0
- package/dist/analytics.mjs +2 -0
- package/dist/catalog.d.mts +14 -1
- package/dist/catalog.d.ts +14 -1
- package/dist/catalog.js +1 -1
- package/dist/catalog.js.map +1 -1
- package/dist/catalog.mjs +1 -1
- package/dist/chunk-3Z6VNXBP.js +2 -0
- package/dist/chunk-3Z6VNXBP.js.map +1 -0
- package/dist/chunk-43IIYJ6J.mjs +2 -0
- package/dist/chunk-43IIYJ6J.mjs.map +1 -0
- package/dist/chunk-6D3OORMK.mjs +2 -0
- package/dist/chunk-6D3OORMK.mjs.map +1 -0
- package/dist/chunk-ADYVTMGH.mjs +2 -0
- package/dist/chunk-ADYVTMGH.mjs.map +1 -0
- package/dist/{chunk-WRCXZMKK.js → chunk-AJNULBC3.js} +2 -2
- package/dist/chunk-AJNULBC3.js.map +1 -0
- package/dist/chunk-B32ACCW2.js +2 -0
- package/dist/chunk-B32ACCW2.js.map +1 -0
- package/dist/chunk-DDY7IBMG.mjs +2 -0
- package/dist/chunk-DDY7IBMG.mjs.map +1 -0
- package/dist/chunk-DPKT6ITB.js +4 -0
- package/dist/chunk-DPKT6ITB.js.map +1 -0
- package/dist/{chunk-T2POA6RW.js → chunk-F46RJVWC.js} +2 -2
- package/dist/chunk-F46RJVWC.js.map +1 -0
- package/dist/chunk-F6GQLKA6.js +2 -0
- package/dist/chunk-F6GQLKA6.js.map +1 -0
- package/dist/chunk-JSDGZ4NY.js.map +1 -1
- package/dist/chunk-JXCHRSPW.mjs +4 -0
- package/dist/chunk-JXCHRSPW.mjs.map +1 -0
- package/dist/chunk-KOYBZORL.js.map +1 -1
- package/dist/chunk-RLEC25JI.mjs +2 -0
- package/dist/chunk-RLEC25JI.mjs.map +1 -0
- package/dist/chunk-RVILRUW3.js +2 -0
- package/dist/chunk-RVILRUW3.js.map +1 -0
- package/dist/chunk-T2OUOO4X.mjs +2 -0
- package/dist/chunk-T2OUOO4X.mjs.map +1 -0
- package/dist/chunk-VIII45AC.js +2 -0
- package/dist/chunk-VIII45AC.js.map +1 -0
- package/dist/chunk-XIHGWNTS.js +2 -0
- package/dist/chunk-XIHGWNTS.js.map +1 -0
- package/dist/chunk-YXFJG4MF.mjs +2 -0
- package/dist/chunk-YXFJG4MF.mjs.map +1 -0
- package/dist/chunk-ZPTHK4OX.mjs +2 -0
- package/dist/{chunk-OJT3YO2R.mjs.map → chunk-ZPTHK4OX.mjs.map} +1 -1
- package/dist/consent.d.mts +165 -0
- package/dist/consent.d.ts +165 -0
- package/dist/consent.js +75 -0
- package/dist/consent.js.map +1 -0
- package/dist/consent.mjs +75 -0
- package/dist/consent.mjs.map +1 -0
- package/dist/course.d.mts +13 -3
- package/dist/course.d.ts +13 -3
- package/dist/course.js +1 -1
- package/dist/course.js.map +1 -1
- package/dist/course.mjs +1 -1
- package/dist/course.mjs.map +1 -1
- package/dist/embed/analytics.js +1 -0
- package/dist/embed/consent.js +74 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +54 -7
- package/dist/index.d.ts +54 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/instrument-CmxK7S4T.d.mts +929 -0
- package/dist/instrument-CmxK7S4T.d.ts +929 -0
- package/dist/internal.js.map +1 -1
- package/dist/methods-A5KGZBAM.js +2 -0
- package/dist/methods-A5KGZBAM.js.map +1 -0
- package/dist/methods-AOHKV7IN.mjs +2 -0
- package/dist/methods-AOHKV7IN.mjs.map +1 -0
- package/dist/models.js.map +1 -1
- package/dist/returns.d.mts +9 -1
- package/dist/returns.d.ts +9 -1
- package/dist/returns.js +1 -1
- package/dist/returns.js.map +1 -1
- package/dist/returns.mjs +1 -1
- package/dist/{types-PSBBDdQm.d.mts → types-BnVWLcoB.d.mts} +13 -0
- package/dist/{types-BTm_ZolC.d.ts → types-i-IuN4Im.d.ts} +13 -0
- package/package.json +46 -45
- package/dist/CartProvider-5KAG5QGA.mjs +0 -2
- package/dist/CartProvider-7GJXW2IP.js +0 -2
- package/dist/CartProvider-7GJXW2IP.js.map +0 -1
- package/dist/chunk-45AP7UZE.mjs +0 -2
- package/dist/chunk-45AP7UZE.mjs.map +0 -1
- package/dist/chunk-7XTDFTQU.js +0 -4
- package/dist/chunk-7XTDFTQU.js.map +0 -1
- package/dist/chunk-C6Z7LOHB.mjs +0 -2
- package/dist/chunk-C6Z7LOHB.mjs.map +0 -1
- package/dist/chunk-HB6KQT26.mjs +0 -4
- package/dist/chunk-HB6KQT26.mjs.map +0 -1
- package/dist/chunk-LWK4E5G5.js +0 -2
- package/dist/chunk-LWK4E5G5.js.map +0 -1
- package/dist/chunk-OJT3YO2R.mjs +0 -2
- package/dist/chunk-OUYRKNZJ.mjs +0 -2
- package/dist/chunk-OUYRKNZJ.mjs.map +0 -1
- package/dist/chunk-P2YB25KZ.js +0 -2
- package/dist/chunk-P2YB25KZ.js.map +0 -1
- package/dist/chunk-T2POA6RW.js.map +0 -1
- package/dist/chunk-VPKE2ZOR.mjs +0 -2
- package/dist/chunk-VPKE2ZOR.mjs.map +0 -1
- package/dist/chunk-WRCXZMKK.js.map +0 -1
- package/dist/chunk-WSM4OM72.mjs +0 -2
- package/dist/chunk-WSM4OM72.mjs.map +0 -1
- package/dist/chunk-XRNTUSBH.js +0 -2
- package/dist/chunk-XRNTUSBH.js.map +0 -1
- package/dist/chunk-Z2BKIX6F.js +0 -2
- package/dist/chunk-Z2BKIX6F.js.map +0 -1
- package/dist/methods-ITD6WFIY.mjs +0 -2
- package/dist/methods-JENIGNF7.js +0 -2
- package/dist/methods-JENIGNF7.js.map +0 -1
- /package/dist/{CartProvider-5KAG5QGA.mjs.map → CartProvider-HXLGQ4EX.mjs.map} +0 -0
- /package/dist/{methods-ITD6WFIY.mjs.map → analytics.mjs.map} +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{A as wn,a as Ne,g as cn,h as dn,i as mn,j as pn,k as fn,s as gn,v as yn,w as Pn,x as bn,y as hn,z as vn}from"./chunk-DDY7IBMG.mjs";import{a as Rt,g as Ge,h as $e,j as ge,k as Ve,l as an,m as on,n as Te}from"./chunk-YXFJG4MF.mjs";import{a as xt,b as kt,c as Ct,d as Nt,e as St,f as en,j as B,k as De,l as Y,p as rn,q as I,r as st,t as sn,u as Le,v as ln}from"./chunk-T2OUOO4X.mjs";import{a as vt,b as Xt,c as wt,d as w,f as Q,g as nn,h as un,m as ce}from"./chunk-43IIYJ6J.mjs";import{h as It,l as ot,m as it,n as Ae,o as tn}from"./chunk-RLEC25JI.mjs";import{useAutoAnimate as Mr}from"@formkit/auto-animate/react";import{useEffect as Sn,useState as ae}from"react";import{jsx as We}from"react/jsx-runtime";function de({className:e,...t}){return We("div",{"data-slot":"card",className:w("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function ye({className:e,...t}){return We("div",{"data-slot":"card-header",className:w("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function Pe({className:e,...t}){return We("div",{"data-slot":"card-title",className:w("leading-none font-semibold",e),...t})}function At({className:e,...t}){return We("div",{"data-slot":"card-description",className:w("text-muted-foreground text-sm",e),...t})}function ue({className:e,...t}){return We("div",{"data-slot":"card-content",className:w("px-6",e),...t})}import*as xn from"react";import{OTPInput as Rr,OTPInputContext as Ar}from"input-otp";import{MinusIcon as Dr}from"lucide-react";import{jsx as Ee,jsxs as Tr}from"react/jsx-runtime";function kn({className:e,containerClassName:t,...r}){return Ee(Rr,{"data-slot":"input-otp",containerClassName:w("flex items-center gap-2 has-disabled:opacity-50",t),className:w("disabled:cursor-not-allowed",e),...r})}function Dt({className:e,...t}){return Ee("div",{"data-slot":"input-otp-group",className:w("flex items-center",e),...t})}function Se({index:e,className:t,...r}){let n=xn.useContext(Ar),{char:a,hasFakeCaret:o,isActive:i}=n?.slots[e]??{};return Tr("div",{"data-slot":"input-otp-slot","data-active":i,className:w("data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",t),...r,children:[a,o&&Ee("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:Ee("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function Cn({...e}){return Ee("div",{"data-slot":"input-otp-separator",role:"separator",...e,children:Ee(Dr,{})})}import{REGEXP_ONLY_DIGITS as jr}from"input-otp";import{jsx as Tt,jsxs as Er}from"react/jsx-runtime";function Lr(){return Er("div",{className:"flex items-center gap-2",children:[Tt("div",{className:"h-3 w-3 animate-bounce rounded-full bg-current [animation-delay:-0.3s]"}),Tt("div",{className:"h-3 w-3 animate-bounce rounded-full bg-current [animation-delay:-0.15s]"}),Tt("div",{className:"h-3 w-3 animate-bounce rounded-full bg-current"})]})}var V=Lr;var Ur="return_url",Lt="__return_url",zr="accessToken";function Ze(e){let t=new URLSearchParams(e).get(Ur);return t?Nn(t):null}function Je(e){typeof window>"u"||(e?window.sessionStorage.setItem(Lt,e):window.sessionStorage.removeItem(Lt))}function Ue(){if(typeof window>"u")return null;let e=window.sessionStorage.getItem(Lt);return e?Nn(e):null}function Or(e,t){return t.some(r=>{if(e===r)return!0;let n=new URL(r).hostname,a=new URL(e).hostname;return a.endsWith(`.${n}`)||a===n})}function Nn(e){try{let t=new URL(e);return t.protocol!=="https:"&&t.protocol!=="http:"||!Or(t.origin,$e())?null:t.toString()}catch{return null}}function ze(e,t){let r=new URL(e);return r.searchParams.set(zr,t),r.toString()}import{jsx as v,jsxs as E}from"react/jsx-runtime";if(typeof window<"u"){let t=[window.location.origin,"https://bitsnap.pl","https://kursy.bitsnap.pl"];$e().length===0&&Ge(Array.from(new Set(t)))}var _r=({projectID:e,host:t,reveal:r,email:n,setEmail:a,loginUser:o,isLoginLoading:i,errMsg:c})=>{let{projectID:s,host:y}=ge();if(typeof window<"u"&&Ve(e??s,t??y)!=null)return window.location.href=window.location.href.replaceAll("login",""),null;let[d,x]=ae(!1),k=l=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(l.trim())?x(!0):x(!1),u=l=>{let{value:P}=l.target;k(P),a(P)};function h(){r()}function C(l){l.preventDefault(),o()}return v("main",{className:"mx-auto flex max-w-sm flex-1 flex-col justify-center space-y-12",children:v("div",{className:w("flex min-w-sm flex-col gap-6"),children:E(de,{children:[E(ye,{children:[v(Pe,{className:"text-2xl",children:"Zaloguj si\u0119"}),v(At,{children:"Wy\u015Blemy do Ciebie kod na maila, dzi\u0119ki kt\xF3remu si\u0119 zalogujesz."})]}),v(ue,{children:E("form",{onSubmit:C,children:[E("div",{className:"flex flex-col gap-6",children:[E("div",{className:"grid gap-2",children:[v(Ne,{htmlFor:"email",children:"Email"}),v(st,{id:"email",onChange:u,type:"email",placeholder:"m@example.com",required:!0}),v("span",{className:w(!d&&n.length>0?"font-bold text-red-500":"text-neutral-700 dark:text-neutral-400","text-xs"),children:!d&&n.length>0?"Nieprawid\u0142owy adres email":"Wpisz sw\xF3j adres email"})]}),E("div",{children:[E(I,{type:"submit",disabled:i,className:"relative w-full",onClick:o,children:[i&&v("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:v(V,{})}),"Zaloguj si\u0119"]}),c.length>0&&v("p",{className:"text-xs font-medium text-red-500",children:c})]})]}),E("div",{className:"mt-4 text-center text-sm",children:["Masz ju\u017C kod?"," ",v("button",{type:"button",onClick:h,className:"underline underline-offset-4",children:"Mam ju\u017C kod"})]})]})})]})})})},Fr=({projectID:e,host:t,email:r,reveal:n,setEmail:a,isLoginLoading:o,loginUserResponse:i,setLoginUserResponse:c,setResponseStatus:s,errMsg:y})=>{let d=it(),{mutateAsync:x,isPending:k}=Y(B.publicApi.userPanelLoginWithCode),[u,h]=ae(""),[C,l]=ae(!1),[P,R]=ae(!1),[F,q]=ae(0),A=U=>/^\d+$/.test(U.trim())?l(!0):l(!1),L=U=>{A(U),h(U)};async function _(){if(R(!0),u.length==0){l(!1);return}let U=parseInt(u),K=await x({code:U}),fe,ke,ne;if(K.result.case==="accessToken"?(l(!0),fe="ok",ke=void 0,ne=K.result.value):(l(!1),fe="error",ke=K.result.value,ne=void 0),fe==="error"&&(l(!1),console.warn("error:",`Kod b\u0142\u0119du: ${ke}`),console.warn("Nieprawid\u0142owy kod, spr\xF3buj ponownie.")),fe==="ok"){d.track("panel_login",{}),ne&&an(e,ne,r,t);let g=typeof window<"u"?Ue():null;setTimeout(()=>{if(ne&&g){window.location.href=ze(g,ne);return}window.location.reload()},100)}}function D(){let U=setInterval(()=>{q(K=>K>0?K-1:(clearInterval(U),0))},1e3);return()=>{clearInterval(U)}}Sn(()=>{i?.status==="ok"&&i?.retryIn>0&&(q(i.retryIn),D())},[i]);function H(){a(""),c(null),s("default"),n()}function pe(U){U.preventDefault(),_()}return v("main",{className:"mx-auto flex max-w-md flex-1 flex-col justify-center space-y-8",children:v("div",{className:w("flex min-w-sm flex-col gap-6"),children:E(de,{children:[E(ye,{children:[v(Pe,{className:"text-2xl",children:"Wpisz kod z maila"}),v(At,{children:"Sprawd\u017A czy przypadkiem nie wyl\u0105dowa\u0142 w spamie."})]}),E(ue,{children:[E("form",{onSubmit:pe,className:"flex flex-col gap-6",children:[v("div",{className:"grid gap-2",children:v("div",{className:"my-5 flex w-full items-center justify-center",children:E("div",{className:"flex flex-col gap-2",children:[E(kn,{id:"verify-code",maxLength:6,pattern:jr,onChange:U=>{L(U)},children:[E(Dt,{children:[v(Se,{index:0}),v(Se,{index:1}),v(Se,{index:2})]}),v(Cn,{}),E(Dt,{children:[v(Se,{index:3}),v(Se,{index:4}),v(Se,{index:5})]})]}),v("span",{className:w(!C&&P?"text-red-500":"text-neutral-700 dark:text-neutral-400","text-xs"),children:!C&&P?u.length==0?"Kod nie mo\u017Ce by\u0107 pusty":"Kod musi sk\u0142ada\u0107 si\u0119 z cyfr":"Wpisz kod z maila"})]})})}),E("div",{children:[E(I,{type:"submit",disabled:o||k,className:"relative w-full",children:[(o||k)&&v("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:v(V,{})}),"Zaloguj si\u0119"]}),y.length>0&&v("p",{className:"text-xs font-medium text-red-500",children:y})]})]}),E("div",{className:"mt-4 text-center text-sm",children:["Nie masz kodu?"," ",v("button",{type:"button",onClick:H,className:"underline underline-offset-4",children:"Wr\xF3\u0107"})]})]})]})})})},qr=({analytics:e})=>{let{theme:t,allowedReturnOrigins:r,projectID:n,host:a}=ge(),o=Ae(n,e,"panel"),i={"--button-background-color":t?.colors?.brand??"#FFFFFF","--button-background-color-dark":t?.colors?.brandDark??"#000000","--button-text-color":t?.colors?.brandDark??"#000000","--button-text-color-dark":t?.colors?.brand??"#FFFFFF"},[c,s]=ae("login"),[y]=Mr({duration:300,easing:"ease-in-out",disrespectUserMotionPreference:!1}),d=()=>s(L=>L==="login"?"verifyCode":"login"),[x,k]=ae(""),[u,h]=ae("default"),[C,l]=ae(null),{mutateAsync:P,isPending:R}=Y(B.publicApi.userPanelLogin),[F,q]=ae("");Sn(()=>{if(typeof window>"u"||window.parent!==window)return;let L=Ze(window.location.search);L&&Je(L);let _=L??Ue();if(!_)return;let D=Ve(n,a);D&&(window.location.href=ze(_,D))},[r,n,a]);async function A(){q(""),h("default");let L=await P({email:x}),_=L.result.case==="success"?"ok":"error",D=0,H;L.result.case==="success"&&(D=L.result.value.retryIn),_==="error"&&(H="Nieprawid\u0142owy adres email, spr\xF3buj ponownie."),l({status:_,retryIn:D,message:H}),_==="ok"&&c==="login"?d():_==="ok"&&c==="verifyCode"?h("success"):_==="error"&&q(H??"Nieprawid\u0142owy adres email, spr\xF3buj ponownie.")}return v(ot,{value:o,children:v("div",{className:"bg-white text-black dark:bg-black dark:text-white",children:E("div",{className:"font-inter flex h-screen w-screen flex-col p-4",style:i,ref:y,children:[E("header",{children:[t?.logoDarkURL&&v("img",{src:t?.logoDarkURL,className:"hidden dark:inline",alt:"Company Logo",draggable:!1}),t?.logoURL&&v("img",{src:t?.logoURL,className:"dark:hidden",alt:"Company Logo",draggable:!1})]}),c==="login"&&v(_r,{projectID:n,host:a,reveal:d,email:x,setEmail:k,loginUser:A,isLoginLoading:R,errMsg:F}),c==="verifyCode"&&v(Fr,{projectID:n,host:a,email:x,reveal:d,setEmail:k,loginUser:A,isLoginLoading:R,loginUserResponse:C,setLoginUserResponse:l,responseStatus:u,setResponseStatus:h,errMsg:F})]})})})},Br=({analytics:e}={})=>v(qr,{analytics:e});import{useAutoAnimate as Xa}from"@formkit/auto-animate/react";import{useEffect as yt,useState as eo}from"react";import{useState as Hr,useCallback as Gr,useEffect as $r}from"react";function In(e){let[t,r]=Hr(()=>{if(typeof window>"u")return e;let a=new URLSearchParams(window.location.search),o={};return Object.keys(e).forEach(i=>{let c=a.get(i);if(c!==null)try{o[i]=JSON.parse(c)}catch{o[i]=c}}),{...e,...o}}),n=Gr(a=>{r(o=>{let i={...o,...a};if(typeof window<"u"){let c=new URLSearchParams;Object.keys(i).forEach(y=>{let d=i[y];d!=null&&c.set(y,JSON.stringify(d))});let s=`${window.location.pathname}?${c.toString()}`;window.history.pushState({},"",s)}return i})},[]);return $r(()=>{let a=()=>{let o=new URLSearchParams(window.location.search),i={};Object.keys(e).forEach(c=>{let s=o.get(c);if(s!==null)try{i[c]=JSON.parse(s)}catch{i[c]=s}}),r({...e,...i})};return window.addEventListener("popstate",a),()=>window.removeEventListener("popstate",a)},[e]),[t,n]}function Rn(e,t){if(e!=null)return e;let r=t?.trim();if(!(r==null||r===""))return{tokens:sn(r)}}import*as lt from"@radix-ui/react-switch";import{jsx as An}from"react/jsx-runtime";function Dn({className:e,...t}){return An(lt.Root,{"data-slot":"switch",className:w("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:An(lt.Thumb,{"data-slot":"switch-thumb",className:w("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}import{useState as Vr}from"react";import{Fragment as Zr,jsx as Ke,jsxs as Et}from"react/jsx-runtime";function Wr({}){let[e,t]=Vr({disableAll:!1});return Et(Zr,{children:[Ke("h3",{className:"text-2xl",children:"Powiadomienia"}),Ke("p",{className:"text-sm text-neutral-500",children:"Zarz\u0105dzaj swoimi powiadomieniami"}),Ke("div",{className:"mt-6",children:Et("div",{className:"flex items-center space-x-2",children:[Ke(Dn,{id:"disable-all-notifications",checked:e.disableAll,onCheckedChange:r=>t(n=>({...n,disableAll:r}))}),Et(Ne,{htmlFor:"disable-all-notifications",className:"flex flex-col gap-1 text-base",children:["Wszystkie powiadomienia",Ke("span",{className:"text-xs font-normal text-neutral-500 md:text-sm",children:"Ten przycisk mo\u017Ce wy\u0142\u0105czy\u0107 wszystkie powiadomienia"})]})]})})]})}var Tn=Wr;import{ChevronLeftIcon as Jr,ChevronRightIcon as Kr,MoreHorizontalIcon as Qr}from"lucide-react";import{jsx as oe,jsxs as zt}from"react/jsx-runtime";function Ln({className:e,...t}){return oe("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:w("mx-auto flex w-full justify-center",e),...t})}function En({className:e,...t}){return oe("ul",{"data-slot":"pagination-content",className:w("flex flex-row items-center gap-1",e),...t})}function be({...e}){return oe("li",{"data-slot":"pagination-item",...e})}function Oe({className:e,isActive:t,size:r="icon",...n}){return oe("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:w(rn({variant:t?"outline":"ghost",size:r}),e),...n})}function Un({className:e,...t}){return zt(Oe,{"aria-label":"Go to previous page",size:"default",className:w("gap-1 px-2.5 sm:pl-2.5",e),...t,children:[oe(Jr,{}),oe("span",{className:"hidden sm:block",children:"Previous"})]})}function zn({className:e,...t}){return zt(Oe,{"aria-label":"Go to next page",size:"default",className:w("gap-1 px-2.5 sm:pr-2.5",e),...t,children:[oe("span",{className:"hidden sm:block",children:"Next"}),oe(Kr,{})]})}function Ut({className:e,...t}){return zt("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:w("flex size-9 items-center justify-center",e),...t,children:[oe(Qr,{className:"size-4"}),oe("span",{className:"sr-only",children:"More pages"})]})}import{useState as Yr}from"react";import{Fragment as aa,jsx as N,jsxs as W}from"react/jsx-runtime";var Xr=e=>new Date(e*1e3).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),ea=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase()}).format(e/100),ta={draft:"Szkic",unpaid:"Nieop\u0142acona",paid:"Op\u0142acona",overdue:"Zaleg\u0142a",cancelled:"Anulowana",completed:"Zako\u0144czone",processing:"Przetwarzane",refunded:"Zwr\xF3cone"},na={draft:"text-neutral-400",unpaid:"text-yellow-500",paid:"text-green-600",overdue:"text-red-500",cancelled:"text-neutral-400 line-through",completed:"text-green-600",processing:"text-blue-500",refunded:"text-purple-500"};function ra({openOrderDetails:e,projectID:t,accessToken:r}){let[n,a]=Yr(0),o=20,{data:i,isFetching:c}=De(B.publicApi.getOrders,{projectId:t,accessToken:r,offset:n,limit:o}),s=i?.orders??[],y=i?.totalCount??0,d=Math.floor(n/o)+1,x=Math.ceil(y/o),k=u=>{a(u)};return W(aa,{children:[N("h3",{className:"text-2xl",children:"Historia zam\xF3wie\u0144"}),N("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"Twoje zam\xF3wienia"}),c?N("div",{className:"mt-6 flex w-full flex-col gap-3",children:[...Array(5)].map((u,h)=>W("div",{className:"rounded-xl bg-white p-4 shadow-sm dark:bg-neutral-800",children:[W("div",{className:"flex items-center justify-between",children:[W("div",{className:"space-y-2",children:[N(Le,{className:"h-4 w-24"}),N(Le,{className:"h-3 w-32"})]}),W("div",{className:"space-y-2 text-right",children:[N(Le,{className:"ml-auto h-4 w-16"}),N(Le,{className:"ml-auto h-3 w-12"})]})]}),N("div",{className:"mt-3",children:N(Le,{className:"h-3 w-40"})})]},h))}):s.length===0?N("div",{className:"mt-6 text-sm text-neutral-400",children:"Brak zam\xF3wie\u0144."}):W("div",{children:[N("div",{className:"mt-6 flex w-full flex-col gap-3",children:s.map(u=>W("button",{onClick:()=>e(u.id),className:"block rounded-xl bg-white p-4 text-left shadow-sm transition-colors hover:bg-neutral-50 dark:bg-neutral-800 dark:hover:bg-neutral-700",children:[W("div",{className:"flex items-center justify-between",children:[W("div",{children:[W("p",{className:"font-medium",children:["Zam\xF3wienie #",u.id]}),N("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:u.customerName||"Klient"})]}),W("div",{className:"text-right",children:[N("p",{className:"font-semibold",children:ea(u.totalAmount,u.currency)}),N("p",{className:`text-xs font-medium ${na[u.status]??"text-neutral-400"}`,children:ta[u.status]??u.status})]})]}),N("div",{className:"mt-2 flex items-center justify-between text-xs text-neutral-500 dark:text-neutral-400",children:W("span",{children:["Data:"," ",u.createdAt?Xr(Number(u.createdAt.seconds)):"-"]})})]},u.id))}),x>1&&!c&&N("div",{className:"mt-4 flex justify-center",children:N(Ln,{children:W(En,{children:[d>1&&N(be,{children:N(Un,{onClick:()=>k(n-o)})}),d>2&&N(be,{children:N(Oe,{onClick:()=>k(0),children:"1"})}),d>3&&N(be,{children:N(Ut,{})}),[d-1,d,d+1].filter(u=>u>0&&u<=x).map(u=>N(be,{children:N(Oe,{onClick:()=>k((u-1)*o),isActive:d===u,children:u})},u)),d<x-2&&N(be,{children:N(Ut,{})}),d<x&&N(be,{children:N(Oe,{onClick:()=>k((x-1)*o),children:x})}),d<x&&N(be,{children:N(zn,{onClick:()=>k(n+o)})})]})})})]})]})}var On=ra;import{useState as Mn}from"react";import{Fragment as la,jsx as X,jsxs as he}from"react/jsx-runtime";var jn=e=>new Date(e*1e3).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),oa={active:"Aktywny",cancelled:"Anulowany",paused:"Wstrzymany"},ia={active:"text-green-600",cancelled:"text-red-500",paused:"text-yellow-500"};function sa({projectID:e}){let[t,r]=Mn([]),[n,a]=Mn(!0);return he(la,{children:[X("h3",{className:"text-2xl",children:"Plany"}),X("p",{className:"text-sm text-neutral-500",children:"Twoje aktywne subskrypcje"}),n?X("div",{className:"mt-6 text-sm text-neutral-400",children:"\u0141adowanie..."}):t.length===0?X("div",{className:"mt-6 text-sm text-neutral-400",children:"Brak aktywnych plan\xF3w."}):X("div",{className:"mt-6 flex flex-col gap-4",children:t.map(o=>he("div",{className:"rounded-xl bg-white p-5 shadow-sm dark:bg-neutral-800",children:[he("div",{className:"flex items-start justify-between",children:[he("div",{children:[X("p",{className:"font-semibold",children:o.tierName}),o.configName&&X("p",{className:"text-sm text-neutral-500",children:o.configName})]}),X("span",{className:`text-sm font-medium ${ia[o.status]??"text-neutral-500"}`,children:oa[o.status]??o.status})]}),he("div",{className:"mt-3 grid grid-cols-2 gap-2 text-sm text-neutral-600 dark:text-neutral-400",children:[he("div",{children:[X("span",{className:"font-medium",children:"Dzie\u0144 rozliczenia:"})," ",o.billingDay]}),he("div",{children:[X("span",{className:"font-medium",children:"Data startu:"})," ",jn(o.startDate)]}),o.endDate&&he("div",{children:[X("span",{className:"font-medium",children:"Data zako\u0144czenia:"})," ",jn(o.endDate)]})]})]},o.id))})]})}var _n=sa;import{useEffect as ca,useState as Ot}from"react";import{jsx as ee,jsxs as ma}from"react/jsx-runtime";function da(e,t,r,n){typeof window>"u"||(t&&Te(r,n),window.location.href=e)}function ua({projectID:e,host:t,loginURL:r,screen:n,params:a,setParams:o,setActiveScreen:i}){let{status:c,exchangeError:s}=pn("PanelReturns"),y=mn(),d=c==="anonymous"&&(s==null||cn(s));ca(()=>{d&&da(r,s!=null,e,t)},[d,r,s,e,t]);let[x,k]=Ot("orders"),[u,h]=Ot({items:[],note:""}),[C,l]=Ot();if(c==="anonymous"&&!d)return ma("div",{role:"alert",className:"flex flex-col items-start gap-3",children:[ee("p",{className:"text-sm",children:y(dn(s))}),ee(I,{type:"button",onClick:()=>window.location.reload(),children:y("errorRetry")})]});if(c!=="authenticated")return ee(gn,{});let P=R=>{k(R),o({state:"returns",orderId:void 0,returnId:void 0}),i("returns")};if(n==="return-details"&&a.returnId)return ee(wn,{returnId:a.returnId,onBack:()=>P("myReturns")});if(x==="myReturns")return ee(vn,{onBack:()=>P("orders"),onSelectReturn:R=>{o({state:"return-details",returnId:R,orderId:void 0}),i("return-details")}});if(x==="result"&&C!=null)return ee(hn,{returnId:C,onContinue:()=>P("orders"),onOpenMyReturns:()=>P("myReturns")});if(a.orderId){let R=a.orderId;return x==="confirmation"?ee(bn,{orderId:R,items:u.items,note:u.note,onBack:()=>k("orders"),onSubmitted:F=>{l(F),h({items:[],note:""}),k("result"),o({orderId:void 0})}}):ee(Pn,{orderId:R,initialItems:u.items.length>0?u.items:void 0,initialNote:u.note,onBack:()=>{h({items:[],note:""}),o({orderId:void 0})},onContinue:F=>{h(F),k("confirmation")}})}return ee(yn,{showLogout:!1,onSelectOrder:R=>{h({items:[],note:""}),k("orders"),o({orderId:R})},onOpenMyReturns:()=>P("myReturns")})}function Mt({accessToken:e,appearance:t,texts:r,...n}){return ee(fn,{projectID:n.projectID,host:n.host,appearance:t,texts:r,panelAccessToken:e,children:ee(ua,{...n})})}import{useState as Ia}from"react";import{jsx as ya}from"react/jsx-runtime";var pa=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g,fa=e=>[...e.matchAll(pa)].map(r=>({url:r[0],startIndex:r.index,endIndex:r.index+r[0].length-1})),ga=(e,t)=>{let r="",n=0;t.sort((a,o)=>a.startIndex-o.startIndex);for(let{startIndex:a,endIndex:o,replacementText:i}of t)r+=e.slice(n,a),r+=i,n=o+1;return r+=e.slice(n),r},Fn=e=>{let t=fa(e);return ya("p",{dangerouslySetInnerHTML:{__html:ga(e,t.map(r=>(r.replacementText=`<a key=${r.url} href=${r.url} style="text-decoration: underline;" target="_blank">
|
|
2
|
+
${r.url}
|
|
3
|
+
</a>`,r)))}})};import{fromJsonString as Ra,toJsonString as Aa}from"@bufbuild/protobuf";import{useAutoAnimate as Ca}from"@formkit/auto-animate/react";import{ChevronLeft as Na,Download as Kn}from"lucide-react";import{useEffect as Qn,useRef as Yn,useState as je}from"react";import Vn from"hls.js";import{Pause as Pa,Play as ba}from"lucide-react";import{forwardRef as ha,useEffect as ct,useImperativeHandle as va,useRef as Qe,useState as Me}from"react";function qn(){typeof navigator>"u"||typeof navigator.mediaSession>"u"||(navigator.mediaSession.playbackState="playing")}function Bn(){typeof navigator>"u"||typeof navigator.mediaSession>"u"||(navigator.mediaSession.playbackState="paused")}function Hn(e,t){typeof navigator>"u"||typeof navigator.mediaSession>"u"||e!=null&&isNaN(e)||t!=null&&isNaN(t)||navigator.mediaSession.setPositionState({playbackRate:1,duration:e,position:t})}function Gn(e){typeof navigator>"u"||typeof navigator.mediaSession>"u"||(navigator.mediaSession.metadata=new MediaMetadata({title:e.title,artwork:e.artwork?[{type:"image/png",src:e.artwork}]:void 0}),navigator.mediaSession.setActionHandler("play",t=>{e.action(t)}),navigator.mediaSession.setActionHandler("pause",t=>{e.action(t)}),navigator.mediaSession.setActionHandler("stop",t=>{e.action(t)}),navigator.mediaSession.setActionHandler("seekbackward",t=>{e.action(t)}),navigator.mediaSession.setActionHandler("seekforward",t=>{e.action(t)}),navigator.mediaSession.setActionHandler("seekto",t=>{e.action(t)}))}function $n(){navigator.mediaSession.metadata=null}import{jsx as ie,jsxs as dt}from"react/jsx-runtime";var wa=ha(({chapters:e,styles:t,updateCurrentTime:r,setCurrentTimeHandler:n,title:a,imageURL:o,uniqueProductID:i,onChapterChange:c},s)=>{let y;(G=>(G[G.Playing=0]="Playing",G[G.Paused=1]="Paused"))(y||={});let[d,x]=Me(1);ct(()=>{switch(d){case 0:qn();break;case 1:Bn();break}},[d]),va(s,()=>({selectChapter:p=>{He(p)}}));let[k,u]=Me(void 0),[h,C]=Me(void 0),l=Qe(null),P=Qe(void 0),R=Qe(void 0),F=Qe(null),q=Qe(null),[A,L]=Me(!0),[_,D]=Me(!1),[H,pe]=Me(!xa());function U(p){p<10||localStorage.setItem(`__player__${i}_${q.current?.id}`,`${p}`)}function K(){let p=localStorage.getItem(`__player__${i}_${q.current?.id}`);if(p!=null)try{let z=parseInt(p);return isNaN(z)||z<0?void 0:z}catch{return}}function fe(){let p=localStorage.getItem(`__player__${i}_last_chapter`);if(p!=null)return p}function ke(p){localStorage.setItem(`__player__${i}_last_chapter`,p)}function ne(p){localStorage.removeItem(`__player__${i}_${p}`)}function g(){l.current!=null&&(l.current.onloadeddata=()=>{if(l.current!=null){if(l.current.readyState<2&&pe(!0),l.current.readyState>=2&&pe(!1),!_){let p=K();p!=null&&at(p),D(!0)}if(A){L(!1);try{bt()}catch(p){console.log("play error",p)}}}},l.current.onplay=()=>{},l.current.onseeked=()=>{},l.current.onseeking=()=>{},l.current.onpause=()=>{},l.current.onended=()=>{re()},Gn({title:a??"",artwork:o,action:p=>{switch(p.action){case"play":bt();break;case"pause":ht();break;case"seekbackward":rt(-15);break;case"seekforward":rt(15);break;case"seekto":p.seekTime&&at(p.seekTime);break;case"stop":ht();break;default:break}}}),Ce())}function re(){if(e==null||e.length==0)return;let p=e.findIndex(G=>G.id==q.current?.id);p==-1||(ne(e[p].id),p+1>=e.length)||He(e[p+1])}function Ce(){Ie(),R.current==null&&(R.current=setTimeout(()=>{Ie(),R.current=void 0,Ce()},500))}function Be(){R.current!=null&&clearTimeout(R.current)}function Ie(){l.current!=null&&(x(l.current.paused?1:0),C(l.current.duration),u(l.current.currentTime),U(l.current.currentTime),Hn(l.current.duration,l.current.currentTime),l.current.networkState===l.current.NETWORK_LOADING&&l.current.readyState<=l.current.HAVE_FUTURE_DATA?pe(!0):pe(!1),r&&r(l.current.currentTime))}function bt(){l.current?.play().then().catch(),Ie()}function ht(){l.current?.pause(),Ie()}function xr(){if(d===0){ht();return}bt()}function rt(p){if(l.current==null)return;let z=l.current.currentTime+p;if(z<0){l.current.currentTime=0;return}if(z>l.current.duration){l.current.currentTime=l.current.duration;return}l.current.currentTime+=p}function at(p){if(l.current!=null){if(u(p),p<0){l.current.currentTime=0;return}if(p>l.current.duration){l.current.currentTime=l.current.duration;return}l.current.currentTime=p}}function kr(){l.current!=null&&(l.current.onplay=null,l.current.onseeked=null,l.current.onseeking=null,l.current.onpause=null,l.current.onended=null,l.current.src="",P.current?.destroy())}function Qt(p){if(p.length==0)return;let z=fe();if(z==null){He(p[0]);return}let G=p.find(Re=>Re.id==z);if(G==null){He(p[0]);return}He(G)}function He(p){D(!1),L(!0),q.current=p,Cr(p.publicUrl),c?.(p),ke(p.id)}function Cr(p){l.current!=null&&(l.current.canPlayType("application/vnd.apple.mpegurl")?l.current.src=p:Vn.isSupported()&&(P.current==null&&(P.current=new Vn,P.current?.attachMedia(l.current)),P.current?.loadSource(p)))}ct(()=>{l.current!=null&&(g(),Qt(e))},[l.current]),ct(()=>{Qt(e)},[e]),ct(()=>(n?.(at),()=>{u(void 0),l.current?.pause(),kr(),$n()}),[]);let Yt=p=>{let z=Math.floor(p/3600),G=Math.floor(p/60)%60,Re=Math.floor(p%60),Sr=z>0?z<10?`0${z}:`:`${z}:`:"",Ir=Re<10?`0${Re}`:`${Re}`;return isNaN(Re)||isNaN(G)||isNaN(z)?"":`${Sr}${G}:${Ir}`},Nr=p=>{let z=parseFloat(p.value)/parseFloat(p.max)*100;F.current.style.setProperty("--seek-before-width",z+"%");let G=h*z/100;at(G)};return dt("div",{id:"audio-player-container",className:"flex flex-col",style:t,ref:F,children:[ie("video",{ref:l,className:"hidden",poster:o,title:a}),ie("input",{type:"range",min:"0",max:h!=null?Math.floor(h).toString():100,value:k??0,onChange:p=>Nr(p.target),className:"w-full"}),dt("section",{className:"flex w-full items-center justify-between text-sm font-medium",children:[ie("span",{id:"current-time",children:Yt(k)}),ie("span",{id:"duration",children:Yt(h)})]}),dt("div",{className:"mt-6 flex items-center justify-center gap-x-12",children:[ie(I,{variant:"outline",onClick:()=>rt(-10),"aria-label":"Rewind 10 Seconds",children:"-10"}),dt(I,{variant:"outline",onClick:xr,"aria-label":"Play Or Pause",children:[d===1&&ie(ba,{className:"h-5 w-5"}),d===0&&ie(Pa,{className:"h-5 w-5"})]}),ie(I,{variant:"outline",onClick:()=>rt(10),"aria-label":"Fast Forward 10 Seconds",children:"+10"})]}),H&&ie("div",{className:"mt-2 flex w-full justify-center",children:ie(V,{})})]})});function xa(){return navigator.userAgent.toLowerCase().indexOf("safari/")>-1}var Wn=wa;var ka={pl:{returnsNavLabel:"Zwroty",openCourse:"Otw\xF3rz kurs"},en:{returnsNavLabel:"Returns",openCourse:"Open the course"}};function Ye(e=ce()){return un(ka,e)}import*as ut from"react";import{jsx as Zn}from"react/jsx-runtime";function Jn(){let[e,t]=ut.useState(13);return ut.useEffect(()=>{let r=setTimeout(()=>t(66),500);return()=>clearTimeout(r)},[]),Zn("div",{className:"w-[60%] h-2 bg-gray-200 rounded-full overflow-hidden",children:Zn("div",{className:"h-full bg-blue-600 transition-all duration-300",style:{width:`${e}%`}})})}import{Fragment as mt,jsx as b,jsxs as M}from"react/jsx-runtime";function me(e,...t){console.warn(e,...t)}function jt(e){console.error(e)}var Sa=({accessToken:e,product:t,styles:r,reveal:n,onOpenCourse:a})=>{let o=t.productType,i=it(),c=()=>i.track("panel_download",{},{product_id:t.productId.length<=64?t.productId:null}),s=Yn(null),[y]=Ca(),[d,x]=je(null),{mutateAsync:k,isPending:u}=Y(B.publicApi.userPanelGetFileDetails),h=Yn(void 0),[C,l]=je(null),[P,R]=je(null),[F,q]=je(!1),{mutateAsync:A,isPending:L}=Y(B.publicApi.userPanelGetAudiobookDetails),{mutateAsync:_,isPending:D}=Y(B.publicApi.userPanelGetAudiobookDetailsDownloadURLs),[H,pe]=je(null),[U,K]=je(null);async function fe(){try{let g=await k({accessId:t.accessId,accessToken:e});if(g.result.case==="success"){x(g.result.value.files);return}else me("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),me("Kod b\u0142\u0119du: ",g.result.value)}catch(g){me("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),jt("B\u0142\u0105d podczas pobierania danych:"+g)}}async function ke(){try{let g=await A({accessId:t.accessId,accessToken:e});if(g.result.case==="audiobook"){l(g.result.value);return}else me("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),me("Kod b\u0142\u0119du: ",g.result.value)}catch(g){me("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),jt("B\u0142\u0105d podczas pobierania danych:"+g)}}async function ne(){try{let g=await _({accessId:t.accessId,accessToken:e,isBrowser:!0});if(g.result.case==="success"){R(g.result.value.audiobookDownloadDetails),q(g.result.value.isAvailableToDownloadInMobileApp===!0);return}else me("Pobranie plik\xF3w nie powiod\u0142o si\u0119. Zalecamy kontakt."),me("Kod b\u0142\u0119du: ",g.result.value)}catch(g){me("Nieoczekiwany b\u0142\u0105d. Spr\xF3buj ponownie za chwil\u0119."),jt("B\u0142\u0105d podczas pobierania danych:"+g)}}return Qn(()=>{o===1&&(ke().then().catch(),ne().then().catch())},[]),Qn(()=>{if(C!=null&&P!=null){let g=C.chapters;if(!g)return;let re=g.map(Ce=>{let Be=P?.find(Ie=>Ie.chapterId===Ce.id);if(Be!=null)return{...Ce,publicUrl:Be.publicUrl,downloadableUrl:Be.downloadableUrl,duration:Be.duration}}).filter(Ce=>Ce!=null);re!=null&&re.length>0&&K(re)}},[C,P]),M("div",{children:[b("div",{className:"mb-3 space-y-4 rounded bg-white p-4 dark:bg-black",children:M(I,{onClick:()=>n(),variant:"ghost",className:"w-fit",children:[b(Na,{className:"h-6 w-6"}),b("span",{className:"font-inter text-sm font-medium",children:"Wr\xF3\u0107"})]})}),M("main",{className:"grid grid-cols-1 justify-center gap-6 sm:justify-start lg:grid-cols-2",children:[M("div",{className:"flex w-full max-w-xl flex-col gap-6",children:[o===2&&M("div",{ref:y,className:"flex flex-col space-y-4 rounded bg-white p-6 drop-shadow-xl dark:border dark:border-neutral-700 dark:bg-neutral-800 dark:drop-shadow-none",children:[M("div",{className:"flex items-center justify-between gap-x-4",children:[b("h4",{className:"text-xl font-semibold",children:"Twoje pliki"}),(d==null||d.length==0)&&b(I,{onClick:fe,"aria-label":"Download Product",className:"text-sm font-medium transition-opacity duration-300 ease-in-out hover:opacity-80 active:opacity-80",style:r,children:u?b(V,{}):"Wy\u015Bwietl"})]}),u&&M("div",{className:"flex flex-col items-start gap-2",children:[b(Jn,{}),b("p",{className:"font-bold transition hover:text-blue-600",children:"Trwa przygotowanie plik\xF3w..."})]}),d!=null&&d.length>0&&b("div",{className:"flex flex-col items-start justify-start gap-2",children:d.map((g,re)=>M("a",{target:"_blank",className:"flex w-fit items-center gap-2 rounded-md bg-neutral-800 px-3 py-2 text-neutral-200 dark:bg-neutral-200 dark:text-neutral-800",href:g,download:!0,onClick:c,children:[`Plik numer ${re+1}`,b(Kn,{width:14,height:14})]},re))})]}),o===4&&b("div",{className:"flex flex-col items-center justify-center rounded-xl bg-white p-6 drop-shadow-xl dark:bg-neutral-900 dark:drop-shadow-none",children:b(I,{onClick:()=>a(t.accessId),className:"text-sm font-medium transition-opacity duration-300 ease-in-out hover:opacity-80 active:opacity-80",style:r,children:Ye().openCourse})}),o===1&&b(mt,{children:M("div",{className:"flex flex-col space-y-6 rounded-xl bg-white p-3 drop-shadow-xl dark:bg-neutral-900 dark:drop-shadow-none",children:[b("h4",{className:"text-xl font-semibold",children:H?.name??"Odtwarzacz"}),H?.description&&b("p",{className:"text-sm",children:H?.description}),b(mt,{children:L?M("div",{className:"flex gap-2",children:[b(V,{}),b("p",{className:"text-xl font-semibold",children:"Trwa pobierania audiobooka..."})]}):b(mt,{children:U!=null?b(mt,{children:b(Wn,{ref:s,chapters:U,title:C?.name??t.productName??void 0,imageURL:C?.coverImage??t.productImageUrl??void 0,styles:r,setCurrentTimeHandler:g=>{h.current=g},uniqueProductID:t.productId,onChapterChange:g=>{pe(g)}})}):b("p",{className:"mt-2",children:"Wybierz rozdzia\u0142, kt\xF3ry ci\u0119 interesuje."})})}),M("div",{className:"rounded-xl bg-neutral-100 p-3 dark:bg-neutral-800",children:[b("p",{className:"mt-3 mb-3 text-xs",children:F?"Mo\u017Cesz s\u0142ucha\u0107 tego audiobooka w aplikacji r\xF3wnie\u017C bez dost\u0119pu do internetu.":"Mo\u017Cesz s\u0142ucha\u0107 tego audiobooka w aplikacji."}),M("div",{className:"flex gap-3",children:[b("a",{href:"https://apps.apple.com/us/app/bitsnap/id6741902807",children:b("img",{width:"100",src:"https://bitsnap.pl/appstore.svg",alt:"Pobierz aplikacje z AppStore"})}),b("a",{href:"https://docs.bitsnap.pl/guides/audiobook",children:b("img",{width:"100",src:"https://bitsnap.pl/playstore.svg",alt:"Pobierz aplikacj\u0119 z GooglePlay"})})]})]})]})}),b("div",{className:"flex items-center justify-center rounded-xl bg-white p-3 drop-shadow-xl dark:bg-neutral-900 dark:drop-shadow-none",children:o===1&&b("div",{className:"max-h-96 w-full overflow-y-auto",children:L?M("div",{className:"jusitfy-center flex flex-col items-center gap-2",children:[b(V,{}),b("p",{children:"\u0141adowanie rozdzia\u0142\xF3w..."})]}):M("div",{children:[b("h2",{className:"mb-3 text-xl font-semibold",children:"Rozdzia\u0142y"}),U==null?b("p",{children:"Brak rozdzia\u0142\xF3w do wy\u015Bwietlenia."}):b("ul",{className:"flex w-full flex-col gap-2",children:U.map((g,re)=>M("li",{className:"flex items-center justify-between",children:[M("button",{className:w("w-full rounded-lg p-2 text-left transition hover:bg-neutral-200 active:bg-neutral-200 dark:hover:bg-neutral-700 dark:active:bg-neutral-700",H?.id==g.id?"bg-neutral-200 dark:bg-neutral-700":"bg-neutral-100 dark:bg-neutral-800 dark:text-neutral-300"),onClick:()=>{s.current.selectChapter(g)},children:[M("div",{className:"flex items-center justify-between",children:[b("p",{className:"text-sm font-medium",children:g.name}),g.duration&&M("span",{className:"text-xs text-neutral-500",children:[Math.floor(g.duration/60),":",String(Math.floor(g.duration%60)).padStart(2,"0")]})]}),g.description&&b("p",{className:"mt-3 text-xs",children:g.description})]}),C&&C.isDownloadable&&g.downloadableUrl&&b("a",{href:g.downloadableUrl,onClick:c,children:b(Kn,{width:14,height:14})})]},re))})]})})})]}),M("div",{className:"w-full max-w-3xl space-y-6 rounded-xl bg-white p-6 drop-shadow-xl dark:bg-neutral-900 dark:drop-shadow-none",children:[b("h2",{className:"text-3xl font-semibold",children:t.productName}),b("p",{className:"text-sm font-normal text-neutral-600 dark:text-neutral-300",children:t.productDescription}),b("img",{src:t.productImageUrl,alt:"Product Photo",width:384,height:384,className:"max-h-sm max-w-sm",draggable:!1})]})]})]})},Xn=Sa;import{Fragment as La,jsx as $,jsxs as Xe}from"react/jsx-runtime";var Da=({accessToken:e,projectID:t,loginURL:r,styles:n,activeScreen:a,params:o,setParams:i,openCourse:c})=>{let{data:s,isLoading:y}=De(B.publicApi.userPanelGetProducts,{accessToken:e});if(y)return Xe("div",{className:"flex items-center gap-2 bg-white p-2 dark:bg-black",children:[$("p",{className:"text-dark font-inter font-medium dark:text-white",children:"\u0141adowanie..."}),$(V,{})]});if(s&&s.result.case==="failure")return console.warn("error:",`Kod b\u0142\u0119du: ${s.result.value}`),Te(t),window.location.href=r,null;let d=s&&s.result.case==="success"?s.result.value.products:[];return $(Ta,{accessToken:e,products:d,styles:n,loginURL:r,activeScreen:a,params:o,setParams:i,openCourse:c})},er=Da,Ta=({accessToken:e,products:t,styles:r,loginURL:n,activeScreen:a,params:o,setParams:i,openCourse:c})=>{if(t.length===0)return window.location.href=n,null;let[s,y]=Ia(o.product?Ra(St,o.product):void 0),d=u=>{u==null?(y(void 0),i({product:void 0,state:"products"})):i({product:Aa(St,u),state:"products"})};function x(u){switch(u){case 1:return"Audio";case 2:return"Plik";case 3:return"Bilet";case 4:return"Kurs";default:return}}function k(u){if(u.productType===4){c(u.accessId);return}y(u),d(u)}return a==="products"&&s!=null?$(Xn,{accessToken:e,product:s,styles:r,reveal:d,onOpenCourse:c}):Xe(La,{children:[$("h3",{className:"text-2xl",children:"Hej \u{1F44B}"}),$("p",{className:"text-sm text-neutral-500",children:"Poni\u017Cej znajdziesz swoje produkty"}),$("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-9 sm:justify-start",children:t?.map((u,h)=>Xe("section",{onClick:()=>k(u),className:"w-full max-w-xs cursor-pointer rounded drop-shadow-xl dark:border dark:border-slate-600 dark:drop-shadow-none",children:[Xe("section",{className:"flex flex-col items-center space-y-2 rounded bg-slate-100 p-4 dark:bg-neutral-900",children:[u.productType&&$("div",{className:"w-fit self-end rounded bg-red-900 px-4 py-1",children:$("span",{className:"text-sm font-medium text-white dark:text-slate-100",children:x(u.productType)})}),$("div",{className:"jusitfy-center flex max-h-40 items-center",children:$("img",{src:u.productImageUrl,alt:`Product ${h} Photo`,draggable:!1,className:"aspect-auto max-h-40"})})]}),Xe("div",{className:"space-y-4 rounded bg-white p-4 dark:bg-black",children:[$("h2",{className:"text-xl font-semibold",children:u.productName}),$("p",{title:u.productDescription,className:"line-clamp-3 text-sm font-normal text-neutral-600 dark:text-neutral-300",children:Fn(u.productDescription)}),$(I,{onClick:C=>{C.stopPropagation(),k(u)},className:"w-full text-sm font-medium transition-opacity duration-300 ease-in-out hover:opacity-80 active:opacity-80",style:r,children:"Zobacz"})]})]},h))})]})};import{useAutoAnimate as Ea}from"@formkit/auto-animate/react";import{LogOut as Ua,Undo2 as nr}from"lucide-react";import{useState as za}from"react";import{Fragment as ar,jsx as S,jsxs as se}from"react/jsx-runtime";function Oa({activeScreen:e,setActiveScreen:t,setParams:r,styles:n,theme:a,logout:o}){return se("header",{className:"md:border-r-neutral-150 md:bg-beige-50 fixed right-0 bottom-0 left-0 z-10 flex h-12 w-full items-center bg-neutral-800 md:static md:z-0 md:min-h-screen md:w-auto md:border-r dark:md:border-r-neutral-900",children:[S(Ma,{activeScreen:e,setActiveScreen:t,setParams:r}),S(ja,{activeScreen:e,setActiveScreen:t,setParams:r,theme:a,logout:o})]})}var rr=Oa;function Ma({activeScreen:e,setActiveScreen:t,setParams:r}){let{returnsNavLabel:n}=Ye();return se("nav",{className:"flex w-full items-center justify-evenly gap-4 md:hidden",children:[S(pt,{panelScreen:"products",label:"Produkty",imageURL:"/icons/bitsnap-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:r}),S(pt,{panelScreen:"orders",label:"Faktury",imageURL:"/icons/category-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:r}),S(pt,{panelScreen:"returns",label:n,icon:S(nr,{className:"h-5 w-5 text-white","aria-hidden":!0}),activeScreen:e,setActiveScreen:t,setParams:r}),S(pt,{panelScreen:"profile",label:"Profil",imageURL:"/icons/profile-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:r})]})}function pt({panelScreen:e,label:t,imageURL:r,icon:n,activeScreen:a,setActiveScreen:o,setParams:i}){return se(I,{onClick:()=>{o(e),i({product:void 0,state:e})},"aria-label":t,variant:null,className:w("flex flex-col gap-0",a===e?"opacity-100":"opacity-50"),children:[n??S("img",{src:r,alt:t,className:"scale-75"}),S("span",{className:"text-xs font-normal text-white",children:t})]})}function ft({panelScreen:e,label:t,imageURL:r,darkImageURL:n,icon:a,activeScreen:o,setActiveScreen:i,setParams:c,isExpanded:s}){return se(I,{onClick:()=>{i(e),c({product:void 0,state:e})},variant:o===e?"secondary":"ghost",className:"justify-start",children:[a!=null?S("span",{className:w("inline-flex h-5 w-5 items-center justify-center",s?"mr-4":"mr-2"),children:a}):se(ar,{children:[S("img",{src:r,alt:t,className:w("aspect-auto h-5 w-5 dark:hidden",s?"mr-4":"mr-2")}),S("img",{src:n,alt:t,className:w("hidden aspect-auto h-5 w-5 dark:inline",s?"mr-4":"mr-2")})]}),s&&S("span",{className:"md:text-medium hidden md:inline",children:t})]})}function ja({activeScreen:e,setActiveScreen:t,setParams:r,theme:n,logout:a}){let[o]=Ea(),[i,c]=za(!0),{returnsNavLabel:s}=Ye();return se("div",{ref:o,className:w("hidden px-4 pt-4 pb-12 md:flex md:h-full md:flex-col dark:bg-neutral-900",i?"md:w-52":"md:w-16"),children:[S("div",{className:"flex items-center justify-between",children:S(_a,{theme:n,isExpanded:i})}),S(tr,{className:"my-6"}),se("div",{className:"flex flex-1 flex-col gap-2",children:[S(ft,{panelScreen:"products",label:"Produkty",imageURL:"/icons/bitsnap-dark-24x24.svg",darkImageURL:"/icons/bitsnap-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:r,isExpanded:i}),S(ft,{panelScreen:"orders",label:"Zam\xF3wienia",imageURL:"/icons/category-dark-24x24.svg",darkImageURL:"/icons/category-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:r,isExpanded:i}),S(ft,{panelScreen:"returns",label:s,icon:S(nr,{className:"h-5 w-5","aria-hidden":!0}),activeScreen:e,setActiveScreen:t,setParams:r,isExpanded:i}),S(ft,{panelScreen:"profile",label:"Profil",imageURL:"/icons/profile-dark-24x24.svg",darkImageURL:"/icons/profile-24x24.svg",activeScreen:e,setActiveScreen:t,setParams:r,isExpanded:i})]}),S(tr,{className:"mb-6"}),se(I,{onClick:a,children:[S(Ua,{className:"mr-2",width:16,height:16}),i&&S("p",{className:"md:text-medium hidden md:inline md:text-center",children:"Wyloguj si\u0119"})]})]})}function tr({className:e}){return se("div",{className:w("relative h-px w-full bg-neutral-300",e),children:[S("div",{className:"absolute -top-px left-0 h-1 w-1 rounded-full bg-neutral-500"}),S("div",{className:"absolute -top-px right-0 h-1 w-1 rounded-full bg-neutral-500"})]})}function _a({theme:e,isExpanded:t}){return se(ar,{children:[e==null&&S("p",{className:"text-xl tracking-wider md:inline dark:text-neutral-200",children:"bitsnap."}),(e?.logoDarkURL||e?.logoURL)&&S("img",{src:e.logoDarkURL??e.logoURL,alt:"Company Logo",className:"hidden h-6 w-6 dark:inline",draggable:!1}),e?.logoURL&&S("img",{src:e.logoURL,alt:"Company Logo",className:"h-6 w-6 dark:hidden",draggable:!1})]})}import{LogOut as Fa}from"lucide-react";import{Fragment as Ba,jsx as _e,jsxs as _t}from"react/jsx-runtime";function qa({email:e,logout:t}){return _t(Ba,{children:[_e("h3",{className:"text-2xl",children:"Profil"}),_t("div",{className:"mt-6 flex-1 md:flex-none",children:[_e("span",{className:"text-sm text-neutral-500",children:"Email"}),_e("p",{className:"mt-2 text-base",children:e||"Brak danych"})]}),_e("div",{className:"flex w-full flex-col items-center space-y-2",children:_t(I,{onClick:t,className:"max-w-64 md:hidden",children:[_e(Fa,{className:"mr-2",width:16,height:16}),_e("p",{className:"text-medium inline text-center",children:"Wyloguj si\u0119"})]})})]})}var or=qa;import{lazy as Ha,Suspense as Ga}from"react";import{jsx as gt}from"react/jsx-runtime";var $a=Ha(()=>import("./course.mjs").then(e=>({default:e.PanelCourse})));function Ft(e){return gt(Ga,{fallback:gt("div",{className:"flex items-center gap-2 p-2",role:"status",children:gt(V,{})}),children:gt($a,{...e})})}import{AlertCircle as dr,CheckCircle2 as ir,ChevronLeft as Va,Loader2 as Bt,Lock as sr,Package as Wa,Truck as ur}from"lucide-react";import{useEffect as Za,useState as qt}from"react";import{Fragment as mr,jsx as m,jsxs as f}from"react/jsx-runtime";function Ja({status:e}){let t={created:{color:"bg-neutral-100 text-neutral-700",icon:null},paid:{color:"bg-green-100 text-green-700",icon:ir},completed:{color:"bg-blue-100 text-blue-700",icon:ir},canceled:{color:"bg-red-100 text-red-700",icon:dr},sent:{color:"bg-purple-100 text-purple-700",icon:ur},processing:{color:"bg-yellow-100 text-yellow-700",icon:Bt}},r=t[e]||t.created,n=r.icon,a={created:"Utworzone",paid:"Op\u0142acone",completed:"Zako\u0144czone",canceled:"Anulowane",sent:"Wys\u0142ane",processing:"Przetwarzane"};return f("span",{className:`inline-flex items-center gap-1 rounded-full px-3 py-1 text-sm font-medium ${r.color}`,children:[n&&m(n,{className:"h-4 w-4"}),a[e]||e]})}function Ka({orderID:e,email:t}){let[r,n]=qt(""),a=Y(B.publicApi.addPublicOrderComment);return f("form",{onSubmit:async i=>{if(i.preventDefault(),!!r.trim())try{await a.mutateAsync({projectId:"",orderId:e,message:r.trim(),accessToken:t}),n("")}catch(c){console.error("Failed to add comment:",c)}},className:"mt-4 space-y-2",children:[m(Ne,{htmlFor:"comment",children:"Dodaj komentarz"}),m(ln,{id:"comment",value:r,onChange:i=>n(i.target.value),placeholder:"Wpisz komentarz...",rows:3,disabled:a.isPending}),m(I,{type:"submit",disabled:!r.trim()||a.isPending,children:a.isPending?f(mr,{children:[m(Bt,{className:"mr-2 h-4 w-4 animate-spin"}),"Wysy\u0142anie..."]}):"Dodaj komentarz"})]})}function lr(e){return e?new Date(Number(e.seconds)*1e3).toLocaleDateString("pl-PL",{year:"numeric",month:"long",day:"numeric"}):"N/A"}function cr(e,t){return new Intl.NumberFormat("pl-PL",{style:"currency",currency:t.toUpperCase()}).format(e/100)}function Qa({orderID:e,initialEmail:t,onBack:r,accessToken:n,analytics:a}){let{theme:o,projectID:i}=ge(),c=Ae(i,a,"order"),[s,y]=qt(t||""),[d,x]=qt(!1),{data:k,isLoading:u,error:h,refetch:C}=De(B.publicApi.getPublicOrderDetails,{projectId:i??"",orderId:e,email:s||void 0,accessToken:n},{enabled:!!e}),l=k?.result.case==="order"?k.result.value:null,P=l?.isVerified??!1,R=l!=null;Za(()=>{R&&c.track("panel_order_viewed",{},{order_ref:null})},[c,R]);let F=()=>{C(),x(!1)},q={"--button-background-color":o?.colors?.brand??"#000000","--button-background-color-dark":o?.colors?.brandDark??"#ffffff","--button-text-color":o?.colors?.brandDark??"#000000","--button-text-color-dark":o?.colors?.brand??"#000000"};return u?m("div",{className:"flex min-h-screen items-center justify-center",children:f("div",{className:"text-center",children:[m(Bt,{className:"mx-auto h-8 w-8 animate-spin text-neutral-400"}),m("p",{className:"mt-2 text-neutral-600 dark:text-neutral-400",children:"\u0141adowanie zam\xF3wienia..."})]})}):h||!l?m("div",{className:"flex min-h-screen items-center justify-center",children:m(de,{className:"w-full max-w-md",children:m(ue,{className:"pt-6",children:f("div",{className:"text-center",children:[m(dr,{className:"mx-auto h-12 w-12 text-red-500"}),m("h2",{className:"mt-4 text-xl font-semibold",children:"Zam\xF3wienie nie znalezione"}),m("p",{className:"mt-2 text-neutral-600 dark:text-neutral-400",children:"Nie znaleziono zam\xF3wienia o podanym numerze."})]})})})}):m("div",{className:"w-full bg-white py-8 dark:bg-black",style:q,children:f("div",{className:"w-full px-4",children:[r&&f(I,{onClick:r,variant:"ghost",className:"mb-4 w-fit",children:[m(Va,{className:"h-4 w-4"}),"Wr\xF3\u0107 do historii zam\xF3wie\u0144"]}),f("div",{className:"mb-6 flex items-center gap-4",children:[o?.logoURL&&f(mr,{children:[m("img",{src:o.logoURL,alt:"Project logo",className:`h-12 w-auto ${o.logoDarkURL?"dark:hidden":""}`}),o.logoDarkURL&&m("img",{src:o.logoDarkURL,alt:"Project logo",className:"hidden h-12 w-auto dark:block"})]}),f("div",{children:[m("h1",{className:"text-3xl font-bold",children:"Zam\xF3wienie"}),f("p",{className:"text-neutral-600 dark:text-neutral-400",children:["Numer zam\xF3wienia: #",l.orderId]})]})]}),f(de,{className:"mb-6",children:[m(ye,{children:f(Pe,{className:"flex items-center",children:[m(Wa,{className:"mr-2 h-5 w-5"}),"Status zam\xF3wienia"]})}),f(ue,{className:"space-y-6",children:[f("div",{children:[f("div",{className:"flex items-center gap-2",children:[m(Ja,{status:l.status}),l.processingStatus&&f("span",{className:"text-sm text-neutral-600",children:["\xB7 ",l.processingStatus]})]}),f("p",{className:"mt-2 text-sm text-neutral-600",children:["Zam\xF3wienie z\u0142o\u017Cone ",lr(l.createdAt)]})]}),f("div",{className:"border-t pt-4",children:[m("h3",{className:"mb-3 font-semibold",children:"Dane klienta"}),f("div",{className:"space-y-2",children:[f("div",{children:[m("span",{className:"font-medium",children:"Imi\u0119 i nazwisko:"})," ",m("span",{className:P?"":"text-neutral-500",children:l.customerName})]}),f("div",{children:[m("span",{className:"font-medium",children:"Email:"})," ",m("span",{className:P?"":"text-neutral-500",children:l.customerEmail})]}),l.customerPhone&&f("div",{children:[m("span",{className:"font-medium",children:"Telefon:"})," ",m("span",{className:P?"":"text-neutral-500",children:l.customerPhone})]})]})]}),!P&&m("div",{className:"border-t pt-4",children:f(I,{onClick:()=>x(!0),variant:"outline",className:"w-full",children:[m(sr,{className:"mr-2 h-4 w-4"}),"Zweryfikuj sw\xF3j email"]})})]})]}),f(de,{className:"mb-6",children:[m(ye,{children:m(Pe,{children:"Produkty"})}),f(ue,{className:"space-y-6",children:[m("div",{className:"space-y-4",children:l.items.map((A,L)=>f("div",{className:"flex items-center gap-4",children:[A.imageUrl&&m("img",{src:A.imageUrl,alt:A.name,className:"h-16 w-16 rounded object-cover"}),f("div",{className:"flex-1",children:[m("p",{className:"font-medium",children:A.name}),f("p",{className:"text-sm text-neutral-600",children:["Ilo\u015B\u0107: ",A.quantity]})]}),m("div",{className:"text-right",children:m("p",{className:"font-medium",children:cr(Number(A.price),A.currency)})})]},L))}),(l.deliveryAddress||l.deliveryMethod)&&f("div",{className:"border-t pt-4",children:[f("h3",{className:"mb-3 flex items-center font-semibold",children:[m(ur,{className:"mr-2 h-5 w-5"}),"Informacje o dostawie"]}),f("div",{className:"space-y-2",children:[l.deliveryAddress&&f("div",{children:[m("span",{className:"font-medium",children:"Adres:"})," ",m("span",{className:P?"":"text-neutral-500",children:l.deliveryAddress})]}),l.deliveryMethod&&f("div",{children:[m("span",{className:"font-medium",children:"Metoda:"})," ",l.deliveryMethod]}),l.trackingNumber&&P&&f("div",{children:[m("span",{className:"font-medium",children:"Tracking:"})," ",l.trackingNumber]})]})]}),m("div",{className:"border-t pt-4",children:f("div",{className:"flex justify-between text-lg font-bold",children:[m("span",{children:"Suma:"}),m("span",{children:cr(Number(l.totalAmount),l.currency)})]})})]})]}),f(de,{children:[m(ye,{children:f(Pe,{children:["Komentarze ",l.commentCount>0&&`(${l.commentCount})`]})}),f(ue,{children:[l.comments.length>0?m("div",{className:"space-y-4",children:l.comments.map(A=>f("div",{className:"border-b pb-4 last:border-b-0",children:[f("div",{className:"mb-1 flex items-center gap-2",children:[m("span",{className:"font-medium",children:A.authorName||"System"}),m("span",{className:"text-xs text-neutral-500",children:lr(A.createdAt)}),A.authorType==="admin"&&m("span",{className:"rounded bg-blue-100 px-2 py-0.5 text-xs text-blue-700",children:"Admin"})]}),m("p",{className:P?"":"text-neutral-500",children:A.message})]},A.id))}):m("p",{className:"text-neutral-600",children:"Brak komentarzy."}),P?m(Ka,{orderID:l.orderId,email:s}):m("div",{className:"mt-4",children:f(I,{onClick:()=>x(!0),variant:"outline",className:"w-full",children:[m(sr,{className:"mr-2 h-4 w-4"}),"Zweryfikuj sw\xF3j email"]})})]})]}),d&&m("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:f(de,{className:"w-full max-w-md",children:[m(ye,{children:m(Pe,{children:"Zweryfikuj sw\xF3j email"})}),f(ue,{className:"space-y-4",children:[m("p",{className:"text-sm text-neutral-700",children:"Podaj adres email u\u017Cyty przy sk\u0142adaniu zam\xF3wienia."}),f("div",{className:"space-y-2",children:[m(Ne,{htmlFor:"verify-email",children:"Adres email"}),m(st,{id:"verify-email",type:"email",placeholder:"twoj@email.com",value:s,onChange:A=>y(A.target.value)})]}),f("div",{className:"flex gap-2",children:[m(I,{variant:"outline",onClick:()=>x(!1),className:"flex-1",children:"Anuluj"}),m(I,{onClick:F,className:"flex-1",children:"Zweryfikuj"})]})]})]})})]})})}function Ya(e){return m(Qa,{...e})}var Ht=Ya;import{jsx as le,jsxs as pr}from"react/jsx-runtime";var to=({returnsAppearance:e,returnsTexts:t,analytics:r}={})=>{let{projectID:n,theme:a,loginURL:o,host:i}=ge(),c=Ae(n,r,"panel"),s=Ve(n,i),y=on(n,i),{mutateAsync:d}=Y(B.publicApi.userPanelLogout);async function x(){s&&await d({accessToken:s}),typeof window<"u"&&(Te(n,i),window.location.reload())}let[k]=Xa(),u=D=>["products","notifications","profile","plans","orders","order-details","returns","return-details","course"].includes(D),[h,C]=In({product:void 0,state:"products",orderId:void 0,returnId:void 0,course:void 0,item:void 0}),[l,P]=eo(u(h.state)?h.state:"products"),R=D=>{C({state:"order-details",orderId:D}),P("order-details")},F=()=>{C({state:"orders",orderId:void 0}),P("orders")},q=D=>C({orderId:void 0,returnId:void 0,course:void 0,item:void 0,...D}),A=D=>{C({state:"course",course:D,item:void 0,product:void 0}),P("course")},L=()=>{C({state:"products",course:void 0,item:void 0,product:void 0}),P("products")};yt(()=>{u(h.state)&&(h.state==="course"||l==="course")&&P(h.state)},[h.state]);let _={"--button-background-color":a?.colors?.brand??"#000000","--button-background-color-dark":a?.colors?.brandDark??"#ffffff","--button-text-color":a?.colors?.brandDark??"#000000","--button-text-color-dark":a?.colors?.brand??"#000000"};return yt(()=>{if(s==null||s.length===0){window.location.href=o??"/panel/login";return}},[]),yt(()=>{if(s==null||s.length===0){window.location.href=o??"/panel/login";return}},[l]),yt(()=>{if(typeof window>"u"||window.parent!==window||!s)return;let D=Ze(window.location.search);D&&Je(D);let H=D??Ue();H&&(window.location.href=ze(H,s))},[s]),le(ot,{value:c,children:pr("div",{ref:k,className:"font-inter relative min-h-screen w-screen bg-beige-100 text-black dark:bg-black dark:text-white md:flex",children:[le(rr,{activeScreen:l,setActiveScreen:P,setParams:q,styles:_,theme:a,logout:x}),pr("main",{className:"flex h-[calc(100vh-80px)] flex-col overflow-y-auto w-full p-5 md:h-screen",children:[l==="products"&&le(er,{projectID:n??"",accessToken:s,loginURL:o??"/panel/login",styles:_,activeScreen:l,params:h,setParams:C,openCourse:A}),l==="course"&&h.course&&s&&le(Ft,{accessId:h.course,accessToken:s,theme:a,itemId:h.item,onItemChange:D=>C({item:D}),onBack:L}),l==="notifications"&&le(Tn,{}),l==="plans"&&le(_n,{projectID:n??""}),l==="orders"&&le(On,{projectID:n??"",accessToken:s??"",openOrderDetails:R}),l==="order-details"&&h.orderId&&le(Ht,{orderID:h.orderId,onBack:F}),(l==="returns"||l==="return-details")&&s&&le(Mt,{projectID:n??"",host:i,accessToken:s,loginURL:o??"/panel/login",appearance:Rn(e,a?.colors?.brand),texts:t,screen:l,params:h,setParams:C,setActiveScreen:P}),l==="profile"&&le(or,{email:y,logout:x})]})]})})},no=to;import{create as xe}from"@bufbuild/protobuf";import{QueryClient as po,QueryClientProvider as fo}from"@tanstack/react-query";import{createContext as go,useContext as yo,useEffect as Po}from"react";import{createClient as ro}from"@connectrpc/connect";import{createConnectTransport as ao}from"@connectrpc/connect-web";var ve;(n=>{function e(a){return ro(en,r(a))}n.get=e;let t=new Map;function r(a){let o=t.get(a);return o==null&&(o=ao({useBinaryFormat:!0,baseUrl:a+"/api/rpc",interceptors:[Xt]}),t.set(a,o)),o}})(ve||={});import T from"zod";import Z from"zod";function j(e,t=2){return+(Math.round(+(e+"e+"+t))+"e-"+t)}function fr(e,t){let r=typeof navigator>"u"?"pl-PL":navigator.language;return Intl.NumberFormat(r,{style:"currency",currency:t,currencyDisplay:"symbol"}).format(e/100)}var Zl=Z.object({event:Z.enum(["purchase","addToCart","customizeProduct","viewCart","removeFromCart","initiateCheckout","lead"]),step:Z.string().optional(),value:Z.number().optional(),currency:Z.string().optional(),content_name:Z.string().optional(),items:Z.array(Z.object({id:Z.string(),name:Z.string(),price:Z.number().default(0),currency:Z.string().default("PLN"),quantity:Z.number().default(1)})).optional()});function Gt(e){typeof window>"u"||(oo(e),so(e),lo(e))}function oo(e){try{typeof window.dataLayer>"u"&&(window.dataLayer=[]);let t=io(e);window.dataLayer.push(t)}catch(t){console.warn("cannot send google analytics event",t)}}function io(e){let t=e.value??e.items?.reduce((o,i)=>o+(i.price||0)*(i.quantity||1),0)??0,r=e.items?.map(o=>({item_id:o.id,item_name:o.name||o.id,price:j((o.price||0)/100,2),quantity:o.quantity||1})),n={currency:e.currency||"PLN",value:j(t/100,2)};r&&r.length>0&&(n.items=r);let a;switch(e.event){case"purchase":a="purchase",n.transaction_id=e.step||`txn_${Date.now()}`;break;case"addToCart":a="add_to_cart";break;case"viewCart":a="view_cart";break;case"removeFromCart":a="remove_from_cart";break;case"initiateCheckout":a="begin_checkout";break;case"customizeProduct":a="customize_product";break;default:a=e.event}return{event:a,ecommerce:n,...e.step&&{step:e.step},...e.content_name&&{content_name:e.content_name}}}function so(e){if(typeof window.fbq>"u")return;let t="",r="",n={};switch(e.event){case"purchase":t="track",r="Purchase",n={category_name:e.step,...e};break;case"lead":t="track",r="Lead",n={category_name:e.step,...e};break;case"addToCart":t="track",r="Add to Cart",n={category_name:e.step,...e};break;case"customizeProduct":t="track",r="Customize Product",n={category_name:e.step,...e};break;case"viewCart":t="track",r="View Cart",n={category_name:e.step,...e};break;case"removeFromCart":t="track",r="Remove from Cart",n={category_name:e.step,...e};break;case"initiateCheckout":t="track",r="Initiate Checkout",n={category_name:e.step,...e};break;default:break}window.location.search.includes("analytics")&&console.log("Pushing FB event",t,r,n),window.fbq(t,r,n)}function lo(e){try{if(typeof window.ttq>"u")return;let t=co(e);if(!t)return;window.location.search.includes("analytics")&&console.log("Pushing TikTok event",t.eventName,t.eventPayload),window.ttq.track(t.eventName,t.eventPayload)}catch(t){console.warn("cannot send tiktok analytics event",t)}}function co(e){let t=e.value??e.items?.reduce((o,i)=>o+(i.price||0)*(i.quantity||1),0)??0,r=e.items?.map(o=>({content_id:o.id,content_type:"product",content_name:o.name||o.id,quantity:o.quantity||1,price:j((o.price||0)/100,2)}))||[];r.length===0&&e.content_name&&r.push({content_id:e.step||"unknown",content_type:"product",content_name:e.content_name,quantity:1,price:j(t/100,2)});let n={currency:e.currency||"PLN",value:j(t/100,2)};r.length>0&&(n.contents=r);let a=null;switch(e.event){case"purchase":a="Purchase";break;case"addToCart":a="AddToCart";break;case"initiateCheckout":a="InitiateCheckout";break;case"customizeProduct":a="CustomizeProduct";break;case"viewCart":return;case"removeFromCart":return;case"lead":return;default:return null}return{eventName:a,eventPayload:n}}function gr(e){let{items:t,googlePayConfig:r,checkout:n,result:a,cartRequiresShipping:o}=e;if(a.totalAmount==null)return;let i=[];return o&&(i.push("SHIPPING_ADDRESS"),i.push("SHIPPING_OPTION")),{apiVersion:2,apiVersionMinor:0,callbackIntents:i,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["MASTERCARD","VISA"]},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:r.gateway,gatewayMerchantId:r.gatewayId}}}],emailRequired:!0,shippingAddressParameters:{phoneNumberRequired:o},shippingAddressRequired:o,shippingOptionRequired:o,shippingOptionParameters:o?{shippingOptions:a.methods.slice(0,5).map(s=>({id:s.id,label:s.name+` - ${fr(s.amount,a.currency)}`,description:s.description??""})),defaultSelectedOptionId:a.selectedDeliveryMethod}:void 0,merchantInfo:{merchantId:r.merchantId+"",merchantName:r.merchantName},transactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:"P\u0142atno\u015B\u0107 za koszyk",totalPrice:`${j(a.totalAmount/100,2)}`,currencyCode:a.currency,countryCode:a.country,checkoutOption:"COMPLETE_IMMEDIATE_PURCHASE",displayItems:uo(t,a.methods,a.selectedDeliveryMethod??(a.methods.length>0?a.methods[0].id:void 0),n.couponCode,a.couponValue)}}}function uo(e,t,r,n,a){let o=[],i=0;for(let s of e)s.details!=null&&(i+=s.details.price*s.quantity,o.push({label:s.details.name+" x "+s.quantity,price:`${j(s.details.price/100,2)}`,type:"LINE_ITEM",status:"FINAL"}));let c=t.find(s=>s.id===r);return c!=null&&o.push({label:c.name,price:`${j(c.amount/100,2)}`,type:"SHIPPING_OPTION",status:"FINAL"}),n!=null&&a!=null&&o.push({label:`Kupon ${n}`,price:`${j(a/100,2)}`,type:"DISCOUNT",status:"FINAL"}),i>0&&o.push({label:"Subtotal",price:`${j(i/100,2)}`,type:"SUBTOTAL",status:"FINAL"}),o}function et(e,t){return`${Q}/api/integrations/${e}/public-commerce${t}`}function we(e){return typeof e=="object"&&e!=null&&"ERR"in e}function J(e,t,r){return{ERR:!0,error:e,type:t,data:r}}function yr(e,t){return t?.find(r=>r.id===e||(r.variants?.some(n=>n.id===e)??!1))}function Pr(e,t){let r=new Set(t.map(n=>n.productID));return Array.from(new Set(e.filter(n=>!r.has(n))))}import{create as mo}from"zustand";var Fe=mo(e=>({isCartVisible:!1,numberOfProductsInCart:0,showCart:()=>e(t=>({...t,isCartVisible:!0})),hideCart:()=>e(t=>({...t,isCartVisible:!1})),setNumberOfProductsInCart:t=>e(r=>({...r,numberOfProductsInCart:t}))}));import{Fragment as Io,jsx as $t}from"react/jsx-runtime";var bo="__m_a",vr=go(void 0),Wt=void 0;function Sc(e){Rt({projectID:e}),Wt=e,typeof window<"u"&&Ge([window.location.origin])}function nt(){return Wt??document.querySelector('script[data-id][data-name="internal-cart"]')?.getAttribute("data-id")??void 0}function ho(){return document.querySelector('script[data-id][data-name="internal-cart"]')?.getAttribute("data-custom-host")??void 0}var vo=({children:e,locale:t})=>{let r=new po;Po(()=>{tt()},[]);let n=nt();if(n==null)return $t(Io,{});let a=Kt(n,t);return $t(fo,{client:r,children:$t(vr.Provider,{value:a,children:e})})},qe=async(e,t)=>{let r=[];t?.items!=null&&t.items.length>0?r=t.items:r=O()?.products??[];let n=Array.from(new Set(r.map(c=>c.productID))),a=new URLSearchParams;a.set("ids",n.join(",")),a.set("locale",t?.locale??ce());let o=await fetch(wt(et(e,`/products?${a.toString()}`)),{method:"GET"});if(o.status!=200)return[];let i=await o.json();return r.flatMap(c=>{let s=yr(c.productID,i.result);return s==null?[]:[{...c,details:So(c.productID,s),catalogProductID:s.id}]})},Ic=()=>{let e=yo(vr);if(e===void 0)throw new Error("useCartProvider must be used within a CartProvider");return e},Rc=vo,wo=T.object({isAvailable:T.boolean(),merchantId:T.string(),merchantName:T.string(),gateway:T.string(),gatewayId:T.string()}),xo=T.object({id:T.string(),productID:T.string(),quantity:T.number(),priceVersion:T.string().optional(),metadata:T.record(T.string(),T.string().optional()).optional()}),ko=T.object({country:T.string().optional(),couponCode:T.string().optional(),selectedDeliveryMethod:T.string().optional(),postalCode:T.string().optional(),email:T.string().optional(),products:T.array(xo).optional(),googlePayConfig:wo.optional()}),Zt={country:void 0,couponCode:void 0,email:void 0,selectedDeliveryMethod:void 0,postalCode:void 0,products:[],googlePayConfig:void 0},wr="checkout";function O(){try{let e=localStorage.getItem(wr);return e==null?Zt:ko.parse(JSON.parse(e))}catch{return Zt}}async function br(e,t){let r=await qe(e,{items:t.map((o,i)=>({...o,id:`price-check-${i}`}))});if(we(r))return r;let n=Pr(t.map(o=>o.productID),r);if(n.length>0)return J("item-ids-not-found","notFound",n);let a=O();a.products==null&&(a.products=[]),a.products.push(...t.map(o=>({id:Math.random().toString(36).substring(7),productID:o.productID,quantity:o.quantity,priceVersion:r.find(i=>i.productID===o.productID)?.details?.pricing?.priceVersion,metadata:o.metadata}))),Co(t,r),Gt({event:"addToCart",currency:"PLN",items:t.map(o=>({id:o.productID,name:o.name??"",price:o.price??0,quantity:o.quantity,currency:o.currency??"PLN"}))}),te(a),tt()}function Co(e,t){for(let r of e)try{let n=t.find(c=>c.productID===r.productID),a=n?.details?.pricing?.effectivePrice??n?.details?.price??r.price,o=n?.details?.currency??r.currency;if(a==null||o==null)continue;let i=n?.catalogProductID??r.productID;(r.analytics??tn()).track("add_to_cart",{qty:r.quantity,value_minor:Math.round(a*r.quantity),currency:o},{product_id:i,variant_id:i!==r.productID?r.productID:null})}catch{}}function hr(e){let t=O(),r={...t,products:t?.products?.filter(n=>!e.includes(n.productID)&&!e.includes(n.id))};Gt({event:"removeFromCart",items:e.map(n=>({id:n,name:"",price:0,quantity:1,currency:"PLN"}))}),te(r),tt()}function te(e){localStorage.setItem(wr,JSON.stringify(e))}var Kt=(e,t=ce())=>{let r=ho();return r!=null&&nn(r),{async checkIfApplePayIsAvailable(){if(typeof window>"u"||typeof document>"u"||!("ApplePaySession"in window))return!1;try{return(await ve.get(Q).isOneClickPaymentAvailable({projectId:e})).applePay}catch(n){return console.error("Error checking if Apple Pay is available",n),!1}},async getGooglePayConfiguration(n){if(typeof window>"u"||typeof document>"u")return{isAvailable:!1};try{let a=await No(e);if(a?.isAvailable!=!0)return{isAvailable:!1};let o=O();if(o==null)return console.log("checkout is null"),{isAvailable:!1};let i=await qe(e,{locale:t,items:n.items.map(d=>({id:Math.random().toString(36).substring(7),quantity:d.quantity,metadata:d.metadata,productID:d.productID}))});if(we(i))return{isAvailable:!1};let c=await ve.get(Q).getPreOrderDetails({items:i.map(d=>xe(Ct,{id:d.productID,quantity:d.quantity})),projectId:e,postCode:o.postalCode,couponCode:o.couponCode,countryCode:o.country,selectedDeliveryMethod:o.selectedDeliveryMethod});if(c.totalAmount==null)return{isAvailable:!1};let s=i.find(d=>d.details?.isDeliverable==!0)!=null,y=await gr({items:i,googlePayConfig:a,checkout:o,cartRequiresShipping:s,result:c});return y==null?{isAvailable:!1}:{isAvailable:!0,config:y}}catch(a){return console.error("Error resolving Google Pay configuration",a),{isAvailable:!1}}},async clearCart(){let n=structuredClone(Zt);n.country=O()?.country,te(n),tt()},async getAvailableCountries(){let n=await fetch(wt(et(e,"/countries")),{method:"GET"});if(n.status!=200)return[];try{return T.array(T.object({name:T.string(),code:T.string()})).parse(await n.json())}catch(a){return J(a.toString(),"internal")}},async getCountry(){let n=O()?.country;if(n==null){n="PL";let a=O();a.country=n,te(a)}return n},async getNumberOfElementsInCart(){return O()?.products?.reduce((n,a)=>n+a.quantity,0)??0},async getProducts(){return await qe(e,{locale:t})},async removeProductFromCart(n){return hr([n.id])},async setCountry(n){let a=O();a.country=n,te(a)},async setCouponCodeIfPossible(n){let a=O();a.couponCode=n,te(a)},async setPostalCode(n){let a=O();a.postalCode=n,te(a)},async setDeliveryMethod(n){let a=O();a.selectedDeliveryMethod=n,te(a)},async setEmail(n){let a=O();a.email=n,te(a)},async addProduct(n){return await br(e,[n])},async updateQuantity(n){let a=O();a.products=a.products?.map(o=>(o.id===n.id&&(o.quantity=n.quantity),o)),te(a),tt()},async redirectToNextStep(){let n=O();if(n.products==null||n.products.length==0)return J("cart-is-empty","badInput");let a=n.products.reduce((c,s)=>(s.metadata!=null&&Object.keys(s.metadata).forEach(y=>{let d=s.metadata?.[y];d!=null&&(c[y]=d)}),c),{}),o={items:n.products.map(c=>({id:c.productID,quantity:c.quantity,priceVersion:c.priceVersion})),askForNote:!0,countries:n.country?[n.country]:void 0,metadata:a,locale:t},i=await Vt(o);return we(i)?(console.warn("cannot create payment URL",i.error),i):{url:i.url}},async justRedirectToPayment(n){let a={items:[{id:n.productID,quantity:1}],askForNote:!1,details:n.email||n.name?{name:n.name,email:n.email}:void 0,locale:n.locale??t};a=Jt(a),n.country==null&&(n.country="pl"),a.details==null&&(a.details={}),a.details.address==null&&(a.details.address={}),a.details.address.country=n.country,n.marketingAgreement===!0&&(a.additionalAgreements=[{id:bo,name:"",required:!0,answer:!0}]);let o=await Vt(a);return we(o)?o:{url:o.url}},async completeApplePayPayment(n){let a=O();if(a==null)return J("Checkout not found");let o=await qe(e,{locale:t});if(we(o))return o;try{let i=n.shippingContact?.givenName;n.shippingContact?.familyName!=null?i+=" "+n.shippingContact?.familyName:n.billingContact?.familyName!=null&&(i+=" "+n.billingContact?.familyName);let c={},s=Pt();s!=null&&(c.ref=s);let y=await ve.get(Q).authorizeOneClickPayment({gateway:0,paymentData:JSON.stringify(n.token.paymentData),paymentMethod:JSON.stringify(n.token.paymentMethod),transactionIdentifier:n.token.transactionIdentifier,order:xe(Nt,{items:o.map(d=>({id:d.productID,quantity:d.quantity})),couponCode:a.couponCode,email:n.shippingContact?.emailAddress??n.billingContact?.emailAddress??a.email??void 0,phone:n.shippingContact?.phoneNumber??n.billingContact?.phoneNumber??void 0,selectedDeliveryMethod:a.selectedDeliveryMethod,postCode:a.postalCode,projectId:e}),shippingAddress:xe(xt,{line1:n.shippingContact?.addressLines?.[0]??"",city:n.shippingContact?.locality??"",country:n.shippingContact?.countryCode??"",zipCode:n.shippingContact?.postalCode??"",name:i}),billingAddress:xe(kt,{name:n.billingContact?.givenName??" "+(n.billingContact?.familyName??""),line1:n.billingContact?.addressLines?.[0]??"",city:n.billingContact?.locality??"",country:n.billingContact?.countryCode??"",zipCode:n.billingContact?.postalCode??""}),metadata:Object.keys(c).length>0?JSON.stringify(c):void 0});return{isSuccess:y.isSuccess,redirectURL:y.redirectUrl}}catch(i){return console.error(i),J("Failed to authorize payment")}},async completeGooglePayPayment(n){let a=O();if(a==null)return J("Checkout not found");let o=await qe(e,{locale:t});if(we(o))return o;try{let i=n.paymentData.shippingAddress?.name,c={},s=Pt();s!=null&&(c.ref=s);let y=await ve.get(Q).authorizeOneClickPayment({gateway:1,paymentData:n.paymentData.paymentMethodData.tokenizationData.token,paymentMethod:n.paymentData.paymentMethodData.type,transactionIdentifier:"",order:xe(Nt,{items:o.map(d=>({id:d.productID,quantity:d.quantity})),couponCode:a.couponCode,email:n.paymentData.email??void 0,phone:n.paymentData.shippingAddress?.phoneNumber??void 0,selectedDeliveryMethod:n.paymentData.shippingOptionData?.id??a.selectedDeliveryMethod,postCode:n.paymentData.shippingAddress?.postalCode,projectId:e}),shippingAddress:xe(xt,{line1:n.paymentData.shippingAddress?.address1??"",city:n.paymentData.shippingAddress?.locality??"",country:n.paymentData.shippingAddress?.countryCode??"",zipCode:n.paymentData.shippingAddress?.postalCode??"",name:i}),billingAddress:xe(kt,{name:n.paymentData.paymentMethodData.info?.billingAddress?.name,line1:n.paymentData.paymentMethodData.info?.billingAddress?.address1??"",city:n.paymentData.paymentMethodData.info?.billingAddress?.locality??"",country:n.paymentData.paymentMethodData.info?.billingAddress?.countryCode??"",zipCode:n.paymentData.paymentMethodData.info?.billingAddress?.postalCode??""}),metadata:Object.keys(c).length>0?JSON.stringify(c):void 0});return{isSuccess:y.isSuccess,redirectURL:y.redirectUrl}}catch(i){return console.error(i),J("Failed to authorize payment")}return{isSuccess:!0}},async getApplePayPaymentRequest(n){let a=O();if(a==null)return J("Checkout not found");n&&n.expectedItems!=null&&n.expectedItems.length>0&&(a.products&&hr(a.products.map(s=>s.productID)),await br(e,n.expectedItems));let o=await qe(e,{locale:t});if(we(o))return o;let i=await ve.get(Q).getPreOrderDetails({items:o.map(s=>xe(Ct,{id:s.productID,quantity:s.quantity})),projectId:e,postCode:a.postalCode,couponCode:a.couponCode,countryCode:a.country,selectedDeliveryMethod:a.selectedDeliveryMethod}),c=o.map(s=>({amount:`${j(s.quantity*(s.details?.price??0)/100,2)}`,label:s.details?.name+" - "+s.quantity,type:"final"}));if(i.selectedDeliveryMethod!=null){let s=i.methods.find(y=>y.id==i.selectedDeliveryMethod);s!=null&&c.push({amount:`${j(s.amount/100,2)}`,label:s.name,type:"final"})}return i.couponCode!=null&&i.couponValue!=null&&c.push({amount:`-${j(i.couponValue/100,2)}`,label:i.couponCode,type:"final"}),{countryCode:a.country??"PL",merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard"],total:{amount:`${j((i.totalAmount??0)/100,2)}`,label:"P\u0142atno\u015B\u0107 za koszyk",type:"final"},shippingMethods:i.methods.map(s=>({amount:`${j(s.amount/100,2)}`,detail:s.description??"",identifier:s.id,label:s.name,dateComponentsRange:{startDateComponents:{days:s.minDays??1,hours:0,months:0,years:0},endDateComponents:{days:s.maxDays??14,hours:0,months:0,years:0}}})),lineItems:c,currencyCode:"PLN"}}}};async function No(e){let t=O();if(t.googlePayConfig?.isAvailable!=!0){let r=await ve.get(Q).isOneClickPaymentAvailable({projectId:e});r.googlePay==!0&&r.googlePayConfig!=null?t.googlePayConfig={isAvailable:!0,gateway:r.googlePayConfig.gateway,gatewayId:r.googlePayConfig.gatewayMerchantId,merchantName:r.googlePayConfig.merchantName,merchantId:r.googlePayConfig.merchantId}:t.googlePayConfig={isAvailable:!1,gateway:"",gatewayId:"",merchantName:"",merchantId:""}}return te(t),t.googlePayConfig}function So(e,t){if(e==t.id){let n=t.variants?.findIndex(a=>a.id===e);if(n!=null&&n!=-1){let a=t.variants[n];return{...t,availableQuantity:a.availableQuantity,isDeliverable:a.isDeliverable,images:a.images??t.images,name:t.name+" "+a.name,price:a.price,currency:a.currency,pricing:a.pricing}}return t}let r=t.variants?.find(n=>n.id===e);return r==null?t:{...t,id:r.id,name:t.name+" "+r.name,price:r.price,currency:r.currency,pricing:r.pricing,metadata:t.metadata,availableQuantity:r.availableQuantity,isDeliverable:r.isDeliverable,images:r.images??t.images}}function tt(){let e=O(),t=0;if(e==null){Fe.setState(r=>({...r,numberOfProductsInCart:t}));return}t=e.products?.reduce((r,n)=>r+n.quantity,0)??0,Fe.setState(r=>({...r,numberOfProductsInCart:t}))}var Ro;(n=>{async function e(a,o=1,i,c){let s=nt();if(s==null)throw new Error("No project ID found");let d=await Kt(s).addProduct({productID:a,quantity:o,metadata:i,...c});if(d!=null)return d}n.addProductToCart=e;function t(){Fe.setState({isCartVisible:!0})}n.showCart=t;function r(){Fe.setState({isCartVisible:!1})}n.hideCart=r})(Ro||={});async function Vt(e){let t=nt();if(t==null)throw new Error("No project ID found");e=Jt(e),e.locale??=ce();let r=await fetch(et(t,"/buy"),{method:"POST",headers:{...vt,...It(t),"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.status!=200){if(r.headers.get("Content-Type")?.includes("application/json")){try{let a=await r.json();if("itemIds"in a&&Array.isArray(a.itemIds)){let o=a.itemIds;return J("item-ids-not-found","badInput",o)}}catch{}return J("internal-error","internal")}else console.warn("result",await r.text(),r.status,r.statusText);return J("internal-error","internal")}return{url:(await r.json()).url}}async function _c(e){let t=nt();if(t==null)throw new Error("No project ID found");let r={...vt,...It(t),"Content-Type":"application/json",...e.apiKey!=null?{Authorization:`Bearer ${e.apiKey}`}:{}},n=e.testMode?`/api/payment/link/auto/${t}/test`:`/api/payment/link/auto/${t}`;return delete e.apiKey,delete e.testMode,e.locale??=ce(),{status:"ok",redirectURL:(await(await fetch(Q+n,{method:"POST",headers:r,body:JSON.stringify(e)})).json()).url}}function Pt(){if(typeof localStorage>"u")return;let e=localStorage.getItem("bitsnap-ref");if(e!=null)return e}function Jt(e){let t=Pt();return t==null||(e.metadata==null&&(e.metadata={}),e.metadata.ref=t),e}export{ve as a,de as b,ye as c,Pe as d,At as e,ue as f,kn as g,Dt as h,Se as i,Ze as j,Je as k,Ue as l,ze as m,Br as n,Dn as o,Ht as p,no as q,j as r,fr as s,Gt as t,we as u,Fe as v,Ro as w,Vt as x,_c as y,Pt as z,Jt as A,bo as B,Wt as C,Sc as D,nt as E,Ic as F,Rc as G,Kt as H};
|
|
4
|
+
//# sourceMappingURL=chunk-JXCHRSPW.mjs.map
|