bitsnap-react 1.18.1 → 1.19.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/AGENTS.md +21 -0
- package/README.md +45 -0
- package/dist/BitsnapCart-E72W5RRZ.mjs +2 -0
- package/dist/BitsnapCart-LHJ6KOTV.css +2 -0
- package/dist/BitsnapCart-LHJ6KOTV.css.map +1 -0
- package/dist/BitsnapCart-Q2HER6GU.js +2 -0
- package/dist/BitsnapCart-Q2HER6GU.js.map +1 -0
- package/dist/CartProvider-677CE2FI.js +2 -0
- package/dist/CartProvider-677CE2FI.js.map +1 -0
- package/dist/CartProvider-YPDOFSYC.mjs +2 -0
- package/dist/PanelModelFiles-EKQRLF46.js.map +1 -1
- package/dist/analytics.js +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/analytics.mjs +1 -1
- package/dist/catalog.js +1 -1
- package/dist/catalog.js.map +1 -1
- package/dist/catalog.mjs +1 -1
- package/dist/chat.css +2 -0
- package/dist/chat.css.map +1 -0
- package/dist/chat.d.mts +172 -0
- package/dist/chat.d.ts +172 -0
- package/dist/chat.js +2 -0
- package/dist/chat.js.map +1 -0
- package/dist/chat.mjs +2 -0
- package/dist/chat.mjs.map +1 -0
- package/dist/chunk-2FD2QP4Y.js +2 -0
- package/dist/chunk-2FD2QP4Y.js.map +1 -0
- package/dist/chunk-5JRUPLXY.mjs +2 -0
- package/dist/chunk-5JRUPLXY.mjs.map +1 -0
- package/dist/chunk-5M6M7FAR.mjs +2 -0
- package/dist/chunk-5M6M7FAR.mjs.map +1 -0
- package/dist/chunk-6Q3VGPSF.js.map +1 -1
- package/dist/chunk-AAC576BC.mjs +5 -0
- package/dist/chunk-AAC576BC.mjs.map +1 -0
- package/dist/{chunk-ZKT4N553.mjs → chunk-AB37DWOK.mjs} +2 -2
- package/dist/{chunk-AHISXVEE.js → chunk-BUYTK7KM.js} +2 -2
- package/dist/chunk-BUYTK7KM.js.map +1 -0
- package/dist/{chunk-G4SEOVLD.js → chunk-D2ASWUXM.js} +2 -2
- package/dist/chunk-D2ASWUXM.js.map +1 -0
- package/dist/chunk-DDIEFKNP.mjs +2 -0
- package/dist/{chunk-ZM5T4TQW.mjs.map → chunk-DDIEFKNP.mjs.map} +1 -1
- package/dist/{chunk-N3B25GTY.js → chunk-DOJICJCQ.js} +2 -2
- package/dist/chunk-DOJICJCQ.js.map +1 -0
- package/dist/chunk-EMR4YXNY.mjs +2 -0
- package/dist/chunk-EMR4YXNY.mjs.map +1 -0
- package/dist/{chunk-DR7WYI37.js → chunk-GJOGATP6.js} +2 -2
- package/dist/chunk-GJOGATP6.js.map +1 -0
- package/dist/chunk-GQ5OKU74.js +2 -0
- package/dist/chunk-GQ5OKU74.js.map +1 -0
- package/dist/chunk-JSDGZ4NY.js.map +1 -1
- package/dist/chunk-KHQEDQYF.js +5 -0
- package/dist/chunk-KHQEDQYF.js.map +1 -0
- package/dist/chunk-KOYBZORL.js.map +1 -1
- package/dist/chunk-LGPNJ5XE.js +2 -0
- package/dist/chunk-LGPNJ5XE.js.map +1 -0
- package/dist/chunk-MDAFPGPA.js +2 -0
- package/dist/chunk-MDAFPGPA.js.map +1 -0
- package/dist/{chunk-UTUPPMLK.mjs → chunk-MMLBQHBM.mjs} +2 -2
- package/dist/chunk-MWWEPEU2.js +2 -0
- package/dist/chunk-MWWEPEU2.js.map +1 -0
- package/dist/{chunk-62WDFH7K.mjs → chunk-N523LFAM.mjs} +2 -2
- package/dist/chunk-NWXZ45TV.js +2 -0
- package/dist/chunk-NWXZ45TV.js.map +1 -0
- package/dist/chunk-OR566YJI.mjs +2 -0
- package/dist/chunk-OR566YJI.mjs.map +1 -0
- package/dist/chunk-Q337IQNA.js.map +1 -1
- package/dist/chunk-SCEWYZUZ.mjs +2 -0
- package/dist/chunk-SCEWYZUZ.mjs.map +1 -0
- package/dist/{chunk-GKJURMDO.mjs → chunk-SSSF64M7.mjs} +2 -2
- package/dist/{chunk-GKJURMDO.mjs.map → chunk-SSSF64M7.mjs.map} +1 -1
- package/dist/chunk-W3RGQYPD.js.map +1 -1
- package/dist/chunk-WG54EHST.mjs +2 -0
- package/dist/chunk-WG54EHST.mjs.map +1 -0
- package/dist/chunk-XEXPQFKN.mjs +2 -0
- package/dist/chunk-XEXPQFKN.mjs.map +1 -0
- package/dist/chunk-YV2C276H.js +2 -0
- package/dist/chunk-YV2C276H.js.map +1 -0
- package/dist/consent.js.map +1 -1
- package/dist/course.d.mts +2 -14
- package/dist/course.d.ts +2 -14
- 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 -1
- 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 +17 -3
- package/dist/index.d.ts +17 -3
- 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/internal.js.map +1 -1
- package/dist/methods-64D5DD6K.js +2 -0
- package/dist/methods-64D5DD6K.js.map +1 -0
- package/dist/methods-NQA3DFLE.mjs +2 -0
- package/dist/methods-NQA3DFLE.mjs.map +1 -0
- package/dist/model-files-client-P4PORZJ6.js.map +1 -1
- package/dist/models.js.map +1 -1
- package/dist/returns.js +1 -1
- package/dist/returns.js.map +1 -1
- package/dist/returns.mjs +1 -1
- package/dist/texts-9kfgClsA.d.mts +14 -0
- package/dist/texts-9kfgClsA.d.ts +14 -0
- package/dist/{types-D6LsoycW.d.mts → types-B-sjyZQs.d.mts} +7 -1
- package/dist/{types-ClFCVzk_.d.ts → types-iRe6ix2y.d.ts} +7 -1
- package/dist/viewer3d.js.map +1 -1
- package/dist/viewer3d.mjs +1 -1
- package/dist/viewer3d.mjs.map +1 -1
- package/dist/widgets-BT2LN2Nq.d.mts +547 -0
- package/dist/widgets-BVOSj9fU.d.ts +547 -0
- package/package.json +16 -2
- package/dist/CartProvider-CC6YIZVS.js +0 -2
- package/dist/CartProvider-CC6YIZVS.js.map +0 -1
- package/dist/CartProvider-ZL65WZN6.mjs +0 -2
- package/dist/chunk-2XSLIZ27.js +0 -2
- package/dist/chunk-2XSLIZ27.js.map +0 -1
- package/dist/chunk-5OCGXVLC.js +0 -2
- package/dist/chunk-5OCGXVLC.js.map +0 -1
- package/dist/chunk-5YN752OV.mjs +0 -2
- package/dist/chunk-5YN752OV.mjs.map +0 -1
- package/dist/chunk-7BG22YBF.js +0 -5
- package/dist/chunk-7BG22YBF.js.map +0 -1
- package/dist/chunk-AHISXVEE.js.map +0 -1
- package/dist/chunk-DR7WYI37.js.map +0 -1
- package/dist/chunk-EOFJAQPT.js +0 -2
- package/dist/chunk-EOFJAQPT.js.map +0 -1
- package/dist/chunk-G4SEOVLD.js.map +0 -1
- package/dist/chunk-IGQZP4YR.mjs +0 -2
- package/dist/chunk-IGQZP4YR.mjs.map +0 -1
- package/dist/chunk-N3B25GTY.js.map +0 -1
- package/dist/chunk-VWA3ZCNI.mjs +0 -2
- package/dist/chunk-VWA3ZCNI.mjs.map +0 -1
- package/dist/chunk-YGE2223J.mjs +0 -5
- package/dist/chunk-YGE2223J.mjs.map +0 -1
- package/dist/chunk-ZM5T4TQW.mjs +0 -2
- package/dist/methods-7DWKFCPK.js +0 -2
- package/dist/methods-7DWKFCPK.js.map +0 -1
- package/dist/methods-DQTADIN4.mjs +0 -2
- /package/dist/{CartProvider-ZL65WZN6.mjs.map → BitsnapCart-E72W5RRZ.mjs.map} +0 -0
- /package/dist/{methods-DQTADIN4.mjs.map → CartProvider-YPDOFSYC.mjs.map} +0 -0
- /package/dist/{chunk-ZKT4N553.mjs.map → chunk-AB37DWOK.mjs.map} +0 -0
- /package/dist/{chunk-UTUPPMLK.mjs.map → chunk-MMLBQHBM.mjs.map} +0 -0
- /package/dist/{chunk-62WDFH7K.mjs.map → chunk-N523LFAM.mjs.map} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -6,11 +6,14 @@ export { BitsnapReturns, BitsnapReturnsProps, BitsnapReturnsProvider, BitsnapRet
|
|
|
6
6
|
export { b as RETURNS_SLOT_NAMES, R as ReturnsAppearance, c as ReturnsAppearanceElements, d as ReturnsAppearanceTokens, e as ReturnsSlotAppearance, f as ReturnsSlotName, h as ReturnsTextKey, a as ReturnsTexts, g as ReturnsTheme } from './texts-LGhuQfA9.mjs';
|
|
7
7
|
import { CSSProperties, ReactNode } from 'react';
|
|
8
8
|
import z__default from 'zod';
|
|
9
|
-
import { P as PanelLoginProps, a as PanelProps, G as GetThemeOutput } from './types-
|
|
10
|
-
export { b as PanelScreen, c as PanelSearchParamsType } from './types-
|
|
9
|
+
import { P as PanelLoginProps, a as PanelProps, G as GetThemeOutput } from './types-B-sjyZQs.mjs';
|
|
10
|
+
export { b as PanelScreen, c as PanelSearchParamsType } from './types-B-sjyZQs.mjs';
|
|
11
|
+
import { e as ChatThreadProps, c as ChannelProps } from './widgets-BT2LN2Nq.mjs';
|
|
12
|
+
export { d as ChatBuyRequest, C as ChatTexts, f as ChatWidgetBaseProps } from './widgets-BT2LN2Nq.mjs';
|
|
11
13
|
import './models.mjs';
|
|
12
14
|
import '@bufbuild/protobuf/wkt';
|
|
13
15
|
import '@bufbuild/protobuf';
|
|
16
|
+
import './texts-9kfgClsA.mjs';
|
|
14
17
|
|
|
15
18
|
type AppleButtonType = "plain" | "add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" | "donate" | "order" | "pay" | "reload" | "rent" | "set-up" | "subscribe" | "support" | "tip" | "top-up";
|
|
16
19
|
type ColorType = "black" | "white" | "white-outline";
|
|
@@ -967,4 +970,15 @@ declare function persistReturnURL(returnURL: string | null): void;
|
|
|
967
970
|
declare function readPersistedReturnURL(): string | null;
|
|
968
971
|
declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
|
|
969
972
|
|
|
970
|
-
|
|
973
|
+
/**
|
|
974
|
+
* A buyer's pack thread for one service product. Loads the chat on demand;
|
|
975
|
+
* the same component is exported eagerly from `bitsnap-react/chat`.
|
|
976
|
+
*/
|
|
977
|
+
declare function ChatThread(props: ChatThreadProps): react_jsx_runtime.JSX.Element;
|
|
978
|
+
/**
|
|
979
|
+
* A community channel. Loads the chat on demand; the same component is
|
|
980
|
+
* exported eagerly from `bitsnap-react/chat`.
|
|
981
|
+
*/
|
|
982
|
+
declare function Channel(props: ChannelProps): react_jsx_runtime.JSX.Element;
|
|
983
|
+
|
|
984
|
+
export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, type BuyErrorData, CHECKOUT_SLOT_NAMES, Channel, ChannelProps, ChatThread, ChatThreadProps, type CheckoutAppearance, type CheckoutAppearanceElements, type CheckoutAppearanceTokens, type CheckoutSlotAppearance, type CheckoutSlotName, type CheckoutTexts, type CheckoutTheme, type ComponentClassNames, type CreateCheckoutResult, type CustomizationTexts, type ExpressItem, GetThemeOutput, Wrapper$1 as GooglePayButton, type Props$2 as GooglePayButtonProps, ITEM_IDS_NOT_FOUND, InPostPayButton, type InPostPayButtonProps, type LinkRequest, type NotificationGroup, Wrapper as NotificationsComponent, type Props$1 as NotificationsComponentProps, type NotificationsComponentPublicProps, PanelPage as Panel, type PanelConfig, PanelLogin, PanelLoginProps, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, RevolutPayButton, type RevolutPayButtonProps, type RevolutPaymentOutcome, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getPaymentMethodChoice, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,11 +6,14 @@ export { BitsnapReturns, BitsnapReturnsProps, BitsnapReturnsProvider, BitsnapRet
|
|
|
6
6
|
export { b as RETURNS_SLOT_NAMES, R as ReturnsAppearance, c as ReturnsAppearanceElements, d as ReturnsAppearanceTokens, e as ReturnsSlotAppearance, f as ReturnsSlotName, h as ReturnsTextKey, a as ReturnsTexts, g as ReturnsTheme } from './texts-m6XQGZ6w.js';
|
|
7
7
|
import { CSSProperties, ReactNode } from 'react';
|
|
8
8
|
import z__default from 'zod';
|
|
9
|
-
import { P as PanelLoginProps, a as PanelProps, G as GetThemeOutput } from './types-
|
|
10
|
-
export { b as PanelScreen, c as PanelSearchParamsType } from './types-
|
|
9
|
+
import { P as PanelLoginProps, a as PanelProps, G as GetThemeOutput } from './types-iRe6ix2y.js';
|
|
10
|
+
export { b as PanelScreen, c as PanelSearchParamsType } from './types-iRe6ix2y.js';
|
|
11
|
+
import { e as ChatThreadProps, c as ChannelProps } from './widgets-BVOSj9fU.js';
|
|
12
|
+
export { d as ChatBuyRequest, C as ChatTexts, f as ChatWidgetBaseProps } from './widgets-BVOSj9fU.js';
|
|
11
13
|
import './models.js';
|
|
12
14
|
import '@bufbuild/protobuf/wkt';
|
|
13
15
|
import '@bufbuild/protobuf';
|
|
16
|
+
import './texts-9kfgClsA.js';
|
|
14
17
|
|
|
15
18
|
type AppleButtonType = "plain" | "add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" | "donate" | "order" | "pay" | "reload" | "rent" | "set-up" | "subscribe" | "support" | "tip" | "top-up";
|
|
16
19
|
type ColorType = "black" | "white" | "white-outline";
|
|
@@ -967,4 +970,15 @@ declare function persistReturnURL(returnURL: string | null): void;
|
|
|
967
970
|
declare function readPersistedReturnURL(): string | null;
|
|
968
971
|
declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
|
|
969
972
|
|
|
970
|
-
|
|
973
|
+
/**
|
|
974
|
+
* A buyer's pack thread for one service product. Loads the chat on demand;
|
|
975
|
+
* the same component is exported eagerly from `bitsnap-react/chat`.
|
|
976
|
+
*/
|
|
977
|
+
declare function ChatThread(props: ChatThreadProps): react_jsx_runtime.JSX.Element;
|
|
978
|
+
/**
|
|
979
|
+
* A community channel. Loads the chat on demand; the same component is
|
|
980
|
+
* exported eagerly from `bitsnap-react/chat`.
|
|
981
|
+
*/
|
|
982
|
+
declare function Channel(props: ChannelProps): react_jsx_runtime.JSX.Element;
|
|
983
|
+
|
|
984
|
+
export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, type BuyErrorData, CHECKOUT_SLOT_NAMES, Channel, ChannelProps, ChatThread, ChatThreadProps, type CheckoutAppearance, type CheckoutAppearanceElements, type CheckoutAppearanceTokens, type CheckoutSlotAppearance, type CheckoutSlotName, type CheckoutTexts, type CheckoutTheme, type ComponentClassNames, type CreateCheckoutResult, type CustomizationTexts, type ExpressItem, GetThemeOutput, Wrapper$1 as GooglePayButton, type Props$2 as GooglePayButtonProps, ITEM_IDS_NOT_FOUND, InPostPayButton, type InPostPayButtonProps, type LinkRequest, type NotificationGroup, Wrapper as NotificationsComponent, type Props$1 as NotificationsComponentProps, type NotificationsComponentPublicProps, PanelPage as Panel, type PanelConfig, PanelLogin, PanelLoginProps, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, RevolutPayButton, type RevolutPayButtonProps, type RevolutPaymentOutcome, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getPaymentMethodChoice, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;var _chunk7BG22YBFjs = require('./chunk-7BG22YBF.js');var _chunkDR7WYI37js = require('./chunk-DR7WYI37.js');var _chunkAHISXVEEjs = require('./chunk-AHISXVEE.js');var _chunkEOFJAQPTjs = require('./chunk-EOFJAQPT.js');var _chunkKOYBZORLjs = require('./chunk-KOYBZORL.js');var _chunk2XSLIZ27js = require('./chunk-2XSLIZ27.js');var _chunk5OCGXVLCjs = require('./chunk-5OCGXVLC.js');var _chunkN3B25GTYjs = require('./chunk-N3B25GTY.js');var _chunkG4SEOVLDjs = require('./chunk-G4SEOVLD.js');var _chunkQ337IQNAjs = require('./chunk-Q337IQNA.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');var _applepaybutton = require('apple-pay-button'); var _applepaybutton2 = _interopRequireDefault(_applepaybutton);function Ct(){try{return _chunk7BG22YBFjs.K.call(void 0, )}catch (e2){return}}var _reactquery = require('@tanstack/react-query');var _jsxruntime = require('react/jsx-runtime');var fi=_nullishCoalesce(_applepaybutton2.default.default, () => (_applepaybutton2.default));function hi({style:t,buttonType:e,colorType:a,items:r,onClick:n}){let{checkIfApplePayIsAvailable:o,getApplePayPaymentRequest:i,completeApplePayPayment:c,setCountry:l,setCouponCodeIfPossible:u,setDeliveryMethod:s,setEmail:f,setPostalCode:v,clearCart:m,getApplePayPreview:g}=_chunk7BG22YBFjs.O.call(void 0, ),p=_chunkG4SEOVLDjs.m.call(void 0, ),S=_chunk7BG22YBFjs.E.call(void 0, "paymentForCart"),{data:R}=_reactquery.useQuery.call(void 0, {queryKey:["is-apple-pay-available"],queryFn:o}),h=r.map(I=>`${I.id}:${I.quantity}`).join(","),y=_chunk7BG22YBFjs.L.call(void 0, ),{data:A}=_reactquery.useQuery.call(void 0, {queryKey:["apple-pay-preview",h,_nullishCoalesce(y.country, () => ("")),_nullishCoalesce(y.couponCode, () => ("")),_nullishCoalesce(y.selectedDeliveryMethod, () => ("")),_nullishCoalesce(y.postalCode, () => (""))],queryFn:()=>g({items:r.map(I=>({productID:I.id,quantity:I.quantity,metadata:I.metadata}))}),enabled:R===!0});if(R!=!0)return null;let k=A!=null&&!_chunk7BG22YBFjs.q.call(void 0, A)?A:{countryCode:y.country||"PL",currencyCode:_nullishCoalesce(_optionalChain([r, 'access', _2 => _2[0], 'optionalAccess', _3 => _3.currency]), () => ("PLN")),totalAmount:`${_chunk7BG22YBFjs.n.call(void 0, r.reduce((I,T)=>I+T.price*T.quantity,0)/100,2)}`},E=r.map(I=>({productID:I.id,quantity:I.quantity,metadata:I.metadata}));async function D(){let I=!1,T=b=>{I||(I=!0,p.track("apple_pay_result",{outcome:b}))};p.track("apple_pay_clicked",{}),p.track("payment_method_selected",{gateway:"apple_pay",method:"apple_pay"}),_chunk7BG22YBFjs.p.call(void 0, {event:"initiateCheckout",items:r.map(b=>({id:b.id,name:b.name,price:b.price,quantity:b.quantity,currency:k.currencyCode}))});let P=r.find(b=>b.isDeliverable===!0)!=null,w=new ApplePaySession(14,{countryCode:k.countryCode,merchantCapabilities:["supports3DS"],supportedNetworks:["visa","masterCard"],currencyCode:k.currencyCode,total:{amount:k.totalAmount,label:S,type:"pending"},lineItems:r.map(b=>({amount:`${_chunk7BG22YBFjs.n.call(void 0, b.price*b.quantity/100,2)}`,label:b.name,type:"final"})),...P?{shippingMethods:[],supportsCouponCode:!0,requiredBillingContactFields:["name","email","postalAddress","phone"],requiredShippingContactFields:["name","email","postalAddress","phone"]}:{}});await _optionalChain([n, 'optionalCall', _4 => _4()]);let U=await i({expectedItems:E});if(_chunk7BG22YBFjs.q.call(void 0, U)){console.error("Error creating ApplePaySession:",U.error),T("fail");return}w.oncancel=b=>{console.log("ApplePaySession cancelled",b),T("cancel")},w.onvalidatemerchant=async b=>{try{let C=await _chunk7BG22YBFjs.a.get(_chunkN3B25GTYjs.e).applePayValidateMerchant({validationUrl:b.validationURL,projectId:_chunk7BG22YBFjs.K.call(void 0, )});console.log("merchantSession",C.merchantSession),C.merchantSession.length>0?(console.log("completing merchant session"),w.completeMerchantValidation(JSON.parse(C.merchantSession))):w.abort()}catch (e3){w.abort()}},w.onshippingmethodselected=async b=>{console.log("shipping method selected",b),p.track("delivery_method_selected",{method:b.shippingMethod.identifier}),await s(b.shippingMethod.identifier);let C=await i({expectedItems:E});if(console.log("apRequest",C),_chunk7BG22YBFjs.q.call(void 0, C))throw w.abort(),new Error("Failed to get Apple Pay payment request");w.completeShippingMethodSelection({newTotal:C.total,newLineItems:C.lineItems,newShippingMethods:C.shippingMethods})},w.onshippingcontactselected=async b=>{try{b.shippingContact.countryCode!=null&&await l(b.shippingContact.countryCode),b.shippingContact.postalCode!=null&&await v(b.shippingContact.postalCode),b.shippingContact.phoneNumber!=null&&await f(b.shippingContact.emailAddress);let C=await i({expectedItems:E});if(_chunk7BG22YBFjs.q.call(void 0, C))throw w.abort(),new Error("Failed to get Apple Pay payment request");console.log("apRequest",C),w.completeShippingContactSelection({newLineItems:C.lineItems,newTotal:C.total,newShippingMethods:C.shippingMethods})}catch(C){console.log("shipping contact selected error",C),w.abort()}},w.oncouponcodechanged=async b=>{try{console.log("coupon code changed",b);let C=await u(b.couponCode),X=await i({expectedItems:E});if(console.log("apRequest",X),_chunk7BG22YBFjs.q.call(void 0, X))throw w.abort(),new Error("Failed to get Apple Pay payment request");w.completeCouponCodeChange({errors:_chunk7BG22YBFjs.q.call(void 0, C)?[new ApplePayError("couponCodeInvalid")]:void 0,newTotal:X.total,newLineItems:X.lineItems,newShippingMethods:X.shippingMethods})}catch(C){console.log("coupon code changed error",C),w.abort()}},w.onpaymentauthorized=async b=>{p.track("payment_submitted",{gateway:"apple_pay",method:"apple_pay"});try{let C=await c({token:b.payment.token,billingContact:b.payment.billingContact,shippingContact:b.payment.shippingContact});if(_chunk7BG22YBFjs.q.call(void 0, C)){console.log("apple pay error",C),T("fail"),w.completePayment({status:ApplePaySession.STATUS_FAILURE});return}C.redirectURL&&setTimeout(()=>{open(C.redirectURL,"_self")},2e3),T(C.isSuccess?"success":"fail"),w.completePayment({status:C.isSuccess?ApplePaySession.STATUS_SUCCESS:ApplePaySession.STATUS_FAILURE}),C.isSuccess&&m()}catch (e4){T("fail"),w.completePayment({status:ApplePaySession.STATUS_FAILURE})}},w.begin()}return _jsxruntime.jsx.call(void 0, fi,{style:t,buttonStyle:a,type:e,onClick:D})}function vi(t){let e=_chunkG4SEOVLDjs.n.call(void 0, Ct(),t.analytics,"cart");return _jsxruntime.jsx.call(void 0, _chunkG4SEOVLDjs.l,{value:e,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.P,{children:_jsxruntime.jsx.call(void 0, hi,{...t})})})}var Sa=vi;var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);var _react3 = require('@formkit/auto-animate/react');var _reactdialog = require('@radix-ui/react-dialog'); var It = _interopRequireWildcard(_reactdialog); var it = _interopRequireWildcard(_reactdialog);var _reactdom = require('react-dom');var yi=["root","overlay","panel","header","title","closeButton","productList","product","productImage","productName","productPrice","quantityControl","quantityInput","quantityButton","removeButton","summary","totalLabel","totalValue","deliveryText","summaryNote","countryLabel","countryTrigger","countryDropdown","countrySearch","countryOption","paymentButtons","paymentMethods","paymentMethodOption","checkoutButton","emptyState","error","skeleton"],wi={fontFamily:"--bitsnap-checkout-font-family",fontSize:"--bitsnap-checkout-font-size",background:"--bitsnap-checkout-background",surface:"--bitsnap-checkout-surface",foreground:"--bitsnap-checkout-foreground",mutedForeground:"--bitsnap-checkout-muted-foreground",border:"--bitsnap-checkout-border",buttonBackground:"--bitsnap-checkout-button-background",buttonForeground:"--bitsnap-checkout-button-foreground",buttonHoverBackground:"--bitsnap-checkout-button-hover-background",hoverSurface:"--bitsnap-checkout-hover-surface",focusRing:"--bitsnap-checkout-focus-ring",error:"--bitsnap-checkout-error",overlay:"--bitsnap-checkout-overlay",radius:"--bitsnap-checkout-radius"},xi={dark:{},light:{background:"#ffffff",surface:"#f9fafb",foreground:"#18181b",mutedForeground:"#71717a",border:"#e4e4e7",buttonBackground:"#18181b",buttonForeground:"#fafafa",buttonHoverBackground:"#000000",hoverSurface:"#e4e4e7",focusRing:"#71717a",error:"#dc2626",overlay:"rgb(0 0 0 / 0.35)"}},ki=[{token:"background",variable:"--background"},{token:"foreground",variable:"--foreground"},{token:"surface",variable:"--card"},{token:"surface",variable:"--popover"},{token:"foreground",variable:"--popover-foreground"},{token:"mutedForeground",variable:"--muted-foreground"},{token:"border",variable:"--border"},{token:"border",variable:"--input"},{token:"focusRing",variable:"--ring"},{token:"error",variable:"--destructive"},{token:"radius",variable:"--radius"}];function Ci(t){return{"--popover":_nullishCoalesce(t.surface, () => ("var(--color-neutral-800)")),"--popover-foreground":_nullishCoalesce(t.foreground, () => ("var(--color-neutral-200)"))}}function Ia(t){let e=_chunkKOYBZORLjs.a.call(void 0, t,{defaultTheme:"dark",presets:xi,variables:wi,shadcnVariables:ki});return{theme:e.theme,isCustomized:e.isCustomized,tokens:e.tokens,elements:e.elements,boundaryClassName:e.theme,boundaryStyle:e.boundaryStyle,dropdownStyle:Ci(e.tokens)}}function jr(t,e){return _chunkKOYBZORLjs.b.call(void 0, t.elements,e)}var qr=_react.createContext.call(void 0, Ia());function le({appearance:t,children:e}){let a=_react.useMemo.call(void 0, ()=>Ia(t),[t]);return _jsxruntime.jsx.call(void 0, qr.Provider,{value:a,children:e})}function Ce(){return _react.useContext.call(void 0, qr)}function L(t){let e=Ce();return _nullishCoalesce(jr(e,t), () => ({}))}var _reactselect = require('@radix-ui/react-select'); var G = _interopRequireWildcard(_reactselect);var _lucidereact = require('lucide-react');function Fr({...t}){return _jsxruntime.jsx.call(void 0, G.Root,{"data-slot":"select",...t})}function Wr({...t}){return _jsxruntime.jsx.call(void 0, G.Value,{"data-slot":"select-value",...t})}var Ri="border-input dark:bg-input/30 dark:hover:bg-input/50 bg-transparent";function Hr({className:t,size:e="default",theme:a="default",children:r,...n}){return _jsxruntime.jsxs.call(void 0, G.Trigger,{"data-slot":"select-trigger","data-size":e,className:_chunkN3B25GTYjs.g.call(void 0, "data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-fit items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a==="bare"?"":Ri,t),...n,children:[r,_jsxruntime.jsx.call(void 0, G.Icon,{asChild:!0,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function Kr({className:t,children:e,position:a="popper",align:r="center",...n}){return _jsxruntime.jsx.call(void 0, G.Portal,{children:_jsxruntime.jsxs.call(void 0, G.Content,{"data-slot":"select-content",className:_chunkN3B25GTYjs.g.call(void 0, "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,align:r,...n,children:[_jsxruntime.jsx.call(void 0, Ai,{}),_jsxruntime.jsx.call(void 0, G.Viewport,{className:_chunkN3B25GTYjs.g.call(void 0, "p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:e}),_jsxruntime.jsx.call(void 0, Di,{})]})})}function Vr({className:t,children:e,...a}){return _jsxruntime.jsxs.call(void 0, G.Item,{"data-slot":"select-item",className:_chunkN3B25GTYjs.g.call(void 0, "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...a,children:[_jsxruntime.jsx.call(void 0, "span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:_jsxruntime.jsx.call(void 0, G.ItemIndicator,{children:_jsxruntime.jsx.call(void 0, _lucidereact.CheckIcon,{className:"size-4"})})}),_jsxruntime.jsx.call(void 0, G.ItemText,{children:e})]})}function Ai({className:t,...e}){return _jsxruntime.jsx.call(void 0, G.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:_chunkN3B25GTYjs.g.call(void 0, "flex cursor-default items-center justify-center py-1",t),...e,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronUpIcon,{className:"size-4"})})}function Di({className:t,...e}){return _jsxruntime.jsx.call(void 0, G.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:_chunkN3B25GTYjs.g.call(void 0, "flex cursor-default items-center justify-center py-1",t),...e,children:_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDownIcon,{className:"size-4"})})}function Ui({id:t,open:e,disabled:a=!1,onToggle:r,onChange:n,selectedValue:o,countries:i}){let[c,l]=_react.useState.call(void 0, ""),{isCustomized:u,boundaryClassName:s,boundaryStyle:f,dropdownStyle:v}=Ce(),m=L("countryTrigger"),g=L("countryDropdown"),p=L("countrySearch"),S=L("countryOption"),R=_chunk7BG22YBFjs.E.call(void 0, "searchCountry"),h=_chunk7BG22YBFjs.E.call(void 0, "noCountriesFound");_react.useEffect.call(void 0, ()=>{o==null&&i.length>0&&n(i[0].code)},[]);let y=i.filter(k=>k.name.toLowerCase().startsWith(c.toLowerCase())),A=i.find(k=>k.code===o);return _jsxruntime.jsxs.call(void 0, Fr,{value:o,onValueChange:k=>{n(k),l("")},open:e,onOpenChange:k=>{k!==e&&r(),k||l("")},disabled:a,children:[_jsxruntime.jsx.call(void 0, Hr,{"data-bitsnap-checkout-slot":"countryTrigger",theme:"bare",className:_chunkN3B25GTYjs.g.call(void 0, a?"bg-neutral-100 dark:bg-neutral-800 dark:border-neutral-700":"","w-full rounded-md",m.className),style:m.style,children:_jsxruntime.jsx.call(void 0, Wr,{children:A&&_jsxruntime.jsxs.call(void 0, "span",{className:"truncate flex items-center",children:[_jsxruntime.jsx.call(void 0, "img",{alt:o,src:`https://purecatamphetamine.github.io/country-flag-icons/3x2/${o}.svg`,className:"inline mr-2 h-4 rounded-sm"}),A.name]})})}),_jsxruntime.jsxs.call(void 0, Kr,{"data-bitsnap-checkout":u?"dropdown":void 0,"data-bitsnap-checkout-slot":u?"countryDropdown":void 0,className:_chunkN3B25GTYjs.g.call(void 0, u?"bitsnap-react":"",s,"w-full max-h-80 max-w-[350px] z-[999999]",g.className),style:{...u?{...f,...v}:void 0,...g.style},position:"popper",children:[_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"countrySearch",className:_chunkN3B25GTYjs.g.call(void 0, "sticky top-0 z-10 p-1 border-b",p.className),style:p.style,children:_jsxruntime.jsx.call(void 0, "input",{type:"search",name:"search",autoComplete:"off",className:"block w-full outline-none sm:text-body-regular bg-transparent rounded-md px-2 py-1.5",placeholder:R,"aria-label":R,value:c,onChange:k=>l(k.target.value),onClick:k=>k.stopPropagation(),onKeyDown:k=>k.stopPropagation()})}),_jsxruntime.jsx.call(void 0, "div",{className:"max-h-64 overflow-y-auto",children:y.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"cursor-default select-none relative py-2 pl-3 pr-9 text-sm",children:h}):y.map(k=>_jsxruntime.jsxs.call(void 0, Vr,{"data-bitsnap-checkout-slot":"countryOption",value:k.code,className:_chunkN3B25GTYjs.g.call(void 0, "cursor-default select-none relative py-2 pl-3 pr-9 flex items-center transition",S.className),style:S.style,children:[_jsxruntime.jsx.call(void 0, "img",{alt:k.code,src:`https://purecatamphetamine.github.io/country-flag-icons/3x2/${k.code}.svg`,className:"inline mr-2 h-4 rounded-sm"}),_jsxruntime.jsx.call(void 0, "span",{className:"font-normal truncate",children:k.name})]},`${t}-${k.code}`))})]})]})}var $r=Ui;var _reactslot = require('@radix-ui/react-slot');var _classvarianceauthority = require('class-variance-authority');var Oi=_classvarianceauthority.cva.call(void 0, "flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function Qr({className:t,orientation:e,...a}){return _jsxruntime.jsx.call(void 0, "div",{role:"group","data-slot":"button-group","data-orientation":e,className:_chunkN3B25GTYjs.g.call(void 0, Oi({orientation:e}),t),...a})}function Xr({price:t,currency:e,pricing:a,quantity:r=1}){let n=_chunk7BG22YBFjs.E.call(void 0, "lowestPrice30Days"),o=_chunk7BG22YBFjs.E.call(void 0, "noPriceHistory"),i=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _5 => _5.regularPrice]), () => (t)),c=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _6 => _6.effectivePrice]), () => (t)),l=_optionalChain([a, 'optionalAccess', _7 => _7.discount, 'optionalAccess', _8 => _8.status])==="ACTIVE"&&c<i;return _jsxruntime.jsx.call(void 0, "span",{children:l?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{className:"mr-2 text-neutral-500 line-through",children:_chunk7BG22YBFjs.o.call(void 0, i*r,e)}),_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold text-red-700",children:_chunk7BG22YBFjs.o.call(void 0, c*r,e)}),_jsxruntime.jsx.call(void 0, "span",{className:"mt-1 block text-xs text-neutral-600",children:_optionalChain([a, 'optionalAccess', _9 => _9.referencePrice, 'access', _10 => _10.historyAvailable])&&a.referencePrice.amount!=null?`${n} ${_chunk7BG22YBFjs.o.call(void 0, a.referencePrice.amount,e)}`:o})]}):_chunk7BG22YBFjs.o.call(void 0, c*r,e)})}function He(t){return Number.isFinite(t)?Math.min(99,Math.max(1,Math.trunc(t))):1}function Ta(t,e){let a=parseInt(t,10);return Number.isNaN(a)?e:He(a)}var Wi=({isNotAvailable:t,quantity:e,details:a,url:r,shouldUpdate:n})=>{let o=L("product"),i=L("productImage"),c=L("productName"),l=L("productPrice"),u=L("removeButton"),s=_chunk7BG22YBFjs.E.call(void 0, "remove"),f=_nullishCoalesce(a.image_url, () => (_optionalChain([a, 'access', _11 => _11.images, 'optionalAccess', _12 => _12[0]]))),[v,m]=_react.useState.call(void 0, ),g=f!=null&&f.length>0&&f!==v,p=_nullishCoalesce(a.baseName, () => (a.name));return _jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"product","data-bitsnap-checkout-unavailable":t?"":void 0,className:_chunkN3B25GTYjs.g.call(void 0, "flex items-center gap-3 mx-3",t?"outline outline-1 rounded-md m-1":"",o.className),style:o.style,children:[g&&_jsxruntime.jsx.call(void 0, Zr,{url:r,tabIndex:-1,"aria-hidden":"true",className:"contents",children:_jsxruntime.jsx.call(void 0, "img",{"data-bitsnap-checkout-slot":"productImage",className:_chunkN3B25GTYjs.g.call(void 0, "aspect-auto max-w-[30%] max-w-32 max-h-32 py-2 overflow-hidden",i.className),style:i.style,src:f,alt:"",onError:()=>m(f)})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"productName",className:_chunkN3B25GTYjs.g.call(void 0, "font-medium",c.className),style:c.style,children:_jsxruntime.jsx.call(void 0, Zr,{url:r,className:"text-inherit no-underline hover:underline",children:p})}),a.variantName!=null&&a.variantName.length>0&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm opacity-70",children:a.variantName}),_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"productPrice",className:_chunkN3B25GTYjs.g.call(void 0, "text-sm",l.className),style:l.style,suppressHydrationWarning:!0,children:_jsxruntime.jsx.call(void 0, Xr,{price:a.price,currency:a.currency,pricing:a.pricing,quantity:e})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between",children:[_jsxruntime.jsx.call(void 0, Hi,{className:"",quantity:e,shouldUpdate:n}),_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{"data-bitsnap-checkout-slot":"removeButton",type:"button",variant:"ghost",size:"sm",className:u.className,style:u.style,"aria-label":`${s}: ${a.name}`,onClick:()=>{Promise.resolve(n(0)).catch(()=>{})},children:s})]})]})]})},tn=Wi,Zr=({url:t,children:e,...a})=>t==null?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):_jsxruntime.jsx.call(void 0, "a",{href:t,...a,children:e}),Hi=({quantity:t,shouldUpdate:e,className:a})=>{let[r,n]=_react.useState.call(void 0, t.toString()),o=_react.useRef.call(void 0, t),i=L("quantityControl"),c=L("quantityInput"),l=L("quantityButton"),u=_chunk7BG22YBFjs.E.call(void 0, "quantity"),s=_chunk7BG22YBFjs.E.call(void 0, "increaseQuantity"),f=_chunk7BG22YBFjs.E.call(void 0, "decreaseQuantity"),v=_react.useRef.call(void 0, t);v.current=t,_react.useEffect.call(void 0, ()=>{o.current=t,n(t.toString())},[t]);function m(g){n(g.toString()),g!==o.current&&(o.current=g,Promise.resolve(e(g)).catch(()=>{o.current===g&&(o.current=v.current,n(v.current.toString()))}))}return _jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"quantityControl",className:_chunkN3B25GTYjs.g.call(void 0, "flex",a,i.className),style:i.style,children:_jsxruntime.jsxs.call(void 0, Qr,{"aria-label":u,children:[_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{"data-bitsnap-checkout-slot":"quantityButton",type:"button",className:l.className,style:l.style,"aria-label":f,onClick:()=>m(He(o.current-1)),children:_jsxruntime.jsx.call(void 0, _lucidereact.MinusIcon,{"aria-hidden":"true"})}),_jsxruntime.jsx.call(void 0, "input",{"data-bitsnap-checkout-slot":"quantityInput",className:_chunkN3B25GTYjs.g.call(void 0, "w-8 bg-transparent text-center",c.className),style:c.style,value:r,"aria-label":u,inputMode:"numeric",pattern:"[0-9]*",onChange:g=>n(g.currentTarget.value),onBlur:g=>m(Ta(g.currentTarget.value,o.current)),onKeyDown:g=>{g.key==="Enter"&&m(Ta(g.currentTarget.value,o.current))},type:"text"}),_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{"data-bitsnap-checkout-slot":"quantityButton",type:"button",className:l.className,style:l.style,"aria-label":s,onClick:()=>m(He(o.current+1)),children:_jsxruntime.jsx.call(void 0, _lucidereact.PlusIcon,{"aria-hidden":"true"})})]})})};function Na({className:t,...e}){return _jsxruntime.jsx.call(void 0, "div",{"data-slot":"skeleton",className:"bg-neutral-700 animate-pulse rounded-md "+t,...e})}function an({choice:t,selected:e,onChange:a,disabled:r}){let n=_chunk7BG22YBFjs.F.call(void 0, ),o=L("paymentMethods"),i=L("paymentMethodOption"),c=_react2.default.useId(),l=_react2.default.useId(),u=t.manualAccountTypes.length===0||t.manualAccountTypes.includes("blik"),s={online:{title:n("paymentMethodOnline"),description:n("paymentMethodOnlineDescription")},manual:{title:n(_chunk7BG22YBFjs.v.call(void 0, t.manualAccountTypes)),description:n("paymentMethodManualDescription"),note:u?n("paymentMethodManualBlikNote"):void 0},cod:{title:n("paymentMethodCod"),description:n("paymentMethodCodDescription")}};return _jsxruntime.jsxs.call(void 0, "fieldset",{"data-bitsnap-checkout-slot":"paymentMethods","aria-labelledby":l,className:_chunkN3B25GTYjs.g.call(void 0, "mx-2 mt-4 mb-2 flex min-w-0 flex-col gap-2 border-0 p-0",o.className),style:o.style,disabled:r,children:[_jsxruntime.jsx.call(void 0, "legend",{id:l,className:"mb-1 px-1 text-sm font-medium",children:n("paymentMethodLegend")}),t.methods.map(f=>{let v=s[f],m=f===e,g=`${c}-${f}-description`;return _jsxruntime.jsxs.call(void 0, "label",{"data-bitsnap-checkout-slot":"paymentMethodOption","data-payment-method":f,"data-selected":m?"":void 0,className:_chunkN3B25GTYjs.g.call(void 0, "flex cursor-pointer items-start gap-3 rounded-md border px-3 py-2.5 transition-colors",i.className),style:i.style,children:[_jsxruntime.jsx.call(void 0, "input",{type:"radio",name:c,value:f,checked:m,onChange:()=>a(f),"aria-describedby":g,className:"mt-0.5 size-4 shrink-0 cursor-pointer"}),_jsxruntime.jsxs.call(void 0, "span",{className:"flex min-w-0 flex-col gap-0.5",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-semibold leading-snug",children:v.title}),_jsxruntime.jsxs.call(void 0, "span",{id:g,"data-bitsnap-checkout-payment-method-description":"",className:"text-xs leading-snug",children:[v.description,m&&v.note!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"mt-1 block font-medium",children:v.note})]})]})]},f)})]})}var $i="x-bitsnap-cart-token",rn=new Set;function Ra(t,e,a){rn.has(t)||(rn.add(t),console.warn(e,a))}function Qi(t,e,a){return`${t.replace(/\/+$/,"")}/api/integrations/${encodeURIComponent(e)}/public-commerce/express${a}`}async function Pe(t,e,a,r){let n=_nullishCoalesce(t.fetch, () => (((o,i)=>globalThis.fetch(o,i))));try{let o=await n(Qi(t.host,t.projectID,e),{method:"POST",headers:{..._chunkN3B25GTYjs.a,"Content-Type":"application/json",...r!=null?{[$i]:r}:{}},body:JSON.stringify(a),cache:"no-store",signal:t.signal}),i=await o.text().catch(()=>""),c;try{c=i.length>0?JSON.parse(i):void 0}catch (e5){c=void 0}return{status:o.status,json:c,text:i}}catch(o){return{transportError:o}}}function Pt(t){return typeof t=="object"&&t!=null&&!Array.isArray(t)}function nn(t){return Xi(t)?{ok:!1,code:"network",message:"aborted"}:{ok:!1,code:"network",message:"The server could not be reached."}}function Xi(t){return typeof t=="object"&&t!=null&&t.name==="AbortError"}function de(t){return t===404||t===405||t===501||t===502}function Aa(t,e){return typeof t=="string"&&t.length>0?t:e}async function on(t,e){let a=await Pe(t,"/availability",e);if("transportError"in a){Ra(`availability:${t.host}:${t.projectID}`,"Bitsnap express availability is not reachable; express buttons stay hidden.",a.transportError);return}if(de(a.status)||a.status!==200){Ra(`availability-status:${t.host}:${t.projectID}`,"Bitsnap express availability is not available on this backend; express buttons stay hidden.",a.status);return}let r=a.json;if(!Pt(r)||r.success!==!0||!Pt(r.providers)){Ra(`availability-shape:${t.host}:${t.projectID}`,"Bitsnap express availability returned an unknown shape; express buttons stay hidden.",void 0);return}return r}async function sn(t,e,a){let r=await Pe(t,"/cart",{...e,...a!=null?{cartId:a.cartId,expectedRevision:a.expectedRevision}:{}},_optionalChain([a, 'optionalAccess', _13 => _13.cartToken]));if("transportError"in r)return{ok:!1,code:"internal",message:"The cart could not be saved."};let n=r.json;if(!Pt(n)||typeof n.success!="boolean")return{ok:!1,code:r.status===403?"cart-forbidden":"internal",message:"The cart endpoint returned an unknown answer."};if(n.success===!0){let o=n.snapshot;return o==null||typeof o.revision!="number"?{ok:!1,code:"internal",message:"The cart endpoint returned no snapshot."}:{ok:!0,...typeof n.cartToken=="string"?{cartToken:n.cartToken}:{},snapshot:o}}return{ok:!1,code:Aa(n.code,"internal"),message:typeof n.message=="string"?n.message:"The cart could not be saved.",...typeof n.currentRevision=="number"?{currentRevision:n.currentRevision}:{},...Pt(n.snapshot)?{snapshot:n.snapshot}:{},...Array.isArray(n.conflicts)?{conflicts:n.conflicts}:{}}}function Yi(t){let e=Aa(t.code,"internal");return{code:e,message:Aa(t.message,e)}}async function cn(t,e,a){let r=await Pe(t,"/cart-snapshot",{cartId:e},a);if("transportError"in r)return nn(r.transportError);let n=r.json;return r.status===404?{ok:!1,code:"cart-not-found",message:"cart-not-found",status:404}:r.status===403?{ok:!1,code:"cart-forbidden",message:"cart-forbidden",status:403}:!Pt(n)||n.success!==!0||!Pt(n.snapshot)?{ok:!1,code:de(r.status)?"not-implemented":"invalid-response",message:"The cart snapshot is not available.",status:r.status}:{ok:!0,value:n.snapshot}}async function ln(t,e,a){let n=await Pe(t,e==="inpostPay"?"/inpost/start":e==="revolutPay"?"/revolut/start":"/adyen/start",{cartId:a.cartId,...a.returnUrl!=null?{returnUrl:a.returnUrl}:{},...a.cancelUrl!=null?{cancelUrl:a.cancelUrl}:{},...a.embedOrigin!=null?{embedOrigin:a.embedOrigin}:{}},a.cartToken);if("transportError"in n)return nn(n.transportError);let o=n.json;if(!Pt(o)||typeof o.success!="boolean")return{ok:!1,code:de(n.status)?"not-implemented":"invalid-response",message:"The provider start is not available.",status:n.status};if(o.success===!0)return typeof o.redirectUrl!="string"||typeof o.providerOrderId!="string"?{ok:!1,code:"invalid-response",message:"The provider start returned no redirect.",status:n.status}:{ok:!0,value:{ok:!0,provider:e,redirectUrl:o.redirectUrl,providerOrderId:o.providerOrderId,...Pt(o.publicConfig)?{publicConfig:o.publicConfig}:{},cartRevision:typeof o.cartRevision=="number"?o.cartRevision:0}};let i=o;return{ok:!1,code:de(n.status)?"not-implemented":i.code,message:typeof i.message=="string"?i.message:"The provider start failed.",status:n.status}}function dn(t,e,a){return un(t,"/revolut/status",e,a)}function pn(t,e,a){return un(t,"/inpost/status",e,a)}async function un(t,e,a,r){let n=await Pe(t,e,{cartId:a},r);if("transportError"in n)return{ok:!1,code:"network",message:"The status is not available."};let o=n.json;return n.status===401||n.status===403?{ok:!1,code:"cart-forbidden",message:"cart-forbidden"}:n.status===404?{ok:!1,code:"cart-not-found",message:"cart-not-found"}:!Pt(o)||typeof o.success!="boolean"?{ok:!1,code:de(n.status)?"not-implemented":"provider-error",message:"The status is not available."}:o.success===!0?o.status==="pending"||o.status==="completed"||o.status==="failed"||o.status==="cancelled"?{ok:!0,status:o.status,...typeof o.orderId=="string"?{orderId:o.orderId}:{}}:{ok:!1,code:"provider-error",message:"Unknown status."}:{ok:!1,code:de(n.status)?"not-implemented":"provider-error",message:Pt(o)?Yi(o).message:"The status failed."}}var Zi="bitsnap-express-cart";function mn(t,e=Date.now()){let a=_optionalChain([t, 'optionalAccess', _14 => _14.pending]);if(a!=null)return e-a.ts<=864e5?a:void 0}function Da(){try{return typeof localStorage>"u"?void 0:localStorage}catch (e6){return}}function La(t,e){return`${Zi}:${encodeURIComponent(t)}:${encodeURIComponent(e)}`}function bn(t){let e=_nullishCoalesce(t.storage, () => (Da()));if(e==null)return;let a=La(t.host,t.projectID),r;try{let n=e.getItem(a);if(n==null)return;r=JSON.parse(n)}catch (e7){St(t);return}if(!Qe(r)){St(t);return}if(r.projectID!==t.projectID||r.host!==t.host||typeof r.cartId!="string"||r.cartId.length===0||typeof r.cartToken!="string"||r.cartToken.length===0||typeof r.revision!="number"||r.environment!=="test"&&r.environment!=="production"){St(t);return}return{projectID:r.projectID,host:r.host,environment:r.environment,cartId:r.cartId,cartToken:r.cartToken,revision:r.revision,updatedAt:typeof r.updatedAt=="number"?r.updatedAt:0,...Array.isArray(r.syncedLines)?{syncedLines:r.syncedLines.filter(n=>Qe(n)&&typeof n.id=="string"&&typeof n.quantity=="number")}:{},...typeof r.inpostBindingApiKey=="string"?{inpostBindingApiKey:r.inpostBindingApiKey}:{},...Ji(r.pending)?{pending:r.pending}:{}}}function Qt(t,e=Da()){if(e==null)return!1;try{return e.setItem(La(t.host,t.projectID),JSON.stringify(t)),!0}catch (e8){return!1}}function St(t){let e=_nullishCoalesce(t.storage, () => (Da()));if(e!=null)try{e.removeItem(La(t.host,t.projectID))}catch (e9){}}function Qe(t){return typeof t=="object"&&t!=null&&!Array.isArray(t)}function Ji(t){return!Qe(t)||t.provider!=="inpostPay"&&t.provider!=="revolutPay"||typeof t.ts!="number"||!Array.isArray(t.lines)?!1:t.lines.every(e=>Qe(e)&&typeof e.id=="string"&&typeof e.quantity=="number")}var ts=3,Xe= (_class =class{__init() {this.running=Promise.resolve()}constructor(e){;_class.prototype.__init.call(this);this.options=e}getRecord(){return bn(this.options)}getInpostBindingApiKey(){return _optionalChain([this, 'access', _15 => _15.getRecord, 'call', _16 => _16(), 'optionalAccess', _17 => _17.inpostBindingApiKey])}previewUpload(e){return this.options.local.upload(e)}getPendingAttempt(){return _optionalChain([this, 'access', _18 => _18.getRecord, 'call', _19 => _19(), 'optionalAccess', _20 => _20.pending])}ensure(e){return this.serialize(()=>this.ensureNow(e))}async ensureNow(e){let a=this.getRecord();a!=null&&e.environment!=null&&a.environment!==e.environment&&(St(this.options),a=void 0);let r,n=_nullishCoalesce(this.options.maxAttempts, () => (ts));for(let o=0;o<n;o++){let i=this.options.local.upload(e.locale);if(i==null)return{ok:!1,code:"invalid-cart",message:"The cart is empty."};let c=this.options.local.signature(),l=await this.options.write(i,a!=null?{cartId:a.cartId,cartToken:a.cartToken,expectedRevision:a.revision}:void 0);if(l.ok){let u=_nullishCoalesce(l.cartToken, () => (_optionalChain([a, 'optionalAccess', _21 => _21.cartToken])));if(u==null)return{ok:!1,code:"internal",message:"The created cart has no access token."};let s=l.snapshot;if(a={projectID:this.options.projectID,host:this.options.host,environment:s.environment,cartId:s.cartId,cartToken:u,revision:s.revision,updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))(),syncedLines:i.items.map(v=>({id:v.id,quantity:v.quantity})),..._optionalChain([a, 'optionalAccess', _22 => _22.inpostBindingApiKey])!=null?{inpostBindingApiKey:a.inpostBindingApiKey}:{}},Qt(a,this.options.storage),this.options.local.signature()===c)return{ok:!0,value:{record:a,snapshot:s}};continue}switch(r=l,l.code){case"revision-conflict":{let u=_nullishCoalesce(_optionalChain([l, 'access', _23 => _23.snapshot, 'optionalAccess', _24 => _24.revision]), () => (l.currentRevision));if(a==null||u==null)return l;let s=as({base:a.syncedLines,local:this.options.local.lines(),server:gn(_optionalChain([l, 'access', _25 => _25.snapshot, 'optionalAccess', _26 => _26.lines]))});if(!s.ok)return{...l,currentRevision:u,snapshot:l.snapshot,conflicts:s.conflicts};if(!es(s.lines,this.options.local.lines())){if(this.options.local.replaceLines==null)return{...l,currentRevision:u,snapshot:l.snapshot,conflicts:s.conflicts};this.options.local.replaceLines(s.lines)}a={...a,revision:u},_optionalChain([l, 'access', _27 => _27.snapshot, 'optionalAccess', _28 => _28.environment])!=null&&(a.environment=l.snapshot.environment),l.snapshot!=null&&(a.syncedLines=gn(l.snapshot.lines)),Qt(a,this.options.storage);continue}case"cart-locked":{St(this.options),a=void 0;continue}case"cart-not-found":case"cart-forbidden":{St(this.options),a=void 0;continue}case"invalid-request":case"product-not-available":case"currency-unsupported":return l;default:return l}}return _nullishCoalesce(r, () => ({ok:!1,code:"internal",message:"The cart could not be saved."}))}reconcileFromServer(){return this.serialize(async()=>{let e=this.getRecord();if(e==null)return{ok:!1,code:"cart-not-found",message:"There is no cart to read."};let a=jt(this.options.local.lines()),r=await this.options.read(e.cartId,e.cartToken);if(!r.ok)return(r.code==="cart-not-found"||r.code==="cart-forbidden")&&St(this.options),r;let n=r.value,o=jt(this.options.local.lines()),i=jt(_nullishCoalesce(e.syncedLines, () => ([]))),c=e.syncedLines!=null?i:a;this.options.local.adoptSnapshot(n);let l=rs(o,c);l.length>0&&this.options.local.appendLines(l);let u=this.getRecord();if(u!=null&&u.cartId===n.cartId&&Qt({...u,revision:n.revision,environment:n.environment,updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))()},this.options.storage),l.length>0){let s=await this.ensureNow({locale:n.locale,environment:n.environment});if(!s.ok)return{ok:!1,code:s.code,message:s.message,...s.status!=null?{status:s.status}:{},...s.currentRevision!=null?{currentRevision:s.currentRevision}:{},...s.snapshot!=null?{snapshot:s.snapshot}:{},...s.conflicts!=null?{conflicts:s.conflicts}:{}}}return{ok:!0,value:n}})}async start(e,a){let r=await this.ensure({locale:a.locale,...a.environment!=null?{environment:a.environment}:{}});if(!r.ok)return r;let{record:n,snapshot:o}=r.value,i=await a.start({cartId:n.cartId,cartToken:n.cartToken,...a.returnUrl!=null?{returnUrl:a.returnUrl}:{},...a.cancelUrl!=null?{cancelUrl:a.cancelUrl}:{},...a.embedOrigin!=null?{embedOrigin:a.embedOrigin}:{}});if(!i.ok)return(i.code==="cart-locked"||i.code==="cart-not-found"||i.code==="cart-forbidden")&&St(this.options),i;let c=this.getRecord();return c!=null&&c.cartId===n.cartId&&Qt({...c,revision:Math.max(c.revision,i.value.cartRevision),updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))(),..._optionalChain([i, 'access', _29 => _29.value, 'access', _30 => _30.publicConfig, 'optionalAccess', _31 => _31.basketBindingApiKey])!=null?{inpostBindingApiKey:i.value.publicConfig.basketBindingApiKey}:{},pending:{provider:e,...i.value.providerOrderId.length>0?{providerOrderId:i.value.providerOrderId}:{},lines:o.lines.map(l=>({id:l.productId,quantity:l.quantity})),ts:(_nullishCoalesce(this.options.now, () => (Date.now)))()}},this.options.storage),{ok:!0,value:{start:i.value,snapshot:o}}}storeInpostBindingApiKey(e){let a=this.getRecord();a==null||e.length===0||Qt({...a,inpostBindingApiKey:e,updatedAt:(_nullishCoalesce(this.options.now, () => (Date.now)))()},this.options.storage)}completePurchase(e){let a=this.getRecord(),r=_nullishCoalesce(_nullishCoalesce(e, () => (_optionalChain([a, 'optionalAccess', _32 => _32.pending, 'optionalAccess', _33 => _33.lines]))), () => ([]));r.length>0&&this.options.local.removeLines(r),St(this.options)}keepCart(){}clearPending(){let e=this.getRecord();if(e==null||e.pending==null)return;let{pending:a,...r}=e;Qt(r,this.options.storage)}status(e){let a=this.getRecord();return a==null?Promise.resolve({ok:!1,code:"cart-not-found",message:"There is no cart to check."}):e(a.cartId,a.cartToken)}serialize(e){let a=this.running.then(e,e);return this.running=a.then(()=>{},()=>{}),a}}, _class);function jt(t){let e=new Map;for(let a of t)e.set(a.id,(_nullishCoalesce(e.get(a.id), () => (0)))+a.quantity);return e}function gn(t){return(_nullishCoalesce(t, () => ([]))).map(e=>({id:e.productId,quantity:e.quantity}))}function es(t,e){let a=jt(t),r=jt(e);if(a.size!==r.size)return!1;for(let[n,o]of a)if(r.get(n)!==o)return!1;return!0}function as(t){if(t.base==null||t.server==null)return{ok:!1,lines:t.local,conflicts:[]};let e=jt(t.base),a=jt(t.local),r=jt(t.server),n=new Set([...e.keys(),...a.keys(),...r.keys()]),o=[],i=[];for(let c of n){let l=_nullishCoalesce(e.get(c), () => (0)),u=_nullishCoalesce(a.get(c), () => (0)),s=_nullishCoalesce(r.get(c), () => (0)),f=u!==l,v=s!==l,m;f?(v&&(u===s||i.push({id:c,base:l,local:u,server:s})),m=u):m=s,m>0&&!i.some(g=>g.id===c)&&o.push({id:c,quantity:m})}return{ok:i.length===0,lines:o,conflicts:i}}function rs(t,e){let a=[];for(let[r,n]of t){let o=n-(_nullishCoalesce(e.get(r), () => (0)));o>0&&a.push({id:r,quantity:o})}return a}var _a=new Map,ns=5*60*1e3;function fn(t,e,a){let r=_chunk7BG22YBFjs.L.call(void 0, );return[t,e,a.items.map(n=>`${n.id}:${n.quantity}`).sort().join(","),(_nullishCoalesce(a.countries, () => ([]))).slice().sort().join(","),_nullishCoalesce(a.couponCode, () => ("")),_nullishCoalesce(a.deliveryMethod, () => ("")),_nullishCoalesce(r.postalCode, () => (""))].join("|")}function pe(t,e,a){let r=fn(t,e,a),n=_a.get(r);if(n!=null){if(Date.now()-n.at>ns){_a.delete(r);return}return n.quote}}function os(t,e,a,r){_a.set(fn(t,e,a),{quote:r,at:Date.now()})}function Xt(t,e){return e==null||e.delivery.length===0?t:{...t,delivery:t.delivery!=null&&t.delivery.length>0?t.delivery:e.delivery,...t.deliveryMethod==null&&e.deliveryMethod!=null?{deliveryMethod:e.deliveryMethod}:{}}}async function is(t){if(t.upload.items.length===0)return{delivery:[]};let e=_chunk7BG22YBFjs.L.call(void 0, );try{let a=await _chunk7BG22YBFjs.a.get(t.host).getPreOrderDetails({projectId:t.projectID,items:t.upload.items.map(i=>({id:i.id,quantity:i.quantity})),..._optionalChain([t, 'access', _34 => _34.upload, 'access', _35 => _35.countries, 'optionalAccess', _36 => _36[0]])!=null?{countryCode:t.upload.countries[0]}:{},...t.upload.couponCode!=null?{couponCode:t.upload.couponCode}:{},...t.upload.deliveryMethod!=null?{selectedDeliveryMethod:t.upload.deliveryMethod}:e.selectedDeliveryMethod!=null?{selectedDeliveryMethod:e.selectedDeliveryMethod}:{},...e.postalCode!=null?{postCode:e.postalCode}:{}}),r=a.methods.map(i=>({name:i.id,...i.description!=null?{desc:i.description}:{},min:_nullishCoalesce(i.minDays, () => (1)),max:_nullishCoalesce(i.maxDays, () => (14)),price:i.amount/100})),n=_nullishCoalesce(_nullishCoalesce(a.selectedDeliveryMethod, () => (_optionalChain([r, 'access', _37 => _37[0], 'optionalAccess', _38 => _38.name]))), () => (void 0)),o={delivery:r,...n!=null?{deliveryMethod:n}:{}};return os(t.host,t.projectID,t.upload,o),o}catch(a){console.warn("cannot resolve the express delivery quote",a);return}}async function Ye(t){if(t.upload.delivery!=null&&t.upload.delivery.length>0)return{ok:!0,upload:t.upload,quote:{delivery:t.upload.delivery,...t.upload.deliveryMethod!=null?{deliveryMethod:t.upload.deliveryMethod}:{}}};let e=pe(t.host,t.projectID,t.upload);if(e!=null)return{ok:!0,upload:Xt(t.upload,e),quote:e};let a=await is(t);return a==null?{ok:!1,message:"The delivery quote for this cart is not available. Use the regular checkout."}:{ok:!0,upload:Xt(t.upload,a),quote:a}}function Ua(t){return{lines:()=>_chunk7BG22YBFjs.Q.call(void 0, ).map(e=>({id:e.productID,quantity:e.quantity})),signature:_chunk7BG22YBFjs.R,upload:e=>{let a=_chunk7BG22YBFjs.S.call(void 0, e);if(a!=null)return Xt(a,pe(t.host,t.projectID,a))},adoptSnapshot:e=>{_chunk7BG22YBFjs.T.call(void 0, e.lines.map(a=>({productId:a.productId,quantity:a.quantity})))},appendLines:_chunk7BG22YBFjs.V,removeLines:_chunk7BG22YBFjs.U,replaceLines:e=>{_chunk7BG22YBFjs.T.call(void 0, e.map(a=>({productId:a.id,quantity:a.quantity})))}}}function Yt(t){let e=_nullishCoalesce(t.host, () => (_chunkN3B25GTYjs.e)),a={projectID:t.projectID,host:e,...t.fetch!=null?{fetch:t.fetch}:{},...t.signal!=null?{signal:t.signal}:{}};return new Xe({projectID:t.projectID,host:e,local:_nullishCoalesce(t.local, () => (Ua({host:e,projectID:t.projectID}))),...t.storage!=null?{storage:t.storage}:{},...t.now!=null?{now:t.now}:{},write:(r,n)=>sn(a,r,n),read:(r,n)=>cn(a,r,n)})}async function Ze(t,e,a=Yt(t)){let r=_nullishCoalesce(t.host, () => (_chunkN3B25GTYjs.e)),n=a.previewUpload(t.locale);if(n!=null){let o=await Ye({host:r,projectID:t.projectID,upload:n});if(!o.ok)return{ok:!1,code:"invalid-cart",message:o.message}}return a.start(e,{locale:t.locale,...t.environment!=null?{environment:t.environment}:{},...t.returnUrl!=null?{returnUrl:t.returnUrl}:{},...t.cancelUrl!=null?{cancelUrl:t.cancelUrl}:{},...t.embedOrigin!=null?{embedOrigin:t.embedOrigin}:{},start:o=>ln({projectID:t.projectID,host:r,...t.fetch!=null?{fetch:t.fetch}:{},...t.signal!=null?{signal:t.signal}:{}},e,o)})}function hn(t,e){return yn(t,"revolutPay",e)}function vn(t,e){return yn(t,"inpostPay",e)}function yn(t,e,a){let r=_nullishCoalesce(t.host, () => (_chunkN3B25GTYjs.e));return(_nullishCoalesce(a, () => (Yt(t)))).status((o,i)=>(e==="inpostPay"?pn:dn)({projectID:t.projectID,host:r,...t.fetch!=null?{fetch:t.fetch}:{},...t.signal!=null?{signal:t.signal}:{}},o,i))}function wn(){return typeof window>"u"?void 0:window}var Oa="inpost-izi-button",Ma="inpost-thank-you";function Cn(t){return t!=null&&/^pl\b/i.test(t)?"pl":"en"}var ss="https://sandbox-inpostpay-widget-api.inpost.pl",cs="https://inpostpay-widget-api.inpost.pl",xn={test:"https://sandbox-inpostpay-widget-v2.inpost.pl/inpostpay.widget.v2.js",production:"https://inpostpay-widget-v2.inpost.pl/inpostpay.widget.v2.js"},kn={test:ss,production:cs};function ls(t,e){return t==="test"||t==="production"?t:t==="prod"||t==="live"?"production":_nullishCoalesce(e, () => ("production"))}function Je(t){return t.includes("sandbox")}function Pn(t,e){if(t==null)return;let a=t.merchantClientId;if(a==null||a.length===0)return;let r=_nullishCoalesce(e, () => (ls(t.environment,void 0))),n=_nullishCoalesce(t.widgetApiBaseUrl, () => (t.apiBaseUrl)),o=t.widgetScriptUrl,i=r==="test"?n!=null&&Je(n)?n:kn.test:n!=null&&!Je(n)?n:kn.production,c=r==="test"?o!=null&&Je(o)?o:xn.test:o!=null&&!Je(o)?o:xn.production;return{merchantClientId:a,environment:r,apiBaseUrl:i,scriptUrl:c,...t.basketBindingApiKey!=null&&t.basketBindingApiKey.length>0?{basketBindingApiKey:t.basketBindingApiKey}:{},...t.basketId!=null&&t.basketId.length>0?{basketId:t.basketId}:{}}}var za;function Sn(){if(typeof window>"u")return Promise.reject(new Error("InPost Pay needs a browser."));let t=_optionalChain([wn, 'call', _39 => _39(), 'optionalAccess', _40 => _40.InPostPayWidget]);return t!=null?Promise.resolve(t):(za??=Promise.resolve().then(() => _interopRequireWildcard(require("@inpost-pay/widget"))).then(e=>{let a=e,r=typeof a.initialiseInpostPayWidget=="function"?a.initialiseInpostPayWidget:typeof a.default=="function"?a.default:typeof _optionalChain([a, 'access', _41 => _41.default, 'optionalAccess', _42 => _42.initialiseInpostPayWidget])=="function"?a.default.initialiseInpostPayWidget:void 0,n=_optionalChain([wn, 'call', _43 => _43(), 'optionalAccess', _44 => _44.InPostPayWidget]);if(n!=null)return n;if(r!=null)return{init:r};throw new Error("The InPost Pay widget exposed no init function.")}).catch(e=>{throw za=void 0,e}),za)}function In(t){if(typeof window>"u")return;let e=window,a=e.__bitsnapInpostOwner,r=e.__INPOST_PAY_WIDGET__;if(r!=null){if(a!=null&&a.projectID===t.owner.projectID&&a.host===t.owner.host&&a.merchantClientId===t.owner.merchantClientId)return r.refresh(t.options),r;if(ds()){_optionalChain([t, 'access', _45 => _45.warn, 'optionalCall', _46 => _46("InPost Pay already runs for another project on this page; mount one InPost Pay button per page.")]);return}delete e.__INPOST_PAY_WIDGET__,delete e.__bitsnapInpostOwner}let n=t.namespace.init(t.options);return e.__INPOST_PAY_WIDGET__=n,e.__bitsnapInpostOwner=t.owner,n}function ds(){return typeof document>"u"?!1:document.querySelector(`${Oa}, ${Ma}`)!=null}function En(t){return{binding_place:t.bindingPlace,...t.productId!=null?{"data-product-id":t.productId}:{},...t.variation!=null?{variation:t.variation}:{}}}function ue(t){let e=Math.max(1,Math.trunc(_nullishCoalesce(t.quantity, () => (1)))),a={...t.country!=null?{country:t.country}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{},productQuantity:e};if(t.items!=null&&t.items.length>0)return{...a,items:t.items.map(n=>({id:n.id,quantity:Math.max(1,Math.trunc(n.quantity))})),source:"items"};let r=_chunk7BG22YBFjs.Q.call(void 0, ).map(n=>({id:n.productID,quantity:n.quantity}));if(t.productId!=null&&t.productId.length>0){let n=r.some(o=>o.id===t.productId);return{...a,items:n?r:[...r,{id:t.productId,quantity:e}],source:"product",productId:t.productId}}return{...a,items:r,source:"cart"}}function ta(t){let e=t.items.map(a=>`${a.id}:${a.quantity}`).sort().join(",");return[t.source,e,_nullishCoalesce(t.country, () => ("")),_nullishCoalesce(t.couponCode, () => ("")),_nullishCoalesce(t.productId, () => (""))].join("|")}function ea(t,e,a){if(t.source==="cart")return Ua(a);let r={items:t.items.map(n=>({id:n.id,quantity:n.quantity})),...t.country!=null?{countries:[t.country]}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{},locale:e};return{lines:()=>t.items,signature:()=>ta(t),upload:()=>Xt(r,pe(a.host,a.projectID,r)),adoptSnapshot:()=>{},appendLines:()=>{},removeLines:()=>{}}}function Se(){return _react.useSyncExternalStore.call(void 0, _chunk7BG22YBFjs.W,_chunk7BG22YBFjs.X,()=>0)}function aa(t){let e=_react.useRef.call(void 0, t);e.current=t;let a=ue(t),r=ta(a),n=Se(),[o,i]=_react.useState.call(void 0, {loading:!1,provider:void 0,environment:void 0,failed:!1});return _react.useEffect.call(void 0, ()=>{let c=e.current;if(c.enabled===!1||c.projectID==null||c.projectID.length===0||typeof window>"u"){i({loading:!1,provider:void 0,environment:void 0,failed:!1});return}let l=ue(c);if(l.items.length===0){i({loading:!1,provider:void 0,environment:void 0,failed:!1});return}let u=new AbortController,s=!0;return i(f=>({...f,loading:!0})),fs({projectID:c.projectID,...c.host!=null?{host:c.host}:{},locale:c.locale,cart:l,...c.fetch!=null?{fetch:c.fetch}:{},signal:u.signal}).then(f=>{if(!s)return;let v=_optionalChain([f, 'optionalAccess', _47 => _47.providers, 'optionalAccess', _48 => _48[c.provider]]);i({loading:!1,provider:v,environment:_nullishCoalesce(_optionalChain([f, 'optionalAccess', _49 => _49.environment]), () => (_optionalChain([v, 'optionalAccess', _50 => _50.environment]))),failed:f==null})}).catch(()=>{s&&i({loading:!1,provider:void 0,environment:void 0,failed:!0})}),()=>{s=!1,u.abort()}},[r,n,t.projectID,t.host,t.provider,t.locale,t.enabled]),o}function ra(t){return _nullishCoalesce(t, () => (_chunkN3B25GTYjs.e))}function gs(t,e,a){let r=t.source==="cart"?_chunk7BG22YBFjs.S.call(void 0, e):t.items.length===0?void 0:{items:t.items.map(n=>({id:n.id,quantity:n.quantity})),...t.country!=null?{countries:[t.country]}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{},locale:e};if(r!=null)return _optionalChain([a, 'optionalAccess', _51 => _51.host])==null||a.projectID==null?r:Xt(r,pe(a.host,a.projectID,r))}async function fs(t){let e=_nullishCoalesce(t.host, () => (_chunkN3B25GTYjs.e)),a=gs(t.cart,t.locale);if(a==null)return;let r=await Ye({host:e,projectID:t.projectID,upload:a});if(!r.ok)return;let n=await on({projectID:t.projectID,host:e,...t.fetch!=null?{fetch:t.fetch}:{},...t.signal!=null?{signal:t.signal}:{}},r.upload);if(n==null)return;if(r.quote.delivery.length===0)return n;let o=n.providers.revolutPay;return o==null||o.available!==!0?n:{...n,providers:{...n.providers,revolutPay:{...o,available:!1,reasons:[...o.reasons,"delivery-unsupported"]}}}}function Tn(t){if(t==null)return;let e=_nullishCoalesce(t.publicKey, () => (t.publicToken)),a=t.mode;if(!(e==null||e.length===0)&&!(a!=="sandbox"&&a!=="prod"))return{publicKey:e,mode:a,...t.orderToken!=null&&t.orderToken.length>0?{orderToken:t.orderToken}:{}}}function Nn(t){let e=_optionalChain([t, 'access', _52 => _52.publicConfig, 'optionalAccess', _53 => _53.orderToken]);return e!=null&&e.length>0?e:t.providerOrderId}function Rn(t){return t!=null&&/^pl\b/i.test(t)?"pl":"en"}var hs=6e4,vs=2e3;function ys(t){return new Promise(e=>setTimeout(e,t))}async function Ba(t){let e=_nullishCoalesce(t.timeoutMs, () => (hs)),a=_nullishCoalesce(t.intervalMs, () => (vs)),r=_nullishCoalesce(t.sleep, () => (ys)),n=(_nullishCoalesce(t.now, () => (Date.now)))(),o=Math.min(1e4,Math.max(1,Math.ceil(e/Math.max(1,a))+1)),i=0,c;for(;;){if(i+=1,_optionalChain([t, 'access', _54 => _54.signal, 'optionalAccess', _55 => _55.aborted])===!0)return c;try{c=await t.check()}catch (e10){c=void 0}if(_optionalChain([c, 'optionalAccess', _56 => _56.ok])===!0&&c.status!=="pending"||_optionalChain([c, 'optionalAccess', _57 => _57.ok])===!1&&c.code==="not-implemented"||i>=o||(_nullishCoalesce(t.now, () => (Date.now)))()-n>=e)return c;await r(a)}}var An=Ba;var ws={pending:"expressPending",confirmed:"expressConfirmed",failed:"expressFailed",cancelled:"expressCancelled","load-failed":"expressLoadFailed","cart-unavailable":"expressCartUnavailable","cart-conflict":"expressCartConflict","price-changed":"expressPriceChanged","product-unavailable":"expressProductUnavailable"},xs=["failed","cancelled","load-failed","cart-unavailable","cart-conflict","price-changed","product-unavailable"];function Ie({phase:t}){let e=_chunk7BG22YBFjs.F.call(void 0, ),a=L("error");if(t==="idle")return null;let r=xs.includes(t);return _jsxruntime.jsx.call(void 0, "p",{role:r?"alert":"status","aria-live":r?"assertive":"polite","data-bitsnap-express-status":t,className:_chunkN3B25GTYjs.g.call(void 0, "w-full px-2 text-center text-sm",r&&"opacity-90",a.className),style:a.style,children:e(ws[t])})}function _n(t){return typeof t=="object"&&t!=null&&t.undeliverable===!0}function ja(t){let{projectID:e}=t,a=ra(t.host),r=_nullishCoalesce(t.locale, () => (_chunkQ337IQNAjs.f.call(void 0, ))),n=_chunkG4SEOVLDjs.m.call(void 0, ),o=_optionalChain([t, 'access', _58 => _58.confirmation, 'optionalAccess', _59 => _59.timeoutMs]),i=_optionalChain([t, 'access', _60 => _60.confirmation, 'optionalAccess', _61 => _61.intervalMs]),c=_optionalChain([t, 'access', _62 => _62.confirmation, 'optionalAccess', _63 => _63.sleep]),l=_optionalChain([t, 'access', _64 => _64.confirmation, 'optionalAccess', _65 => _65.now]),u=Se(),s=_react.useMemo.call(void 0, ()=>ue({...t.items!=null?{items:t.items}:{},...t.productId!=null?{productId:t.productId}:{},...t.quantity!=null?{quantity:t.quantity}:{}}),[t.items,t.productId,t.quantity,u]),f=ta(s),v=aa({provider:"inpostPay",projectID:e,host:a,locale:r,...t.items!=null?{items:t.items}:{},...t.productId!=null?{productId:t.productId}:{},...t.quantity!=null?{quantity:t.quantity}:{},...t.fetch!=null?{fetch:t.fetch}:{}}),m=v.provider,g=_nullishCoalesce(_optionalChain([m, 'optionalAccess', _66 => _66.environment]), () => (v.environment)),p=_optionalChain([m, 'optionalAccess', _67 => _67.available])===!0?Pn(m.publicConfig,g):void 0,S=_optionalChain([p, 'optionalAccess', _68 => _68.merchantClientId]),R=_optionalChain([p, 'optionalAccess', _69 => _69.apiBaseUrl]),h=_react.useMemo.call(void 0, ()=>Yt({projectID:e,host:a,...s.source==="items"?{local:ea(s,r,{host:a,projectID:e})}:{},...t.fetch!=null?{fetch:t.fetch}:{}}),[e,a,t.fetch,s,r]),[y,A]=_react.useState.call(void 0, "idle"),k=_react.useRef.call(void 0, void 0),E=_react.useRef.call(void 0, void 0),D=_react.useRef.call(void 0, !0),I=_react.useRef.call(void 0, !1),T=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>(D.current=!0,()=>{D.current=!1}),[]);let P=_react.useRef.call(void 0, {cart:s,locale:r,environment:g,session:h,onOrderCreated:t.onOrderCreated,onBasketChanged:t.onBasketChanged});P.current={cart:s,locale:r,environment:g,session:h,onOrderCreated:t.onOrderCreated,onBasketChanged:t.onBasketChanged};let w=_react.useCallback.call(void 0, async()=>{if(E.current!=null)return E.current;let O=Ze({projectID:e,host:a,locale:P.current.locale,...P.current.environment!=null?{environment:P.current.environment}:{},...typeof window<"u"?{returnUrl:window.location.href,cancelUrl:window.location.href,embedOrigin:window.location.origin}:{},...t.fetch!=null?{fetch:t.fetch}:{}},"inpostPay",P.current.session).then(z=>{if(!z.ok)throw A(z.code==="revision-conflict"?"cart-conflict":"cart-unavailable"),new Error(`inpost-start-${z.code}`);return n.track("payment_submitted",{gateway:"inpost_pay",method:"inpost_pay"}),z.value.start}).finally(()=>{E.current=void 0});return E.current=O,O},[e,a,n,t.fetch]),U=_react.useCallback.call(void 0, async O=>{if(_chunk7BG22YBFjs.Q.call(void 0, ).some(_=>_.productID===O)||P.current.cart.source==="items")return;if(await _chunk7BG22YBFjs.x.addProductToCart(O,P.current.cart.productQuantity)!=null)throw{undeliverable:!0}},[]),b=_react.useCallback.call(void 0, async O=>{n.track("payment_method_selected",{gateway:"inpost_pay",method:"inpost_pay"});try{O!=null&&await U(O);let N=await _asyncOptionalChain([(await w()), 'access', async _70 => _70.publicConfig, 'optionalAccess', async _71 => _71.basketBindingApiKey]);if(N==null||N.length===0)throw new Error("inpost-start-without-basket-key");return P.current.session.storeInpostBindingApiKey(N),A("idle"),N}catch(z){throw _n(z)?(A("product-unavailable"),new Error("UNDELIVERABLE_PRODUCT")):(A(z instanceof Error&&z.message==="inpost-start-revision-conflict"?"cart-conflict":"cart-unavailable"),z instanceof Error?z:new Error("inpost-pay-failed"))}},[U,n,w]),C=_react.useCallback.call(void 0, async O=>{let z=_nullishCoalesce(O, () => (P.current.cart.productId));if(z!=null)try{if(await _chunk7BG22YBFjs.x.addProductToCart(z,P.current.cart.productQuantity)!=null)throw{undeliverable:!0};await P.current.session.ensure({locale:P.current.locale,...P.current.environment!=null?{environment:P.current.environment}:{}})}catch(N){throw A("product-unavailable"),_n(N)?new Error("UNDELIVERABLE_PRODUCT"):N instanceof Error?N:new Error("inpost-pay-failed")}},[]),X=_react.useCallback.call(void 0, async()=>{if(!I.current){I.current=!0;try{let O=P.current.session,z=O.getPendingAttempt();if(_optionalChain([z, 'optionalAccess', _72 => _72.provider])!=="inpostPay")return;D.current&&A("pending");let N=await Ba({check:()=>vn({projectID:e,host:a,...t.fetch!=null?{fetch:t.fetch}:{}},O),timeoutMs:_nullishCoalesce(o, () => (2e4)),intervalMs:_nullishCoalesce(i, () => (1500)),...c!=null?{sleep:c}:{},...l!=null?{now:l}:{}});if(!D.current)return;let _=z.providerOrderId;if(_optionalChain([N, 'optionalAccess', _73 => _73.ok])===!0&&N.status==="completed"){let W=await O.reconcileFromServer(),F=W.ok?W.value.lines.map(V=>({id:V.productId,quantity:V.quantity})):z.lines;F.length>0&&O.completePurchase(F),A("confirmed"),n.track("payment_returned",{gateway:"inpost_pay",method:"inpost_pay",outcome:"pending"}),T.current||(T.current=!0,_optionalChain([P, 'access', _74 => _74.current, 'access', _75 => _75.onOrderCreated, 'optionalCall', _76 => _76({..._!=null?{providerOrderId:_}:{},status:"completed"})]));return}if(_optionalChain([N, 'optionalAccess', _77 => _77.ok])===!0&&N.status==="failed"){O.clearPending(),A("failed"),T.current||(T.current=!0,_optionalChain([P, 'access', _78 => _78.current, 'access', _79 => _79.onOrderCreated, 'optionalCall', _80 => _80({..._!=null?{providerOrderId:_}:{},status:"failed"})]));return}if(_optionalChain([N, 'optionalAccess', _81 => _81.ok])===!0&&N.status==="cancelled"){O.clearPending(),A("cancelled"),T.current||(T.current=!0,_optionalChain([P, 'access', _82 => _82.current, 'access', _83 => _83.onOrderCreated, 'optionalCall', _84 => _84({..._!=null?{providerOrderId:_}:{},status:"cancelled"})]));return}A("pending"),T.current||(T.current=!0,_optionalChain([P, 'access', _85 => _85.current, 'access', _86 => _86.onOrderCreated, 'optionalCall', _87 => _87({..._!=null?{providerOrderId:_}:{},status:"pending"})]))}finally{I.current=!1}}},[i,l,c,o,a,n,e,t.fetch]),yt=_react.useCallback.call(void 0, async O=>{if(O==="basketProductChanged"){let z=await P.current.session.reconcileFromServer();return z.ok&&_optionalChain([P, 'access', _88 => _88.current, 'access', _89 => _89.onBasketChanged, 'optionalCall', _90 => _90(z.value)]),!0}return O==="orderCreated"&&X(),!0},[X]);if(_react.useEffect.call(void 0, ()=>{_optionalChain([m, 'optionalAccess', _91 => _91.available])===!0&&_optionalChain([h, 'access', _92 => _92.getPendingAttempt, 'call', _93 => _93(), 'optionalAccess', _94 => _94.provider])==="inpostPay"&&X()},[_optionalChain([m, 'optionalAccess', _95 => _95.available]),h,X]),_react.useEffect.call(void 0, ()=>{if(_optionalChain([m, 'optionalAccess', _96 => _96.available])!==!0||S==null||S.length===0||typeof window>"u")return;let O=!1;return Sn().then(z=>{if(O)return;let N=In({namespace:z,owner:{projectID:e,host:a,merchantClientId:S},options:{merchantClientId:S,basketBindingApiKey:h.getInpostBindingApiKey(),unboundWidgetClicked:b,...s.source==="product"||t.productId!=null?{addToBasketClicked:C}:{},handleBasketEvent:yt,...R!=null?{apiBaseUrl:R}:{},language:Cn(r)}});if(N==null){A("cart-unavailable");return}k.current=N,N.rerender()}).catch(()=>{O||A("load-failed")}),()=>{O=!0,k.current=void 0}},[_optionalChain([m, 'optionalAccess', _97 => _97.available]),S,R,r,e,a,h,b,C,yt,s.source,t.productId]),_react.useEffect.call(void 0, ()=>{_optionalChain([k, 'access', _98 => _98.current, 'optionalAccess', _99 => _99.refresh, 'call', _100 => _100({basketBindingApiKey:h.getInpostBindingApiKey()})])},[f,h]),_optionalChain([m, 'optionalAccess', _101 => _101.available])!==!0||S==null||S.length===0)return _jsxruntime.jsx.call(void 0, Ie,{phase:y==="idle"?"idle":y});let Ot=_nullishCoalesce(t.bindingPlace, () => ((t.productId!=null?"PRODUCT_CARD":"BASKET_SUMMARY")));return _jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-express":"inpostPay","aria-busy":y==="pending"?!0:void 0,className:t.className,style:t.style,children:[Ot==="THANK_YOU_PAGE"?_react.createElement.call(void 0, Ma,{...t.variation!=null?{variation:t.variation}:{}}):_react.createElement.call(void 0, Oa,En({bindingPlace:Ot,...t.productId!=null?{productId:t.productId}:{},...t.variation!=null?{variation:t.variation}:{}})),_jsxruntime.jsx.call(void 0, Ie,{phase:y})]})}function Ps(t){let e=_nullishCoalesce(t.projectID, () => (Ct())),a=_chunkG4SEOVLDjs.n.call(void 0, e,t.analytics,"cart");return _react.useEffect.call(void 0, ()=>{t.projectID!=null&&_chunk7BG22YBFjs.J.call(void 0, t.projectID)},[t.projectID]),_jsxruntime.jsx.call(void 0, _chunkG4SEOVLDjs.l,{value:a,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.D,{locale:t.locale,texts:t.texts,children:_jsxruntime.jsx.call(void 0, le,{appearance:t.appearance,children:e==null?null:_jsxruntime.jsx.call(void 0, ja,{...t,projectID:e})})})})}var Ss=Ps;var Es={prod:"https://merchant.revolut.com/embed.js",sandbox:"https://sandbox-merchant.revolut.com/embed.js"},Un={prod:"revolut-checkout",sandbox:"revolut-checkout-sandbox"},qa=new Map;function zn(t,e={}){if(typeof window>"u")return Promise.reject(new Error("Revolut Checkout needs a browser."));let a=window.RevolutCheckout;if(a!=null)return Promise.resolve(a);let r=qa.get(t);if(r!=null)return r;let n=_nullishCoalesce(e.document, () => (document)),o=_nullishCoalesce(e.timeoutMs, () => (15e3)),i=new Promise((c,l)=>{let u=!1,s=n.getElementById(Un[t]),f,v=()=>{f!=null&&clearTimeout(f),_optionalChain([s, 'optionalAccess', _102 => _102.removeEventListener, 'call', _103 => _103("load",g)]),_optionalChain([s, 'optionalAccess', _104 => _104.removeEventListener, 'call', _105 => _105("error",p)])},m=S=>{u||(u=!0,v(),S())},g=()=>{m(()=>{let S=window.RevolutCheckout;S!=null?c(S):l(new Error("Revolut Checkout did not initialise."))})},p=()=>{m(()=>l(new Error("Revolut Checkout could not be loaded.")))};s==null?(s=n.createElement("script"),s.id=Un[t],s.src=Es[t],s.async=!0,s.addEventListener("load",g),s.addEventListener("error",p),n.head.appendChild(s)):(s.addEventListener("load",g),s.addEventListener("error",p)),f=setTimeout(()=>{m(()=>l(new Error("Revolut Checkout timed out while loading.")))},o)});return qa.set(t,i),i.catch(()=>qa.delete(t)),i}function On(t,e){return t.payments({publicToken:e.publicKey,mode:e.mode,locale:e.locale})}var Ga="bitsnap_express",Fa="bitsnap_express_cart",Wa="bitsnap_express_result",Mn="_rp_oid";function Bn(t){let e;try{e=new URLSearchParams(t.startsWith("?")?t:`?${t}`)}catch (e11){return{returned:!1}}let a=e.get(Ga),r=_nullishCoalesce(e.get(Mn), () => (void 0)),n=_nullishCoalesce(e.get(Fa), () => (void 0)),o=e.get(Wa),i=o==="success"||o==="failure"||o==="cancel"?o:void 0,c=a==="inpostPay"||a==="revolutPay";return{returned:c||r!=null,...c?{provider:a}:{},...n!=null?{cartId:n}:{},...r!=null?{orderToken:r}:{},...i!=null?{result:i}:{}}}function na(t,e){let a=typeof window<"u"?window.location.href:"https://localhost/",r=new URL(t,a);return r.searchParams.set(Ga,e.provider),r.searchParams.set(Fa,e.cartId),r.searchParams.set(Wa,e.result),r.toString()}function jn(t){let e=typeof window<"u"?window.location.href:"https://localhost/",a=new URL(t,e);return a.searchParams.delete(Ga),a.searchParams.delete(Fa),a.searchParams.delete(Wa),a.searchParams.delete(Mn),a.pathname+a.search+a.hash}function Ka(t){let{projectID:e}=t,a=ra(t.host),r=_nullishCoalesce(t.locale, () => (_chunkQ337IQNAjs.f.call(void 0, ))),n=_chunkG4SEOVLDjs.m.call(void 0, ),o=_optionalChain([t, 'access', _106 => _106.confirmation, 'optionalAccess', _107 => _107.timeoutMs]),i=_optionalChain([t, 'access', _108 => _108.confirmation, 'optionalAccess', _109 => _109.intervalMs]),c=_optionalChain([t, 'access', _110 => _110.confirmation, 'optionalAccess', _111 => _111.sleep]),l=_optionalChain([t, 'access', _112 => _112.confirmation, 'optionalAccess', _113 => _113.now]),u=JSON.stringify(_nullishCoalesce(t.buttonStyle, () => (null))),s=Se(),f=_react.useMemo.call(void 0, ()=>ue({...t.items!=null?{items:t.items}:{},...t.productId!=null?{productId:t.productId}:{},...t.quantity!=null?{quantity:t.quantity}:{},...t.country!=null?{country:t.country}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{}}),[t.items,t.productId,t.quantity,t.country,t.couponCode,s]),v=[f.source,f.items.map(I=>`${I.id}:${I.quantity}`).sort().join(",")].join("|"),m=aa({provider:"revolutPay",projectID:e,host:a,locale:r,...t.items!=null?{items:t.items}:{},...t.productId!=null?{productId:t.productId}:{},...t.quantity!=null?{quantity:t.quantity}:{},...t.country!=null?{country:t.country}:{},...t.couponCode!=null?{couponCode:t.couponCode}:{},...t.fetch!=null?{fetch:t.fetch}:{}}),g=_optionalChain([m, 'access', _114 => _114.provider, 'optionalAccess', _115 => _115.available])===!0?Tn(m.provider.publicConfig):void 0,p=_nullishCoalesce(_optionalChain([m, 'access', _116 => _116.provider, 'optionalAccess', _117 => _117.environment]), () => (m.environment)),S=_react.useRef.call(void 0, null),[R,h]=_react.useState.call(void 0, "idle"),[y,A]=_react.useState.call(void 0, 0),k=_react.useRef.call(void 0, !0),E=_react.useRef.call(void 0, void 0),D=_react.useRef.call(void 0, void 0);return _react.useEffect.call(void 0, ()=>(k.current=!0,()=>{k.current=!1}),[]),_react.useEffect.call(void 0, ()=>{if(g==null||typeof window>"u"||S.current==null)return;let I=new AbortController,T=!1,P,w=ea(f,r,{host:a,projectID:e}),U=Yt({projectID:e,host:a,local:w,...t.fetch!=null?{fetch:t.fetch}:{},signal:I.signal}),b=_nullishCoalesce(t.returnUrl, () => (window.location.href)),C=!1,X=!1,yt=async N=>{if(!k.current||X)return;h("pending");let _=await An({check:()=>hn({projectID:e,host:a,...t.fetch!=null?{fetch:t.fetch}:{},signal:I.signal},N),signal:I.signal,...o!=null?{timeoutMs:o}:{},...i!=null?{intervalMs:i}:{},...c!=null?{sleep:c}:{},...l!=null?{now:l}:{}});if(!(T||!k.current)){if(_optionalChain([_, 'optionalAccess', _118 => _118.ok])===!0&&_.status==="completed"){X=!0,N.completePurchase(),h("confirmed"),_optionalChain([t, 'access', _119 => _119.onPaymentResult, 'optionalCall', _120 => _120({status:"completed",..._.orderId!=null?{orderId:_.orderId}:{}})]);return}if(_optionalChain([_, 'optionalAccess', _121 => _121.ok])===!0&&_.status==="failed"){X=!0,N.clearPending(),h("failed"),_optionalChain([t, 'access', _122 => _122.onPaymentResult, 'optionalCall', _123 => _123({status:"failed"})]);return}if(_optionalChain([_, 'optionalAccess', _124 => _124.ok])===!0&&_.status==="cancelled"){X=!0,N.clearPending(),h("cancelled"),_optionalChain([t, 'access', _125 => _125.onPaymentResult, 'optionalCall', _126 => _126({status:"cancelled"})]);return}h("pending"),_optionalChain([t, 'access', _127 => _127.onPaymentResult, 'optionalCall', _128 => _128({status:"pending"})])}},Ot=N=>{C||(C=!0,yt(N).finally(()=>{C=!1}))},O=N=>{if(N.type==="cancel"){n.track("payment_returned",{gateway:"revolut_pay",method:"revolut_pay",outcome:"cancel"}),U.clearPending(),h("cancelled"),_optionalChain([t, 'access', _129 => _129.onPaymentResult, 'optionalCall', _130 => _130({status:"cancelled"})]);return}if(N.type==="error"){n.track("payment_returned",{gateway:"revolut_pay",method:"revolut_pay",outcome:"fail"}),U.clearPending();let _=D.current;D.current=void 0,h(_nullishCoalesce(_, () => ("failed"))),_==null&&_optionalChain([t, 'access', _131 => _131.onPaymentResult, 'optionalCall', _132 => _132({status:"failed"})]);return}n.track("payment_returned",{gateway:"revolut_pay",method:"revolut_pay",outcome:"pending"}),Ot(U)};return(async()=>{let N=await U.ensure({locale:r,...p!=null?{environment:p}:{}});if(T)return;if(!N.ok){h(N.code==="revision-conflict"?"cart-conflict":"cart-unavailable");return}let _=N.value.snapshot;E.current={cartId:_.cartId,currency:_.currency,totalMinor:_.totalMinor};let W=await zn(g.mode);if(T)return;let F=await On(W,{publicKey:g.publicKey,mode:g.mode,locale:Rn(r)});if(T){_optionalChain([F, 'access', _133 => _133.destroy, 'optionalCall', _134 => _134()]);return}let{revolutPay:V}=F,Wt,ua=async()=>(Wt!=null||(Wt=(async()=>{let Y=await U.ensure({locale:r,...p!=null?{environment:p}:{}});if(!Y.ok)throw D.current=Y.code==="revision-conflict"?"cart-conflict":"cart-unavailable",new Error(`revolut-cart-${Y.code}`);if(!Gn(Y.value.snapshot,E.current))throw E.current={cartId:Y.value.snapshot.cartId,currency:Y.value.snapshot.currency,totalMinor:Y.value.snapshot.totalMinor},D.current="price-changed",h("price-changed"),A(ye=>ye+1),new Error("revolut-amount-changed");let rt=await Ze({projectID:e,host:a,locale:r,...p!=null?{environment:p}:{},returnUrl:b,cancelUrl:_nullishCoalesce(t.cancelUrl, () => (b)),embedOrigin:window.location.origin,...t.fetch!=null?{fetch:t.fetch}:{}},"revolutPay",U);if(!rt.ok)throw D.current=rt.code==="revision-conflict"?"cart-conflict":"cart-unavailable",new Error(`revolut-start-${rt.code}`);if(!Gn(rt.value.snapshot,E.current))throw E.current={cartId:rt.value.snapshot.cartId,currency:rt.value.snapshot.currency,totalMinor:rt.value.snapshot.totalMinor},D.current="price-changed",h("price-changed"),A(ye=>ye+1),new Error("revolut-amount-changed");return n.track("payment_submitted",{gateway:"revolut_pay",method:"revolut_pay"}),{publicId:Nn(rt.value.start)}})().finally(()=>{Wt=void 0})),Wt);V.mount(S.current,{currency:_.currency,totalAmount:_.totalMinor,createOrder:ua,mobileRedirectUrls:{success:na(b,{provider:"revolutPay",cartId:_.cartId,result:"success"}),failure:na(b,{provider:"revolutPay",cartId:_.cartId,result:"failure"}),cancel:na(b,{provider:"revolutPay",cartId:_.cartId,result:"cancel"})},...t.buttonStyle!=null?{buttonStyle:t.buttonStyle}:{}}),V.on("click",()=>{n.track("payment_method_selected",{gateway:"revolut_pay",method:"revolut_pay"})}),V.on("payment",O),!T&&k.current&&h(Y=>Y==="price-changed"||Y==="cart-conflict"||Y==="confirmed"||Y==="failed"||Y==="cancelled"?Y:"idle"),P=()=>{try{V.destroy()}catch (e12){}try{_optionalChain([F, 'access', _135 => _135.destroy, 'optionalCall', _136 => _136()])}catch (e13){}};let Tt=Bn(window.location.search),ba=_optionalChain([mn, 'call', _137 => _137(U.getRecord()), 'optionalAccess', _138 => _138.provider])==="revolutPay"&&(Tt.cartId==null||Tt.cartId===_.cartId)||Tt.returned&&Tt.provider==="revolutPay";Tt.returned&&window.history.replaceState({},"",jn(window.location.href)),ba&&await yt(U)})().catch(()=>{!T&&k.current&&h("load-failed")}),()=>{T=!0,I.abort(),_optionalChain([P, 'optionalCall', _139 => _139()])}},[_optionalChain([g, 'optionalAccess', _140 => _140.publicKey]),_optionalChain([g, 'optionalAccess', _141 => _141.mode]),p,r,v,e,a,t.fetch,t.returnUrl,t.cancelUrl,u,o,i,c,l,y]),_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-express":"revolutPay","aria-busy":R==="pending"?!0:void 0,className:t.className,style:t.style,children:[_jsxruntime.jsx.call(void 0, "div",{ref:S}),_jsxruntime.jsx.call(void 0, Ie,{phase:R})]})}function Gn(t,e){return e!=null&&t.cartId===e.cartId&&t.currency===e.currency&&t.totalMinor===e.totalMinor}function Ns(t){let e=_nullishCoalesce(t.projectID, () => (Ct())),a=_chunkG4SEOVLDjs.n.call(void 0, e,t.analytics,"cart");return _react.useEffect.call(void 0, ()=>{t.projectID!=null&&_chunk7BG22YBFjs.J.call(void 0, t.projectID)},[t.projectID]),_jsxruntime.jsx.call(void 0, _chunkG4SEOVLDjs.l,{value:a,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.D,{locale:t.locale,texts:t.texts,children:_jsxruntime.jsx.call(void 0, le,{appearance:t.appearance,children:e==null?null:_jsxruntime.jsx.call(void 0, Ka,{...t,projectID:e})})})})}var Rs=Ns;var _s=({className:t,locale:e})=>{let a=_chunk7BG22YBFjs.O.call(void 0, ),r=_chunkG4SEOVLDjs.m.call(void 0, ),n=_nullishCoalesce(e, () => (_chunkQ337IQNAjs.f.call(void 0, ))),o=L("productList"),i=L("summary"),c=L("totalLabel"),l=L("totalValue"),u=L("deliveryText"),s=L("summaryNote"),f=L("countryLabel"),v=L("paymentButtons"),m=L("checkoutButton"),g=L("emptyState"),p=L("error"),S=L("skeleton"),R=_chunk7BG22YBFjs.E.call(void 0, "unavailableProducts"),h=_chunk7BG22YBFjs.F.call(void 0, ),y=_chunk7BG22YBFjs.E.call(void 0, "emptyCart"),A=_chunk7BG22YBFjs.E.call(void 0, "total"),k=_chunk7BG22YBFjs.E.call(void 0, "delivery"),E=_chunk7BG22YBFjs.E.call(void 0, "chooseCountry"),D=_chunk7BG22YBFjs.E.call(void 0, "nextStep"),I=_chunk7BG22YBFjs.E.call(void 0, "loadFailed"),T=_chunk7BG22YBFjs.E.call(void 0, "retry"),P=_chunk7BG22YBFjs.E.call(void 0, "countryRequired"),w=_chunk7BG22YBFjs.E.call(void 0, "extrasCalculatedNext"),U=_react2.default.useId(),b=_react2.default.useId(),{mutateAsync:C}=_reactquery.useMutation.call(void 0, {mutationFn:a.removeProductFromCart}),{mutateAsync:X}=_reactquery.useMutation.call(void 0, {mutationFn:a.updateQuantity}),{mutateAsync:yt}=_reactquery.useMutation.call(void 0, {mutationFn:a.setCountry}),{mutateAsync:Ot}=_reactquery.useMutation.call(void 0, {mutationFn:a.clearCart}),[O,z]=_react2.default.useState(""),N=_chunk7BG22YBFjs.w.call(void 0, x=>x.notice);_react2.default.useEffect(()=>()=>_chunk7BG22YBFjs.w.getState().setNotice(void 0),[]);let _=O.length>0?O:_nullishCoalesce(N, () => ("")),[W,F]=_react2.default.useState([]),[V,Wt]=_react2.default.useState(!1),{mutateAsync:ua,isPending:Tt}=_reactquery.useMutation.call(void 0, {mutationFn:a.redirectToNextStep}),{data:ma}=_reactquery.useQuery.call(void 0, {queryKey:["cart-available-countries"],queryFn:a.getAvailableCountries}),{data:ba}=_reactquery.useQuery.call(void 0, {queryKey:["cart-one-click-payment"],queryFn:a.checkIfApplePayIsAvailable}),{data:Y,isLoading:rt,isError:ye,refetch:tr}=_reactquery.useQuery.call(void 0, {queryKey:["cart",n],queryFn:a.getProducts}),{data:Ht,refetch:er}=_reactquery.useQuery.call(void 0, {queryKey:["cart-country"],queryFn:a.getCountry}),[wo]=_react3.useAutoAnimate.call(void 0, ),j=_chunk7BG22YBFjs.q.call(void 0, Y)?void 0:Y,Mt=Ht!=null&&!_chunk7BG22YBFjs.q.call(void 0, Ht)&&Ht!=""?Ht:void 0,ar=_reactquery.useQueryClient.call(void 0, ),ze=j==null||j.length===0||Mt==null?void 0:j.map(x=>`${x.productID}:${x.quantity}`).sort().join(","),rr={queryKey:["cart-payment-methods",_chunk7BG22YBFjs.K.call(void 0, ),n,Mt,ze],queryFn:async()=>a.getPaymentMethodChoice().catch(()=>null),staleTime:6e4,retry:!1},{data:nr,isPlaceholderData:xo}=_reactquery.useQuery.call(void 0, {...rr,enabled:ze!=null,placeholderData:x=>x===void 0?void 0:_chunk7BG22YBFjs.t.call(void 0, x)}),Oe=ze!=null?_nullishCoalesce(nr, () => (null)):null,[or,ko]=_react2.default.useState(void 0),[ir,sr]=_react2.default.useState(!1),cr=_react2.default.useRef(null),lr=!rt&&(ye||_chunk7BG22YBFjs.q.call(void 0, Y)),Bt=_chunk7BG22YBFjs.q.call(void 0, ma)?[]:ma,we=_nullishCoalesce(_optionalChain([j, 'optionalAccess', _142 => _142.reduce, 'call', _143 => _143((x,K)=>K.details==null?x:x+(_nullishCoalesce(_optionalChain([K, 'access', _144 => _144.details, 'access', _145 => _145.pricing, 'optionalAccess', _146 => _146.effectivePrice]), () => (K.details.price)))*K.quantity,0)]), () => (0)),xe=_nullishCoalesce(_optionalChain([j, 'optionalAccess', _147 => _147[0], 'optionalAccess', _148 => _148.details, 'optionalAccess', _149 => _149.currency]), () => ("PLN")),Co=_nullishCoalesce(_optionalChain([j, 'optionalAccess', _150 => _150.some, 'call', _151 => _151(x=>_optionalChain([x, 'access', _152 => _152.details, 'optionalAccess', _153 => _153.isDeliverable])===!0)]), () => (!1)),dr=Ht!==void 0&&Mt==null,pr=_react2.default.useRef(!1);_react2.default.useEffect(()=>{pr.current||Bt==null||Bt.length===0||Ht==null||Mt!=null&&Bt.some(x=>x.code===Mt)||(pr.current=!0,yt(Bt[0].code).then(()=>er()).catch(()=>{}))},[Bt,Ht,Mt]);let ur=_react2.default.useRef(!1);_react2.default.useEffect(()=>{ur.current||rt||(ur.current=!0,r.track("cart_opened",{item_count:_nullishCoalesce(_optionalChain([j, 'optionalAccess', _154 => _154.reduce, 'call', _155 => _155((x,K)=>x+K.quantity,0)]), () => (0)),value_minor:we,currency:xe}))},[rt,r,j,we,xe]);let ga=_react2.default.useRef(new Map);_react2.default.useEffect(()=>{ga.current.clear()},[j]);function Po(x,K){let st=_optionalChain([j, 'optionalAccess', _156 => _156.find, 'call', _157 => _157(Eo=>Eo.id===x)]);if(_optionalChain([st, 'optionalAccess', _158 => _158.details])==null)return;let ct=K-(_nullishCoalesce(ga.current.get(x), () => (st.quantity)));if(ga.current.set(x,K),ct===0)return;let wt=_nullishCoalesce(_optionalChain([st, 'access', _159 => _159.details, 'access', _160 => _160.pricing, 'optionalAccess', _161 => _161.effectivePrice]), () => (st.details.price)),Me=_nullishCoalesce(st.catalogProductID, () => (st.productID));r.track(ct>0?"add_to_cart":"remove_from_cart",{qty:Math.abs(ct),value_minor:Math.round(wt*Math.abs(ct)),currency:st.details.currency},{product_id:Me,variant_id:Me!==st.productID?st.productID:null})}let mr=_react2.default.useRef(!1);async function So(x,K){if(K!=null){Po(x,Math.max(0,K));try{let st=K<=0?await C({id:x}):await X({id:x,quantity:K});if(_chunk7BG22YBFjs.q.call(void 0, st))throw new Error(`cannot change the cart: ${st.error}`)}finally{await tr().catch(()=>{})}}}async function Io(){try{z(""),F([]),_chunk7BG22YBFjs.w.getState().setNotice(void 0);let x=Oe,K=x!=null?_chunk7BG22YBFjs.u.call(void 0, x,or):void 0;if(ze!=null&&(nr===void 0||xo)){sr(!0);try{x=await ar.fetchQuery(rr).catch(()=>null)}finally{sr(!1)}if(x==null)K=void 0;else if(K==null||!x.methods.includes(K)){window.setTimeout(()=>{_optionalChain([cr, 'access', _162 => _162.current, 'optionalAccess', _163 => _163.querySelector, 'call', _164 => _164("input:checked"), 'optionalAccess', _165 => _165.focus, 'call', _166 => _166()])},0);return}}if(j!=null){!mr.current&&j.length>0&&(mr.current=!0,r.track("checkout_started",{item_count:j.reduce((wt,Me)=>wt+Me.quantity,0),checkout_type:"cart",value_minor:we,currency:xe}));try{_chunk7BG22YBFjs.p.call(void 0, {event:"initiateCheckout",items:_optionalChain([j, 'optionalAccess', _167 => _167.map, 'call', _168 => _168(wt=>({id:wt.productID,name:_nullishCoalesce(_optionalChain([wt, 'access', _169 => _169.details, 'optionalAccess', _170 => _170.name]), () => ("")),price:_nullishCoalesce(_optionalChain([wt, 'access', _171 => _171.details, 'optionalAccess', _172 => _172.price]), () => (0)),quantity:wt.quantity,currency:_nullishCoalesce(_optionalChain([wt, 'access', _173 => _173.details, 'optionalAccess', _174 => _174.currency]), () => ("PLN"))}))])})}catch (e14){}}let st=_chunk7BG22YBFjs.M.call(void 0, ),ct=await ua(K!=null?{paymentMethod:K}:void 0);if(_chunk7BG22YBFjs.q.call(void 0, ct)){ar.invalidateQueries({queryKey:["cart-payment-methods"]}),ct.error=="item-ids-not-found"?(z(R),"data"in ct&&Array.isArray(ct.data)&&F(ct.data)):K==="cod"&&ct.error=="gateway-not-configured"?z(h("paymentMethodCodUnavailable")):z(_chunk7BG22YBFjs.s.call(void 0, ct,h));return}_chunk7BG22YBFjs.G.call(void 0, ct,{cartProjectId:_chunk7BG22YBFjs.K.call(void 0, ),lines:st})||await Ot(),window.location.href=ct.url}catch(x){console.warn("checkout failed",x),z(h("checkoutFailed"))}}return _jsxruntime.jsxs.call(void 0, "div",{className:`${t} flex flex-col`,ref:wo,children:[rt&&_jsxruntime.jsxs.call(void 0, "div",{className:"relative flex w-full justify-center flex-col gap-4",children:[_jsxruntime.jsx.call(void 0, Na,{"data-bitsnap-checkout-slot":"skeleton",className:_chunkN3B25GTYjs.g.call(void 0, "w-full h-32",S.className),style:S.style}),_jsxruntime.jsx.call(void 0, Na,{"data-bitsnap-checkout-slot":"skeleton",className:_chunkN3B25GTYjs.g.call(void 0, "w-full h-32",S.className),style:S.style})]}),lr&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-3 p-4",children:[_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunkN3B25GTYjs.g.call(void 0, p.className),style:p.style,children:I}),N!=null&&N.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunkN3B25GTYjs.g.call(void 0, "text-sm",p.className),style:p.style,children:N}),_jsxruntime.jsx.call(void 0, "button",{type:"button","data-bitsnap-checkout-slot":"checkoutButton",onClick:()=>{tr().then().catch()},className:_chunkN3B25GTYjs.g.call(void 0, "px-3 py-2 rounded-md transition font-bold",m.className),style:m.style,children:T})]}),!rt&&!lr&&(j==null||j.length==0)&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-4 p-4",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"emptyState",className:_chunkN3B25GTYjs.g.call(void 0, g.className),style:g.style,children:y}),N!=null&&N.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunkN3B25GTYjs.g.call(void 0, "text-sm",p.className),style:p.style,children:N})]}),_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"productList",className:_chunkN3B25GTYjs.g.call(void 0, "max-h-[70vh] overflow-clip overflow-y-scroll",o.className),style:o.style,children:j!=null&&j.length>0&&_jsxruntime.jsx.call(void 0, "ul",{className:"mt-5",children:j.map(x=>_jsxruntime.jsx.call(void 0, _react2.default.Fragment,{children:x.details!=null&&_jsxruntime.jsxs.call(void 0, "li",{className:"mb-3",children:[_jsxruntime.jsx.call(void 0, tn,{isNotAvailable:W.includes(x.productID),quantity:x.quantity,details:x.details,url:x.url,shouldUpdate:K=>So(x.id,K)}),_jsxruntime.jsx.call(void 0, "hr",{className:"h-1"})]})},x.id))})}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),we>0&&xe!=null&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"summary",className:_chunkN3B25GTYjs.g.call(void 0, "mx-3 flex flex-col",i.className),style:i.style,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row justify-between text-lg",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"totalLabel",className:_chunkN3B25GTYjs.g.call(void 0, "text-xl",c.className),style:c.style,children:A}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end",children:[_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"totalValue",className:_chunkN3B25GTYjs.g.call(void 0, "font-medium",l.className),style:l.style,children:_chunk7BG22YBFjs.o.call(void 0, we,xe)}),Co&&_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"deliveryText",className:_chunkN3B25GTYjs.g.call(void 0, "opacity-70 text-right text-base",u.className),style:u.style,children:k})]})]}),_jsxruntime.jsx.call(void 0, "p",{"data-bitsnap-checkout-slot":"summaryNote",className:_chunkN3B25GTYjs.g.call(void 0, "opacity-70 text-sm",s.className),style:s.style,children:w})]}),Bt&&_optionalChain([Bt, 'optionalAccess', _175 => _175.length])>1&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "h4",{"data-bitsnap-checkout-slot":"countryLabel",className:_chunkN3B25GTYjs.g.call(void 0, "ml-3 text-sm",f.className),style:f.style,children:E}),_jsxruntime.jsx.call(void 0, $r,{id:U,open:V,onToggle:()=>{Wt(!V)},onChange:x=>{yt(x).then(()=>{er().then().catch()})},selectedValue:_nullishCoalesce(Mt, () => ("")),countries:Bt})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mb-3 flex flex-col",children:[ba&&j!=null&&j.length>0&&_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"paymentButtons",className:_chunkN3B25GTYjs.g.call(void 0, "w-full px-2",v.className),style:v.style,children:_jsxruntime.jsx.call(void 0, Sa,{colorType:"white",style:{width:"100%"},items:_optionalChain([j, 'optionalAccess', _176 => _176.map, 'call', _177 => _177(x=>({name:_nullishCoalesce(_optionalChain([x, 'access', _178 => _178.details, 'optionalAccess', _179 => _179.name]), () => ("")),id:x.productID,price:_nullishCoalesce(_nullishCoalesce(_optionalChain([x, 'access', _180 => _180.details, 'optionalAccess', _181 => _181.pricing, 'optionalAccess', _182 => _182.effectivePrice]), () => (_optionalChain([x, 'access', _183 => _183.details, 'optionalAccess', _184 => _184.price]))), () => (0)),currency:_optionalChain([x, 'access', _185 => _185.details, 'optionalAccess', _186 => _186.currency]),quantity:x.quantity,isDeliverable:_nullishCoalesce(_optionalChain([x, 'access', _187 => _187.details, 'optionalAccess', _188 => _188.isDeliverable]), () => (!1)),metadata:x.metadata}))])})}),j!=null&&j.length>0&&_jsxruntime.jsx.call(void 0, "div",{"data-bitsnap-checkout-slot":"paymentButtons",className:_chunkN3B25GTYjs.g.call(void 0, "w-full px-2",v.className),style:v.style,children:_jsxruntime.jsx.call(void 0, Va,{buttonSizeMode:"fill",buttonColor:"white",style:{width:"100%"},items:_optionalChain([j, 'optionalAccess', _189 => _189.map, 'call', _190 => _190(x=>({name:_nullishCoalesce(_optionalChain([x, 'access', _191 => _191.details, 'optionalAccess', _192 => _192.name]), () => ("")),id:x.productID,price:_nullishCoalesce(_nullishCoalesce(_optionalChain([x, 'access', _193 => _193.details, 'optionalAccess', _194 => _194.pricing, 'optionalAccess', _195 => _195.effectivePrice]), () => (_optionalChain([x, 'access', _196 => _196.details, 'optionalAccess', _197 => _197.price]))), () => (0)),quantity:x.quantity,isDeliverable:_nullishCoalesce(_optionalChain([x, 'access', _198 => _198.details, 'optionalAccess', _199 => _199.isDeliverable]), () => (!1)),metadata:x.metadata}))])})}),j!=null&&j.length>0&&_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"paymentButtons",className:_chunkN3B25GTYjs.g.call(void 0, "w-full px-2",v.className),style:v.style,children:[_jsxruntime.jsx.call(void 0, ja,{projectID:_nullishCoalesce(_chunk7BG22YBFjs.K.call(void 0, ), () => ("")),locale:n}),_jsxruntime.jsx.call(void 0, Ka,{projectID:_nullishCoalesce(_chunk7BG22YBFjs.K.call(void 0, ), () => ("")),locale:n})]}),Oe!=null&&_jsxruntime.jsx.call(void 0, "div",{ref:cr,className:"contents",children:_jsxruntime.jsx.call(void 0, an,{choice:Oe,selected:_chunk7BG22YBFjs.u.call(void 0, Oe,or),onChange:ko,disabled:Tt})}),_jsxruntime.jsx.call(void 0, "button",{"data-bitsnap-checkout-slot":"checkoutButton",onClick:Io,disabled:rt||Tt||ir||Mt==null,"aria-describedby":dr?b:void 0,className:_chunkN3B25GTYjs.g.call(void 0, "px-3 py-2 my-2 mx-2 rounded-md disabled:opacity-40 disabled:cursor-not-allowed transition font-bold",m.className),style:m.style,children:Tt||ir?_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{}):D}),dr&&_jsxruntime.jsx.call(void 0, "p",{id:b,className:"text-sm text-center opacity-70",children:P}),_.length>0&&_jsxruntime.jsx.call(void 0, "p",{role:"alert","data-bitsnap-checkout-slot":"error",className:_chunkN3B25GTYjs.g.call(void 0, "text-sm text-center",p.className),style:p.style,children:_})]})]})]})},Fn=_s;function qs({isVisible:t,shouldHide:e,panelId:a,locale:r}){let[n]=_react3.useAutoAnimate.call(void 0, ),[o,i]=_react.useState.call(void 0, null),c=_react.useCallback.call(void 0, y=>{n(y),i(y)},[n]),l=_react.useRef.call(void 0, null),{boundaryClassName:u,boundaryStyle:s}=Ce(),f=L("root"),v=L("overlay"),m=L("panel"),g=L("header"),p=L("title"),S=L("closeButton"),R=_chunk7BG22YBFjs.E.call(void 0, "cart"),h=_chunk7BG22YBFjs.E.call(void 0, "close");return _jsxruntime.jsx.call(void 0, "div",{ref:c,"data-bitsnap-checkout":"root","data-bitsnap-checkout-slot":"root",className:_chunkN3B25GTYjs.g.call(void 0, "bitsnap-react",u,f.className),style:{zIndex:999999,...s,...f.style},children:o!=null&&_jsxruntime.jsx.call(void 0, It.Root,{open:t,onOpenChange:y=>{y||e()},children:_jsxruntime.jsxs.call(void 0, It.Portal,{container:o,children:[_jsxruntime.jsx.call(void 0, It.Overlay,{"data-bitsnap-checkout-slot":"overlay","aria-hidden":"true",className:_chunkN3B25GTYjs.g.call(void 0, "fixed top-0 right-0 left-0 bottom-0 cursor-pointer z-10",v.className),style:v.style,onClick:e}),_jsxruntime.jsxs.call(void 0, It.Content,{id:a,"data-bitsnap-checkout-slot":"panel","aria-modal":"true","aria-describedby":void 0,onOpenAutoFocus:()=>{let y=document.activeElement;l.current=y instanceof HTMLElement?y:null},onCloseAutoFocus:y=>{y.preventDefault(),_optionalChain([l, 'access', _200 => _200.current, 'optionalAccess', _201 => _201.focus, 'call', _202 => _202()]),l.current=null},className:_chunkN3B25GTYjs.g.call(void 0, "fixed z-20 top-0 right-0 bottom-0 w-full md:w-[350px] xl:w-[420px] flex flex-col overflow-y-auto",m.className),style:m.style,onPointerDownOutside:y=>y.preventDefault(),children:[_jsxruntime.jsxs.call(void 0, "div",{"data-bitsnap-checkout-slot":"header",className:_chunkN3B25GTYjs.g.call(void 0, "mx-3 mt-7 flex justify-between items-center",g.className),style:g.style,children:[_jsxruntime.jsx.call(void 0, It.Title,{asChild:!0,children:_jsxruntime.jsx.call(void 0, "h1",{"data-bitsnap-checkout-slot":"title",className:_chunkN3B25GTYjs.g.call(void 0, "text-2xl font-medium",p.className),style:p.style,children:R})}),_jsxruntime.jsx.call(void 0, "button",{type:"button","data-bitsnap-checkout-slot":"closeButton",className:_chunkN3B25GTYjs.g.call(void 0, "rounded-xl p-2 transition",S.className),style:S.style,"aria-label":h,onClick:e,children:_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-x","aria-hidden":"true",focusable:"false",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"18",y1:"6",x2:"6",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),_jsxruntime.jsx.call(void 0, Fn,{className:"grow",locale:r})]})]})})})}var Gs=t=>typeof window>"u"?null:_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, le,{appearance:t.appearance,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.D,{texts:t.texts,locale:t.locale,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.P,{locale:t.locale,children:_jsxruntime.jsx.call(void 0, qs,{...t})})})}),document.body),Wn=Gs;var Hs=_zod2.default.object({id:_zod2.default.string(),isSubscription:_zod2.default.boolean().default(!1),quantity:_zod2.default.number(),metadata:_zod2.default.record(_zod2.default.string(),_zod2.default.string().optional()).optional(),url:_zod2.default.string().optional()}),Ks={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Vs({projectID:t,locale:e,children:a,onVisibleChange:r,className:n,numberOfProductsInCartOptions:o,appearance:i,texts:c,analytics:l}){let u=_chunkG4SEOVLDjs.n.call(void 0, t,l,"cart");_chunkG4SEOVLDjs.q.call(void 0, u);let{isCartVisible:s,showCart:f,hideCart:v,numberOfProductsInCart:m}=_chunk7BG22YBFjs.w.call(void 0, ),g=`bitsnap-cart-${_react.useId.call(void 0, )}`,p=E=>_chunkQ337IQNAjs.c.call(void 0, E,_nullishCoalesce(e, () => (_chunkQ337IQNAjs.f.call(void 0, ))),c),S=_react.useRef.call(void 0, p);S.current=p;function R(E){_chunk7BG22YBFjs.w.getState().setNotice(S.current(E)),f()}function h(E){document.querySelectorAll("iframe").forEach(I=>{_optionalChain([I, 'access', _203 => _203.contentWindow, 'optionalAccess', _204 => _204.postMessage, 'call', _205 => _205(E,"*")])})}_react.useEffect.call(void 0, ()=>{_optionalChain([r, 'optionalCall', _206 => _206(s)]),s&&_chunk7BG22YBFjs.p.call(void 0, {event:"viewCart"})},[s]),_react.useEffect.call(void 0, ()=>{_chunk7BG22YBFjs.J.call(void 0, t)},[t]),_react.useEffect.call(void 0, ()=>{_chunkQ337IQNAjs.e.call(void 0, e)},[e]),_react.useEffect.call(void 0, ()=>{if(!("cart"in window)){let E=_chunk7BG22YBFjs.K.call(void 0, );if(E==null){console.warn("There is no project ID configured.");return}window.cart={buyProduct:async D=>{try{let I=_zod2.default.object({productID:_zod2.default.string(),email:_zod2.default.string().optional(),name:_zod2.default.string().optional(),country:_zod2.default.string().optional(),marketingAgreement:_zod2.default.boolean().optional(),locale:_zod2.default.string().optional()}).parse(D),T=_chunk7BG22YBFjs.Y.call(void 0, E);try{let w=await T.getProducts();_chunk7BG22YBFjs.q.call(void 0, w)==!1&&_chunk7BG22YBFjs.p.call(void 0, {event:"initiateCheckout",items:w.map(U=>({id:U.productID,name:_nullishCoalesce(_optionalChain([U, 'access', _207 => _207.details, 'optionalAccess', _208 => _208.name]), () => ("")),price:_nullishCoalesce(_optionalChain([U, 'access', _209 => _209.details, 'optionalAccess', _210 => _210.price]), () => (0)),quantity:U.quantity,currency:_nullishCoalesce(_optionalChain([U, 'access', _211 => _211.details, 'optionalAccess', _212 => _212.currency]), () => ("PLN"))}))})}catch (e15){}let P=await T.justRedirectToPayment(I);_chunk7BG22YBFjs.q.call(void 0, P)==!1?window.location.href=P.url:R("redirectFailed")}catch(I){console.warn(I)}}}}},[]);async function y(E,D){let I=_chunk7BG22YBFjs.K.call(void 0, );if(I==null){console.warn("There is no project ID configured.");return}try{let T=Hs.parse(D);if(T.isSubscription){await A(I,T);return}await _chunk7BG22YBFjs.Y.call(void 0, I).addProduct({productID:T.id,quantity:T.quantity,metadata:T.metadata,url:T.url}),h({id:E,type:"ADD_TO_CART",success:!0}),f()}catch(T){console.warn("cannot add item to cart",T)}}async function A(E,D){console.warn("subscriptions cannot be added to the cart yet",E,D.id),R("subscriptionUnsupported")}function k(){"__cart_is_listening"in window||(window.__cart_is_listening=!0,window.addEventListener("message",E=>{if(typeof E.data.id<"u"&&typeof E.data.type<"u"){let{id:D,type:I}=E.data;switch(I){case"ADD_TO_CART".toString():y(D,E.data.payload).then().catch();break;default:break}}}))}return _react.useEffect.call(void 0, ()=>{if(k(),typeof window<"u")try{let E=new URLSearchParams(window.location.search),D=_nullishCoalesce(E.get("ref"), () => (E.get("utm-source")));typeof localStorage<"u"&&D&&D.length>0&&localStorage.setItem("bitsnap-ref",D)}catch (e16){return}},[]),_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>s?v():f(),"aria-label":a?void 0:m>0?`${p("openCart")}. ${p("cartItemsCount")}: ${m}`:p("openCart"),"aria-expanded":s,"aria-haspopup":"dialog","aria-controls":s?g:void 0,style:{position:"relative"},className:["bitsnap-react",_nullishCoalesce(n, () => ("rounded-full hover:bg-neutral-300 transition p-1"))].join(" "),children:[a?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:a}):_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-shopping-cart","aria-hidden":"true",focusable:"false",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"8",cy:"21",r:"1"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"19",cy:"21",r:"1"}),_jsxruntime.jsx.call(void 0, "path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"})]}),m>0&&_jsxruntime.jsxs.call(void 0, "span",{style:Ks,children:[p("cartItemsCount"),": ",m]}),_optionalChain([o, 'optionalAccess', _213 => _213.isVisible])!=!1&&m>0&&_jsxruntime.jsx.call(void 0, "div",{"aria-hidden":"true",style:{position:"absolute",bottom:-5,right:-5,background:"black",color:"white",borderRadius:"50%",width:"22px",height:"22px",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"13px",fontWeight:600,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.25)",..._optionalChain([o, 'optionalAccess', _214 => _214.style])},children:m})]}),_jsxruntime.jsx.call(void 0, _chunkG4SEOVLDjs.l,{value:u,children:_jsxruntime.jsx.call(void 0, Wn,{isVisible:s,locale:e,appearance:i,texts:c,panelId:g,shouldHide:()=>{v()}})})]})}var $s=Vs;var _buttonreact = require('@google-pay/button-react'); var _buttonreact2 = _interopRequireDefault(_buttonreact);function Zs({items:t,style:e,buttonColor:a,buttonSizeMode:r,test:n}){let{getGooglePayConfiguration:o,completeGooglePayPayment:i,setCountry:c,setCouponCodeIfPossible:l,setDeliveryMethod:u,setEmail:s,setPostalCode:f,clearCart:v}=_chunk7BG22YBFjs.O.call(void 0, ),m=_chunkG4SEOVLDjs.m.call(void 0, ),{data:g}=_reactquery.useQuery.call(void 0, {queryKey:["get-google-pay-configuration",t.map(R=>R.id).join(",")],queryFn:()=>o({items:t.map(R=>({...R,id:void 0,productID:R.id}))})}),{mutateAsync:p,isPending:S}=_reactquery.useMutation.call(void 0, {mutationFn:i});return g==null||g.isAvailable!=!0?(console.log("google pay configuration is not available",g),null):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _buttonreact2.default,{buttonSizeMode:r,buttonColor:a,style:e,existingPaymentMethodRequired:!0,onClick:()=>m.track("payment_method_selected",{gateway:"google_pay",method:"google_pay"}),environment:n===!0?"TEST":"PRODUCTION",onPaymentDataChanged:async R=>{_chunk7BG22YBFjs.p.call(void 0, {event:"initiateCheckout",items:t.map(y=>({id:y.id,name:y.name,price:y.price,quantity:y.quantity,currency:"PLN"}))}),console.log("payment data changed",R),_optionalChain([R, 'access', _215 => _215.shippingAddress, 'optionalAccess', _216 => _216.postalCode])!=null&&await f(_optionalChain([R, 'access', _217 => _217.shippingAddress, 'optionalAccess', _218 => _218.postalCode])),_optionalChain([R, 'access', _219 => _219.shippingAddress, 'optionalAccess', _220 => _220.countryCode])!=null&&await c(_optionalChain([R, 'access', _221 => _221.shippingAddress, 'optionalAccess', _222 => _222.countryCode])),_optionalChain([R, 'access', _223 => _223.shippingOptionData, 'optionalAccess', _224 => _224.id])!=null&&await u(R.shippingOptionData.id);let h=await o({items:[]});return console.log("PAYMENT DATA CHANGED CONFIG",h),h.isAvailable?{error:void 0,newShippingOptionParameters:h.config.shippingOptionParameters,newTransactionInfo:h.config.transactionInfo}:{error:void 0}},paymentRequest:g.config,onLoadPaymentData:async R=>{m.track("payment_submitted",{gateway:"google_pay",method:"google_pay"});try{let h=await p({paymentData:R});if(_chunk7BG22YBFjs.q.call(void 0, h)){console.log("apple pay error",h);return}h.isSuccess&&v(),h.redirectURL&&open(h.redirectURL,"_self")}catch(h){console.warn("error completing google pay payment",h)}}}),S?_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{}):null]})}function Js(t){let e=_chunkG4SEOVLDjs.n.call(void 0, Ct(),t.analytics,"cart");return _jsxruntime.jsx.call(void 0, _chunkG4SEOVLDjs.l,{value:e,children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.P,{children:_jsxruntime.jsx.call(void 0, Zs,{...t})})})}var Va=Js;var tt=_chunkAHISXVEEjs.g.pl,B={title:null,description:null,managingDescription:"Zarz\u0105dzaj rodzajami powiadomie\u0144 i sposobem dostarczania.",formTitle:"Podaj Email aby zapisa\u0107 si\u0119\xA0do powiadomie\u0144",formEmailLabel:"Email",formPhoneLabel:"Numer telefonu",formPhoneOptional:"(opcjonalnie)",formEmailPlaceholder:"np. mail@gmail...",formPhonePlaceholder:"np. 663...",formSubmitButton:"Zapisz si\u0119",formSuccessMessage:"Zapisa\u0142e\u015B si\u0119 do powiadomie\u0144.",agreementText:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"red"},children:"*"}),"Wyra\u017Cam zgod\u0119 na przetwarzanie moich danych w celach marketingowych zgodnie z"," ",_jsxruntime.jsx.call(void 0, "a",{href:"/regulations/polityka-prywatnosci",target:"_blank",className:"cursor-alias font-bold hover:font-medium",children:"regulaminem"})," ",_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-light",children:"(zgod\u0119 mo\u017Cna w ka\u017Cdej chwili wycofa\u0107)"})]}),qrCodeTitle:"lub zainstaluj aplikacj\u0119 mobiln\u0105",qrCodeSubtitle:"Aplikacja mobilna",qrCodeScanText:"zeskanuj kod QR",groupsNoSelectionWarning:"Je\u015Bli \u017Cadna z grup nie jest zaznaczona, nie otrzymasz \u017Cadnych powiadomie\u0144.",groupsSelectAllButton:"Zaznacz wszystkie",groupsUpdateButton:"Aktualizuj",groupsUpdateSuccess:"Zaktualizowano pomy\u015Blnie.",groupsTitle:"Zarz\u0105dzaj grupami z kt\xF3rych chcesz otrzymywa\u0107 powiadomienia",manageDataTitle:"Ustawienia powiadomie\u0144",manageDataDescription:"W jaki spos\xF3b chcesz otrzymywa\u0107 powiadomienia?",manageDataUnsubscribeButton:"Odsubskrybuj",manageDataUpdatedMessage:"Zaktualizowano",manageDataUnsubscribeDescription:"Wypisz mnie z wszystkich powiadomie\u0144 i grup.",loginEmailLabel:"Email",loginEmailPlaceholder:"Wprowad\u017A sw\xF3j email",loginSendCodeButton:"Wy\u015Blij kod weryfikacyjny",loginSendingButton:"Wysy\u0142anie...",loginCodeLabel:"Wprowad\u017A kod weryfikacyjny",loginCodeSentMessage:"Wys\u0142ali\u015Bmy kod weryfikacyjny na adres",loginChangeEmailButton:"Popraw email",loginResendCodeButton:"Wy\u015Blij kod ponownie",loginInvalidEmailError:"Wprowad\u017A prawid\u0142owy adres email",loginSlugRequiredError:"Wymagany jest identyfikator projektu",loginInvalidCodeError:"Nieprawid\u0142owy kod weryfikacyjny",loginVerificationFailedError:"Weryfikacja nie powiod\u0142a si\u0119. Sprawd\u017A sw\xF3j kod.",loginSendEmailError:"Nie uda\u0142o si\u0119 wys\u0142a\u0107 kodu weryfikacyjnego",loginVerifyCodeError:"Nie uda\u0142o si\u0119 zweryfikowa\u0107 kodu",loginResendEmailError:"Nie uda\u0142o si\u0119 ponownie wys\u0142a\u0107 kodu weryfikacyjnego",loginTitle:"Wpisz email aby zarz\u0105dza\u0107 powiadomieniami",loginDescription:"Dostaniesz kod weryfikacyjny na email.",loginIHaveCode:"Mam ju\u017C kod",loginVerifyButton:"Potwierd\u017A",loginResendInText:tt.resendIn,loginResentMessage:tt.resent,loginExpiredError:tt.expired,loginTooManyAttemptsError:tt.tooManyAttempts,loginRateLimitedError:tt.rateLimited,loginNetworkError:tt.network,loginSpamHint:tt.spamHint,loginValidityHint:tt.validity,loginVerifyingButton:tt.verifying,loginStepEmailHint:tt.stepEmail,loginStepCodeHint:tt.stepCode,loginAlreadySentMessage:tt.alreadySent,loginEmailNotFoundError:tt.emailNotFound,loginDeliveryUnavailableError:tt.deliveryUnavailable,loginResendNewCodeButton:tt.resendNew,loginNoCodeButton:tt.noCode,loginCodeIncompleteError:tt.codeIncomplete};function Vn({projectName:t,projectLogo:e,projectLogoDark:a,description:r,className:n,onLogout:o}){return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[e!=null||t!=null&&_jsxruntime.jsxs.call(void 0, "h2",{className:_chunkN3B25GTYjs.g.call(void 0, "flex max-w-44 items-center gap-3 text-lg font-medium text-black sm:max-w-none md:text-xl lg:text-2xl xl:text-3xl dark:text-neutral-100",_optionalChain([n, 'optionalAccess', _225 => _225.headerTitle])),children:[e!=null&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "img",{src:e,alt:"",className:_chunkN3B25GTYjs.g.call(void 0, "h-12 w-auto dark:hidden",_optionalChain([n, 'optionalAccess', _226 => _226.headerLogo]))}),_jsxruntime.jsx.call(void 0, "img",{src:_nullishCoalesce(a, () => (e)),alt:"",className:_chunkN3B25GTYjs.g.call(void 0, "hidden h-12 w-auto dark:inline",_optionalChain([n, 'optionalAccess', _227 => _227.headerLogo]))})]}),_jsxruntime.jsx.call(void 0, "span",{children:t})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[r&&_jsxruntime.jsx.call(void 0, "p",{className:_chunkN3B25GTYjs.g.call(void 0, "mt-4 font-medium text-left",_optionalChain([n, 'optionalAccess', _228 => _228.headerDescription])),children:r}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),o&&_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{variant:"ghost",size:"icon-sm",onClick:o,children:_jsxruntime.jsx.call(void 0, _lucidereact.LogOutIcon,{className:"h-5 w-5"})})]})]})}var _reactswitch = require('@radix-ui/react-switch'); var la = _interopRequireWildcard(_reactswitch);function he({className:t,...e}){return _jsxruntime.jsx.call(void 0, la.Root,{"data-slot":"switch",className:_chunkN3B25GTYjs.g.call(void 0, "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",t),...e,children:_jsxruntime.jsx.call(void 0, la.Thumb,{"data-slot":"switch-thumb",className:_chunkN3B25GTYjs.g.call(void 0, "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")})})}var _reactpopover = require('@radix-ui/react-popover'); var Lt = _interopRequireWildcard(_reactpopover);function Qn({...t}){return _jsxruntime.jsx.call(void 0, Lt.Root,{"data-slot":"popover",...t})}function Xn({...t}){return _jsxruntime.jsx.call(void 0, Lt.Trigger,{"data-slot":"popover-trigger",...t})}function Yn({className:t,align:e="center",sideOffset:a=4,...r}){return _jsxruntime.jsx.call(void 0, Lt.Portal,{children:_jsxruntime.jsx.call(void 0, Lt.Content,{"data-slot":"popover-content",align:e,sideOffset:a,className:_chunkN3B25GTYjs.g.call(void 0, "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...r})})}function Zn({regularity:t}){let e="";switch(t){case"rarely":e="rzadko";break;case"often":e="cz\u0119sto";break;case"very_often":e="codzienne";break}return _jsxruntime.jsxs.call(void 0, Qn,{children:[_jsxruntime.jsx.call(void 0, Xn,{onClick:a=>{a.stopPropagation()},children:_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"flex w-[30%] cursor-help flex-col items-center justify-center text-xs md:w-[25%] xl:w-[20%]",children:[_jsxruntime.jsx.call(void 0, _lucidereact.ClockIcon,{size:12}),_jsxruntime.jsx.call(void 0, "span",{children:e})]})}),_jsxruntime.jsx.call(void 0, Yn,{className:"w-80",children:_jsxruntime.jsxs.call(void 0, "div",{className:"grid gap-4",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"space-y-2",children:[_jsxruntime.jsx.call(void 0, "h4",{className:"leading-none font-medium",children:"Co to oznacza?"}),_jsxruntime.jsxs.call(void 0, "ul",{className:"list-inside list-disc text-sm",children:[_jsxruntime.jsxs.call(void 0, "li",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold",children:"Rzadko"})," \u2013 powiadomienia b\u0119d\u0105 wysy\u0142ane maksymalnie kilka razy w miesi\u0105cu."]}),_jsxruntime.jsxs.call(void 0, "li",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold",children:"Cz\u0119sto"})," \u2013 powiadomienia mog\u0119 by\u0107 wysy\u0142ane kilka razy w tygodniu."]}),_jsxruntime.jsxs.call(void 0, "li",{children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-semibold",children:"Codzienne"})," \u2013 powiadomienia b\u0119d\u0105 wysy\u0142ane nawet codziennie."]})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"grid gap-2"})]})})]})}function pa({groups:t=[],isManaging:e,onToggle:a,onCheckAll:r,onUpdate:n,isUpdating:o,wasChanged:i,isUserGroupsUpdated:c,className:l,texts:u}){let[s]=_react3.useAutoAnimate.call(void 0, ),[f]=_react3.useAutoAnimate.call(void 0, ),v=t.filter(p=>p.isOn===!1).length>0,m=t.filter(p=>p.isOn===!1).length>0;if(t.length<=1&&e!=!0)return null;let g=_jsxruntime.jsxs.call(void 0, "div",{ref:s,className:_chunkN3B25GTYjs.g.call(void 0, "my-5 flex flex-col gap-3",_optionalChain([l, 'optionalAccess', _229 => _229.groupsList])),children:[t.map(p=>_jsxruntime.jsxs.call(void 0, "div",{id:p.id,role:"button",className:_chunkN3B25GTYjs.g.call(void 0, p.isOn?"bg-neutral-50 hover:bg-transparent shadow-sm border-transparent dark:bg-neutral-800":"border-neutral-200 hover:bg-neutral-50 dark:hover:border-neutral-800 shadow-sm dark:border-neutral-800","active:bg-beige-300 flex w-full cursor-pointer items-center gap-3 rounded-xl border px-3 py-2 transition active:dark:bg-neutral-900",_optionalChain([l, 'optionalAccess', _230 => _230.groupItem])),onClick:S=>{S.target instanceof HTMLButtonElement||a(p.id)},children:[_jsxruntime.jsx.call(void 0, he,{checked:p.isOn,className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-700",onCheckedChange:()=>{a(p.id)}}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start justify-start",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-medium text-sm",children:p.name}),p.description&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs font-light",children:p.description})]}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"}),p.howOften&&_jsxruntime.jsx.call(void 0, Zn,{regularity:p.howOften})]},p.id)),_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[e===!0&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{ref:f,className:"flex flex-col items-start justify-start",children:[i&&_jsxruntime.jsxs.call(void 0, _chunk5OCGXVLCjs.q,{variant:"default",size:"sm",className:"relative",disabled:o,onClick:n,children:[_nullishCoalesce(_optionalChain([u, 'optionalAccess', _231 => _231.groupsUpdateButton]), () => (B.groupsUpdateButton)),o&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{})})]}),c&&_jsxruntime.jsxs.call(void 0, "p",{className:"mt-3 flex items-center gap-2 text-sm text-green-500",children:[_jsxruntime.jsx.call(void 0, _lucidereact.CheckCircleIcon,{color:"var(--color-green-500",size:16})," ",_nullishCoalesce(_optionalChain([u, 'optionalAccess', _232 => _232.groupsUpdateSuccess]), () => (B.groupsUpdateSuccess))]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"grow"})]}),m&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-start",children:_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{className:"cursor-pointer dark:bg-neutral-700",onClick:r,size:"sm",variant:"secondary",type:"button",children:_nullishCoalesce(_optionalChain([u, 'optionalAccess', _233 => _233.groupsSelectAllButton]), () => (B.groupsSelectAllButton))})})]}),v&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex text-left gap-2 text-xs text-yellow-500",children:[_jsxruntime.jsx.call(void 0, _lucidereact.TriangleAlertIcon,{color:"orange",size:16}),_nullishCoalesce(_optionalChain([u, 'optionalAccess', _234 => _234.groupsNoSelectionWarning]), () => (B.groupsNoSelectionWarning))]})]});return e==!0?_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.b,{className:"mt-5 text-left",children:[_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.c,{children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.d,{children:_nullishCoalesce(_optionalChain([u, 'optionalAccess', _235 => _235.groupsTitle]), () => (B.groupsTitle))})}),_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.e,{children:g})]}):g}function to({showQRCode:t=!0,isManaging:e,className:a,texts:r}){let n=typeof window<"u",o=n?!!_optionalChain([window, 'access', _236 => _236.matchMedia, 'optionalCall', _237 => _237("(prefers-color-scheme: dark)"), 'access', _238 => _238.matches]):!1;function i(c){return c?window.location.href:""}return t?_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.b,{className:_chunkN3B25GTYjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([a, 'optionalAccess', _239 => _239.qrCodeSection])),children:[_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.c,{children:_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.d,{className:_chunkN3B25GTYjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([a, 'optionalAccess', _240 => _240.qrCodeTitle])),children:[_nullishCoalesce(_optionalChain([r, 'optionalAccess', _241 => _241.qrCodeSubtitle]), () => (B.qrCodeSubtitle))," "+(_nullishCoalesce(_optionalChain([r, 'optionalAccess', _242 => _242.qrCodeTitle]), () => (B.qrCodeTitle)))]})}),_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.e,{className:"flex flex-col items-center gap-2",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"mt-1.5 mb-3 flex items-center gap-x-2",children:[_jsxruntime.jsx.call(void 0, "a",{href:"https://apps.apple.com/us/app/bitsnap/id6741902807",target:"_blank",className:"max-w-28 flex-1 basis-1/2 lg:max-w-36",children:_jsxruntime.jsx.call(void 0, "img",{className:"h-auto w-full",src:_chunkN3B25GTYjs.e+"/app-store-logo.png",alt:"Download on App Store"})}),_jsxruntime.jsx.call(void 0, "a",{href:"https://play.google.com/store/apps/details?id=com.bitsnap.Bitsnap&pli=1",target:"_blank",className:"max-w-28 flex-1 basis-1/2 lg:max-w-36",children:_jsxruntime.jsx.call(void 0, "img",{className:"h-auto w-full",src:_chunkN3B25GTYjs.e+"/google-play-logo.png",alt:"Get in on Google Play"})})]}),n&&_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center",children:_jsxruntime.jsxs.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "flex min-w-[40%] flex-col items-center gap-2 rounded-xl bg-white p-2 dark:bg-neutral-900",_optionalChain([a, 'optionalAccess', _243 => _243.qrCodeContainer])),children:[_jsxruntime.jsx.call(void 0, "img",{className:"mt-3 w-[80%] p-1 pt-3",src:_chunkN3B25GTYjs.e+`/api/qr-gen?url=${i(n)}&bgColor=${o?"171717":"F6F4F0"}&textColor=${o?"ffffff":"000000"}&margin=0`}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs md:text-sm",children:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _244 => _244.qrCodeScanText]), () => (B.qrCodeScanText))})]})})]})]}):null}var _reactphonenumberinput = require('react-phone-number-input');var _reactlabel = require('@radix-ui/react-label');function ao({submit:t,isLoading:e,errMsg:a,emailLack:r,warnMsg:n,isSubmited:o,agreementLack:i,showPhoneInput:c=!1,agreementText:l,className:u,texts:s}){let[f,v]=_react.useState.call(void 0, ""),[m,g]=_react.useState.call(void 0, ""),[p,S]=_react.useState.call(void 0, !1),[R]=_react3.useAutoAnimate.call(void 0, );function h(y){y.preventDefault(),t(f,m,p)}return _jsxruntime.jsxs.call(void 0, "form",{ref:R,onSubmit:h,className:_chunkN3B25GTYjs.g.call(void 0, "flex flex-col gap-3 text-left",_optionalChain([u, 'optionalAccess', _245 => _245.formContainer])),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 text-left",children:[_jsxruntime.jsx.call(void 0, _reactlabel.Label,{className:"text-sm",htmlFor:"bts-notifications-form-email",children:_nullishCoalesce(_optionalChain([s, 'optionalAccess', _246 => _246.formEmailLabel]), () => (B.formEmailLabel))}),_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.r,{value:f,onChange:y=>{v(y.currentTarget.value)},id:"bts-notifications-form-email",className:_chunkN3B25GTYjs.g.call(void 0, r===!0?"border-red-400":""),type:"email",placeholder:_nullishCoalesce(_optionalChain([s, 'optionalAccess', _247 => _247.formEmailPlaceholder]), () => (B.formEmailPlaceholder))})]}),c&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 text-left",children:[_jsxruntime.jsxs.call(void 0, _reactlabel.Label,{className:"text-sm",htmlFor:"bts-notifications-form-phone",children:[_nullishCoalesce(_optionalChain([s, 'optionalAccess', _248 => _248.formPhoneLabel]), () => (B.formPhoneLabel))," ",_jsxruntime.jsx.call(void 0, "span",{className:"text-neutral-500 dark:text-neutral-500",children:_nullishCoalesce(_optionalChain([s, 'optionalAccess', _249 => _249.formPhoneOptional]), () => (B.formPhoneOptional))})]}),_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.r,{value:m,onChange:y=>{g(y.currentTarget.value)},id:"bts-notifications-form-phone",className:"",type:"tel",autoComplete:"tel",autoCorrect:"off",placeholder:_nullishCoalesce(_optionalChain([s, 'optionalAccess', _250 => _250.formPhonePlaceholder]), () => (B.formPhonePlaceholder))})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start gap-x-1.5",children:[_jsxruntime.jsx.call(void 0, "input",{className:"cursor-pointer",id:"bts-notifications-form-marketing-consent",type:"checkbox",checked:p,onChange:()=>{S(!p)}}),_jsxruntime.jsx.call(void 0, "label",{htmlFor:"bts-notifications-form-marketing-consent",className:_chunkN3B25GTYjs.g.call(void 0, "cursor-pointer text-xs leading-4 transition-colors md:text-sm md:leading-4",i===!0?"text-yellow-700":""),children:l})]}),a.length>0&&_jsxruntime.jsxs.call(void 0, "p",{className:"mb-3 flex items-center gap-1 text-sm text-red-400",children:[_jsxruntime.jsx.call(void 0, _lucidereact.TriangleAlertIcon,{color:"#ff6467",size:16})," ",a]}),n.length>0&&_jsxruntime.jsxs.call(void 0, "p",{className:"mb-3 flex items-center gap-1 text-sm text-amber-400",children:[_jsxruntime.jsx.call(void 0, _lucidereact.CircleAlertIcon,{color:"var(--color-amber-400)",size:16})," ",n]}),o==!1&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-start",children:_jsxruntime.jsxs.call(void 0, _chunk5OCGXVLCjs.q,{variant:"default",disabled:e,className:_chunkN3B25GTYjs.g.call(void 0, e?"cursor-not-allowed text-transparent":"","relative"),children:[_nullishCoalesce(_optionalChain([s, 'optionalAccess', _251 => _251.formSubmitButton]), () => (B.formSubmitButton)),e&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{})})]})}),o&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3 text-sm text-green-400",children:[_jsxruntime.jsx.call(void 0, _lucidereact.CheckCircleIcon,{size:16})," ",_nullishCoalesce(_optionalChain([s, 'optionalAccess', _252 => _252.formSuccessMessage]), () => (B.formSuccessMessage))]})]})}var bc=/^(([^<>()\[\]\\.,;:\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,}))$/;function ro({groups:t,onToggle:e,onCheckAll:a,slug:r,showPhoneInput:n=!1,agreementText:o,className:i,texts:c,isUpdating:l,wasChanged:u,onSuccess:s}){let[f,v]=_react.useState.call(void 0, ""),[m,g]=_react.useState.call(void 0, ""),[p,S]=_react.useState.call(void 0, !1),[R,h]=_react.useState.call(void 0, !1),[y,A]=_react.useState.call(void 0, !1),{mutateAsync:k,isPending:E}=_chunk5OCGXVLCjs.m.call(void 0, _chunk5OCGXVLCjs.k.notifications.createNotificationUser);function D(P){return P==null?!1:_reactphonenumberinput.isValidPhoneNumber.call(void 0, P,"PL")}async function I(P,w,U){if(v(""),g(""),A(!1),S(!1),h(!1),!U){h(!0),v("Zgoda w tym przypadku jest wymagana.");return}if(bc.test(P)===!1){v("Email jest nieprawid\u0142owy."),A(!0);return}w.length>0&&D(w)===!1&&g("Numer telefonu mo\u017Ce by\u0107 nieprawid\u0142owy. Zapisali\u015Bmy go ale je\u015Bli jest nieprawid\u0142owy to wpisz jeszcze raz i kliknij przycisk.");try{let b=await k({slug:r,email:P,phone:w,groups:t.filter(C=>C.isOn==!0).map(C=>C.id),mobileNotificationEnabled:!0,emailNotificationEnabled:!0,smsNotificationEnabled:!0});if(b.result.case==="success"){S(!0),setTimeout(()=>{_optionalChain([s, 'optionalCall', _253 => _253(!1,b.userId,b.accessToken)])},1e3);return}else{S(!0);let C=b.result.value;if(C!=null){if(C==32){_optionalChain([s, 'optionalCall', _254 => _254(!0,void 0,void 0)]);return}console.log(`Code error: ${_chunk5OCGXVLCjs.g[C]}`),v("Wyst\u0105pi\u0142 b\u0142\u0105d: "+_chunk5OCGXVLCjs.g[C]);return}return}}catch(b){v("Wyst\u0105pi\u0142 b\u0142\u0105d podczas zapisywania. Spr\xF3buj ponownie."),console.log(`Error: ${b}`)}}let T=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _255 => _255.formTitle]), () => (B.formTitle));return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([i, 'optionalAccess', _256 => _256.formSection])),children:[T.length>0&&_jsxruntime.jsx.call(void 0, "h3",{className:_chunkN3B25GTYjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([i, 'optionalAccess', _257 => _257.formTitle])),children:T}),_jsxruntime.jsx.call(void 0, pa,{groups:t,isManaging:!1,onToggle:_nullishCoalesce(e, () => ((()=>{}))),onCheckAll:_nullishCoalesce(a, () => ((()=>{}))),isUpdating:_nullishCoalesce(l, () => (!1)),wasChanged:_nullishCoalesce(u, () => (!1)),isUserGroupsUpdated:!1,className:i,texts:c}),_jsxruntime.jsx.call(void 0, ao,{errMsg:f,emailLack:y,warnMsg:m,submit:I,isLoading:E,isSubmited:p,agreementLack:R,showPhoneInput:n,agreementText:_nullishCoalesce(_nullishCoalesce(o, () => (_optionalChain([c, 'optionalAccess', _258 => _258.agreementText]))), () => (B.agreementText)),className:i,texts:c})]})}var _usedebounce = require('use-debounce');function oo({open:t,onOpenChange:e,onConfirm:a,isDeleting:r=!1}){let[n,o]=_react.useState.call(void 0, !1);if(_react.useEffect.call(void 0, ()=>(o(!0),()=>o(!1)),[]),_react.useEffect.call(void 0, ()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),!n||!t)return null;let i=l=>{l.target===l.currentTarget&&e(!1)},c=()=>{a()};return _reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, "div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 p-4",onClick:i,children:_jsxruntime.jsxs.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "relative w-full max-w-md rounded-2xl bg-white p-6 shadow-lg","dark:bg-neutral-800","animate-in fade-in-0 zoom-in-95 duration-200"),onClick:l=>l.stopPropagation(),children:[_jsxruntime.jsxs.call(void 0, "button",{onClick:()=>e(!1),className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 disabled:pointer-events-none dark:ring-offset-neutral-950 dark:focus:ring-neutral-300",disabled:r,children:[_jsxruntime.jsx.call(void 0, _lucidereact.XIcon,{className:"h-4 w-4"}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Zamknij"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-4",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start gap-3",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex-shrink-0",children:_jsxruntime.jsx.call(void 0, _lucidereact.TriangleAlertIcon,{className:"h-6 w-6 text-amber-500","aria-hidden":"true"})}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1",children:_jsxruntime.jsx.call(void 0, "h2",{className:"text-lg font-semibold text-black dark:text-neutral-100",children:"Czy na pewno chcesz si\u0119 wypisa\u0107?"})})]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:"Klikni\u0119cie tego przycisku spowoduje wypisanie z wszelkich powiadomie\u0144 i grup, kt\xF3re zapisa\u0142e\u015B."}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{type:"button",variant:"ghost",onClick:()=>e(!1),disabled:r,className:"sm:min-w-[100px]",children:"Anuluj"}),_jsxruntime.jsxs.call(void 0, _chunk5OCGXVLCjs.q,{type:"button",variant:"destructive",onClick:c,disabled:r,className:_chunkN3B25GTYjs.g.call(void 0, r&&"cursor-not-allowed text-transparent","relative sm:min-w-[100px]"),children:["Usu\u0144",r&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"})})]})]})]})]})}),document.body)}function so({accessToken:t,slug:e,userID:a,className:r,texts:n}){let[o]=_react3.useAutoAnimate.call(void 0, ),[i]=_react3.useAutoAnimate.call(void 0, ),{mutateAsync:c,isPending:l}=_chunk5OCGXVLCjs.m.call(void 0, _chunk5OCGXVLCjs.k.notifications.deleteNotificationUser),{mutateAsync:u,isPending:s}=_chunk5OCGXVLCjs.m.call(void 0, _chunk5OCGXVLCjs.k.notifications.updateNotificationUser),{data:f,isFetching:v}=_chunk5OCGXVLCjs.l.call(void 0, _chunk5OCGXVLCjs.k.notifications.getNotificationUserSettings,{userId:a,slug:e,accessToken:t}),[m,g]=_react.useState.call(void 0, !1),[p,S]=_react.useState.call(void 0, !1),[R,h]=_react.useState.call(void 0, !1),[y,A]=_react.useState.call(void 0, !1),[k,E]=_react.useState.call(void 0, !1),D=_optionalChain([f, 'optionalAccess', _259 => _259.result, 'access', _260 => _260.case])==="success"?_optionalChain([f, 'optionalAccess', _261 => _261.result, 'optionalAccess', _262 => _262.value]):void 0;function I(){E(!0)}async function T(){await c({accessToken:t,slug:e,userId:a}),E(!1)}async function P(){await u({accessToken:t,slug:e,notificationUserId:a,mobileNotificationEnabled:y,emailNotificationEnabled:m,smsNotificationEnabled:p}),h(!0),setTimeout(()=>{h(!1)},3e3)}let w=_usedebounce.useDebouncedCallback.call(void 0, b=>{P()},300);_react.useEffect.call(void 0, ()=>{let b=_optionalChain([f, 'optionalAccess', _263 => _263.result, 'access', _264 => _264.case])==="success"?_optionalChain([f, 'optionalAccess', _265 => _265.result, 'optionalAccess', _266 => _266.value]):void 0;g(_nullishCoalesce(_optionalChain([b, 'optionalAccess', _267 => _267.emailNotificationEnabled]), () => (!1))),S(_nullishCoalesce(_optionalChain([b, 'optionalAccess', _268 => _268.smsNotificationEnabled]), () => (!1))),A(_nullishCoalesce(_optionalChain([b, 'optionalAccess', _269 => _269.mobileNotificationEnabled]), () => (!1)))},[f]);function U(b,C){b==="email"&&g(C),b==="phone"&&S(C),b==="push"&&A(C),w(!0)}return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "bg-beige-100 rounded-xl p-4 dark:bg-neutral-700",_optionalChain([r, 'optionalAccess', _270 => _270.manageDataSection])),children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-start",children:_jsxruntime.jsx.call(void 0, "h3",{className:_chunkN3B25GTYjs.g.call(void 0, "mb-3 text-base font-medium lg:text-lg",_optionalChain([r, 'optionalAccess', _271 => _271.manageDataTitle])),children:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _272 => _272.manageDataTitle]), () => (B.manageDataTitle))})}),v?_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.u,{className:"h-64 w-full"}):_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.b,{ref:i,className:_chunkN3B25GTYjs.g.call(void 0, s&&"relative"),children:[_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.c,{children:_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.d,{children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-left",children:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _273 => _273.manageDataDescription]), () => (B.manageDataDescription))})})}),_jsxruntime.jsxs.call(void 0, _chunk7BG22YBFjs.e,{ref:o,children:[_jsxruntime.jsx.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, s&&"opacity-50 pointer-events-none","flex flex-col gap-2"),children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-5 gap-x-2",children:[_optionalChain([D, 'optionalAccess', _274 => _274.emailNotificationAvailable])&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, he,{id:"email-enabled",className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-600",checked:m,onCheckedChange:()=>{U("email",!m)}}),_jsxruntime.jsx.call(void 0, _reactlabel.Label,{htmlFor:"email-enabled",className:"text-sm",children:"Email"})]}),_optionalChain([D, 'optionalAccess', _275 => _275.smsNotificationAvailable])&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, he,{id:"sms-enabled",className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-600",checked:p,onCheckedChange:()=>{U("phone",!p)}}),_jsxruntime.jsx.call(void 0, _reactlabel.Label,{htmlFor:"sms-enabled",className:"text-sm",children:"SMS"})]}),_optionalChain([D, 'optionalAccess', _276 => _276.mobileNotificationAvailable])&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, he,{id:"push-enabled",className:"data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-600",checked:y,onCheckedChange:()=>{U("push",!y)}}),_jsxruntime.jsx.call(void 0, _reactlabel.Label,{htmlFor:"push-enabled",className:"text-sm",children:"Powiadomienia na telefon"})]}),_optionalChain([D, 'optionalAccess', _277 => _277.hasUserInstalledApp])===!1&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, _lucidereact.MessageCircleWarningIcon,{color:"var(--color-amber-500)",size:26}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-amber-500",children:"Wygl\u0105da na to, \u017Ce nie masz zainstalowanej aplikacji mobilnej. Zainstaluj i wyra\u017A zgod\u0119 na otrzymywanie powiadomie\u0144 na telefon."})]})]})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"mt-5 flex flex-col gap-2 text-left",children:[_jsxruntime.jsx.call(void 0, "hr",{}),R&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-green-500",children:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _278 => _278.manageDataUpdatedMessage]), () => (B.manageDataUpdatedMessage))}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-x-2",children:_jsxruntime.jsxs.call(void 0, _chunk5OCGXVLCjs.q,{size:"sm",variant:"link",className:_chunkN3B25GTYjs.g.call(void 0, "pl-0 ml-0",l&&"cursor-not-allowed"),onClick:I,children:[_nullishCoalesce(_optionalChain([n, 'optionalAccess', _279 => _279.manageDataUnsubscribeButton]), () => (B.manageDataUnsubscribeButton)),l&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{})})]})})]})]}),s&&_jsxruntime.jsx.call(void 0, "div",{className:"bg-black/30 absolute inset-0 rounded-xl",children:_jsxruntime.jsx.call(void 0, "div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{})})})]}),_jsxruntime.jsx.call(void 0, oo,{open:k,onOpenChange:E,onConfirm:T,isDeleting:l})]})}function co({...t}){return _jsxruntime.jsx.call(void 0, it.Root,{"data-slot":"dialog",...t})}function Sc({...t}){return _jsxruntime.jsx.call(void 0, it.Portal,{"data-slot":"dialog-portal",...t})}function Ic({className:t,...e}){return _jsxruntime.jsx.call(void 0, it.Overlay,{"data-slot":"dialog-overlay",className:_chunkN3B25GTYjs.g.call(void 0, "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function lo({className:t,children:e,showCloseButton:a=!0,...r}){return _jsxruntime.jsxs.call(void 0, Sc,{"data-slot":"dialog-portal",children:[_jsxruntime.jsx.call(void 0, Ic,{}),_jsxruntime.jsxs.call(void 0, it.Content,{"data-slot":"dialog-content",className:_chunkN3B25GTYjs.g.call(void 0, "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...r,children:[e,a&&_jsxruntime.jsxs.call(void 0, it.Close,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[_jsxruntime.jsx.call(void 0, _lucidereact.XIcon,{}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Close"})]})]})]})}function po({className:t,...e}){return _jsxruntime.jsx.call(void 0, it.Title,{"data-slot":"dialog-title",className:_chunkN3B25GTYjs.g.call(void 0, "text-lg leading-none font-semibold",t),...e})}function uo({className:t,...e}){return _jsxruntime.jsx.call(void 0, it.Description,{"data-slot":"dialog-description",className:_chunkN3B25GTYjs.g.call(void 0, "text-muted-foreground text-sm",t),...e})}var _connect = require('@connectrpc/connect');function go(t,e="pl"){let a=t.loginCodeSentMessage,r={emailLabel:t.loginEmailLabel,emailPlaceholder:t.loginEmailPlaceholder,sendCode:t.loginSendCodeButton,sending:t.loginSendingButton,invalidEmail:t.loginInvalidEmailError,codeSentTo:a!=null?`${a} {email}.`:void 0,changeEmail:t.loginChangeEmailButton,verify:t.loginVerifyButton,spamHint:t.loginSpamHint,validity:t.loginValidityHint,resend:t.loginResendCodeButton,resendIn:t.loginResendInText,resent:t.loginResentMessage,haveCodePrompt:"",haveCode:t.loginIHaveCode,wrongCode:t.loginInvalidCodeError,expired:t.loginExpiredError,tooManyAttempts:t.loginTooManyAttemptsError,rateLimited:t.loginRateLimitedError,network:t.loginNetworkError,generic:t.loginVerifyCodeError,deliveryFailed:t.loginSendEmailError,verifying:t.loginVerifyingButton,stepEmail:t.loginStepEmailHint,stepCode:t.loginStepCodeHint,alreadySent:t.loginAlreadySentMessage,emailNotFound:t.loginEmailNotFoundError,deliveryUnavailable:t.loginDeliveryUnavailableError,resendNew:t.loginResendNewCodeButton,noCode:t.loginNoCodeButton,codeIncomplete:t.loginCodeIncompleteError};return _chunkAHISXVEEjs.h.call(void 0, e,r)}function bo(t){let e=_connect.ConnectError.from(t),a=e.rawMessage||e.message;return e.code===_connect.Code.ResourceExhausted?/too many attempts/i.test(a)?"tooManyAttempts":"rateLimited":/invalid code/i.test(a)?"wrongCode":/expired/i.test(a)?"expired":e.code===_connect.Code.Unavailable?"unknown":_chunkAHISXVEEjs.a.call(void 0, t)}function fo(t,e,a){return{async send(r,{resend:n}){if(!e)return{ok:!1,kind:"unknown",message:a.loginSlugRequiredError};try{let o=await t({email:r,slug:e});return o.ok===!1?o.retryIn!=null&&o.retryIn>0?{ok:!1,kind:"rateLimited",retryIn:o.retryIn}:{ok:!1,kind:"deliveryFailed",message:n?a.loginResendEmailError:a.loginSendEmailError}:o.sent===!1?{ok:!1,kind:"alreadySent",retryIn:o.retryIn||void 0}:{ok:!0,retryIn:o.retryIn||void 0}}catch(o){let i=bo(o);return{ok:!1,kind:i,cause:o,message:i==="unknown"?n?a.loginResendEmailError:a.loginSendEmailError:void 0}}},async verify({email:r,code:n}){try{let o=await t({email:r,code:n,slug:e});return o.ok&&o.accessToken?{ok:!0,value:{userId:o.userId,accessToken:o.accessToken}}:{ok:!1,kind:"wrongCode",message:a.loginVerificationFailedError}}catch(o){return{ok:!1,kind:bo(o),cause:o}}}}}function Ac({slug:t,onSuccess:e,onError:a,texts:r,projectName:n,projectLogo:o,projectLogoDark:i,showLogo:c}){let[l]=_react3.useAutoAnimate.call(void 0, ),{mutateAsync:u}=_chunk5OCGXVLCjs.m.call(void 0, _chunk5OCGXVLCjs.k.notifications.verifyUserEmail),s=_react.useMemo.call(void 0, ()=>go(r),[r]),[f,v]=s.codeSentTo.split("{email}"),m=_react.useRef.call(void 0, a);m.current=a;let g=_react.useMemo.call(void 0, ()=>{let h=fo(y=>u(y),t,r);return{...h,async verify(y){let A=await h.verify(y);return!A.ok&&A.kind==="wrongCode"&&_optionalChain([m, 'access', _280 => _280.current, 'optionalCall', _281 => _281(A.cause instanceof Error?A.cause:new Error(_nullishCoalesce(A.message, () => ("wrongCode"))))]),A}}},[u,t,r]),p=_chunkAHISXVEEjs.j.call(void 0, {adapter:g,texts:s,storageKey:t?_chunkAHISXVEEjs.f.call(void 0, "notifications",t):void 0,onVerified:({userId:h,accessToken:y})=>_optionalChain([e, 'optionalCall', _282 => _282(h,y)]),onFailure:(h,y)=>_optionalChain([a, 'optionalCall', _283 => _283(y instanceof Error?y:new Error(h))])}),S=p.step==="code",R=S&&!p.needsEmail?_nullishCoalesce(r.loginCodeLabel, () => ("")):_nullishCoalesce(r.loginTitle, () => (""));return _jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full flex-col",children:[_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.c,{projectId:t,name:n,showLogo:c,logoUrl:o,logoDarkUrl:i,className:"text-foreground mb-3"}),_jsxruntime.jsxs.call(void 0, "div",{ref:l,className:"mb-2 flex items-start gap-2",children:[S&&_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{type:"button",variant:"ghost",size:"icon-sm",className:"-mt-2 -ml-2 size-11 shrink-0","aria-label":s.changeEmail,disabled:p.isBusy,onClick:p.changeEmail,children:_jsxruntime.jsx.call(void 0, _lucidereact.ArrowLeft,{className:"h-5 w-5","aria-hidden":!0})}),_jsxruntime.jsx.call(void 0, po,{className:"text-lg leading-6 font-semibold",children:R})]}),_jsxruntime.jsx.call(void 0, uo,{className:S?"sr-only":"mb-4",children:S?`${f}${p.email}${_nullishCoalesce(v, () => (""))}`:_nullishCoalesce(r.loginDescription, () => (""))}),_jsxruntime.jsx.call(void 0, _chunk7BG22YBFjs.f,{login:p,texts:s})]})}function yo({slug:t,onSuccess:e,onError:a,className:r,isOpen:n,onClose:o,texts:i,projectName:c,projectLogo:l,projectLogoDark:u,showLogo:s}){return _jsxruntime.jsx.call(void 0, co,{open:n,onOpenChange:o,children:_jsxruntime.jsx.call(void 0, lo,{className:"max-h-[100dvh] overflow-y-auto sm:max-w-[425px]",children:_jsxruntime.jsx.call(void 0, Ac,{slug:t,onSuccess:e,onError:a,texts:i,projectName:c,projectLogo:l,projectLogoDark:u,showLogo:s})})})}function Oc(t,e){switch(e.type){case"SET_IS_LOGGED_IN":return{...t,isLoggedIn:e.value};case"SET_USER_ID":return{...t,userID:e.value};case"SET_LOADING":return{...t,isLoading:e.value};case"SET_PUBLIC_GROUPS":return{...t,groupsProvided:e.value,groups:e.value!=null&&e.value.length>0?t.groups.filter(a=>_optionalChain([e, 'access', _284 => _284.value, 'optionalAccess', _285 => _285.find, 'call', _286 => _286(r=>r.id===a.id)])!=null):t.groups};case"SET_GROUPS":{let a=t.isLoggedIn==!1||t.groupsProvided!=null,r=e.value.map(n=>t.isLoggedIn==!0?n:{...n,isOn:_nullishCoalesce(_optionalChain([t, 'access', _287 => _287.groupsProvided, 'optionalAccess', _288 => _288.find, 'call', _289 => _289(o=>o.id===n.id), 'optionalAccess', _290 => _290.isOn]), () => (a))});return{...t,groups:r}}case"TOGGLE_GROUP":{let a=t.groups.map(r=>r.id===e.groupID?{...r,isOn:!r.isOn}:r);return{...t,wasChanged:!0,groups:a}}case"CHECK_ALL_GROUPS":{let a=t.groups.map(r=>({...r,isOn:!0}));return{...t,groups:a,wasChanged:!0}}case"SET_WAS_CHANGED":return{...t,wasChanged:e.value};case"SET_IS_USER_GROUPS_UPDATED":return{...t,isUserGroupsUpdated:e.value};case"RESET_UPDATE_STATE":return{...t,wasChanged:!1,isUserGroupsUpdated:!0};case"SHOW_SETTINGS":return{...t,showSettings:!0};case"HIDE_SETTINGS":return{...t,showSettings:!1};default:return t}}function Mc({slug:t,userID:e,productID:a,projectID:r,analytics:n,projectName:o,projectLogo:i,projectLogoDark:c,showLoginLogo:l,groups:u,isManaging:s=!1,texts:f,showQRCode:v=!1,showPhoneInput:m=!1,hiddenGroupIds:g=[],className:p}){let[S]=_react3.useAutoAnimate.call(void 0, ),R=_chunkG4SEOVLDjs.n.call(void 0, _nullishCoalesce(r, () => (Ct())),n),h=_nullishCoalesce(_nullishCoalesce(t, () => (_chunk7BG22YBFjs.K.call(void 0, ))), () => ((typeof window<"u"?window.location.hostname:"")));_chunkAHISXVEEjs.b.call(void 0, h.trim(),l!==!1&&!i&&!c&&h.trim()!=="");let{mutateAsync:y,isPending:A}=_chunk5OCGXVLCjs.m.call(void 0, _chunk5OCGXVLCjs.k.notifications.updateUserGroups),{data:k,refetch:E}=_reactquery.useQuery.call(void 0, {queryKey:["notifications_accessToken"],queryFn:()=>{if(typeof window<"u")return{accessToken:_nullishCoalesce(localStorage.getItem("notifications_accessToken"), () => (void 0)),userID:_nullishCoalesce(localStorage.getItem("notifications_userID"), () => (void 0))}}}),{data:D,isPending:I,refetch:T}=_chunk5OCGXVLCjs.l.call(void 0, _chunk5OCGXVLCjs.k.notifications.getUserGroups,{slug:h,accessToken:_optionalChain([k, 'optionalAccess', _291 => _291.accessToken])}),[P,w]=_react.useReducer.call(void 0, Oc,{isLoading:I,isUserGroupsUpdated:!1,wasChanged:!1,groupsProvided:u,groups:[],showSettings:k!=null&&s==!0,isLoggedIn:k!=null,userID:void 0});_react.useEffect.call(void 0, ()=>{w({type:"SET_LOADING",value:A||I})},[A,I]),_react.useEffect.call(void 0, ()=>{w({type:"SET_IS_LOGGED_IN",value:_optionalChain([k, 'optionalAccess', _292 => _292.accessToken])!=null}),w({type:"SET_USER_ID",value:_optionalChain([k, 'optionalAccess', _293 => _293.userID])}),_optionalChain([k, 'optionalAccess', _294 => _294.accessToken])!=null&&s==!0&&w({type:"SHOW_SETTINGS"})},[k,s]),_react.useEffect.call(void 0, ()=>{if(D==null)return;let W=D.groups.map(F=>{let V="rarely";switch(F.howOften){case 0:V="rarely";break;case 1:V="often";break;case 2:V="veryOften";break}return{id:F.id,name:F.name,description:F.description,howOften:V,isOn:_nullishCoalesce(F.isOn, () => (void 0))}});w({type:"SET_GROUPS",value:W})},[D,I,u]);let U=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{let W=_optionalChain([u, 'optionalAccess', _295 => _295.map, 'call', _296 => _296(F=>(F.id.startsWith("group_")||(F.id=`group_${F.id}`),F))]);w({type:"SET_PUBLIC_GROUPS",value:W})},[u]);let b={...B,...f};async function C(){await y({accessToken:_optionalChain([k, 'optionalAccess', _297 => _297.accessToken]),slug:h,userId:e,groupIds:P.groups.filter(W=>W.isOn===!0).map(W=>W.id)}),w({type:"RESET_UPDATE_STATE"}),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>{w({type:"SET_IS_USER_GROUPS_UPDATED",value:!1})},2e3)}function X(W){w({type:"TOGGLE_GROUP",groupID:W})}function yt(){w({type:"CHECK_ALL_GROUPS"})}function Ot(){w({type:"SHOW_SETTINGS"})}function O(){w({type:"HIDE_SETTINGS"})}function z(){localStorage.removeItem("notifications_accessToken"),localStorage.removeItem("notifications_userID"),E(),w({type:"SET_USER_ID",value:void 0}),w({type:"SET_IS_LOGGED_IN",value:!1}),w({type:"HIDE_SETTINGS"})}async function N(W,F){typeof window<"u"&&(localStorage.setItem("notifications_accessToken",F),W!=null&&localStorage.setItem("notifications_userID",W)),w({type:"SET_USER_ID",value:W});try{await E(),T().then().catch().finally(()=>{s==!0&&w({type:"SHOW_SETTINGS"})})}catch(V){console.log(`Error: ${V}`)}}_react.useEffect.call(void 0, ()=>()=>{U.current&&clearTimeout(U.current)},[]);let _=s==!0&&P.userID!=null&&_optionalChain([k, 'optionalAccess', _298 => _298.accessToken])!=null;return _jsxruntime.jsxs.call(void 0, "main",{className:_chunkN3B25GTYjs.g.call(void 0, "bitsnap-react relative",_optionalChain([p, 'optionalAccess', _299 => _299.container])),children:[b.title!=null&&_jsxruntime.jsx.call(void 0, "h1",{className:"text-2xl font-semibold text-black md:text-3xl lg:text-4xl xl:text-5xl dark:text-neutral-100",children:b.title}),!P.showSettings&&s&&_jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.q,{onClick:Ot,variant:"outline",size:"icon",className:"absolute bottom-6 right-6 z-50 h-12 w-12 rounded-full shadow-lg hover:shadow-xl md:bottom-8 md:right-8","aria-label":"Settings",children:_jsxruntime.jsx.call(void 0, _lucidereact.Settings,{className:"h-5 w-5"})}),_jsxruntime.jsx.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "md:pt8 relative z-0 mt-6 overflow-hidden rounded-2xl bg-white px-3 pt-6 pb-3 md:px-5 md:pb-5 dark:bg-neutral-800",_optionalChain([p, 'optionalAccess', _300 => _300.header])),children:P.showSettings?_jsxruntime.jsx.call(void 0, "div",{className:"space-y-6",children:P.isLoggedIn&&_jsxruntime.jsxs.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "grid grid-cols-1 gap-3 lg:gap-6",_?"md:grid-cols-2":""),children:[_jsxruntime.jsxs.call(void 0, "div",{className:_optionalChain([p, 'optionalAccess', _301 => _301.groupsContainer]),children:[_jsxruntime.jsx.call(void 0, Vn,{projectName:o,projectLogo:i,projectLogoDark:c,description:b.managingDescription,className:p,onLogout:z}),I&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center items-center py-8",children:_jsxruntime.jsx.call(void 0, _chunkAHISXVEEjs.e,{})}),_jsxruntime.jsx.call(void 0, pa,{groups:P.groups,hiddenGroupIds:g,isManaging:s,onToggle:X,onCheckAll:yt,onUpdate:C,isUpdating:A,wasChanged:P.wasChanged,isUserGroupsUpdated:P.isUserGroupsUpdated,className:p,texts:b})]}),_&&_jsxruntime.jsx.call(void 0, so,{accessToken:_nullishCoalesce(k.accessToken, () => ("")),slug:h,userID:_nullishCoalesce(P.userID, () => ("")),className:p,texts:b}),v!=!1&&_jsxruntime.jsx.call(void 0, to,{showQRCode:v,isManaging:!0,className:p,texts:b})]})}):_jsxruntime.jsx.call(void 0, "div",{className:_chunkN3B25GTYjs.g.call(void 0, "grid grid-cols-1 gap-3 lg:gap-6"),children:_jsxruntime.jsx.call(void 0, ro,{slug:h,onToggle:W=>{w({type:"TOGGLE_GROUP",groupID:W})},onCheckAll:()=>{w({type:"CHECK_ALL_GROUPS"})},onSuccess:(W,F,V)=>{R.track("availability_signup",{},{product_id:_nullishCoalesce(a, () => (null))}),V!=null&&N(F,V),W&&w({type:"SHOW_SETTINGS"})},groups:P.groups,showPhoneInput:m,agreementText:b.agreementText,className:p,texts:b,wasChanged:P.wasChanged,isUpdating:A})})}),_jsxruntime.jsx.call(void 0, yo,{isOpen:P.showSettings&&!P.isLoggedIn,slug:h,onSuccess:N,texts:b,onClose:O,projectName:o,projectLogo:i,projectLogoDark:c,showLogo:l})]})}function Bc({slug:t,userID:e,productID:a,projectID:r,analytics:n,projectName:o,projectLogo:i,projectLogoDark:c,showLoginLogo:l,groups:u,isManaging:s,texts:f,showQRCode:v,showPhoneInput:m,hiddenGroupIds:g,className:p}){return _jsxruntime.jsx.call(void 0, _chunk5OCGXVLCjs.p,{children:_jsxruntime.jsx.call(void 0, Mc,{slug:t,userID:e,productID:a,projectID:r,analytics:n,projectName:o,projectLogo:i,projectLogoDark:c,showLoginLogo:l,groups:u,isManaging:s,texts:f,showQRCode:v,showPhoneInput:m,hiddenGroupIds:g,className:p})})}var jc=Bc;exports.ApplePayButton = Sa; exports.Bitsnap = _chunk7BG22YBFjs.x; exports.BitsnapCheckout = $s; exports.BitsnapReturns = _chunkDR7WYI37js.a; exports.BitsnapReturnsProvider = _chunkAHISXVEEjs.v; exports.CHECKOUT_SLOT_NAMES = yi; exports.Environment = _chunk5OCGXVLCjs.i; exports.GooglePayButton = Va; exports.ITEM_IDS_NOT_FOUND = _chunk7BG22YBFjs.r; exports.InPostPayButton = Ss; exports.NotificationsComponent = jc; exports.PRODUCT_LIST_SLOT_NAMES = _chunkEOFJAQPTjs.a; exports.Panel = _chunk7BG22YBFjs.m; exports.PanelLogin = _chunk7BG22YBFjs.k; exports.PanelProvider = _chunk2XSLIZ27js.i; exports.ProductList = _chunkEOFJAQPTjs.d; exports.PublicOrderPage = _chunk7BG22YBFjs.l; exports.RETURNS_SLOT_NAMES = _chunkAHISXVEEjs.l; exports.ReturnsAppearanceProvider = _chunkAHISXVEEjs.m; exports.ReturnsCodeStep = _chunkAHISXVEEjs.E; exports.ReturnsConfirmation = _chunkAHISXVEEjs.H; exports.ReturnsEmailStep = _chunkAHISXVEEjs.D; exports.ReturnsMyReturnDetail = _chunkAHISXVEEjs.K; exports.ReturnsMyReturnsList = _chunkAHISXVEEjs.J; exports.ReturnsOrderDetail = _chunkAHISXVEEjs.G; exports.ReturnsOrderList = _chunkAHISXVEEjs.F; exports.ReturnsProvider = _chunkAHISXVEEjs.u; exports.ReturnsResult = _chunkAHISXVEEjs.I; exports.RevolutPayButton = Rs; exports.buildAccessTokenRedirect = _chunk7BG22YBFjs.j; exports.createCheckout = _chunk7BG22YBFjs.A; exports.createPaymentURL = _chunk7BG22YBFjs.z; exports.formatProductPrice = _chunkEOFJAQPTjs.b; exports.getAllowedReturnOrigins = _chunk2XSLIZ27js.h; exports.getLocale = _chunkQ337IQNAjs.f; exports.getPanelConfig = _chunk2XSLIZ27js.b; exports.getPaymentMethodChoice = _chunk7BG22YBFjs.y; exports.getReferenceIfPossible = _chunk7BG22YBFjs.B; exports.getReturnURLFromSearch = _chunk7BG22YBFjs.g; exports.injectReferenceToRequestIfNeeded = _chunk7BG22YBFjs.C; exports.persistReturnURL = _chunk7BG22YBFjs.h; exports.readPersistedReturnURL = _chunk7BG22YBFjs.i; exports.setAllowedReturnOrigins = _chunk2XSLIZ27js.g; exports.setCustomHost = _chunkN3B25GTYjs.f; exports.setHost = _chunk2XSLIZ27js.f; exports.setLocale = _chunkQ337IQNAjs.e; exports.setLoginURL = _chunk2XSLIZ27js.e; exports.setPanelConfig = _chunk2XSLIZ27js.a; exports.setPanelProjectID = _chunk2XSLIZ27js.c; exports.setProjectID = _chunk7BG22YBFjs.J; exports.setTheme = _chunk2XSLIZ27js.d; exports.useCreateReturn = _chunkAHISXVEEjs.z; exports.useMyReturn = _chunkAHISXVEEjs.B; exports.useMyReturns = _chunkAHISXVEEjs.A; exports.usePanelConfig = _chunk2XSLIZ27js.j; exports.useProducts = _chunkEOFJAQPTjs.c; exports.useReturnOrders = _chunkAHISXVEEjs.x; exports.useReturnSession = _chunkAHISXVEEjs.w; exports.useReturnableOrder = _chunkAHISXVEEjs.y; exports.useReturnsAppearance = _chunkAHISXVEEjs.n; exports.useReturnsSlot = _chunkAHISXVEEjs.o; exports.useReturnsText = _chunkAHISXVEEjs.r;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkYV2C276Hjs = require('./chunk-YV2C276H.js');var _chunkKHQEDQYFjs = require('./chunk-KHQEDQYF.js');var _chunkGJOGATP6js = require('./chunk-GJOGATP6.js');var _chunkBUYTK7KMjs = require('./chunk-BUYTK7KM.js');var _chunkGQ5OKU74js = require('./chunk-GQ5OKU74.js');require('./chunk-KOYBZORL.js');var _chunkNWXZ45TVjs = require('./chunk-NWXZ45TV.js');var _chunk2FD2QP4Yjs = require('./chunk-2FD2QP4Y.js');require('./chunk-MWWEPEU2.js');var _chunkMDAFPGPAjs = require('./chunk-MDAFPGPA.js');require('./chunk-LGPNJ5XE.js');var _chunkDOJICJCQjs = require('./chunk-DOJICJCQ.js');require('./chunk-D2ASWUXM.js');require('./chunk-W3RGQYPD.js');var _chunkQ337IQNAjs = require('./chunk-Q337IQNA.js');require('./chunk-JSDGZ4NY.js');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var n=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./chat.js"))).then(t=>({default:t.ChatThread}))),o=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./chat.js"))).then(t=>({default:t.Channel})));function i(){return _jsxruntime.jsx.call(void 0, "div",{className:"bitsnap-react h-full",children:_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true",className:"h-full min-h-[28rem] w-full rounded-xl border border-neutral-200 bg-white motion-safe:animate-pulse dark:border-neutral-800 dark:bg-neutral-900"})})}function c(t){return _jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:_jsxruntime.jsx.call(void 0, i,{}),children:_jsxruntime.jsx.call(void 0, n,{...t})})}function s(t){return _jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:_jsxruntime.jsx.call(void 0, i,{}),children:_jsxruntime.jsx.call(void 0, o,{...t})})}exports.ApplePayButton = _chunkYV2C276Hjs.e; exports.Bitsnap = _chunkKHQEDQYFjs.s; exports.BitsnapCheckout = _chunkYV2C276Hjs.d; exports.BitsnapReturns = _chunkGJOGATP6js.a; exports.BitsnapReturnsProvider = _chunkBUYTK7KMjs.v; exports.CHECKOUT_SLOT_NAMES = _chunkYV2C276Hjs.a; exports.Channel = s; exports.ChatThread = c; exports.Environment = _chunk2FD2QP4Yjs.c; exports.GooglePayButton = _chunkYV2C276Hjs.f; exports.ITEM_IDS_NOT_FOUND = _chunkKHQEDQYFjs.m; exports.InPostPayButton = _chunkYV2C276Hjs.b; exports.NotificationsComponent = _chunkYV2C276Hjs.g; exports.PRODUCT_LIST_SLOT_NAMES = _chunkGQ5OKU74js.a; exports.Panel = _chunkKHQEDQYFjs.G; exports.PanelLogin = _chunkKHQEDQYFjs.k; exports.PanelProvider = _chunkNWXZ45TVjs.a; exports.ProductList = _chunkGQ5OKU74js.d; exports.PublicOrderPage = _chunkKHQEDQYFjs.F; exports.RETURNS_SLOT_NAMES = _chunkBUYTK7KMjs.l; exports.ReturnsAppearanceProvider = _chunkBUYTK7KMjs.m; exports.ReturnsCodeStep = _chunkBUYTK7KMjs.E; exports.ReturnsConfirmation = _chunkBUYTK7KMjs.H; exports.ReturnsEmailStep = _chunkBUYTK7KMjs.D; exports.ReturnsMyReturnDetail = _chunkBUYTK7KMjs.K; exports.ReturnsMyReturnsList = _chunkBUYTK7KMjs.J; exports.ReturnsOrderDetail = _chunkBUYTK7KMjs.G; exports.ReturnsOrderList = _chunkBUYTK7KMjs.F; exports.ReturnsProvider = _chunkBUYTK7KMjs.u; exports.ReturnsResult = _chunkBUYTK7KMjs.I; exports.RevolutPayButton = _chunkYV2C276Hjs.c; exports.buildAccessTokenRedirect = _chunkKHQEDQYFjs.j; exports.createCheckout = _chunkKHQEDQYFjs.v; exports.createPaymentURL = _chunkKHQEDQYFjs.u; exports.formatProductPrice = _chunkGQ5OKU74js.b; exports.getAllowedReturnOrigins = _chunkMDAFPGPAjs.h; exports.getLocale = _chunkQ337IQNAjs.f; exports.getPanelConfig = _chunkMDAFPGPAjs.b; exports.getPaymentMethodChoice = _chunkKHQEDQYFjs.t; exports.getReferenceIfPossible = _chunkKHQEDQYFjs.w; exports.getReturnURLFromSearch = _chunkKHQEDQYFjs.g; exports.injectReferenceToRequestIfNeeded = _chunkKHQEDQYFjs.x; exports.persistReturnURL = _chunkKHQEDQYFjs.h; exports.readPersistedReturnURL = _chunkKHQEDQYFjs.i; exports.setAllowedReturnOrigins = _chunkMDAFPGPAjs.g; exports.setCustomHost = _chunkDOJICJCQjs.f; exports.setHost = _chunkMDAFPGPAjs.f; exports.setLocale = _chunkQ337IQNAjs.e; exports.setLoginURL = _chunkMDAFPGPAjs.e; exports.setPanelConfig = _chunkMDAFPGPAjs.a; exports.setPanelProjectID = _chunkMDAFPGPAjs.c; exports.setProjectID = _chunkKHQEDQYFjs.J; exports.setTheme = _chunkMDAFPGPAjs.d; exports.useCreateReturn = _chunkBUYTK7KMjs.z; exports.useMyReturn = _chunkBUYTK7KMjs.B; exports.useMyReturns = _chunkBUYTK7KMjs.A; exports.usePanelConfig = _chunkNWXZ45TVjs.b; exports.useProducts = _chunkGQ5OKU74js.c; exports.useReturnOrders = _chunkBUYTK7KMjs.x; exports.useReturnSession = _chunkBUYTK7KMjs.w; exports.useReturnableOrder = _chunkBUYTK7KMjs.y; exports.useReturnsAppearance = _chunkBUYTK7KMjs.n; exports.useReturnsSlot = _chunkBUYTK7KMjs.o; exports.useReturnsText = _chunkBUYTK7KMjs.r;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/user/bitsnap-react-payment-release/dist/index.js","../src/components/checkout/ApplePay.tsx","../src/components/checkout/project-id.ts"],"names":["currentProjectID","getProjectID","ApplePayButton","ApplePayButtonModule","ApplePayButtonComponent","style","buttonType","colorType","items","onClick","checkIfApplePayIsAvailable","getApplePayPaymentRequest","completeApplePayPayment","setCountry","setCouponCodeIfPossible","setDeliveryMethod","setEmail","setPostalCode","clearCart","getApplePayPreview","useCartProvider","instrument","useInstrumentContext","paymentForCartText","useCheckoutText","isApplePayAvailable","useQuery","itemsKey","el"],"mappings":"AAAA,goDAA8Z,sDAAyC,sDAAyQ,sDAAiE,sDAAiD,sDAAiH,sDAAwG,sDAAgE,sDAAiE,sDAAyD,+BAA4B,+BAA4B,kHCA5uC,SCGjBA,EAAAA,CAAAA,CAAuC,CACrD,GAAI,CACF,OAAOC,gCAAAA,CACT,CAAA,UAAQ,CACN,MACF,CACF,CDEA,mDAAyB,+CAmWrB,IAvVEC,EAAAA,kBACHC,wBAAAA,CACE,OAAA,SAAWA,0BAAAA,CAmDhB,SAASC,EAAAA,CAAwB,CAC/B,KAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CACF,CAAA,CAAU,CACR,GAAM,CACJ,0BAAA,CAAAC,CAAAA,CACA,yBAAA,CAAAC,CAAAA,CACA,uBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,uBAAA,CAAAC,CAAAA,CACA,iBAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,kBAAA,CAAAC,CACF,CAAA,CAAIC,gCAAAA,CAAgB,CACdC,CAAAA,CAAaC,gCAAAA,CAAqB,CAClCC,CAAAA,CAAqBC,gCAAAA,gBAAgC,CAAA,CACrD,CAAE,IAAA,CAAMC,CAAoB,CAAA,CAAIC,kCAAAA,CACpC,QAAA,CAAU,CAAC,wBAAwB,CAAA,CACnC,OAAA,CAAShB,CACX,CAAC,CAAA,CACKiB,CAAAA,CAAWnB,CAAAA,CAAM,GAAA,CAAKoB,CAAAA,EAAO,CAAA,EAAA","file":"/home/user/bitsnap-react-payment-release/dist/index.js","sourcesContent":[null,"import ApplePayButtonModule from \"apple-pay-button\";\nimport { PublicApiClient } from \"src/public.api.client\";\nimport CartProvider, {\n getCheckoutSelection,\n getProjectID,\n useCartProvider,\n} from \"./CartProvider\";\nimport { HOST } from \"./constants\";\nimport { isErr } from \"./lib/err\";\nimport { currentProjectID } from \"./project-id\";\nimport { round } from \"./lib/round.number\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { sendAnalyticEvent } from \"./frontent.analytics\";\nimport { useCheckoutText } from \"./texts.context\";\nimport {\n InstrumentProvider,\n useInstrument,\n useInstrumentContext,\n type AnalyticsOption,\n} from \"@/src/analytics/instrument\";\n\n// A CommonJS package with a `default` export: bundlers unwrap it, Node's own\n// ESM loader (server rendering of the unbundled library) does not.\nconst ApplePayButton: typeof ApplePayButtonModule =\n (ApplePayButtonModule as unknown as { default?: typeof ApplePayButtonModule })\n .default ?? ApplePayButtonModule;\n\ntype AppleButtonType =\n | \"plain\"\n | \"add-money\"\n | \"book\"\n | \"buy\"\n | \"check-out\"\n | \"continue\"\n | \"contribute\"\n | \"donate\"\n | \"order\"\n | \"pay\"\n | \"reload\"\n | \"rent\"\n | \"set-up\"\n | \"subscribe\"\n | \"support\"\n | \"tip\"\n | \"top-up\";\ntype ColorType = \"black\" | \"white\" | \"white-outline\";\n\nexport type Props = {\n style?: {\n width?: string;\n height?: string;\n borderRadius?: string;\n padding?: string;\n boxSizing?: string;\n };\n buttonType?: AppleButtonType;\n colorType?: ColorType;\n items: {\n name: string;\n id: string;\n price: number;\n /** Currency of `price` (minor units); defaults to PLN. */\n currency?: string;\n quantity: number;\n isDeliverable?: boolean;\n metadata?: { [key: string]: string | undefined };\n }[];\n onClick?: () => Promise<void>;\n /**\n * Usage statistics for your Bitsnap dashboard (Apple Pay clicks and\n * results). On by default; `false` turns it off. Inside `<BitsnapCheckout>`\n * the checkout's setting applies unless this is given.\n */\n analytics?: AnalyticsOption;\n};\n\nfunction ApplePayButtonComponent({\n style,\n buttonType,\n colorType,\n items,\n onClick,\n}: Props) {\n const {\n checkIfApplePayIsAvailable,\n getApplePayPaymentRequest,\n completeApplePayPayment,\n setCountry,\n setCouponCodeIfPossible,\n setDeliveryMethod,\n setEmail,\n setPostalCode,\n clearCart,\n getApplePayPreview,\n } = useCartProvider();\n const instrument = useInstrumentContext();\n const paymentForCartText = useCheckoutText(\"paymentForCart\");\n const { data: isApplePayAvailable } = useQuery({\n queryKey: [\"is-apple-pay-available\"],\n queryFn: checkIfApplePayIsAvailable,\n });\n const itemsKey = items.map((el) => `${el.id}:${el.quantity}`).join(\",\");\n const selection = getCheckoutSelection();\n const { data: preview } = useQuery({\n queryKey: [\n \"apple-pay-preview\",\n itemsKey,\n selection.country ?? \"\",\n selection.couponCode ?? \"\",\n selection.selectedDeliveryMethod ?? \"\",\n selection.postalCode ?? \"\",\n ],\n queryFn: () =>\n getApplePayPreview({\n items: items.map((el) => ({\n productID: el.id,\n quantity: el.quantity,\n metadata: el.metadata,\n })),\n }),\n enabled: isApplePayAvailable === true,\n });\n if (isApplePayAvailable != true) {\n return null;\n }\n // The backend's answer when it is there; else the cart's own currency and\n // total, with no delivery in it (it is added once the buyer picks a method).\n const loadedPreview =\n preview != null && !isErr(preview)\n ? preview\n : {\n countryCode: selection.country || \"PL\",\n currencyCode: items[0]?.currency ?? \"PLN\",\n totalAmount: `${round(\n items.reduce((acc, item) => acc + item.price * item.quantity, 0) /\n 100,\n 2,\n )}`,\n };\n\n const expectedItems = items.map((el) => ({\n productID: el.id,\n quantity: el.quantity,\n metadata: el.metadata,\n }));\n\n async function beginSession() {\n let reported = false;\n const report = (outcome: \"success\" | \"fail\" | \"cancel\") => {\n if (reported) {\n return;\n }\n reported = true;\n instrument.track(\"apple_pay_result\", { outcome });\n };\n instrument.track(\"apple_pay_clicked\", {});\n instrument.track(\"payment_method_selected\", {\n gateway: \"apple_pay\",\n method: \"apple_pay\",\n });\n sendAnalyticEvent({\n event: \"initiateCheckout\",\n items: items.map((el) => ({\n id: el.id,\n name: el.name,\n price: el.price,\n quantity: el.quantity,\n currency: loadedPreview.currencyCode,\n })),\n });\n const requiresShipping =\n items.find((el) => el.isDeliverable === true) != null;\n // The session has to be created inside the click, so country, currency\n // and total come from the backend's answer that was loaded beforehand.\n const session = new ApplePaySession(14, {\n countryCode: loadedPreview.countryCode,\n merchantCapabilities: [\"supports3DS\"],\n supportedNetworks: [\"visa\", \"masterCard\"],\n currencyCode: loadedPreview.currencyCode,\n total: {\n amount: loadedPreview.totalAmount,\n label: paymentForCartText,\n type: \"pending\",\n },\n // Delivery is added once the buyer picks a contact and a method.\n lineItems: items.map(\n (item) =>\n ({\n amount: `${round((item.price * item.quantity) / 100, 2)}`,\n label: item.name,\n type: \"final\",\n } as ApplePayJS.ApplePayLineItem)\n ),\n ...(requiresShipping\n ? {\n shippingMethods: [],\n supportsCouponCode: true,\n requiredBillingContactFields: [\n \"name\",\n \"email\",\n \"postalAddress\",\n \"phone\",\n ],\n requiredShippingContactFields: [\n \"name\",\n \"email\",\n \"postalAddress\",\n \"phone\",\n ],\n }\n : {}),\n });\n await onClick?.();\n const apRequest = await getApplePayPaymentRequest({ expectedItems });\n if (isErr(apRequest)) {\n console.error(\"Error creating ApplePaySession:\", apRequest.error);\n report(\"fail\");\n return;\n }\n\n session.oncancel = (event) => {\n console.log(\"ApplePaySession cancelled\", event);\n report(\"cancel\");\n };\n\n session.onvalidatemerchant = async (event) => {\n try {\n const result = await PublicApiClient.get(HOST).applePayValidateMerchant(\n {\n validationUrl: event.validationURL,\n projectId: getProjectID(),\n }\n );\n console.log(\"merchantSession\", result.merchantSession);\n if (result.merchantSession.length > 0) {\n console.log(\"completing merchant session\");\n session.completeMerchantValidation(\n JSON.parse(result.merchantSession)\n );\n } else {\n session.abort();\n }\n } catch (error) {\n session.abort();\n }\n };\n\n session.onshippingmethodselected = async (event) => {\n console.log(\"shipping method selected\", event);\n instrument.track(\"delivery_method_selected\", {\n method: event.shippingMethod.identifier,\n });\n await setDeliveryMethod(event.shippingMethod.identifier);\n const apRequest = await getApplePayPaymentRequest({ expectedItems });\n console.log(\"apRequest\", apRequest);\n if (isErr(apRequest)) {\n session.abort();\n throw new Error(\"Failed to get Apple Pay payment request\");\n }\n\n session.completeShippingMethodSelection({\n newTotal: apRequest.total,\n newLineItems: apRequest.lineItems,\n newShippingMethods: apRequest.shippingMethods,\n });\n };\n session.onshippingcontactselected = async (event) => {\n try {\n if (event.shippingContact.countryCode != null) {\n await setCountry(event.shippingContact.countryCode);\n }\n if (event.shippingContact.postalCode != null) {\n await setPostalCode(event.shippingContact.postalCode);\n }\n if (event.shippingContact.phoneNumber != null) {\n await setEmail(event.shippingContact.emailAddress);\n }\n const apRequest = await getApplePayPaymentRequest({ expectedItems });\n if (isErr(apRequest)) {\n session.abort();\n throw new Error(\"Failed to get Apple Pay payment request\");\n }\n\n console.log(\"apRequest\", apRequest);\n session.completeShippingContactSelection({\n newLineItems: apRequest.lineItems,\n newTotal: apRequest.total,\n newShippingMethods: apRequest.shippingMethods,\n });\n } catch (error) {\n console.log(\"shipping contact selected error\", error);\n session.abort();\n }\n };\n\n session.oncouponcodechanged = async (event) => {\n try {\n console.log(\"coupon code changed\", event);\n const result = await setCouponCodeIfPossible(event.couponCode);\n const apRequest = await getApplePayPaymentRequest({ expectedItems });\n console.log(\"apRequest\", apRequest);\n if (isErr(apRequest)) {\n session.abort();\n throw new Error(\"Failed to get Apple Pay payment request\");\n }\n\n session.completeCouponCodeChange({\n errors: isErr(result)\n ? [new ApplePayError(\"couponCodeInvalid\")]\n : undefined,\n newTotal: apRequest.total,\n newLineItems: apRequest.lineItems,\n newShippingMethods: apRequest.shippingMethods,\n });\n } catch (error) {\n console.log(\"coupon code changed error\", error);\n session.abort();\n }\n };\n\n session.onpaymentauthorized = async (event) => {\n instrument.track(\"payment_submitted\", {\n gateway: \"apple_pay\",\n method: \"apple_pay\",\n });\n try {\n const result = await completeApplePayPayment({\n token: event.payment.token,\n billingContact: event.payment.billingContact,\n shippingContact: event.payment.shippingContact,\n });\n if (isErr(result)) {\n console.log(\"apple pay error\", result);\n report(\"fail\");\n session.completePayment({\n status: ApplePaySession.STATUS_FAILURE,\n });\n return;\n }\n\n if (result.redirectURL) {\n setTimeout(() => {\n open(result.redirectURL, \"_self\");\n }, 2000);\n }\n report(result.isSuccess ? \"success\" : \"fail\");\n session.completePayment({\n status: result.isSuccess\n ? ApplePaySession.STATUS_SUCCESS\n : ApplePaySession.STATUS_FAILURE,\n });\n\n result.isSuccess && clearCart();\n } catch (e) {\n report(\"fail\");\n session.completePayment({\n status: ApplePaySession.STATUS_FAILURE,\n });\n }\n // event.complete(ApplePaySession.STATUS_SUCCESS);\n };\n\n session.begin();\n }\n\n return (\n <ApplePayButton\n style={style}\n buttonStyle={colorType}\n type={buttonType}\n onClick={beginSession}\n />\n );\n}\n\nfunction Wrapper(props: Props) {\n const instrument = useInstrument(\n currentProjectID(),\n props.analytics,\n \"cart\",\n );\n return (\n <InstrumentProvider value={instrument}>\n <CartProvider>\n <ApplePayButtonComponent {...props} />\n </CartProvider>\n </InstrumentProvider>\n );\n}\nexport default Wrapper;\n","import { getProjectID } from \"./CartProvider\";\n\n/** The page's project ID; `undefined` (instead of a throw) during server rendering. */\nexport function currentProjectID(): string | undefined {\n try {\n return getProjectID();\n } catch {\n return undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/dist/index.js","../src/chat/lazy.tsx"],"names":["LazyThread","lazy","module","LazyChannel","Fallback","jsx","ChatThread","props","Suspense","Channel"],"mappings":"AAAA,iZAAwF,sDAA+I,sDAAyC,sDAA0K,sDAAiE,+BAA4B,sDAA+C,sDAAwC,+BAA4B,sDAAyF,+BAA4B,sDAAwC,+BAA4B,+BAA4B,sDAA+C,+BAA4B,8BCA34B,+CAczB,IAVAA,CAAAA,CAAaC,yBAAAA,CAAK,CAAA,EACtB,4DAAA,CAAO,WAAS,GAAA,CAAE,IAAA,CAAMC,CAAAA,EAAAA,CAAY,CAAE,OAAA,CAASA,CAAAA,CAAO,UAAW,CAAA,CAAE,CACrE,CAAA,CACMC,CAAAA,CAAcF,yBAAAA,CAAK,CAAA,EACvB,4DAAA,CAAO,WAAS,GAAA,CAAE,IAAA,CAAMC,CAAAA,EAAAA,CAAY,CAAE,OAAA,CAASA,CAAAA,CAAO,OAAQ,CAAA,CAAE,CAClE,CAAA,CAEA,SAASE,CAAAA,CAAAA,CAAW,CAClB,OACEC,6BAAAA,KAAC,CAAA,CAAI,SAAA,CAAU,sBAAA,CACb,QAAA,CAAAA,6BAAAA,KAAC,CAAA,CACC,IAAA,CAAK,QAAA,CACL,WAAA,CAAU,MAAA,CACV,SAAA,CAAU,iJAAA,CACZ,CAAA,CACF,CAEJ,CAMO,SAASC,CAAAA,CAAWC,CAAAA,CAAwB,CACjD,OACEF,6BAAAA,eAACG,CAAA,CAAS,QAAA,CAAUH,6BAAAA,CAACD,CAAA,CAAA,CAAS,CAAA,CAC5B,QAAA,CAAAC,6BAAAA,CAACL,CAAA,CAAY,GAAGO,CAAAA,CAAO,CAAA,CACzB,CAEJ,CAMO,SAASE,CAAAA,CAAQF,CAAAA,CAAqB,CAC3C,OACEF,6BAAAA,eAACG,CAAA,CAAS,QAAA,CAAUH,6BAAAA,CAACD,CAAA,CAAA,CAAS,CAAA,CAC5B,QAAA,CAAAC,6BAAAA,CAACF,CAAA,CAAa,GAAGI,CAAAA,CAAO,CAAA,CAC1B,CAEJ,CAAA,24FAAA","file":"/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/dist/index.js","sourcesContent":[null,"import { lazy, Suspense } from \"react\";\nimport type { ChannelProps, ChatThreadProps } from \"./widgets\";\n\n// The chat view is a separate chunk: shops without chat never load it.\nconst LazyThread = lazy(() =>\n import(\"./index\").then((module) => ({ default: module.ChatThread })),\n);\nconst LazyChannel = lazy(() =>\n import(\"./index\").then((module) => ({ default: module.Channel })),\n);\n\nfunction Fallback() {\n return (\n <div className=\"bitsnap-react h-full\">\n <div\n role=\"status\"\n aria-busy=\"true\"\n className=\"h-full min-h-[28rem] w-full rounded-xl border border-neutral-200 bg-white motion-safe:animate-pulse dark:border-neutral-800 dark:bg-neutral-900\"\n />\n </div>\n );\n}\n\n/**\n * A buyer's pack thread for one service product. Loads the chat on demand;\n * the same component is exported eagerly from `bitsnap-react/chat`.\n */\nexport function ChatThread(props: ChatThreadProps) {\n return (\n <Suspense fallback={<Fallback />}>\n <LazyThread {...props} />\n </Suspense>\n );\n}\n\n/**\n * A community channel. Loads the chat on demand; the same component is\n * exported eagerly from `bitsnap-react/chat`.\n */\nexport function Channel(props: ChannelProps) {\n return (\n <Suspense fallback={<Fallback />}>\n <LazyChannel {...props} />\n </Suspense>\n );\n}\n"]}
|