@nice2dev/ui-money 1.0.20 → 1.0.22

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.
@@ -0,0 +1,44 @@
1
+ import { NiceBaseProps } from '@nice2dev/ui-core';
2
+
3
+ /** A selectable payment method. */
4
+ export interface NicePaymentMethod {
5
+ /** Stable id (e.g. `card`, `blik`, `paypal`). */
6
+ id: string;
7
+ /** Display label. */
8
+ label: string;
9
+ /** Optional icon / logo. */
10
+ icon?: React.ReactNode;
11
+ /** Secondary description. */
12
+ description?: string;
13
+ /** Disable selection. */
14
+ disabled?: boolean;
15
+ /** Restrict to these ISO 4217 codes; hidden when `currency` is set and not included. */
16
+ currencies?: string[];
17
+ }
18
+ export interface NicePaymentMethodSelectorProps extends NiceBaseProps {
19
+ /** Methods to choose from. */
20
+ methods: NicePaymentMethod[];
21
+ /** Selected method id. */
22
+ value?: string;
23
+ /** Selection callback. */
24
+ onChange?: (id: string) => void;
25
+ /** Layout. Default `'list'`. */
26
+ layout?: 'list' | 'grid';
27
+ /** Grid column count (only for `layout='grid'`). Default `2`. */
28
+ columns?: number;
29
+ /** Active currency — filters out methods whose `currencies` don't include it. */
30
+ currency?: string;
31
+ /** Group label. */
32
+ label?: string;
33
+ /** HTML name (for form serialization). */
34
+ name?: string;
35
+ /** Render read-only (no selection changes). */
36
+ readOnly?: boolean;
37
+ }
38
+ /**
39
+ * {@link NicePaymentMethodSelector} — accessible radio-card picker for payment
40
+ * methods. Self-contained (no heavy deps); pair with `NICE_PAYMENT_PROVIDER_PROFILES`
41
+ * to derive a method list from configured providers.
42
+ */
43
+ export declare const NicePaymentMethodSelector: import('react').ForwardRefExoticComponent<NicePaymentMethodSelectorProps & import('react').RefAttributes<HTMLDivElement>>;
44
+ export default NicePaymentMethodSelector;
@@ -0,0 +1,47 @@
1
+ import { NiceBaseProps, NiceComponentTutorial } from '@nice2dev/ui-core';
2
+
3
+ /** Edited payment-provider configuration. */
4
+ export interface NicePaymentProviderConfigValue {
5
+ /** Selected provider id. */
6
+ providerId: string;
7
+ /** Test/sandbox or live credentials. */
8
+ mode: 'test' | 'live';
9
+ /** Credential key → value map (secrets included). */
10
+ credentials: Record<string, string>;
11
+ /** Methods enabled for this provider. */
12
+ enabledMethods?: string[];
13
+ }
14
+ export interface NicePaymentProviderConfigProps extends NiceBaseProps {
15
+ /** Current configuration (controlled). */
16
+ value: NicePaymentProviderConfigValue;
17
+ /** Change callback. */
18
+ onChange: (value: NicePaymentProviderConfigValue) => void;
19
+ /** Restrict the provider list to these ids (defaults to all bundled profiles). */
20
+ providers?: string[];
21
+ /** Verify credentials. Resolve `{ ok, message }` to show inline feedback. */
22
+ onTestConnection?: (value: NicePaymentProviderConfigValue) => Promise<{
23
+ ok: boolean;
24
+ message?: string;
25
+ }>;
26
+ /** Show the computed webhook URL. Default `true`. */
27
+ showWebhookUrl?: boolean;
28
+ /** Base URL prepended to the provider's webhook path. */
29
+ baseUrl?: string;
30
+ /** Render read-only. */
31
+ readOnly?: boolean;
32
+ /** Label for the test-connection button. Default `'Test connection'`. */
33
+ testLabel?: string;
34
+ /** Optional guided tour. `true` = built-in; array/object = custom steps. Shows a "?" button. */
35
+ tutorial?: NiceComponentTutorial;
36
+ }
37
+ /**
38
+ * {@link NicePaymentProviderConfig} — per-provider configuration "wizard":
39
+ * provider picker → typed credential fields (with secret mask/reveal) →
40
+ * test/live toggle → enabled methods → computed webhook URL → test connection.
41
+ *
42
+ * Self-contained (built on `@nice2dev/ui-core` only); credentials are a typed
43
+ * schema from {@link NICE_PAYMENT_PROVIDER_PROFILES}, so no generic key/value
44
+ * editor is required.
45
+ */
46
+ export declare const NicePaymentProviderConfig: import('react').ForwardRefExoticComponent<NicePaymentProviderConfigProps & import('react').RefAttributes<HTMLDivElement>>;
47
+ export default NicePaymentProviderConfig;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var xt=Object.defineProperty;var _t=(t,e,n)=>e in t?xt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var I=(t,e,n)=>_t(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),c=require("react/jsx-runtime"),ue=[{code:"USD",numeric:840,symbol:"$",name:"US Dollar",decimals:2,symbolFirst:!0},{code:"EUR",numeric:978,symbol:"€",name:"Euro",decimals:2,symbolFirst:!0},{code:"GBP",numeric:826,symbol:"£",name:"Pound Sterling",decimals:2,symbolFirst:!0},{code:"JPY",numeric:392,symbol:"¥",name:"Japanese Yen",decimals:0,symbolFirst:!0},{code:"CHF",numeric:756,symbol:"Fr",name:"Swiss Franc",decimals:2},{code:"CAD",numeric:124,symbol:"CA$",name:"Canadian Dollar",decimals:2,symbolFirst:!0},{code:"AUD",numeric:36,symbol:"A$",name:"Australian Dollar",decimals:2,symbolFirst:!0},{code:"NZD",numeric:554,symbol:"NZ$",name:"New Zealand Dollar",decimals:2,symbolFirst:!0},{code:"CNY",numeric:156,symbol:"¥",name:"Chinese Yuan Renminbi",decimals:2,symbolFirst:!0},{code:"HKD",numeric:344,symbol:"HK$",name:"Hong Kong Dollar",decimals:2,symbolFirst:!0},{code:"SGD",numeric:702,symbol:"S$",name:"Singapore Dollar",decimals:2,symbolFirst:!0},{code:"PLN",numeric:985,symbol:"zł",name:"Polish Złoty",decimals:2},{code:"CZK",numeric:203,symbol:"Kč",name:"Czech Koruna",decimals:2},{code:"HUF",numeric:348,symbol:"Ft",name:"Hungarian Forint",decimals:2},{code:"RON",numeric:946,symbol:"lei",name:"Romanian Leu",decimals:2},{code:"BGN",numeric:975,symbol:"лв",name:"Bulgarian Lev",decimals:2},{code:"HRK",numeric:191,symbol:"kn",name:"Croatian Kuna",decimals:2},{code:"DKK",numeric:208,symbol:"kr",name:"Danish Krone",decimals:2},{code:"SEK",numeric:752,symbol:"kr",name:"Swedish Krona",decimals:2},{code:"NOK",numeric:578,symbol:"kr",name:"Norwegian Krone",decimals:2},{code:"ISK",numeric:352,symbol:"kr",name:"Icelandic Króna",decimals:0},{code:"RUB",numeric:643,symbol:"₽",name:"Russian Ruble",decimals:2},{code:"UAH",numeric:980,symbol:"₴",name:"Ukrainian Hryvnia",decimals:2},{code:"TRY",numeric:949,symbol:"₺",name:"Turkish Lira",decimals:2,symbolFirst:!0},{code:"MXN",numeric:484,symbol:"Mex$",name:"Mexican Peso",decimals:2,symbolFirst:!0},{code:"BRL",numeric:986,symbol:"R$",name:"Brazilian Real",decimals:2,symbolFirst:!0},{code:"ARS",numeric:32,symbol:"AR$",name:"Argentine Peso",decimals:2,symbolFirst:!0},{code:"CLP",numeric:152,symbol:"CL$",name:"Chilean Peso",decimals:0,symbolFirst:!0},{code:"COP",numeric:170,symbol:"CO$",name:"Colombian Peso",decimals:2,symbolFirst:!0},{code:"PEN",numeric:604,symbol:"S/",name:"Peruvian Sol",decimals:2,symbolFirst:!0},{code:"UYU",numeric:858,symbol:"$U",name:"Uruguayan Peso",decimals:2,symbolFirst:!0},{code:"INR",numeric:356,symbol:"₹",name:"Indian Rupee",decimals:2,symbolFirst:!0},{code:"IDR",numeric:360,symbol:"Rp",name:"Indonesian Rupiah",decimals:2,symbolFirst:!0},{code:"KRW",numeric:410,symbol:"₩",name:"South Korean Won",decimals:0,symbolFirst:!0},{code:"MYR",numeric:458,symbol:"RM",name:"Malaysian Ringgit",decimals:2,symbolFirst:!0},{code:"PHP",numeric:608,symbol:"₱",name:"Philippine Peso",decimals:2,symbolFirst:!0},{code:"THB",numeric:764,symbol:"฿",name:"Thai Baht",decimals:2,symbolFirst:!0},{code:"VND",numeric:704,symbol:"₫",name:"Vietnamese Đồng",decimals:0},{code:"TWD",numeric:901,symbol:"NT$",name:"New Taiwan Dollar",decimals:2,symbolFirst:!0},{code:"PKR",numeric:586,symbol:"₨",name:"Pakistani Rupee",decimals:2},{code:"BDT",numeric:50,symbol:"৳",name:"Bangladeshi Taka",decimals:2},{code:"LKR",numeric:144,symbol:"Rs",name:"Sri Lankan Rupee",decimals:2},{code:"AED",numeric:784,symbol:"د.إ",name:"UAE Dirham",decimals:2},{code:"SAR",numeric:682,symbol:"ر.س",name:"Saudi Riyal",decimals:2},{code:"QAR",numeric:634,symbol:"ر.ق",name:"Qatari Riyal",decimals:2},{code:"KWD",numeric:414,symbol:"د.ك",name:"Kuwaiti Dinar",decimals:3},{code:"BHD",numeric:48,symbol:".د.ب",name:"Bahraini Dinar",decimals:3},{code:"OMR",numeric:512,symbol:"ر.ع",name:"Omani Rial",decimals:3},{code:"JOD",numeric:400,symbol:"د.أ",name:"Jordanian Dinar",decimals:3},{code:"ILS",numeric:376,symbol:"₪",name:"Israeli New Shekel",decimals:2,symbolFirst:!0},{code:"EGP",numeric:818,symbol:"E£",name:"Egyptian Pound",decimals:2,symbolFirst:!0},{code:"ZAR",numeric:710,symbol:"R",name:"South African Rand",decimals:2,symbolFirst:!0},{code:"NGN",numeric:566,symbol:"₦",name:"Nigerian Naira",decimals:2,symbolFirst:!0},{code:"KES",numeric:404,symbol:"KSh",name:"Kenyan Shilling",decimals:2},{code:"GHS",numeric:936,symbol:"₵",name:"Ghanaian Cedi",decimals:2},{code:"MAD",numeric:504,symbol:"د.م.",name:"Moroccan Dirham",decimals:2},{code:"TND",numeric:788,symbol:"د.ت",name:"Tunisian Dinar",decimals:3},{code:"BTC",numeric:0,symbol:"₿",name:"Bitcoin",decimals:8,symbolFirst:!0},{code:"ETH",numeric:0,symbol:"Ξ",name:"Ether",decimals:8,symbolFirst:!0},{code:"USDC",numeric:0,symbol:"USDC",name:"USD Coin",decimals:6},{code:"USDT",numeric:0,symbol:"USDT",name:"Tether",decimals:6}],Oe=new Map(ue.map(t=>[t.code,t]));function H(t){return Oe.get(t.toUpperCase())}function Nt(t){Oe.set(t.code.toUpperCase(),t);const e=ue.findIndex(n=>n.code===t.code);e>=0?ue[e]=t:ue.push(t)}function X(t,e){const n=H(e),a=(n==null?void 0:n.decimals)??2,r=Math.pow(10,a);return{amount:(t<0?-1:1)*Math.round(Math.abs(t)*r),currency:e.toUpperCase()}}function we(t){const e=H(t.currency),n=(e==null?void 0:e.decimals)??2;return t.amount/Math.pow(10,n)}function gt(t,e){return t.currency.toUpperCase()===e.currency.toUpperCase()}function Ce(t,e,n){if(!gt(t,e))throw new Error(`Cannot ${n} different currencies: ${t.currency} vs ${e.currency}`)}function oe(t,e){return Ce(t,e,"add"),{amount:t.amount+e.amount,currency:t.currency}}function Ke(t,e){return Ce(t,e,"subtract"),{amount:t.amount-e.amount,currency:t.currency}}function he(t,e){return{amount:(t.amount*e<0?-1:1)*Math.round(Math.abs(t.amount*e)),currency:t.currency}}function wt(t,e){return Ce(t,e,"compare"),t.amount-e.amount}function Ct(t){return t.amount===0}function jt(t){return t.amount<0}function vt(t){return{amount:-t.amount,currency:t.currency}}function Q(t,e={}){const n=H(t.currency),a=e.decimals??(n==null?void 0:n.decimals)??2,r=t.amount/Math.pow(10,a);try{return new Intl.NumberFormat(e.locale,{style:"currency",currency:t.currency,minimumFractionDigits:a,maximumFractionDigits:a,currencyDisplay:e.currencyDisplay??"symbol"}).format(r)}catch{const s=(n==null?void 0:n.symbol)??t.currency,l=r.toFixed(a);return n!=null&&n.symbolFirst?`${s}${l}`:`${l} ${s}`}}function Te(t,e){if(!t)return null;let n=t.replace(/[^\d.,\-]/g,"").trim();if(!n||n==="-")return null;const a=n.startsWith("-");a&&(n=n.slice(1));const r=n.lastIndexOf("."),s=n.lastIndexOf(","),l=Math.max(r,s);let i,u="";l===-1?i=n:(i=n.slice(0,l).replace(/[.,]/g,""),u=n.slice(l+1).replace(/[.,]/g,""));const d=`${i}.${u||"0"}`,p=parseFloat(d);return Number.isFinite(p)?X(a?-p:p,e):null}function me(t){const e=(t||"").replace(/\D/g,"");return e?/^4/.test(e)?"visa":/^(5[1-5]|2(2[2-9]|[3-6]\d|7[01]|720))/.test(e)?"mastercard":/^3[47]/.test(e)?"amex":/^(6011|65|64[4-9]|622(12[6-9]|1[3-9]\d|[2-8]\d\d|9[01]\d|92[0-5]))/.test(e)?"discover":/^3(0[0-5]|[68])/.test(e)?"diners":/^35(2[89]|[3-8])/.test(e)?"jcb":/^62/.test(e)?"unionpay":/^(50|5[6-9]|6[0-9])/.test(e)?"maestro":/^(2200|2201|2202|2203|2204)/.test(e)?"mir":/^(4011|4312|4389|4514|4576|5041|5066|5067|509|6277|6362|6363|650|6516|6550)/.test(e)?"elo":/^(606282|3841)/.test(e)?"hipercard":"unknown":"unknown"}function je(t){const e=(t||"").replace(/\D/g,"");if(e.length<12||e.length>19)return!1;let n=0,a=!1;for(let r=e.length-1;r>=0;r--){let s=e.charCodeAt(r)-48;a&&(s*=2,s>9&&(s-=9)),n+=s,a=!a}return n%10===0}function Be(t,e){const n=(t||"").replace(/\D/g,""),a=e??me(n);return a==="amex"?[n.slice(0,4),n.slice(4,10),n.slice(10,15)].filter(Boolean).join(" "):a==="diners"?[n.slice(0,4),n.slice(4,10),n.slice(10,14)].filter(Boolean).join(" "):(n.match(/.{1,4}/g)??[]).join(" ").trim()}function Dt(t,e){const n=(t||"").replace(/\D/g,"");if(n.length<4)return n;const a=n.slice(-4),r="*".repeat(n.length-4)+a,s=e??me(n);return s==="amex"?[r.slice(0,4),r.slice(4,10),r.slice(10,15)].filter(Boolean).join(" "):s==="diners"?[r.slice(0,4),r.slice(4,10),r.slice(10,14)].filter(Boolean).join(" "):(r.match(/.{1,4}/g)??[]).join(" ").trim()}function ve(t){const e=(t||"").replace(/\D/g,"");if(e.length<3)return null;const n=e.slice(0,2),a=e.length>=4?e.slice(-2):e.slice(2,4),r=parseInt(n,10);return!Number.isFinite(r)||r<1||r>12?null:`${n}/${a}`}function De(t,e=new Date){const n=ve(t);if(!n)return!1;const[a,r]=n.split("/"),s=parseInt(a,10),l=2e3+parseInt(r,10);return new Date(l,s,0,23,59,59,999).getTime()>=e.getTime()}function le(t){return t==="amex"?4:3}function Ne(t,e={}){var d;const n={},a=me(t.number),r=je(t.number);r||(n.number="Invalid card number");const s=De(t.expiry,e.now);s||(n.expiry="Invalid or expired");const i=(t.cvc||"").replace(/\D/g,"").length===le(a);i||(n.cvc=`CVC must be ${le(a)} digits`);const u=!e.requireHolder||(((d=t.holderName)==null?void 0:d.trim().length)??0)>=2;return u||(n.holderName="Cardholder name required"),{brand:a,numberValid:r,expiryValid:s,cvcValid:i,holderValid:u,isValid:r&&s&&i&&u,errors:n}}class St{constructor(e){I(this,"id","static");this.rates=e}async getRate(e,n){const a=e.toUpperCase(),r=n.toUpperCase();if(a===r)return{base:a,quote:r,rate:1,asOf:new Date().toISOString()};const s=this.rates.find(d=>d.base===a&&d.quote===r);if(s)return s;const l=this.rates.find(d=>d.base===r&&d.quote===a);if(l)return{base:a,quote:r,rate:1/l.rate,asOf:l.asOf};const i=this.rates.find(d=>d.base===a&&d.quote==="USD")??this.rates.find(d=>d.base==="USD"&&d.quote===a),u=this.rates.find(d=>d.base==="USD"&&d.quote===r)??this.rates.find(d=>d.base===r&&d.quote==="USD");if(i&&u){const d=i.base==="USD"?1/i.rate:i.rate,p=u.base==="USD"?u.rate:1/u.rate;return{base:a,quote:r,rate:d*p,asOf:new Date().toISOString()}}throw new Error(`No FX rate for ${a}/${r}`)}}class xe{constructor(e={}){I(this,"cache",new Map);I(this,"fetchImpl");I(this,"ttl");this.fetchImpl=e.fetchImpl??fetch,this.ttl=e.cacheTtl??6e4}cacheKey(e,n){return`${this.id}:${e.toUpperCase()}/${n.toUpperCase()}`}getCached(e,n){const a=this.cacheKey(e,n),r=this.cache.get(a);return r&&r.expires>Date.now()?r.rate:(r&&this.cache.delete(a),null)}setCached(e){this.cache.set(this.cacheKey(e.base,e.quote),{expires:Date.now()+this.ttl,rate:e})}}class qe extends xe{constructor(n={}){super(n);I(this,"id","frankfurter")}async getRate(n,a){const r=n.toUpperCase(),s=a.toUpperCase();if(r===s)return{base:r,quote:s,rate:1,asOf:new Date().toISOString()};const l=this.getCached(r,s);if(l)return l;const i=`https://api.frankfurter.app/latest?from=${r}&to=${s}`,u=await this.fetchImpl(i);if(!u.ok)throw new Error(`Frankfurter HTTP ${u.status}`);const d=await u.json(),p=d.rates[s];if(p==null)throw new Error(`Frankfurter: no rate for ${r}/${s}`);const x={base:r,quote:s,rate:p,asOf:d.date};return this.setCached(x),x}}class Le extends xe{constructor(n,a={}){super(a);I(this,"id","openexchangerates");this.appId=n}async getRate(n,a){const r=n.toUpperCase(),s=a.toUpperCase();if(r===s)return{base:r,quote:s,rate:1,asOf:new Date().toISOString()};const l=this.getCached(r,s);if(l)return l;const i=`https://openexchangerates.org/api/latest.json?app_id=${this.appId}`,u=await this.fetchImpl(i);if(!u.ok)throw new Error(`OpenExchangeRates HTTP ${u.status}`);const d=await u.json(),p=d.rates[r],x=d.rates[s];if(p==null||x==null)throw new Error(`OpenExchangeRates: missing rate for ${r} or ${s}`);const y={base:r,quote:s,rate:x/p,asOf:new Date(d.timestamp*1e3).toISOString()};return this.setCached(y),y}}class He extends xe{constructor(n={}){super(n);I(this,"id","exchangerate.host")}async getRate(n,a){var y;const r=n.toUpperCase(),s=a.toUpperCase();if(r===s)return{base:r,quote:s,rate:1,asOf:new Date().toISOString()};const l=this.getCached(r,s);if(l)return l;const i=`https://api.exchangerate.host/convert?from=${r}&to=${s}`,u=await this.fetchImpl(i);if(!u.ok)throw new Error(`exchangerate.host HTTP ${u.status}`);const d=await u.json(),p=((y=d.info)==null?void 0:y.rate)??d.result,x={base:r,quote:s,rate:p,asOf:d.date};return this.setCached(x),x}}class ze extends xe{constructor(n={}){super(n);I(this,"id","nbp");I(this,"table");this.table=n.table??"A"}async getRate(n,a){const r=n.toUpperCase(),s=a.toUpperCase();if(r===s)return{base:r,quote:s,rate:1,asOf:new Date().toISOString()};const l=this.getCached(r,s);if(l)return l;const i=async x=>{var f;if(x==="PLN")return{rate:1,date:new Date().toISOString().slice(0,10)};const y=`https://api.nbp.pl/api/exchangerates/rates/${this.table}/${x}/?format=json`,m=await this.fetchImpl(y);if(!m.ok)return null;const b=(f=(await m.json()).rates)==null?void 0:f[0];return b?{rate:b.mid??b.ask??0,date:b.effectiveDate}:null},u=await i(r),d=await i(s);if(!u||!d||u.rate===0)throw new Error(`NBP: missing rate for ${r} or ${s}`);const p={base:r,quote:s,rate:u.rate/d.rate,asOf:u.date};return this.setCached(p),p}}class Ye extends qe{constructor(){super(...arguments);I(this,"id","ecb")}}class Ge extends He{constructor(){super(...arguments);I(this,"id","free-forex")}}const Mt=(t={})=>new ze(t),Rt=(t={})=>new Ye(t),kt=t=>new Le(t.apiKey,t),$t=(t={})=>new Ge(t);async function Ze(t,e,n){const a=e.toUpperCase();if(t.currency.toUpperCase()===a)return t;const r=H(t.currency),s=H(a),l=(r==null?void 0:r.decimals)??2,i=(s==null?void 0:s.decimals)??2,{rate:u}=await n.getRate(t.currency,a),p=t.amount/Math.pow(10,l)*u;return{currency:a,amount:Math.round(p*Math.pow(10,i))}}class Je{constructor(e={}){I(this,"id");I(this,"name");I(this,"supportedCurrencies");I(this,"minimums");I(this,"counter",0);this.id=e.id??"mock",this.name=e.name??"Mock Processor",this.supportedCurrencies=e.supportedCurrencies??"*"}newId(e){return this.counter+=1,`${e}_${Date.now().toString(36)}_${this.counter}`}async authorize(e){return{id:this.newId("auth"),status:"authorized",processor:this.id,amount:e.amount,raw:{mock:!0,request:e}}}async capture(e,n){return{id:e.replace("auth_","cap_"),status:"captured",processor:this.id,amount:n}}async cancel(e){return{id:e,status:"cancelled",processor:this.id}}async refund(e,n){return{id:e.replace(/^[a-z]+_/,"ref_"),status:"refunded",processor:this.id,amount:n}}}function B(t,e,n,a,r){const s=l=>{const i=a==null?void 0:a[l];return i||(async()=>{throw new Error(`[ui-money] ${e} adapter is not wired. Pass an \`executor.${String(l)}\` implementation that calls the ${e} SDK.`)})};return{id:t,name:e,supportedCurrencies:n,minimums:r,authorize:s("authorize"),capture:s("capture"),cancel:s("cancel"),refund:s("refund")}}function Xe(t){return B("stripe","Stripe","*",t,{USD:50,EUR:50,GBP:30,JPY:50,AUD:50,CAD:50,CHF:50,DKK:250,NOK:300,SEK:300,PLN:200})}function Qe(t){return B("paypal","PayPal",["USD","EUR","GBP","AUD","CAD","JPY","CHF","NZD","SEK","NOK","DKK","PLN","CZK","HUF","BRL","MXN","HKD","SGD","TWD","THB","PHP","ILS"],t)}function Ve(t){return B("adyen","Adyen","*",t)}function We(t){return B("square","Square",["USD","CAD","GBP","AUD","JPY","EUR"],t)}function et(t){return B("mollie","Mollie","*",t)}function tt(t){return B("braintree","Braintree","*",t)}function nt(t){return B("razorpay","Razorpay",["INR","USD","EUR","GBP","AED"],t)}function rt(t){return B("payu","PayU",["PLN","EUR","USD","CZK","HUF","RON","BGN","TRY"],t)}function at(t){return B("przelewy24","Przelewy24",["PLN","EUR"],t)}function ct(t={}){return B("tpay","Tpay",["PLN","EUR","USD","GBP"],t)}function st(t={}){return B("autopay","Autopay",["PLN","EUR","USD","GBP","CZK"],t)}function it(t={}){const{acquirer:e="native",...n}=t;return B(`blik:${e}`,`BLIK (${e})`,["PLN"],n)}function ot(t){return B("klarna","Klarna",["USD","EUR","GBP","SEK","NOK","DKK","CHF","AUD","CAD","NZD","PLN"],t)}function lt(t){return B("coinbase-commerce","Coinbase Commerce",["BTC","ETH","USDC","USDT","USD","EUR"],t)}const Pt={mock:()=>new Je,stripe:()=>Xe(),paypal:()=>Qe(),adyen:()=>Ve(),square:()=>We(),mollie:()=>et(),braintree:()=>tt(),razorpay:()=>nt(),payu:()=>rt(),przelewy24:()=>at(),tpay:()=>ct(),autopay:()=>st(),blik:()=>it(),klarna:()=>ot(),"coinbase-commerce":()=>lt()};function Ut(t,e){const n=o.useMemo(()=>"amount"in t?t:X(t.major,t.currency),[]),[a,r]=o.useState(n),s=o.useCallback(y=>r(m=>X(y,m.currency)),[]),l=o.useCallback(y=>{r(m=>({...m,currency:y.toUpperCase()}))},[]),i=o.useCallback(y=>r(m=>oe(m,y)),[]),u=o.useCallback(y=>r(m=>Ke(m,y)),[]),d=o.useCallback(y=>r(m=>he(m,y)),[]),p=o.useMemo(()=>Q(a,{locale:e}),[a,e]),x=o.useMemo(()=>we(a),[a]);return{money:a,setMoney:r,setMajor:s,setCurrency:l,add:i,subtract:u,scale:d,formatted:p,major:x}}function be(t,e,n){const[a,r]=o.useState(null),[s,l]=o.useState(null),[i,u]=o.useState(!1),d=o.useRef(0);return o.useEffect(()=>{if(!t){r(null);return}const p=++d.current;u(!0),l(null),Ze(t,e,n).then(x=>{d.current===p&&r(x)}).catch(x=>{d.current===p&&(l(x instanceof Error?x:new Error(String(x))),r(null))}).finally(()=>{d.current===p&&u(!1)})},[t==null?void 0:t.amount,t==null?void 0:t.currency,e,n]),{converted:a,loading:i,error:s}}function ut(t){const[e,n]=o.useState("idle"),[a,r]=o.useState(null),[s,l]=o.useState(null),i=o.useCallback(()=>{n("idle"),r(null),l(null)},[]),u=o.useCallback(async y=>{n("authorizing"),l(null);try{const m=await t.authorize(y);return r(m),n(m.status),m}catch(m){const h=m instanceof Error?m:new Error(String(m));throw l(h),n("failed"),h}},[t]),d=o.useCallback(async(y,m)=>{const h=y??(a==null?void 0:a.id);if(!h)throw new Error("No authorization id to capture");n("capturing");try{const b=await t.capture(h,m);return r(b),n(b.status),b}catch(b){const f=b instanceof Error?b:new Error(String(b));throw l(f),n("failed"),f}},[t,a==null?void 0:a.id]),p=o.useCallback(async y=>{const m=y??(a==null?void 0:a.id);if(!m)throw new Error("No payment id to cancel");const h=await t.cancel(m);return r(h),n(h.status),h},[t,a==null?void 0:a.id]),x=o.useCallback(async(y,m)=>{const h=y??(a==null?void 0:a.id);if(!h)throw new Error("No payment id to refund");const b=await t.refund(h,m);return r(b),n(b.status),b},[t,a==null?void 0:a.id]);return{status:e,response:a,error:s,authorize:u,capture:d,cancel:p,refund:x,reset:i}}const ge=o.forwardRef(function({value:e,amount:n,currency:a,locale:r,display:s="symbol",highlightNegative:l=!0,zeroPlaceholder:i,convertTo:u,exchangeProvider:d,className:p,style:x,"aria-label":y},m){const h=o.useMemo(()=>{if(e)return e;if(n!=null&&a){const N=H(a),C=(N==null?void 0:N.decimals)??2;return{amount:Math.round(n*Math.pow(10,C)),currency:a.toUpperCase()}}return null},[e,n,a]),b=o.useMemo(()=>h?h.amount===0&&i!=null?i:Q(h,{locale:r,currencyDisplay:s}):"",[h,r,s,i]),{converted:f}=be(u&&d?h:null,u??"",d);if(!h)return null;const _=h.amount<0,S="nice-money"+(l&&_?" nice-money--negative":"")+(p?` ${p}`:"");return c.jsxs("span",{ref:m,className:S,style:x,"aria-label":y,children:[c.jsx("span",{className:"nice-money__value",children:b}),f&&c.jsxs("span",{className:"nice-money__converted","aria-label":`Converted to ${f.currency}`,children:[" ≈ ",Q(f,{locale:r})]})]})}),At=ue.map(t=>t.code).sort(),Se=o.forwardRef(function({value:e,onChange:n,options:a=ue,recents:r=[],searchable:s,showCode:l=!0,showSymbol:i=!0,compact:u=!1,disabled:d,readOnly:p,loading:x,accessMode:y,label:m,helperText:h,error:b,required:f,size:_="md",labelPlacement:S="top",labelWidth:N,controlWidth:C,className:E,style:z,id:Y,name:R,title:K,"data-testid":W,"aria-label":U,placeholder:G},q){const $=y==="hidden",Z=d||y==="disabled"||x,ae=p||y==="readOnly",A=o.useId(),ce=Y??`nice-cs-${A}`,[T,M]=o.useState(""),k=s??a.length>8,F=o.useMemo(()=>{if(!T.trim())return a;const w=T.trim().toLowerCase();return a.filter(j=>j.code.toLowerCase().includes(w)||j.name.toLowerCase().includes(w)||j.symbol.toLowerCase().includes(w))},[a,T]),D=o.useMemo(()=>{const w=new Set;return r.map(j=>H(j)).filter(j=>!!j&&!w.has(j.code)&&!!w.add(j.code))},[r]),se=o.useCallback(w=>{const j=w.target.value,te=H(j);te&&(n==null||n(j,te))},[n]),V=w=>{if(u)return`${i?w.symbol+" ":""}${w.code}`;const j=[];return i&&j.push(w.symbol),l&&j.push(w.code),j.push("—",w.name),j.join(" ")},g=`nice-currency-selector nice-currency-selector--${_} nice-currency-selector--label-${S}`+(u?" nice-currency-selector--compact":"")+(b?" nice-currency-selector--error":"")+(Z?" nice-currency-selector--disabled":"")+(E?` ${E}`:""),P=S==="left"&&N!=null?{width:typeof N=="number"?`${N}px`:N,flex:"none"}:void 0,ee=C!=null?{width:typeof C=="number"?`${C}px`:C,flex:"none"}:void 0;return $?null:c.jsxs("div",{ref:q,className:g,style:z,title:K,"data-testid":W,children:[m&&c.jsxs("label",{htmlFor:ce,className:"nice-currency-selector__label",style:P,children:[m,f&&c.jsx("span",{className:"nice-currency-selector__required","aria-hidden":!0,children:"*"})]}),c.jsxs("div",{className:"nice-currency-selector__inner",style:ee,children:[k&&c.jsx("input",{type:"search",className:"nice-currency-selector__search",placeholder:"Search currency…",value:T,onChange:w=>M(w.target.value),disabled:Z||ae,"aria-label":"Search currency"}),c.jsxs("select",{id:ce,name:R,className:"nice-currency-selector__select",value:e??"",onChange:se,disabled:Z||ae,required:f,"aria-invalid":!!b,"aria-label":U??(typeof m=="string"?m:"Currency"),children:[!e&&c.jsx("option",{value:"",children:G??"Select currency…"}),D.length>0&&c.jsx("optgroup",{label:"Recent",children:D.map(w=>c.jsx("option",{value:w.code,children:V(w)},`r-${w.code}`))}),c.jsx("optgroup",{label:D.length>0?"All":"",children:F.map(w=>c.jsx("option",{value:w.code,children:V(w)},w.code))})]})]}),(b||h)&&c.jsx("span",{className:b?"nice-currency-selector__error":"nice-currency-selector__helper",children:b??h})]})}),Me=o.forwardRef(function({value:e,onChange:n,currency:a,onCurrencyChange:r,currencies:s,hideCurrencySelector:l,min:i,max:u,step:d,locale:p,placeholder:x,label:y,helperText:m,error:h,size:b="md",disabled:f,readOnly:_,required:S,loading:N,accessMode:C,labelPlacement:E="top",errorPlacement:z="bottom",labelWidth:Y,controlWidth:R,submitOnEnter:K,onSubmit:W,showFormattedPreview:U=!0,showSteppers:G=!1,className:q,style:$,id:Z,name:ae,title:A,"data-testid":ce,onBlur:T,onFocus:M,liveGrouping:k,multiplierShortcuts:F=!0,onValidationError:D},se){const V=f||C==="disabled"||N,g=_||C==="readOnly",P=C==="hidden",ee=o.useId(),w=Z??`nice-money-${ee}`,j=((e==null?void 0:e.currency)??a??"USD").toUpperCase(),te=H(j),L=(te==null?void 0:te.decimals)??2,Re=d??1/Math.pow(10,L),[_e,pe]=o.useState(()=>e?(e.amount/Math.pow(10,L)).toFixed(L):""),[ye,ke]=o.useState(!1);o.useEffect(()=>{if(ye)return;if(e==null){pe("");return}const v=H(e.currency),O=(v==null?void 0:v.decimals)??2;pe((e.amount/Math.pow(10,O)).toFixed(O))},[e,ye]);const $e=o.useCallback(v=>{let O=v;if(F){const re=v.trim().match(/^([+-]?\d+(?:[.,]\d+)?)\s*([kKmMbB])$/);if(re){const ie=re[2].toLowerCase()==="k"?1e3:re[2].toLowerCase()==="m"?1e6:1e9,Ee=Number(re[1].replace(",","."))*ie;if(!Number.isFinite(Ee)){D==null||D(new Error("overflow"));return}O=String(Ee)}}const J=Te(O,j);if(!J){n==null||n(null);return}if(!Number.isSafeInteger(J.amount)){D==null||D(new Error("overflow: amount exceeds Number.MAX_SAFE_INTEGER"));return}const ne=J.amount/Math.pow(10,L);if(i!=null&&ne<i){D==null||D(new Error(`min: ${i}`)),n==null||n(X(i,j));return}if(u!=null&&ne>u){D==null||D(new Error(`max: ${u}`)),n==null||n(X(u,j));return}n==null||n(J)},[j,L,i,u,n,F,D]),mt=o.useCallback(v=>{const O=v.target.value;pe(O),$e(O)},[$e]),Pe=o.useCallback(v=>{const J=(e?e.amount/Math.pow(10,L):0)+v,ne=Math.min(u??1/0,Math.max(i??-1/0,J));n==null||n(X(ne,j))},[e,L,i,u,j,n]),fe=o.useMemo(()=>{var v,O;try{const J=new Intl.NumberFormat(p).formatToParts(12345.6),ne=((v=J.find(ie=>ie.type==="group"))==null?void 0:v.value)??",",re=((O=J.find(ie=>ie.type==="decimal"))==null?void 0:O.value)??".";return{group:ne,decimal:re}}catch{return{group:",",decimal:"."}}},[p]),Ue=k??!!fe.group,pt=o.useMemo(()=>{if(!Ue||ye===!1)return _e;const v=fe.decimal,O=fe.group,J=_e.replace(new RegExp(`[${O.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}]`,"g"),""),[ne,re]=J.split(v);if(!ne)return J;const ie=ne.replace(/\B(?=(\d{3})+(?!\d))/g,O);return re!=null?`${ie}${v}${re}`:ie},[_e,ye,Ue,fe]),Ae=o.useMemo(()=>e?Q(e,{locale:p}):"",[e,p]),de=typeof h=="string"?h:void 0,yt=`nice-money-input nice-money-input--${b} nice-money-input--label-${E} nice-money-input--error-${z}`+(de?" nice-money-input--error":"")+(V?" nice-money-input--disabled":"")+(N?" nice-money-input--loading":"")+(q?` ${q}`:""),ft=v=>{K&&v.key==="Enter"&&W&&(v.preventDefault(),W())},ht=E==="left"&&Y!=null?{width:typeof Y=="number"?`${Y}px`:Y,flex:"none"}:void 0,bt=R!=null?{width:typeof R=="number"?`${R}px`:R,flex:"none"}:void 0;return P?null:c.jsxs("div",{ref:se,className:yt,style:$,title:A,"data-testid":ce,children:[y&&c.jsxs("label",{htmlFor:w,className:"nice-money-input__label",style:ht,children:[y,S&&c.jsx("span",{className:"nice-money-input__required","aria-hidden":!0,children:"*"})]}),c.jsxs("div",{className:"nice-money-input__row",style:bt,children:[!l&&c.jsx(Se,{value:j,compact:!0,options:s?s.map(H).filter(v=>!!v):void 0,onChange:v=>r==null?void 0:r(v),disabled:V||g,className:"nice-money-input__currency","aria-label":"Currency"}),l&&c.jsx("span",{className:"nice-money-input__symbol","aria-hidden":!0,children:(te==null?void 0:te.symbol)??j}),G&&c.jsx("button",{type:"button",className:"nice-money-input__step nice-money-input__step--down",onClick:()=>Pe(-Re),disabled:V||g||i!=null&&e!=null&&e.amount/Math.pow(10,L)<=i,"aria-label":"Decrease amount",tabIndex:-1,children:"−"}),c.jsx("input",{id:w,name:ae,type:"text",inputMode:"decimal",autoComplete:"transaction-amount",className:"nice-money-input__amount",value:pt,onChange:mt,onKeyDown:ft,onFocus:v=>{ke(!0),M==null||M(v)},onBlur:v=>{ke(!1),e&&pe((e.amount/Math.pow(10,L)).toFixed(L)),T==null||T(v)},placeholder:x??`0${L>0?"."+"0".repeat(L):""}`,disabled:V,readOnly:g,required:S,"aria-invalid":!!de,"aria-describedby":de||m?`${w}-help`:void 0}),G&&c.jsx("button",{type:"button",className:"nice-money-input__step nice-money-input__step--up",onClick:()=>Pe(Re),disabled:V||g||u!=null&&e!=null&&e.amount/Math.pow(10,L)>=u,"aria-label":"Increase amount",tabIndex:-1,children:"+"}),N&&c.jsx("span",{className:"nice-money-input__spinner","aria-hidden":!0,children:"⟳"})]}),U&&Ae&&c.jsx("span",{className:"nice-money-input__preview","aria-live":"polite",children:Ae}),(de||m)&&c.jsx("span",{id:`${w}-help`,className:de?"nice-money-input__error":"nice-money-input__helper",children:de??m})]})}),Et={number:"",expiry:"",cvc:""},dt=o.forwardRef(function({value:e=Et,onChange:n,showHolderName:a=!0,requireHolderName:r,showPostalCode:s=!1,acceptedBrands:l,showBrandIcon:i=!0,size:u="md",disabled:d,readOnly:p,loading:x,accessMode:y,label:m,helperText:h,error:b,required:f,className:_,style:S,id:N,title:C,"data-testid":E},z){const Y=y==="hidden",R=d||y==="disabled"||x,K=p||y==="readOnly",W=o.useId(),U=N??`nice-cc-${W}`,[G,q]=o.useState({number:!1,expiry:!1,cvc:!1,holder:!1,postal:!1}),$=o.useMemo(()=>me(e.number),[e.number]),Z=o.useMemo(()=>Ne(e,{requireHolder:r??a}),[e,r,a]),ae=!l||l.includes($)||$==="unknown",A=o.useCallback(g=>{const P={...e,...g},ee=Ne(P,{requireHolder:r??a});n==null||n(P,ee)},[e,r,a,n]),ce=o.useCallback(g=>{const P=g.target.value.replace(/\D/g,"").slice(0,19);A({number:P})},[A]),T=o.useCallback(g=>{const P=g.target.value.replace(/\D/g,"").slice(0,4);let ee=P;P.length>=3?ee=`${P.slice(0,2)}/${P.slice(2)}`:P.length===2&&(ee=`${P}/`),A({expiry:ee})},[A]),M=o.useCallback(g=>{const P=g.target.value.replace(/\D/g,"").slice(0,le($));A({cvc:P})},[$,A]),k=o.useMemo(()=>Be(e.number,$),[e.number,$]),F=G.number&&e.number.length>0&&(je(e.number)?ae?void 0:"Card brand not accepted":Z.errors.number),D=G.expiry&&e.expiry.length>0&&!De(e.expiry)?Z.errors.expiry:void 0,se=G.cvc&&e.cvc.length>0&&e.cvc.length!==le($)?Z.errors.cvc:void 0,V=`nice-credit-card nice-credit-card--${u}`+(R?" nice-credit-card--disabled":"")+(x?" nice-credit-card--loading":"")+(b?" nice-credit-card--error":"")+(_?` ${_}`:"");return Y?null:c.jsxs("div",{ref:z,className:V,style:S,title:C,"data-testid":E,children:[m&&c.jsxs("div",{className:"nice-credit-card__title",children:[m,f&&c.jsx("span",{className:"nice-credit-card__required","aria-hidden":!0,children:"*"})]}),c.jsx("div",{className:"nice-credit-card__row",children:c.jsxs("label",{className:"nice-credit-card__field nice-credit-card__field--number",children:[c.jsx("span",{className:"nice-credit-card__label",children:"Card number"}),c.jsxs("span",{className:"nice-credit-card__input-wrapper",children:[c.jsx("input",{id:`${U}-number`,type:"text",inputMode:"numeric",autoComplete:"cc-number",placeholder:$==="amex"?"3782 822463 10005":"1234 1234 1234 1234",value:k,onChange:ce,onBlur:()=>q(g=>({...g,number:!0})),disabled:R,readOnly:K,"aria-invalid":!!F,"aria-describedby":F?`${U}-number-err`:void 0,className:"nice-credit-card__input",maxLength:$==="amex"?17:23}),i&&c.jsx(It,{brand:$})]}),F&&c.jsx("span",{id:`${U}-number-err`,className:"nice-credit-card__error",children:F})]})}),c.jsxs("div",{className:"nice-credit-card__row nice-credit-card__row--split",children:[c.jsxs("label",{className:"nice-credit-card__field",children:[c.jsx("span",{className:"nice-credit-card__label",children:"Expiry"}),c.jsx("input",{id:`${U}-expiry`,type:"text",inputMode:"numeric",autoComplete:"cc-exp",placeholder:"MM/YY",value:e.expiry,onChange:T,onBlur:()=>{q(P=>({...P,expiry:!0}));const g=ve(e.expiry);g&&g!==e.expiry&&A({expiry:g})},disabled:R,readOnly:K,"aria-invalid":!!D,"aria-describedby":D?`${U}-expiry-err`:void 0,className:"nice-credit-card__input",maxLength:5}),D&&c.jsx("span",{id:`${U}-expiry-err`,className:"nice-credit-card__error",children:D})]}),c.jsxs("label",{className:"nice-credit-card__field",children:[c.jsx("span",{className:"nice-credit-card__label",children:$==="amex"?"CID":"CVC"}),c.jsx("input",{id:`${U}-cvc`,type:"text",inputMode:"numeric",autoComplete:"cc-csc",placeholder:"•".repeat(le($)),value:e.cvc,onChange:M,onBlur:()=>q(g=>({...g,cvc:!0})),disabled:R,readOnly:K,"aria-invalid":!!se,"aria-describedby":se?`${U}-cvc-err`:void 0,className:"nice-credit-card__input",maxLength:le($)}),se&&c.jsx("span",{id:`${U}-cvc-err`,className:"nice-credit-card__error",children:se})]})]}),a&&c.jsx("div",{className:"nice-credit-card__row",children:c.jsxs("label",{className:"nice-credit-card__field",children:[c.jsx("span",{className:"nice-credit-card__label",children:"Cardholder name"}),c.jsx("input",{id:`${U}-holder`,type:"text",autoComplete:"cc-name",placeholder:"Jane Doe",value:e.holderName??"",onChange:g=>A({holderName:g.target.value}),onBlur:()=>q(g=>({...g,holder:!0})),disabled:R,readOnly:K,className:"nice-credit-card__input",maxLength:120})]})}),s&&c.jsx("div",{className:"nice-credit-card__row",children:c.jsxs("label",{className:"nice-credit-card__field",children:[c.jsx("span",{className:"nice-credit-card__label",children:"Postal code"}),c.jsx("input",{id:`${U}-postal`,type:"text",autoComplete:"postal-code",value:e.postalCode??"",onChange:g=>A({postalCode:g.target.value}),onBlur:()=>q(g=>({...g,postal:!0})),disabled:R,readOnly:K,className:"nice-credit-card__input",maxLength:16})]})}),(b||h)&&c.jsx("div",{className:b?"nice-credit-card__form-error":"nice-credit-card__helper",role:b?"alert":void 0,children:b??h})]})}),Ie={visa:"VISA",mastercard:"MasterCard",amex:"AMEX",discover:"Discover",diners:"Diners",jcb:"JCB",unionpay:"UnionPay",maestro:"Maestro",mir:"MIR",elo:"Elo",hipercard:"Hipercard",unknown:""};function It({brand:t}){return t==="unknown"?null:c.jsx("span",{className:`nice-credit-card__brand nice-credit-card__brand--${t}`,"aria-label":Ie[t],children:Ie[t]})}const Ft=o.forwardRef(function({processor:e,amount:n,editableAmount:a,customer:r,currencies:s,description:l,metadata:i,autoCapture:u=!0,submitLabel:d="Pay",onSuccess:p,onError:x,consents:y,className:m,style:h},b){const[f,_]=o.useState(n),[S,N]=o.useState(n.currency),[C,E]=o.useState({number:"",expiry:"",cvc:""}),[z,Y]=o.useState(null),[R,K]=o.useState(!1),[W,U]=o.useState(null),G=ut(e),q=o.useMemo(()=>e.supportedCurrencies==="*"?!0:e.supportedCurrencies.includes(f.currency.toUpperCase()),[e,f.currency]),$=o.useMemo(()=>{var k;const M=(k=e.minimums)==null?void 0:k[f.currency.toUpperCase()];return M==null||f.amount>=M},[e,f]),Z=o.useMemo(()=>{var k;const M=(k=e.minimums)==null?void 0:k[f.currency.toUpperCase()];return M==null?null:{amount:M,currency:f.currency}},[e,f.currency]),ae=!!(z!=null&&z.isValid),A=!R&&q&&$&&ae,ce=o.useCallback(async M=>{if(M.preventDefault(),!!A){U(null),K(!0);try{const k={amount:f,card:C,customer:r,description:l,metadata:i,idempotencyKey:Ot()},F=await G.authorize(k);if(u&&F.status==="authorized"){const D=await G.capture(F.id,f);p==null||p(D)}else p==null||p(F)}catch(k){const F=k instanceof Error?k:new Error(String(k));U(F.message),x==null||x(F)}finally{K(!1)}}},[A,f,C,r,l,i,u,G,p,x]),T=H(f.currency);return c.jsxs("form",{ref:b,className:"nice-payment-form"+(m?` ${m}`:""),style:h,onSubmit:ce,"aria-busy":R,children:[c.jsx("div",{className:"nice-payment-form__amount",children:a?c.jsx(Me,{label:"Amount",value:f,currency:S,currencies:s,onChange:M=>M&&_(M),onCurrencyChange:M=>{N(M),_(k=>({...k,currency:M}))},disabled:R,required:!0,showFormattedPreview:!0}):c.jsxs("div",{className:"nice-payment-form__total",children:[c.jsx("span",{className:"nice-payment-form__total-label",children:"Total"}),c.jsx(ge,{value:f})]})}),l&&c.jsx("p",{className:"nice-payment-form__description",children:l}),c.jsx("div",{className:"nice-payment-form__card",children:c.jsx(dt,{value:C,onChange:(M,k)=>{E(M),Y(k)},disabled:R})}),!q&&c.jsxs("div",{className:"nice-payment-form__warning",role:"alert",children:[e.name," does not accept ",(T==null?void 0:T.name)??f.currency,"."]}),!$&&Z&&c.jsxs("div",{className:"nice-payment-form__warning",role:"alert",children:["Minimum charge for ",e.name," is ",c.jsx(ge,{value:Z}),"."]}),y&&c.jsx("div",{className:"nice-payment-form__consents",children:y}),W&&c.jsx("div",{className:"nice-payment-form__error",role:"alert",children:W}),c.jsx("button",{type:"submit",className:"nice-payment-form__submit",disabled:!A,"aria-disabled":!A,children:R?"Processing…":d}),c.jsxs("p",{className:"nice-payment-form__processor",children:["Secured by ",c.jsx("strong",{children:e.name})]})]})});function Ot(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`idem_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`}const Kt=o.forwardRef(function({price:e,originalPrice:n,period:a,prefix:r,suffix:s,showDiscountBadge:l=!0,size:i="md",locale:u,className:d,style:p},x){const y=n&&n.currency===e.currency&&n.amount>e.amount,m=o.useMemo(()=>!y||!n?null:Math.round((n.amount-e.amount)/n.amount*100),[y,n,e.amount]),h=`nice-price-tag nice-price-tag--${i}`+(d?` ${d}`:"");return c.jsxs("div",{ref:x,className:h,style:p,children:[r&&c.jsx("span",{className:"nice-price-tag__prefix",children:r}),c.jsxs("span",{className:"nice-price-tag__main",children:[c.jsx("span",{className:"nice-price-tag__amount",children:Q(e,{locale:u})}),a&&c.jsx("span",{className:"nice-price-tag__period",children:a})]}),y&&n&&c.jsx("span",{className:"nice-price-tag__original","aria-label":"Original price",children:c.jsx("s",{children:Q(n,{locale:u})})}),y&&l&&m!=null&&m>0&&c.jsxs("span",{className:"nice-price-tag__discount","aria-label":`${m} percent off`,children:["−",m,"%"]}),s&&c.jsx("span",{className:"nice-price-tag__suffix",children:s})]})}),Tt=o.forwardRef(function({source:e,onSourceChange:n,targetCurrency:a,onTargetCurrencyChange:r,provider:s,locale:l,showRateLine:i=!0,className:u,style:d},p){const{converted:x,loading:y,error:m}=be(e,a,s),h=o.useMemo(()=>({amount:Math.pow(10,2),currency:e.currency}),[e.currency]),{converted:b}=be(i?h:null,a,s);return c.jsxs("div",{ref:p,className:"nice-currency-converter"+(u?` ${u}`:""),style:d,children:[c.jsx("div",{className:"nice-currency-converter__row",children:c.jsx(Me,{label:"From",value:e,onChange:f=>f&&n(f),currency:e.currency,onCurrencyChange:f=>n({...e,currency:f}),showFormattedPreview:!1})}),c.jsxs("div",{className:"nice-currency-converter__row",children:[c.jsx("label",{className:"nice-currency-converter__label",children:"To"}),c.jsxs("div",{className:"nice-currency-converter__output",children:[c.jsx(Se,{value:a,onChange:f=>r(f),compact:!0}),c.jsx("span",{className:"nice-currency-converter__amount",children:y?"…":m?"—":x?Q(x,{locale:l}):""})]})]}),i&&b&&c.jsxs("p",{className:"nice-currency-converter__rate",children:["1 ",e.currency," = ",Q(b,{locale:l})," ",c.jsxs("span",{className:"nice-currency-converter__inverse",children:["· 1 ",a," ="," ",Q(X(1/we(b),e.currency),{locale:l})]})]}),m&&c.jsx("p",{className:"nice-currency-converter__error",role:"alert",children:m.message})]})});function Fe(t){return{amount:Math.round(t.amount),currency:t.currency}}const Bt=o.forwardRef(function({lines:e,locale:n,rounding:a="line",showTotals:r=!0,showGrandTotal:s=!0,hideRateColumn:l=!1,labels:i,density:u="comfortable",className:d,style:p,id:x},y){const m={label:(i==null?void 0:i.label)??"Item",rate:(i==null?void 0:i.rate)??"VAT",net:(i==null?void 0:i.net)??"Net",vat:(i==null?void 0:i.vat)??"Tax",gross:(i==null?void 0:i.gross)??"Gross",total:(i==null?void 0:i.total)??"Total"},h=o.useMemo(()=>{if(a==="total"){const _=new Map;for(const N of e){let C=_.get(N.vatRate);C||(C=[],_.set(N.vatRate,C)),C.push(N.netAmount)}const S=[];for(const[N,C]of _){const E=C.reduce((R,K)=>oe(R,K),X(0,C[0].currency)),z=Fe(he(E,N)),Y=oe(E,z);S.push({rate:N,net:E,vat:z,gross:Y})}return S}return e.map(_=>{const S=Fe(he(_.netAmount,_.vatRate)),N=oe(_.netAmount,S);return{label:_.label,rate:_.vatRate,net:_.netAmount,vat:S,gross:N}})},[e,a]),b=o.useMemo(()=>{if(h.length===0)return null;const _=h[0].net.currency;let S=X(0,_),N=X(0,_),C=X(0,_);for(const E of h)S=oe(S,E.net),N=oe(N,E.vat),C=oe(C,E.gross);return{net:S,vat:N,gross:C}},[h]),f=_=>Q(_,{locale:n});return c.jsxs("table",{ref:y,id:x,className:`nice-tax-breakdown nice-tax-breakdown--${u} ${d??""}`,style:p,role:"table","aria-label":m.total,children:[c.jsx("thead",{children:c.jsxs("tr",{children:[h.some(_=>_.label!==void 0)&&c.jsx("th",{scope:"col",children:m.label}),!l&&c.jsx("th",{scope:"col",className:"nice-tax-breakdown__rate",children:m.rate}),c.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:m.net}),c.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:m.vat}),c.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:m.gross})]})}),c.jsx("tbody",{children:h.map((_,S)=>c.jsxs("tr",{children:[h.some(N=>N.label!==void 0)&&c.jsx("td",{children:_.label??""}),!l&&c.jsxs("td",{className:"nice-tax-breakdown__rate",children:[(_.rate*100).toLocaleString(n,{maximumFractionDigits:2}),"%"]}),c.jsx("td",{className:"nice-tax-breakdown__num",children:f(_.net)}),c.jsx("td",{className:"nice-tax-breakdown__num",children:f(_.vat)}),c.jsx("td",{className:"nice-tax-breakdown__num",children:f(_.gross)})]},`${_.rate}-${S}`))}),r&&b&&c.jsx("tfoot",{children:s&&c.jsxs("tr",{className:"nice-tax-breakdown__totals",children:[h.some(_=>_.label!==void 0)&&c.jsx("td",{children:m.total}),!l&&c.jsx("td",{}),c.jsx("td",{className:"nice-tax-breakdown__num",children:f(b.net)}),c.jsx("td",{className:"nice-tax-breakdown__num",children:f(b.vat)}),c.jsx("td",{className:"nice-tax-breakdown__num",children:f(b.gross)})]})})]})});exports.EcbRatesProvider=Ye;exports.ExchangeRateHostProvider=He;exports.FrankfurterProvider=qe;exports.FreeForexApiProvider=Ge;exports.MockPaymentProcessor=Je;exports.NICE_CURRENCY_CATALOG=ue;exports.NICE_CURRENCY_CODES=At;exports.NICE_PAYMENT_PROCESSORS=Pt;exports.NbpRatesProvider=ze;exports.NiceCreditCardInput=dt;exports.NiceCurrencyConverter=Tt;exports.NiceCurrencySelector=Se;exports.NiceMoney=ge;exports.NiceMoneyInput=Me;exports.NicePaymentForm=Ft;exports.NicePriceTag=Kt;exports.NiceTaxBreakdown=Bt;exports.OpenExchangeRatesProvider=Le;exports.StaticExchangeRateProvider=St;exports.addMoney=oe;exports.compareMoney=wt;exports.convertMoney=Ze;exports.createEcbRatesProvider=Rt;exports.createFreeForexApiProvider=$t;exports.createNbpRatesProvider=Mt;exports.createOpenExchangeRatesProvider=kt;exports.detectCardBrand=me;exports.expectedCvcLength=le;exports.findCurrency=H;exports.formatCardNumber=Be;exports.formatMoney=Q;exports.fromMoney=we;exports.isExpiryValid=De;exports.isNegative=jt;exports.isZero=Ct;exports.luhnCheck=je;exports.makeAdyenAdapter=Ve;exports.makeAutopayAdapter=st;exports.makeBlikAdapter=it;exports.makeBraintreeAdapter=tt;exports.makeCoinbaseCommerceAdapter=lt;exports.makeKlarnaAdapter=ot;exports.makeMollieAdapter=et;exports.makePayPalAdapter=Qe;exports.makePayUAdapter=rt;exports.makePrzelewy24Adapter=at;exports.makeRazorpayAdapter=nt;exports.makeSquareAdapter=We;exports.makeStripeAdapter=Xe;exports.makeTpayAdapter=ct;exports.maskCardNumber=Dt;exports.multiplyMoney=he;exports.negateMoney=vt;exports.normaliseExpiry=ve;exports.parseMoney=Te;exports.registerCurrency=Nt;exports.subtractMoney=Ke;exports.toMoney=X;exports.useNiceExchangeRate=be;exports.useNiceMoney=Ut;exports.useNicePayment=ut;exports.validateCreditCard=Ne;
1
+ "use strict";var vt=Object.defineProperty;var kt=(t,e,r)=>e in t?vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var F=(t,e,r)=>kt(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),n=require("react/jsx-runtime"),Te=require("@nice2dev/ui-core"),de=[{code:"USD",numeric:840,symbol:"$",name:"US Dollar",decimals:2,symbolFirst:!0},{code:"EUR",numeric:978,symbol:"€",name:"Euro",decimals:2,symbolFirst:!0},{code:"GBP",numeric:826,symbol:"£",name:"Pound Sterling",decimals:2,symbolFirst:!0},{code:"JPY",numeric:392,symbol:"¥",name:"Japanese Yen",decimals:0,symbolFirst:!0},{code:"CHF",numeric:756,symbol:"Fr",name:"Swiss Franc",decimals:2},{code:"CAD",numeric:124,symbol:"CA$",name:"Canadian Dollar",decimals:2,symbolFirst:!0},{code:"AUD",numeric:36,symbol:"A$",name:"Australian Dollar",decimals:2,symbolFirst:!0},{code:"NZD",numeric:554,symbol:"NZ$",name:"New Zealand Dollar",decimals:2,symbolFirst:!0},{code:"CNY",numeric:156,symbol:"¥",name:"Chinese Yuan Renminbi",decimals:2,symbolFirst:!0},{code:"HKD",numeric:344,symbol:"HK$",name:"Hong Kong Dollar",decimals:2,symbolFirst:!0},{code:"SGD",numeric:702,symbol:"S$",name:"Singapore Dollar",decimals:2,symbolFirst:!0},{code:"PLN",numeric:985,symbol:"zł",name:"Polish Złoty",decimals:2},{code:"CZK",numeric:203,symbol:"Kč",name:"Czech Koruna",decimals:2},{code:"HUF",numeric:348,symbol:"Ft",name:"Hungarian Forint",decimals:2},{code:"RON",numeric:946,symbol:"lei",name:"Romanian Leu",decimals:2},{code:"BGN",numeric:975,symbol:"лв",name:"Bulgarian Lev",decimals:2},{code:"HRK",numeric:191,symbol:"kn",name:"Croatian Kuna",decimals:2},{code:"DKK",numeric:208,symbol:"kr",name:"Danish Krone",decimals:2},{code:"SEK",numeric:752,symbol:"kr",name:"Swedish Krona",decimals:2},{code:"NOK",numeric:578,symbol:"kr",name:"Norwegian Krone",decimals:2},{code:"ISK",numeric:352,symbol:"kr",name:"Icelandic Króna",decimals:0},{code:"RUB",numeric:643,symbol:"₽",name:"Russian Ruble",decimals:2},{code:"UAH",numeric:980,symbol:"₴",name:"Ukrainian Hryvnia",decimals:2},{code:"TRY",numeric:949,symbol:"₺",name:"Turkish Lira",decimals:2,symbolFirst:!0},{code:"MXN",numeric:484,symbol:"Mex$",name:"Mexican Peso",decimals:2,symbolFirst:!0},{code:"BRL",numeric:986,symbol:"R$",name:"Brazilian Real",decimals:2,symbolFirst:!0},{code:"ARS",numeric:32,symbol:"AR$",name:"Argentine Peso",decimals:2,symbolFirst:!0},{code:"CLP",numeric:152,symbol:"CL$",name:"Chilean Peso",decimals:0,symbolFirst:!0},{code:"COP",numeric:170,symbol:"CO$",name:"Colombian Peso",decimals:2,symbolFirst:!0},{code:"PEN",numeric:604,symbol:"S/",name:"Peruvian Sol",decimals:2,symbolFirst:!0},{code:"UYU",numeric:858,symbol:"$U",name:"Uruguayan Peso",decimals:2,symbolFirst:!0},{code:"INR",numeric:356,symbol:"₹",name:"Indian Rupee",decimals:2,symbolFirst:!0},{code:"IDR",numeric:360,symbol:"Rp",name:"Indonesian Rupiah",decimals:2,symbolFirst:!0},{code:"KRW",numeric:410,symbol:"₩",name:"South Korean Won",decimals:0,symbolFirst:!0},{code:"MYR",numeric:458,symbol:"RM",name:"Malaysian Ringgit",decimals:2,symbolFirst:!0},{code:"PHP",numeric:608,symbol:"₱",name:"Philippine Peso",decimals:2,symbolFirst:!0},{code:"THB",numeric:764,symbol:"฿",name:"Thai Baht",decimals:2,symbolFirst:!0},{code:"VND",numeric:704,symbol:"₫",name:"Vietnamese Đồng",decimals:0},{code:"TWD",numeric:901,symbol:"NT$",name:"New Taiwan Dollar",decimals:2,symbolFirst:!0},{code:"PKR",numeric:586,symbol:"₨",name:"Pakistani Rupee",decimals:2},{code:"BDT",numeric:50,symbol:"৳",name:"Bangladeshi Taka",decimals:2},{code:"LKR",numeric:144,symbol:"Rs",name:"Sri Lankan Rupee",decimals:2},{code:"AED",numeric:784,symbol:"د.إ",name:"UAE Dirham",decimals:2},{code:"SAR",numeric:682,symbol:"ر.س",name:"Saudi Riyal",decimals:2},{code:"QAR",numeric:634,symbol:"ر.ق",name:"Qatari Riyal",decimals:2},{code:"KWD",numeric:414,symbol:"د.ك",name:"Kuwaiti Dinar",decimals:3},{code:"BHD",numeric:48,symbol:".د.ب",name:"Bahraini Dinar",decimals:3},{code:"OMR",numeric:512,symbol:"ر.ع",name:"Omani Rial",decimals:3},{code:"JOD",numeric:400,symbol:"د.أ",name:"Jordanian Dinar",decimals:3},{code:"ILS",numeric:376,symbol:"₪",name:"Israeli New Shekel",decimals:2,symbolFirst:!0},{code:"EGP",numeric:818,symbol:"E£",name:"Egyptian Pound",decimals:2,symbolFirst:!0},{code:"ZAR",numeric:710,symbol:"R",name:"South African Rand",decimals:2,symbolFirst:!0},{code:"NGN",numeric:566,symbol:"₦",name:"Nigerian Naira",decimals:2,symbolFirst:!0},{code:"KES",numeric:404,symbol:"KSh",name:"Kenyan Shilling",decimals:2},{code:"GHS",numeric:936,symbol:"₵",name:"Ghanaian Cedi",decimals:2},{code:"MAD",numeric:504,symbol:"د.م.",name:"Moroccan Dirham",decimals:2},{code:"TND",numeric:788,symbol:"د.ت",name:"Tunisian Dinar",decimals:3},{code:"BTC",numeric:0,symbol:"₿",name:"Bitcoin",decimals:8,symbolFirst:!0},{code:"ETH",numeric:0,symbol:"Ξ",name:"Ether",decimals:8,symbolFirst:!0},{code:"USDC",numeric:0,symbol:"USDC",name:"USD Coin",decimals:6},{code:"USDT",numeric:0,symbol:"USDT",name:"Tether",decimals:6}],Fe=new Map(de.map(t=>[t.code,t]));function J(t){return Fe.get(t.toUpperCase())}function wt(t){Fe.set(t.code.toUpperCase(),t);const e=de.findIndex(r=>r.code===t.code);e>=0?de[e]=t:de.push(t)}function Q(t,e){const r=J(e),a=(r==null?void 0:r.decimals)??2,c=Math.pow(10,a);return{amount:(t<0?-1:1)*Math.round(Math.abs(t)*c),currency:e.toUpperCase()}}function ke(t){const e=J(t.currency),r=(e==null?void 0:e.decimals)??2;return t.amount/Math.pow(10,r)}function Ct(t,e){return t.currency.toUpperCase()===e.currency.toUpperCase()}function we(t,e,r){if(!Ct(t,e))throw new Error(`Cannot ${r} different currencies: ${t.currency} vs ${e.currency}`)}function oe(t,e){return we(t,e,"add"),{amount:t.amount+e.amount,currency:t.currency}}function Ke(t,e){return we(t,e,"subtract"),{amount:t.amount-e.amount,currency:t.currency}}function fe(t,e){return{amount:(t.amount*e<0?-1:1)*Math.round(Math.abs(t.amount*e)),currency:t.currency}}function jt(t,e){return we(t,e,"compare"),t.amount-e.amount}function Mt(t){return t.amount===0}function Pt(t){return t.amount<0}function Dt(t){return{amount:-t.amount,currency:t.currency}}function W(t,e={}){const r=J(t.currency),a=e.decimals??(r==null?void 0:r.decimals)??2,c=t.amount/Math.pow(10,a);try{return new Intl.NumberFormat(e.locale,{style:"currency",currency:t.currency,minimumFractionDigits:a,maximumFractionDigits:a,currencyDisplay:e.currencyDisplay??"symbol"}).format(c)}catch{const s=(r==null?void 0:r.symbol)??t.currency,l=c.toFixed(a);return r!=null&&r.symbolFirst?`${s}${l}`:`${l} ${s}`}}function Be(t,e){if(!t)return null;let r=t.replace(/[^\d.,\-]/g,"").trim();if(!r||r==="-")return null;const a=r.startsWith("-");a&&(r=r.slice(1));const c=r.lastIndexOf("."),s=r.lastIndexOf(","),l=Math.max(c,s);let i,d="";l===-1?i=r:(i=r.slice(0,l).replace(/[.,]/g,""),d=r.slice(l+1).replace(/[.,]/g,""));const u=`${i}.${d||"0"}`,y=parseFloat(u);return Number.isFinite(y)?Q(a?-y:y,e):null}function pe(t){const e=(t||"").replace(/\D/g,"");return e?/^4/.test(e)?"visa":/^(5[1-5]|2(2[2-9]|[3-6]\d|7[01]|720))/.test(e)?"mastercard":/^3[47]/.test(e)?"amex":/^(6011|65|64[4-9]|622(12[6-9]|1[3-9]\d|[2-8]\d\d|9[01]\d|92[0-5]))/.test(e)?"discover":/^3(0[0-5]|[68])/.test(e)?"diners":/^35(2[89]|[3-8])/.test(e)?"jcb":/^62/.test(e)?"unionpay":/^(50|5[6-9]|6[0-9])/.test(e)?"maestro":/^(2200|2201|2202|2203|2204)/.test(e)?"mir":/^(4011|4312|4389|4514|4576|5041|5066|5067|509|6277|6362|6363|650|6516|6550)/.test(e)?"elo":/^(606282|3841)/.test(e)?"hipercard":"unknown":"unknown"}function Ce(t){const e=(t||"").replace(/\D/g,"");if(e.length<12||e.length>19)return!1;let r=0,a=!1;for(let c=e.length-1;c>=0;c--){let s=e.charCodeAt(c)-48;a&&(s*=2,s>9&&(s-=9)),r+=s,a=!a}return r%10===0}function Le(t,e){const r=(t||"").replace(/\D/g,""),a=e??pe(r);return a==="amex"?[r.slice(0,4),r.slice(4,10),r.slice(10,15)].filter(Boolean).join(" "):a==="diners"?[r.slice(0,4),r.slice(4,10),r.slice(10,14)].filter(Boolean).join(" "):(r.match(/.{1,4}/g)??[]).join(" ").trim()}function St(t,e){const r=(t||"").replace(/\D/g,"");if(r.length<4)return r;const a=r.slice(-4),c="*".repeat(r.length-4)+a,s=e??pe(r);return s==="amex"?[c.slice(0,4),c.slice(4,10),c.slice(10,15)].filter(Boolean).join(" "):s==="diners"?[c.slice(0,4),c.slice(4,10),c.slice(10,14)].filter(Boolean).join(" "):(c.match(/.{1,4}/g)??[]).join(" ").trim()}function je(t){const e=(t||"").replace(/\D/g,"");if(e.length<3)return null;const r=e.slice(0,2),a=e.length>=4?e.slice(-2):e.slice(2,4),c=parseInt(r,10);return!Number.isFinite(c)||c<1||c>12?null:`${r}/${a}`}function Me(t,e=new Date){const r=je(t);if(!r)return!1;const[a,c]=r.split("/"),s=parseInt(a,10),l=2e3+parseInt(c,10);return new Date(l,s,0,23,59,59,999).getTime()>=e.getTime()}function le(t){return t==="amex"?4:3}function Ne(t,e={}){var u;const r={},a=pe(t.number),c=Ce(t.number);c||(r.number="Invalid card number");const s=Me(t.expiry,e.now);s||(r.expiry="Invalid or expired");const i=(t.cvc||"").replace(/\D/g,"").length===le(a);i||(r.cvc=`CVC must be ${le(a)} digits`);const d=!e.requireHolder||(((u=t.holderName)==null?void 0:u.trim().length)??0)>=2;return d||(r.holderName="Cardholder name required"),{brand:a,numberValid:c,expiryValid:s,cvcValid:i,holderValid:d,isValid:c&&s&&i&&d,errors:r}}class It{constructor(e){F(this,"id","static");this.rates=e}async getRate(e,r){const a=e.toUpperCase(),c=r.toUpperCase();if(a===c)return{base:a,quote:c,rate:1,asOf:new Date().toISOString()};const s=this.rates.find(u=>u.base===a&&u.quote===c);if(s)return s;const l=this.rates.find(u=>u.base===c&&u.quote===a);if(l)return{base:a,quote:c,rate:1/l.rate,asOf:l.asOf};const i=this.rates.find(u=>u.base===a&&u.quote==="USD")??this.rates.find(u=>u.base==="USD"&&u.quote===a),d=this.rates.find(u=>u.base==="USD"&&u.quote===c)??this.rates.find(u=>u.base===c&&u.quote==="USD");if(i&&d){const u=i.base==="USD"?1/i.rate:i.rate,y=d.base==="USD"?d.rate:1/d.rate;return{base:a,quote:c,rate:u*y,asOf:new Date().toISOString()}}throw new Error(`No FX rate for ${a}/${c}`)}}class xe{constructor(e={}){F(this,"cache",new Map);F(this,"fetchImpl");F(this,"ttl");this.fetchImpl=e.fetchImpl??fetch,this.ttl=e.cacheTtl??6e4}cacheKey(e,r){return`${this.id}:${e.toUpperCase()}/${r.toUpperCase()}`}getCached(e,r){const a=this.cacheKey(e,r),c=this.cache.get(a);return c&&c.expires>Date.now()?c.rate:(c&&this.cache.delete(a),null)}setCached(e){this.cache.set(this.cacheKey(e.base,e.quote),{expires:Date.now()+this.ttl,rate:e})}}class He extends xe{constructor(r={}){super(r);F(this,"id","frankfurter")}async getRate(r,a){const c=r.toUpperCase(),s=a.toUpperCase();if(c===s)return{base:c,quote:s,rate:1,asOf:new Date().toISOString()};const l=this.getCached(c,s);if(l)return l;const i=`https://api.frankfurter.app/latest?from=${c}&to=${s}`,d=await this.fetchImpl(i);if(!d.ok)throw new Error(`Frankfurter HTTP ${d.status}`);const u=await d.json(),y=u.rates[s];if(y==null)throw new Error(`Frankfurter: no rate for ${c}/${s}`);const x={base:c,quote:s,rate:y,asOf:u.date};return this.setCached(x),x}}class ze extends xe{constructor(r,a={}){super(a);F(this,"id","openexchangerates");this.appId=r}async getRate(r,a){const c=r.toUpperCase(),s=a.toUpperCase();if(c===s)return{base:c,quote:s,rate:1,asOf:new Date().toISOString()};const l=this.getCached(c,s);if(l)return l;const i=`https://openexchangerates.org/api/latest.json?app_id=${this.appId}`,d=await this.fetchImpl(i);if(!d.ok)throw new Error(`OpenExchangeRates HTTP ${d.status}`);const u=await d.json(),y=u.rates[c],x=u.rates[s];if(y==null||x==null)throw new Error(`OpenExchangeRates: missing rate for ${c} or ${s}`);const h={base:c,quote:s,rate:x/y,asOf:new Date(u.timestamp*1e3).toISOString()};return this.setCached(h),h}}class Ye extends xe{constructor(r={}){super(r);F(this,"id","exchangerate.host")}async getRate(r,a){var h;const c=r.toUpperCase(),s=a.toUpperCase();if(c===s)return{base:c,quote:s,rate:1,asOf:new Date().toISOString()};const l=this.getCached(c,s);if(l)return l;const i=`https://api.exchangerate.host/convert?from=${c}&to=${s}`,d=await this.fetchImpl(i);if(!d.ok)throw new Error(`exchangerate.host HTTP ${d.status}`);const u=await d.json(),y=((h=u.info)==null?void 0:h.rate)??u.result,x={base:c,quote:s,rate:y,asOf:u.date};return this.setCached(x),x}}class Ge extends xe{constructor(r={}){super(r);F(this,"id","nbp");F(this,"table");this.table=r.table??"A"}async getRate(r,a){const c=r.toUpperCase(),s=a.toUpperCase();if(c===s)return{base:c,quote:s,rate:1,asOf:new Date().toISOString()};const l=this.getCached(c,s);if(l)return l;const i=async x=>{var f;if(x==="PLN")return{rate:1,date:new Date().toISOString().slice(0,10)};const h=`https://api.nbp.pl/api/exchangerates/rates/${this.table}/${x}/?format=json`,p=await this.fetchImpl(h);if(!p.ok)return null;const b=(f=(await p.json()).rates)==null?void 0:f[0];return b?{rate:b.mid??b.ask??0,date:b.effectiveDate}:null},d=await i(c),u=await i(s);if(!d||!u||d.rate===0)throw new Error(`NBP: missing rate for ${c} or ${s}`);const y={base:c,quote:s,rate:d.rate/u.rate,asOf:d.date};return this.setCached(y),y}}class Ze extends He{constructor(){super(...arguments);F(this,"id","ecb")}}class Je extends Ye{constructor(){super(...arguments);F(this,"id","free-forex")}}const Rt=(t={})=>new Ge(t),$t=(t={})=>new Ze(t),At=t=>new ze(t.apiKey,t),Ut=(t={})=>new Je(t);async function Xe(t,e,r){const a=e.toUpperCase();if(t.currency.toUpperCase()===a)return t;const c=J(t.currency),s=J(a),l=(c==null?void 0:c.decimals)??2,i=(s==null?void 0:s.decimals)??2,{rate:d}=await r.getRate(t.currency,a),y=t.amount/Math.pow(10,l)*d;return{currency:a,amount:Math.round(y*Math.pow(10,i))}}class Qe{constructor(e={}){F(this,"id");F(this,"name");F(this,"supportedCurrencies");F(this,"minimums");F(this,"counter",0);this.id=e.id??"mock",this.name=e.name??"Mock Processor",this.supportedCurrencies=e.supportedCurrencies??"*"}newId(e){return this.counter+=1,`${e}_${Date.now().toString(36)}_${this.counter}`}async authorize(e){return{id:this.newId("auth"),status:"authorized",processor:this.id,amount:e.amount,raw:{mock:!0,request:e}}}async capture(e,r){return{id:e.replace("auth_","cap_"),status:"captured",processor:this.id,amount:r}}async cancel(e){return{id:e,status:"cancelled",processor:this.id}}async refund(e,r){return{id:e.replace(/^[a-z]+_/,"ref_"),status:"refunded",processor:this.id,amount:r}}}function G(t,e,r,a,c){const s=l=>{const i=a==null?void 0:a[l];return i||(async()=>{throw new Error(`[ui-money] ${e} adapter is not wired. Pass an \`executor.${String(l)}\` implementation that calls the ${e} SDK.`)})};return{id:t,name:e,supportedCurrencies:r,minimums:c,authorize:s("authorize"),capture:s("capture"),cancel:s("cancel"),refund:s("refund")}}function We(t){return G("stripe","Stripe","*",t,{USD:50,EUR:50,GBP:30,JPY:50,AUD:50,CAD:50,CHF:50,DKK:250,NOK:300,SEK:300,PLN:200})}function Ve(t){return G("paypal","PayPal",["USD","EUR","GBP","AUD","CAD","JPY","CHF","NZD","SEK","NOK","DKK","PLN","CZK","HUF","BRL","MXN","HKD","SGD","TWD","THB","PHP","ILS"],t)}function et(t){return G("adyen","Adyen","*",t)}function tt(t){return G("square","Square",["USD","CAD","GBP","AUD","JPY","EUR"],t)}function rt(t){return G("mollie","Mollie","*",t)}function nt(t){return G("braintree","Braintree","*",t)}function at(t){return G("razorpay","Razorpay",["INR","USD","EUR","GBP","AED"],t)}function ct(t){return G("payu","PayU",["PLN","EUR","USD","CZK","HUF","RON","BGN","TRY"],t)}function st(t){return G("przelewy24","Przelewy24",["PLN","EUR"],t)}function it(t={}){return G("tpay","Tpay",["PLN","EUR","USD","GBP"],t)}function ot(t={}){return G("autopay","Autopay",["PLN","EUR","USD","GBP","CZK"],t)}function lt(t={}){const{acquirer:e="native",...r}=t;return G(`blik:${e}`,`BLIK (${e})`,["PLN"],r)}function dt(t){return G("klarna","Klarna",["USD","EUR","GBP","SEK","NOK","DKK","CHF","AUD","CAD","NZD","PLN"],t)}function ut(t){return G("coinbase-commerce","Coinbase Commerce",["BTC","ETH","USDC","USDT","USD","EUR"],t)}const mt={mock:()=>new Qe,stripe:()=>We(),paypal:()=>Ve(),adyen:()=>et(),square:()=>tt(),mollie:()=>rt(),braintree:()=>nt(),razorpay:()=>at(),payu:()=>ct(),przelewy24:()=>st(),tpay:()=>it(),autopay:()=>ot(),blik:()=>lt(),klarna:()=>dt(),"coinbase-commerce":()=>ut()};function Et(t){const e=mt[t];return e?e().supportedCurrencies:"*"}function Tt(t){return`/api/payments/${t}/webhook`}const Ot=[{id:"stripe",name:"Stripe",type:"card",credentials:[{key:"apiKey",label:"Secret API key",secret:!0,required:!0,help:"sk_live_… / sk_test_…"},{key:"publishableKey",label:"Publishable key",required:!0,help:"pk_live_… / pk_test_…"},{key:"webhookSecret",label:"Webhook signing secret",secret:!0,help:"whsec_…"}],supportedMethods:["card","applepay","googlepay","link"],allowedDomains:["api.stripe.com"],hasTestMode:!0},{id:"paypal",name:"PayPal",type:"wallet",credentials:[{key:"clientId",label:"Client ID",required:!0},{key:"clientSecret",label:"Client secret",secret:!0,required:!0},{key:"webhookId",label:"Webhook ID"}],supportedMethods:["paypal","card","paylater"],allowedDomains:["api-m.paypal.com","api-m.sandbox.paypal.com"],hasTestMode:!0},{id:"adyen",name:"Adyen",type:"aggregator",credentials:[{key:"apiKey",label:"API key",secret:!0,required:!0},{key:"merchantAccount",label:"Merchant account",required:!0},{key:"hmacKey",label:"HMAC key (webhooks)",secret:!0},{key:"clientKey",label:"Client key"}],supportedMethods:["card","ideal","bancontact","applepay","googlepay"],allowedDomains:["checkout-test.adyen.com","checkout-live.adyen.com"],hasTestMode:!0},{id:"square",name:"Square",type:"card",credentials:[{key:"accessToken",label:"Access token",secret:!0,required:!0},{key:"applicationId",label:"Application ID",required:!0},{key:"locationId",label:"Location ID",required:!0}],supportedMethods:["card","applepay","googlepay"],allowedDomains:["connect.squareup.com","connect.squareupsandbox.com"],hasTestMode:!0},{id:"mollie",name:"Mollie",type:"aggregator",credentials:[{key:"apiKey",label:"API key",secret:!0,required:!0,help:"live_… / test_…"}],supportedMethods:["card","ideal","bancontact","blik","applepay"],allowedDomains:["api.mollie.com"],hasTestMode:!0},{id:"braintree",name:"Braintree",type:"card",credentials:[{key:"merchantId",label:"Merchant ID",required:!0},{key:"publicKey",label:"Public key",required:!0},{key:"privateKey",label:"Private key",secret:!0,required:!0}],supportedMethods:["card","paypal","applepay","googlepay"],allowedDomains:["api.braintreegateway.com","api.sandbox.braintreegateway.com"],hasTestMode:!0},{id:"razorpay",name:"Razorpay",type:"aggregator",credentials:[{key:"keyId",label:"Key ID",required:!0},{key:"keySecret",label:"Key secret",secret:!0,required:!0},{key:"webhookSecret",label:"Webhook secret",secret:!0}],supportedMethods:["card","upi","netbanking","wallet"],allowedDomains:["api.razorpay.com"],hasTestMode:!0},{id:"payu",name:"PayU",type:"aggregator",credentials:[{key:"posId",label:"POS ID",required:!0},{key:"clientId",label:"OAuth client ID",required:!0},{key:"clientSecret",label:"OAuth client secret",secret:!0,required:!0},{key:"secondKey",label:"Second key (MD5)",secret:!0}],supportedMethods:["card","blik","transfer","googlepay"],allowedDomains:["secure.payu.com","secure.snd.payu.com"],hasTestMode:!0},{id:"przelewy24",name:"Przelewy24",type:"bank",credentials:[{key:"merchantId",label:"Merchant ID",required:!0},{key:"posId",label:"POS ID",required:!0},{key:"crcKey",label:"CRC key",secret:!0,required:!0},{key:"apiKey",label:"API key",secret:!0,required:!0}],supportedMethods:["transfer","blik","card"],allowedDomains:["secure.przelewy24.pl","sandbox.przelewy24.pl"],hasTestMode:!0},{id:"tpay",name:"Tpay",type:"aggregator",credentials:[{key:"merchantId",label:"Merchant ID",required:!0},{key:"apiKey",label:"API key",secret:!0,required:!0},{key:"apiPassword",label:"API password",secret:!0,required:!0}],supportedMethods:["card","blik","transfer","applepay"],allowedDomains:["api.tpay.com","secure.tpay.com"],hasTestMode:!0},{id:"autopay",name:"Autopay",type:"aggregator",credentials:[{key:"serviceId",label:"Service ID",required:!0},{key:"sharedSecret",label:"Shared secret",secret:!0,required:!0}],supportedMethods:["card","blik","transfer"],allowedDomains:["pay.autopay.eu","testpay.autopay.eu"],hasTestMode:!0},{id:"blik",name:"BLIK",type:"bank",credentials:[{key:"acquirer",label:"Acquirer (p24 / tpay / payu / native)",required:!0,help:"Underlying acquirer routing BLIK."}],supportedMethods:["blik"],hasTestMode:!0},{id:"klarna",name:"Klarna",type:"bnpl",credentials:[{key:"username",label:"API username (UID)",required:!0},{key:"password",label:"API password",secret:!0,required:!0},{key:"region",label:"Region (eu / na / oc)",help:"Selects the Klarna API host."}],supportedMethods:["paylater","installments","paynow"],allowedDomains:["api.klarna.com","api.playground.klarna.com"],hasTestMode:!0},{id:"coinbase-commerce",name:"Coinbase Commerce",type:"crypto",credentials:[{key:"apiKey",label:"API key",secret:!0,required:!0},{key:"webhookSharedSecret",label:"Webhook shared secret",secret:!0}],supportedMethods:["crypto"],allowedDomains:["api.commerce.coinbase.com"],hasTestMode:!1},{id:"wallet",name:"In-app Wallet",type:"wallet",currencyKey:"mock",credentials:[{key:"ledgerAccount",label:"Ledger account",required:!0,help:"Account the wallet debits/credits."}],supportedMethods:["wallet"],hasTestMode:!0}],me=Object.fromEntries(Ot.map(t=>{const{currencyKey:e,...r}=t,a={...r,supportedCurrencies:Et(e??t.id),webhookPath:Tt(t.id)};return[t.id,a]})),pt=Object.values(me);function qt(t){return me[t]}function Ft(t,e){const r=o.useMemo(()=>"amount"in t?t:Q(t.major,t.currency),[]),[a,c]=o.useState(r),s=o.useCallback(h=>c(p=>Q(h,p.currency)),[]),l=o.useCallback(h=>{c(p=>({...p,currency:h.toUpperCase()}))},[]),i=o.useCallback(h=>c(p=>oe(p,h)),[]),d=o.useCallback(h=>c(p=>Ke(p,h)),[]),u=o.useCallback(h=>c(p=>fe(p,h)),[]),y=o.useMemo(()=>W(a,{locale:e}),[a,e]),x=o.useMemo(()=>ke(a),[a]);return{money:a,setMoney:c,setMajor:s,setCurrency:l,add:i,subtract:d,scale:u,formatted:y,major:x}}function _e(t,e,r){const[a,c]=o.useState(null),[s,l]=o.useState(null),[i,d]=o.useState(!1),u=o.useRef(0);return o.useEffect(()=>{if(!t){c(null);return}const y=++u.current;d(!0),l(null),Xe(t,e,r).then(x=>{u.current===y&&c(x)}).catch(x=>{u.current===y&&(l(x instanceof Error?x:new Error(String(x))),c(null))}).finally(()=>{u.current===y&&d(!1)})},[t==null?void 0:t.amount,t==null?void 0:t.currency,e,r]),{converted:a,loading:i,error:s}}function yt(t){const[e,r]=o.useState("idle"),[a,c]=o.useState(null),[s,l]=o.useState(null),i=o.useCallback(()=>{r("idle"),c(null),l(null)},[]),d=o.useCallback(async h=>{r("authorizing"),l(null);try{const p=await t.authorize(h);return c(p),r(p.status),p}catch(p){const _=p instanceof Error?p:new Error(String(p));throw l(_),r("failed"),_}},[t]),u=o.useCallback(async(h,p)=>{const _=h??(a==null?void 0:a.id);if(!_)throw new Error("No authorization id to capture");r("capturing");try{const b=await t.capture(_,p);return c(b),r(b.status),b}catch(b){const f=b instanceof Error?b:new Error(String(b));throw l(f),r("failed"),f}},[t,a==null?void 0:a.id]),y=o.useCallback(async h=>{const p=h??(a==null?void 0:a.id);if(!p)throw new Error("No payment id to cancel");const _=await t.cancel(p);return c(_),r(_.status),_},[t,a==null?void 0:a.id]),x=o.useCallback(async(h,p)=>{const _=h??(a==null?void 0:a.id);if(!_)throw new Error("No payment id to refund");const b=await t.refund(_,p);return c(b),r(b.status),b},[t,a==null?void 0:a.id]);return{status:e,response:a,error:s,authorize:d,capture:u,cancel:y,refund:x,reset:i}}const ve=o.forwardRef(function({value:e,amount:r,currency:a,locale:c,display:s="symbol",highlightNegative:l=!0,zeroPlaceholder:i,convertTo:d,exchangeProvider:u,className:y,style:x,"aria-label":h},p){const _=o.useMemo(()=>{if(e)return e;if(r!=null&&a){const v=J(a),k=(v==null?void 0:v.decimals)??2;return{amount:Math.round(r*Math.pow(10,k)),currency:a.toUpperCase()}}return null},[e,r,a]),b=o.useMemo(()=>_?_.amount===0&&i!=null?i:W(_,{locale:c,currencyDisplay:s}):"",[_,c,s,i]),{converted:f}=_e(d&&u?_:null,d??"",u);if(!_)return null;const g=_.amount<0,S="nice-money"+(l&&g?" nice-money--negative":"")+(y?` ${y}`:"");return n.jsxs("span",{ref:p,className:S,style:x,"aria-label":h,children:[n.jsx("span",{className:"nice-money__value",children:b}),f&&n.jsxs("span",{className:"nice-money__converted","aria-label":`Converted to ${f.currency}`,children:[" ≈ ",W(f,{locale:c})]})]})}),Kt=de.map(t=>t.code).sort(),Pe=o.forwardRef(function({value:e,onChange:r,options:a=de,recents:c=[],searchable:s,showCode:l=!0,showSymbol:i=!0,compact:d=!1,disabled:u,readOnly:y,loading:x,accessMode:h,label:p,helperText:_,error:b,required:f,size:g="md",labelPlacement:S="top",labelWidth:v,controlWidth:k,className:A,style:E,id:C,name:M,title:N,"data-testid":K,"aria-label":T,placeholder:z},L){const U=h==="hidden",Y=u||h==="disabled"||x,V=y||h==="readOnly",O=o.useId(),ee=C??`nice-cs-${O}`,[B,m]=o.useState(""),w=s??a.length>8,$=o.useMemo(()=>{if(!B.trim())return a;const D=B.trim().toLowerCase();return a.filter(I=>I.code.toLowerCase().includes(D)||I.name.toLowerCase().includes(D)||I.symbol.toLowerCase().includes(D))},[a,B]),P=o.useMemo(()=>{const D=new Set;return c.map(I=>J(I)).filter(I=>!!I&&!D.has(I.code)&&!!D.add(I.code))},[c]),te=o.useCallback(D=>{const I=D.target.value,ae=J(I);ae&&(r==null||r(I,ae))},[r]),re=D=>{if(d)return`${i?D.symbol+" ":""}${D.code}`;const I=[];return i&&I.push(D.symbol),l&&I.push(D.code),I.push("—",D.name),I.join(" ")},j=`nice-currency-selector nice-currency-selector--${g} nice-currency-selector--label-${S}`+(d?" nice-currency-selector--compact":"")+(b?" nice-currency-selector--error":"")+(Y?" nice-currency-selector--disabled":"")+(A?` ${A}`:""),q=S==="left"&&v!=null?{width:typeof v=="number"?`${v}px`:v,flex:"none"}:void 0,ne=k!=null?{width:typeof k=="number"?`${k}px`:k,flex:"none"}:void 0;return U?null:n.jsxs("div",{ref:L,className:j,style:E,title:N,"data-testid":K,children:[p&&n.jsxs("label",{htmlFor:ee,className:"nice-currency-selector__label",style:q,children:[p,f&&n.jsx("span",{className:"nice-currency-selector__required","aria-hidden":!0,children:"*"})]}),n.jsxs("div",{className:"nice-currency-selector__inner",style:ne,children:[w&&n.jsx("input",{type:"search",className:"nice-currency-selector__search",placeholder:"Search currency…",value:B,onChange:D=>m(D.target.value),disabled:Y||V,"aria-label":"Search currency"}),n.jsxs("select",{id:ee,name:M,className:"nice-currency-selector__select",value:e??"",onChange:te,disabled:Y||V,required:f,"aria-invalid":!!b,"aria-label":T??(typeof p=="string"?p:"Currency"),children:[!e&&n.jsx("option",{value:"",children:z??"Select currency…"}),P.length>0&&n.jsx("optgroup",{label:"Recent",children:P.map(D=>n.jsx("option",{value:D.code,children:re(D)},`r-${D.code}`))}),n.jsx("optgroup",{label:P.length>0?"All":"",children:$.map(D=>n.jsx("option",{value:D.code,children:re(D)},D.code))})]})]}),(b||_)&&n.jsx("span",{className:b?"nice-currency-selector__error":"nice-currency-selector__helper",children:b??_})]})}),De=o.forwardRef(function({value:e,onChange:r,currency:a,onCurrencyChange:c,currencies:s,hideCurrencySelector:l,min:i,max:d,step:u,locale:y,placeholder:x,label:h,helperText:p,error:_,size:b="md",disabled:f,readOnly:g,required:S,loading:v,accessMode:k,labelPlacement:A="top",errorPlacement:E="bottom",labelWidth:C,controlWidth:M,submitOnEnter:N,onSubmit:K,showFormattedPreview:T=!0,showSteppers:z=!1,className:L,style:U,id:Y,name:V,title:O,"data-testid":ee,onBlur:B,onFocus:m,liveGrouping:w,multiplierShortcuts:$=!0,onValidationError:P},te){const re=f||k==="disabled"||v,j=g||k==="readOnly",q=k==="hidden",ne=o.useId(),D=Y??`nice-money-${ne}`,I=((e==null?void 0:e.currency)??a??"USD").toUpperCase(),ae=J(I),Z=(ae==null?void 0:ae.decimals)??2,Se=u??1/Math.pow(10,Z),[ge,ye]=o.useState(()=>e?(e.amount/Math.pow(10,Z)).toFixed(Z):""),[he,Ie]=o.useState(!1);o.useEffect(()=>{if(he)return;if(e==null){ye("");return}const R=J(e.currency),H=(R==null?void 0:R.decimals)??2;ye((e.amount/Math.pow(10,H)).toFixed(H))},[e,he]);const Re=o.useCallback(R=>{let H=R;if($){const se=R.trim().match(/^([+-]?\d+(?:[.,]\d+)?)\s*([kKmMbB])$/);if(se){const ie=se[2].toLowerCase()==="k"?1e3:se[2].toLowerCase()==="m"?1e6:1e9,Ee=Number(se[1].replace(",","."))*ie;if(!Number.isFinite(Ee)){P==null||P(new Error("overflow"));return}H=String(Ee)}}const X=Be(H,I);if(!X){r==null||r(null);return}if(!Number.isSafeInteger(X.amount)){P==null||P(new Error("overflow: amount exceeds Number.MAX_SAFE_INTEGER"));return}const ce=X.amount/Math.pow(10,Z);if(i!=null&&ce<i){P==null||P(new Error(`min: ${i}`)),r==null||r(Q(i,I));return}if(d!=null&&ce>d){P==null||P(new Error(`max: ${d}`)),r==null||r(Q(d,I));return}r==null||r(X)},[I,Z,i,d,r,$,P]),bt=o.useCallback(R=>{const H=R.target.value;ye(H),Re(H)},[Re]),$e=o.useCallback(R=>{const X=(e?e.amount/Math.pow(10,Z):0)+R,ce=Math.min(d??1/0,Math.max(i??-1/0,X));r==null||r(Q(ce,I))},[e,Z,i,d,I,r]),be=o.useMemo(()=>{var R,H;try{const X=new Intl.NumberFormat(y).formatToParts(12345.6),ce=((R=X.find(ie=>ie.type==="group"))==null?void 0:R.value)??",",se=((H=X.find(ie=>ie.type==="decimal"))==null?void 0:H.value)??".";return{group:ce,decimal:se}}catch{return{group:",",decimal:"."}}},[y]),Ae=w??!!be.group,ft=o.useMemo(()=>{if(!Ae||he===!1)return ge;const R=be.decimal,H=be.group,X=ge.replace(new RegExp(`[${H.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}]`,"g"),""),[ce,se]=X.split(R);if(!ce)return X;const ie=ce.replace(/\B(?=(\d{3})+(?!\d))/g,H);return se!=null?`${ie}${R}${se}`:ie},[ge,he,Ae,be]),Ue=o.useMemo(()=>e?W(e,{locale:y}):"",[e,y]),ue=typeof _=="string"?_:void 0,_t=`nice-money-input nice-money-input--${b} nice-money-input--label-${A} nice-money-input--error-${E}`+(ue?" nice-money-input--error":"")+(re?" nice-money-input--disabled":"")+(v?" nice-money-input--loading":"")+(L?` ${L}`:""),xt=R=>{N&&R.key==="Enter"&&K&&(R.preventDefault(),K())},gt=A==="left"&&C!=null?{width:typeof C=="number"?`${C}px`:C,flex:"none"}:void 0,Nt=M!=null?{width:typeof M=="number"?`${M}px`:M,flex:"none"}:void 0;return q?null:n.jsxs("div",{ref:te,className:_t,style:U,title:O,"data-testid":ee,children:[h&&n.jsxs("label",{htmlFor:D,className:"nice-money-input__label",style:gt,children:[h,S&&n.jsx("span",{className:"nice-money-input__required","aria-hidden":!0,children:"*"})]}),n.jsxs("div",{className:"nice-money-input__row",style:Nt,children:[!l&&n.jsx(Pe,{value:I,compact:!0,options:s?s.map(J).filter(R=>!!R):void 0,onChange:R=>c==null?void 0:c(R),disabled:re||j,className:"nice-money-input__currency","aria-label":"Currency"}),l&&n.jsx("span",{className:"nice-money-input__symbol","aria-hidden":!0,children:(ae==null?void 0:ae.symbol)??I}),z&&n.jsx("button",{type:"button",className:"nice-money-input__step nice-money-input__step--down",onClick:()=>$e(-Se),disabled:re||j||i!=null&&e!=null&&e.amount/Math.pow(10,Z)<=i,"aria-label":"Decrease amount",tabIndex:-1,children:"−"}),n.jsx("input",{id:D,name:V,type:"text",inputMode:"decimal",autoComplete:"transaction-amount",className:"nice-money-input__amount",value:ft,onChange:bt,onKeyDown:xt,onFocus:R=>{Ie(!0),m==null||m(R)},onBlur:R=>{Ie(!1),e&&ye((e.amount/Math.pow(10,Z)).toFixed(Z)),B==null||B(R)},placeholder:x??`0${Z>0?"."+"0".repeat(Z):""}`,disabled:re,readOnly:j,required:S,"aria-invalid":!!ue,"aria-describedby":ue||p?`${D}-help`:void 0}),z&&n.jsx("button",{type:"button",className:"nice-money-input__step nice-money-input__step--up",onClick:()=>$e(Se),disabled:re||j||d!=null&&e!=null&&e.amount/Math.pow(10,Z)>=d,"aria-label":"Increase amount",tabIndex:-1,children:"+"}),v&&n.jsx("span",{className:"nice-money-input__spinner","aria-hidden":!0,children:"⟳"})]}),T&&Ue&&n.jsx("span",{className:"nice-money-input__preview","aria-live":"polite",children:Ue}),(ue||p)&&n.jsx("span",{id:`${D}-help`,className:ue?"nice-money-input__error":"nice-money-input__helper",children:ue??p})]})}),Bt={number:"",expiry:"",cvc:""},ht=o.forwardRef(function({value:e=Bt,onChange:r,showHolderName:a=!0,requireHolderName:c,showPostalCode:s=!1,acceptedBrands:l,showBrandIcon:i=!0,size:d="md",disabled:u,readOnly:y,loading:x,accessMode:h,label:p,helperText:_,error:b,required:f,className:g,style:S,id:v,title:k,"data-testid":A},E){const C=h==="hidden",M=u||h==="disabled"||x,N=y||h==="readOnly",K=o.useId(),T=v??`nice-cc-${K}`,[z,L]=o.useState({number:!1,expiry:!1,cvc:!1,holder:!1,postal:!1}),U=o.useMemo(()=>pe(e.number),[e.number]),Y=o.useMemo(()=>Ne(e,{requireHolder:c??a}),[e,c,a]),V=!l||l.includes(U)||U==="unknown",O=o.useCallback(j=>{const q={...e,...j},ne=Ne(q,{requireHolder:c??a});r==null||r(q,ne)},[e,c,a,r]),ee=o.useCallback(j=>{const q=j.target.value.replace(/\D/g,"").slice(0,19);O({number:q})},[O]),B=o.useCallback(j=>{const q=j.target.value.replace(/\D/g,"").slice(0,4);let ne=q;q.length>=3?ne=`${q.slice(0,2)}/${q.slice(2)}`:q.length===2&&(ne=`${q}/`),O({expiry:ne})},[O]),m=o.useCallback(j=>{const q=j.target.value.replace(/\D/g,"").slice(0,le(U));O({cvc:q})},[U,O]),w=o.useMemo(()=>Le(e.number,U),[e.number,U]),$=z.number&&e.number.length>0&&(Ce(e.number)?V?void 0:"Card brand not accepted":Y.errors.number),P=z.expiry&&e.expiry.length>0&&!Me(e.expiry)?Y.errors.expiry:void 0,te=z.cvc&&e.cvc.length>0&&e.cvc.length!==le(U)?Y.errors.cvc:void 0,re=`nice-credit-card nice-credit-card--${d}`+(M?" nice-credit-card--disabled":"")+(x?" nice-credit-card--loading":"")+(b?" nice-credit-card--error":"")+(g?` ${g}`:"");return C?null:n.jsxs("div",{ref:E,className:re,style:S,title:k,"data-testid":A,children:[p&&n.jsxs("div",{className:"nice-credit-card__title",children:[p,f&&n.jsx("span",{className:"nice-credit-card__required","aria-hidden":!0,children:"*"})]}),n.jsx("div",{className:"nice-credit-card__row",children:n.jsxs("label",{className:"nice-credit-card__field nice-credit-card__field--number",children:[n.jsx("span",{className:"nice-credit-card__label",children:"Card number"}),n.jsxs("span",{className:"nice-credit-card__input-wrapper",children:[n.jsx("input",{id:`${T}-number`,type:"text",inputMode:"numeric",autoComplete:"cc-number",placeholder:U==="amex"?"3782 822463 10005":"1234 1234 1234 1234",value:w,onChange:ee,onBlur:()=>L(j=>({...j,number:!0})),disabled:M,readOnly:N,"aria-invalid":!!$,"aria-describedby":$?`${T}-number-err`:void 0,className:"nice-credit-card__input",maxLength:U==="amex"?17:23}),i&&n.jsx(Lt,{brand:U})]}),$&&n.jsx("span",{id:`${T}-number-err`,className:"nice-credit-card__error",children:$})]})}),n.jsxs("div",{className:"nice-credit-card__row nice-credit-card__row--split",children:[n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:"Expiry"}),n.jsx("input",{id:`${T}-expiry`,type:"text",inputMode:"numeric",autoComplete:"cc-exp",placeholder:"MM/YY",value:e.expiry,onChange:B,onBlur:()=>{L(q=>({...q,expiry:!0}));const j=je(e.expiry);j&&j!==e.expiry&&O({expiry:j})},disabled:M,readOnly:N,"aria-invalid":!!P,"aria-describedby":P?`${T}-expiry-err`:void 0,className:"nice-credit-card__input",maxLength:5}),P&&n.jsx("span",{id:`${T}-expiry-err`,className:"nice-credit-card__error",children:P})]}),n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:U==="amex"?"CID":"CVC"}),n.jsx("input",{id:`${T}-cvc`,type:"text",inputMode:"numeric",autoComplete:"cc-csc",placeholder:"•".repeat(le(U)),value:e.cvc,onChange:m,onBlur:()=>L(j=>({...j,cvc:!0})),disabled:M,readOnly:N,"aria-invalid":!!te,"aria-describedby":te?`${T}-cvc-err`:void 0,className:"nice-credit-card__input",maxLength:le(U)}),te&&n.jsx("span",{id:`${T}-cvc-err`,className:"nice-credit-card__error",children:te})]})]}),a&&n.jsx("div",{className:"nice-credit-card__row",children:n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:"Cardholder name"}),n.jsx("input",{id:`${T}-holder`,type:"text",autoComplete:"cc-name",placeholder:"Jane Doe",value:e.holderName??"",onChange:j=>O({holderName:j.target.value}),onBlur:()=>L(j=>({...j,holder:!0})),disabled:M,readOnly:N,className:"nice-credit-card__input",maxLength:120})]})}),s&&n.jsx("div",{className:"nice-credit-card__row",children:n.jsxs("label",{className:"nice-credit-card__field",children:[n.jsx("span",{className:"nice-credit-card__label",children:"Postal code"}),n.jsx("input",{id:`${T}-postal`,type:"text",autoComplete:"postal-code",value:e.postalCode??"",onChange:j=>O({postalCode:j.target.value}),onBlur:()=>L(j=>({...j,postal:!0})),disabled:M,readOnly:N,className:"nice-credit-card__input",maxLength:16})]})}),(b||_)&&n.jsx("div",{className:b?"nice-credit-card__form-error":"nice-credit-card__helper",role:b?"alert":void 0,children:b??_})]})}),Oe={visa:"VISA",mastercard:"MasterCard",amex:"AMEX",discover:"Discover",diners:"Diners",jcb:"JCB",unionpay:"UnionPay",maestro:"Maestro",mir:"MIR",elo:"Elo",hipercard:"Hipercard",unknown:""};function Lt({brand:t}){return t==="unknown"?null:n.jsx("span",{className:`nice-credit-card__brand nice-credit-card__brand--${t}`,"aria-label":Oe[t],children:Oe[t]})}const Ht=o.forwardRef(function({processor:e,amount:r,editableAmount:a,customer:c,currencies:s,description:l,metadata:i,autoCapture:d=!0,submitLabel:u="Pay",onSuccess:y,onError:x,consents:h,className:p,style:_},b){const[f,g]=o.useState(r),[S,v]=o.useState(r.currency),[k,A]=o.useState({number:"",expiry:"",cvc:""}),[E,C]=o.useState(null),[M,N]=o.useState(!1),[K,T]=o.useState(null),z=yt(e),L=o.useMemo(()=>e.supportedCurrencies==="*"?!0:e.supportedCurrencies.includes(f.currency.toUpperCase()),[e,f.currency]),U=o.useMemo(()=>{var w;const m=(w=e.minimums)==null?void 0:w[f.currency.toUpperCase()];return m==null||f.amount>=m},[e,f]),Y=o.useMemo(()=>{var w;const m=(w=e.minimums)==null?void 0:w[f.currency.toUpperCase()];return m==null?null:{amount:m,currency:f.currency}},[e,f.currency]),V=!!(E!=null&&E.isValid),O=!M&&L&&U&&V,ee=o.useCallback(async m=>{if(m.preventDefault(),!!O){T(null),N(!0);try{const w={amount:f,card:k,customer:c,description:l,metadata:i,idempotencyKey:zt()},$=await z.authorize(w);if(d&&$.status==="authorized"){const P=await z.capture($.id,f);y==null||y(P)}else y==null||y($)}catch(w){const $=w instanceof Error?w:new Error(String(w));T($.message),x==null||x($)}finally{N(!1)}}},[O,f,k,c,l,i,d,z,y,x]),B=J(f.currency);return n.jsxs("form",{ref:b,className:"nice-payment-form"+(p?` ${p}`:""),style:_,onSubmit:ee,"aria-busy":M,children:[n.jsx("div",{className:"nice-payment-form__amount",children:a?n.jsx(De,{label:"Amount",value:f,currency:S,currencies:s,onChange:m=>m&&g(m),onCurrencyChange:m=>{v(m),g(w=>({...w,currency:m}))},disabled:M,required:!0,showFormattedPreview:!0}):n.jsxs("div",{className:"nice-payment-form__total",children:[n.jsx("span",{className:"nice-payment-form__total-label",children:"Total"}),n.jsx(ve,{value:f})]})}),l&&n.jsx("p",{className:"nice-payment-form__description",children:l}),n.jsx("div",{className:"nice-payment-form__card",children:n.jsx(ht,{value:k,onChange:(m,w)=>{A(m),C(w)},disabled:M})}),!L&&n.jsxs("div",{className:"nice-payment-form__warning",role:"alert",children:[e.name," does not accept ",(B==null?void 0:B.name)??f.currency,"."]}),!U&&Y&&n.jsxs("div",{className:"nice-payment-form__warning",role:"alert",children:["Minimum charge for ",e.name," is ",n.jsx(ve,{value:Y}),"."]}),h&&n.jsx("div",{className:"nice-payment-form__consents",children:h}),K&&n.jsx("div",{className:"nice-payment-form__error",role:"alert",children:K}),n.jsx("button",{type:"submit",className:"nice-payment-form__submit",disabled:!O,"aria-disabled":!O,children:M?"Processing…":u}),n.jsxs("p",{className:"nice-payment-form__processor",children:["Secured by ",n.jsx("strong",{children:e.name})]})]})});function zt(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`idem_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`}const Yt=o.forwardRef(function({price:e,originalPrice:r,period:a,prefix:c,suffix:s,showDiscountBadge:l=!0,size:i="md",locale:d,className:u,style:y},x){const h=r&&r.currency===e.currency&&r.amount>e.amount,p=o.useMemo(()=>!h||!r?null:Math.round((r.amount-e.amount)/r.amount*100),[h,r,e.amount]),_=`nice-price-tag nice-price-tag--${i}`+(u?` ${u}`:"");return n.jsxs("div",{ref:x,className:_,style:y,children:[c&&n.jsx("span",{className:"nice-price-tag__prefix",children:c}),n.jsxs("span",{className:"nice-price-tag__main",children:[n.jsx("span",{className:"nice-price-tag__amount",children:W(e,{locale:d})}),a&&n.jsx("span",{className:"nice-price-tag__period",children:a})]}),h&&r&&n.jsx("span",{className:"nice-price-tag__original","aria-label":"Original price",children:n.jsx("s",{children:W(r,{locale:d})})}),h&&l&&p!=null&&p>0&&n.jsxs("span",{className:"nice-price-tag__discount","aria-label":`${p} percent off`,children:["−",p,"%"]}),s&&n.jsx("span",{className:"nice-price-tag__suffix",children:s})]})}),Gt=o.forwardRef(function({source:e,onSourceChange:r,targetCurrency:a,onTargetCurrencyChange:c,provider:s,locale:l,showRateLine:i=!0,className:d,style:u},y){const{converted:x,loading:h,error:p}=_e(e,a,s),_=o.useMemo(()=>({amount:Math.pow(10,2),currency:e.currency}),[e.currency]),{converted:b}=_e(i?_:null,a,s);return n.jsxs("div",{ref:y,className:"nice-currency-converter"+(d?` ${d}`:""),style:u,children:[n.jsx("div",{className:"nice-currency-converter__row",children:n.jsx(De,{label:"From",value:e,onChange:f=>f&&r(f),currency:e.currency,onCurrencyChange:f=>r({...e,currency:f}),showFormattedPreview:!1})}),n.jsxs("div",{className:"nice-currency-converter__row",children:[n.jsx("label",{className:"nice-currency-converter__label",children:"To"}),n.jsxs("div",{className:"nice-currency-converter__output",children:[n.jsx(Pe,{value:a,onChange:f=>c(f),compact:!0}),n.jsx("span",{className:"nice-currency-converter__amount",children:h?"…":p?"—":x?W(x,{locale:l}):""})]})]}),i&&b&&n.jsxs("p",{className:"nice-currency-converter__rate",children:["1 ",e.currency," = ",W(b,{locale:l})," ",n.jsxs("span",{className:"nice-currency-converter__inverse",children:["· 1 ",a," ="," ",W(Q(1/ke(b),e.currency),{locale:l})]})]}),p&&n.jsx("p",{className:"nice-currency-converter__error",role:"alert",children:p.message})]})});function qe(t){return{amount:Math.round(t.amount),currency:t.currency}}const Zt=o.forwardRef(function({lines:e,locale:r,rounding:a="line",showTotals:c=!0,showGrandTotal:s=!0,hideRateColumn:l=!1,labels:i,density:d="comfortable",className:u,style:y,id:x},h){const p={label:(i==null?void 0:i.label)??"Item",rate:(i==null?void 0:i.rate)??"VAT",net:(i==null?void 0:i.net)??"Net",vat:(i==null?void 0:i.vat)??"Tax",gross:(i==null?void 0:i.gross)??"Gross",total:(i==null?void 0:i.total)??"Total"},_=o.useMemo(()=>{if(a==="total"){const g=new Map;for(const v of e){let k=g.get(v.vatRate);k||(k=[],g.set(v.vatRate,k)),k.push(v.netAmount)}const S=[];for(const[v,k]of g){const A=k.reduce((M,N)=>oe(M,N),Q(0,k[0].currency)),E=qe(fe(A,v)),C=oe(A,E);S.push({rate:v,net:A,vat:E,gross:C})}return S}return e.map(g=>{const S=qe(fe(g.netAmount,g.vatRate)),v=oe(g.netAmount,S);return{label:g.label,rate:g.vatRate,net:g.netAmount,vat:S,gross:v}})},[e,a]),b=o.useMemo(()=>{if(_.length===0)return null;const g=_[0].net.currency;let S=Q(0,g),v=Q(0,g),k=Q(0,g);for(const A of _)S=oe(S,A.net),v=oe(v,A.vat),k=oe(k,A.gross);return{net:S,vat:v,gross:k}},[_]),f=g=>W(g,{locale:r});return n.jsxs("table",{ref:h,id:x,className:`nice-tax-breakdown nice-tax-breakdown--${d} ${u??""}`,style:y,role:"table","aria-label":p.total,children:[n.jsx("thead",{children:n.jsxs("tr",{children:[_.some(g=>g.label!==void 0)&&n.jsx("th",{scope:"col",children:p.label}),!l&&n.jsx("th",{scope:"col",className:"nice-tax-breakdown__rate",children:p.rate}),n.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:p.net}),n.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:p.vat}),n.jsx("th",{scope:"col",className:"nice-tax-breakdown__num",children:p.gross})]})}),n.jsx("tbody",{children:_.map((g,S)=>n.jsxs("tr",{children:[_.some(v=>v.label!==void 0)&&n.jsx("td",{children:g.label??""}),!l&&n.jsxs("td",{className:"nice-tax-breakdown__rate",children:[(g.rate*100).toLocaleString(r,{maximumFractionDigits:2}),"%"]}),n.jsx("td",{className:"nice-tax-breakdown__num",children:f(g.net)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:f(g.vat)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:f(g.gross)})]},`${g.rate}-${S}`))}),c&&b&&n.jsx("tfoot",{children:s&&n.jsxs("tr",{className:"nice-tax-breakdown__totals",children:[_.some(g=>g.label!==void 0)&&n.jsx("td",{children:p.total}),!l&&n.jsx("td",{}),n.jsx("td",{className:"nice-tax-breakdown__num",children:f(b.net)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:f(b.vat)}),n.jsx("td",{className:"nice-tax-breakdown__num",children:f(b.gross)})]})})]})}),Jt=o.forwardRef(function(e,r){const{methods:a,value:c,onChange:s,layout:l="list",columns:i=2,currency:d,label:u,name:y,readOnly:x=!1,className:h,style:p,id:_,accessMode:b,"data-testid":f}=e,g=o.useId(),S=y??`nice-pm-${g}`,v=o.useMemo(()=>{if(!d)return a;const C=d.toUpperCase();return a.filter(M=>!M.currencies||M.currencies.map(N=>N.toUpperCase()).includes(C))},[a,d]);if(b==="hidden")return null;const k=x||b==="disabled"||b==="readOnly",A=`nice-payment-method-selector nice-payment-method-selector--${l}`+(h?` ${h}`:""),E=l==="grid"?{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`}:void 0;return n.jsxs("div",{ref:r,id:_,className:A,style:p,"data-testid":f,children:[u&&n.jsx("div",{className:"nice-payment-method-selector__label",children:u}),n.jsxs("div",{className:"nice-payment-method-selector__options",style:E,role:"radiogroup","aria-label":u??"Payment method",children:[v.map(C=>{const M=C.id===c,N=k||C.disabled;return n.jsxs("label",{className:"nice-payment-method-selector__option"+(M?" nice-payment-method-selector__option--selected":"")+(N?" nice-payment-method-selector__option--disabled":""),children:[n.jsx("input",{type:"radio",className:"nice-payment-method-selector__radio",name:S,value:C.id,checked:M,disabled:N,onChange:()=>s==null?void 0:s(C.id)}),C.icon&&n.jsx("span",{className:"nice-payment-method-selector__icon",children:C.icon}),n.jsxs("span",{className:"nice-payment-method-selector__text",children:[n.jsx("span",{className:"nice-payment-method-selector__name",children:C.label}),C.description&&n.jsx("span",{className:"nice-payment-method-selector__desc",children:C.description})]})]},C.id)}),v.length===0&&n.jsx("div",{className:"nice-payment-method-selector__empty",children:"No methods available."})]})]})}),Xt=[{target:".nice-payment-provider-config",titleKey:"tutorial.paymentProviderConfig.intro.title",title:"Payment provider",contentKey:"tutorial.paymentProviderConfig.intro.content",content:"Pick a provider, fill its credentials (secrets are masked), choose test/live, enable methods and copy the webhook URL.",placement:"auto"}],Qt=o.forwardRef(function(e,r){const{value:a,onChange:c,providers:s,onTestConnection:l,showWebhookUrl:i=!0,baseUrl:d,readOnly:u=!1,testLabel:y="Test connection",tutorial:x,className:h,style:p,id:_,accessMode:b,"data-testid":f}=e,g=o.useId(),[S,v]=o.useState(new Set),[k,A]=o.useState(!1),[E,C]=o.useState(null),M=o.useMemo(()=>s?s.map(m=>me[m]).filter(m=>!!m):pt,[s]),N=me[a.providerId];if(b==="hidden")return null;const K=u||b==="disabled"||b==="readOnly",T=m=>{C(null),v(new Set),c({providerId:m,mode:a.mode,credentials:{},enabledMethods:[]})},z=(m,w)=>{c({...a,credentials:{...a.credentials,[m]:w}})},L=m=>{const w=new Set(a.enabledMethods??[]);w.has(m)?w.delete(m):w.add(m),c({...a,enabledMethods:[...w]})},U=m=>{v(w=>{const $=new Set(w);return $.has(m)?$.delete(m):$.add(m),$})},Y=async()=>{if(l){A(!0),C(null);try{C(await l(a))}catch(m){C({ok:!1,message:m instanceof Error?m.message:String(m)})}finally{A(!1)}}},V=N!=null&&N.webhookPath?`${(d??"").replace(/\/$/,"")}${N.webhookPath}`:"",O=(N==null?void 0:N.supportedCurrencies)==="*"?"All currencies":((N==null?void 0:N.supportedCurrencies)??[]).join(", "),ee="nice-payment-provider-config"+(h?` ${h}`:""),B=((N==null?void 0:N.credentials)??[]).filter(m=>!m.testOnly||a.mode==="test");return n.jsxs("div",{ref:r,id:_,className:ee,style:p,"data-testid":f,children:[x&&n.jsx("div",{className:"nice-payment-provider-config__tutorial",children:n.jsx(Te.NiceTutorialButton,{steps:Te.resolveTutorial(x,Xt)})}),n.jsxs("div",{className:"nice-payment-provider-config__row",children:[n.jsxs("label",{className:"nice-payment-provider-config__field",children:[n.jsx("span",{className:"nice-payment-provider-config__field-label",children:"Provider"}),n.jsxs("select",{className:"nice-payment-provider-config__select",value:a.providerId,disabled:K,onChange:m=>T(m.target.value),children:[n.jsx("option",{value:"",children:"— select provider —"}),M.map(m=>n.jsx("option",{value:m.id,children:m.name},m.id))]})]}),(N==null?void 0:N.hasTestMode)&&n.jsxs("div",{className:"nice-payment-provider-config__mode",role:"group","aria-label":"Mode",children:[n.jsx("button",{type:"button",className:"nice-payment-provider-config__mode-btn"+(a.mode==="test"?" nice-payment-provider-config__mode-btn--active":""),onClick:()=>c({...a,mode:"test"}),disabled:K,children:"Test"}),n.jsx("button",{type:"button",className:"nice-payment-provider-config__mode-btn"+(a.mode==="live"?" nice-payment-provider-config__mode-btn--active":""),onClick:()=>c({...a,mode:"live"}),disabled:K,children:"Live"})]})]}),N&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"nice-payment-provider-config__meta",children:[n.jsx("span",{className:"nice-payment-provider-config__badge",children:N.type}),n.jsx("span",{className:"nice-payment-provider-config__currencies",children:O})]}),n.jsx("div",{className:"nice-payment-provider-config__credentials",children:B.map(m=>{const w=`${g}-${m.key}`,$=m.secret,P=S.has(m.key);return n.jsxs("div",{className:"nice-payment-provider-config__field",children:[n.jsxs("label",{className:"nice-payment-provider-config__field-label",htmlFor:w,children:[m.label,m.required&&n.jsx("span",{className:"nice-payment-provider-config__required",children:" *"})]}),n.jsxs("div",{className:"nice-payment-provider-config__input-wrap",children:[n.jsx("input",{id:w,type:$&&!P?"password":"text",className:"nice-payment-provider-config__input",value:a.credentials[m.key]??"",readOnly:K,autoComplete:$?"new-password":"off",onChange:te=>z(m.key,te.target.value)}),$&&n.jsx("button",{type:"button",className:"nice-payment-provider-config__reveal",onClick:()=>U(m.key),"aria-label":P?"Hide":"Reveal","aria-pressed":P,children:P?"🙈":"👁"})]}),m.help&&n.jsx("span",{className:"nice-payment-provider-config__help",children:m.help})]},m.key)})}),N.supportedMethods&&N.supportedMethods.length>0&&n.jsxs("div",{className:"nice-payment-provider-config__methods",children:[n.jsx("span",{className:"nice-payment-provider-config__field-label",children:"Enabled methods"}),n.jsx("div",{className:"nice-payment-provider-config__method-list",children:N.supportedMethods.map(m=>n.jsxs("label",{className:"nice-payment-provider-config__method",children:[n.jsx("input",{type:"checkbox",checked:(a.enabledMethods??[]).includes(m),disabled:K,onChange:()=>L(m)}),m]},m))})]}),i&&N.webhookPath&&n.jsxs("div",{className:"nice-payment-provider-config__field",children:[n.jsx("span",{className:"nice-payment-provider-config__field-label",children:"Webhook URL"}),n.jsx("code",{className:"nice-payment-provider-config__webhook",children:V})]}),l&&n.jsxs("div",{className:"nice-payment-provider-config__test",children:[n.jsx("button",{type:"button",className:"nice-payment-provider-config__test-btn",onClick:()=>void Y(),disabled:K||k,children:k?"Testing…":y}),E&&n.jsxs("span",{className:"nice-payment-provider-config__test-result nice-payment-provider-config__test-result--"+(E.ok?"ok":"error"),children:[E.ok?"✓":"✕"," ",E.message??(E.ok?"OK":"Failed")]})]})]})]})});exports.EcbRatesProvider=Ze;exports.ExchangeRateHostProvider=Ye;exports.FrankfurterProvider=He;exports.FreeForexApiProvider=Je;exports.MockPaymentProcessor=Qe;exports.NICE_CURRENCY_CATALOG=de;exports.NICE_CURRENCY_CODES=Kt;exports.NICE_PAYMENT_PROCESSORS=mt;exports.NICE_PAYMENT_PROVIDER_LIST=pt;exports.NICE_PAYMENT_PROVIDER_PROFILES=me;exports.NbpRatesProvider=Ge;exports.NiceCreditCardInput=ht;exports.NiceCurrencyConverter=Gt;exports.NiceCurrencySelector=Pe;exports.NiceMoney=ve;exports.NiceMoneyInput=De;exports.NicePaymentForm=Ht;exports.NicePaymentMethodSelector=Jt;exports.NicePaymentProviderConfig=Qt;exports.NicePriceTag=Yt;exports.NiceTaxBreakdown=Zt;exports.OpenExchangeRatesProvider=ze;exports.StaticExchangeRateProvider=It;exports.addMoney=oe;exports.compareMoney=jt;exports.convertMoney=Xe;exports.createEcbRatesProvider=$t;exports.createFreeForexApiProvider=Ut;exports.createNbpRatesProvider=Rt;exports.createOpenExchangeRatesProvider=At;exports.detectCardBrand=pe;exports.expectedCvcLength=le;exports.findCurrency=J;exports.findPaymentProviderProfile=qt;exports.formatCardNumber=Le;exports.formatMoney=W;exports.fromMoney=ke;exports.isExpiryValid=Me;exports.isNegative=Pt;exports.isZero=Mt;exports.luhnCheck=Ce;exports.makeAdyenAdapter=et;exports.makeAutopayAdapter=ot;exports.makeBlikAdapter=lt;exports.makeBraintreeAdapter=nt;exports.makeCoinbaseCommerceAdapter=ut;exports.makeKlarnaAdapter=dt;exports.makeMollieAdapter=rt;exports.makePayPalAdapter=Ve;exports.makePayUAdapter=ct;exports.makePrzelewy24Adapter=st;exports.makeRazorpayAdapter=at;exports.makeSquareAdapter=tt;exports.makeStripeAdapter=We;exports.makeTpayAdapter=it;exports.maskCardNumber=St;exports.multiplyMoney=fe;exports.negateMoney=Dt;exports.normaliseExpiry=je;exports.parseMoney=Be;exports.registerCurrency=wt;exports.subtractMoney=Ke;exports.toMoney=Q;exports.useNiceExchangeRate=_e;exports.useNiceMoney=Ft;exports.useNicePayment=yt;exports.validateCreditCard=Ne;
package/dist/index.d.ts CHANGED
@@ -7,6 +7,8 @@ export { StaticExchangeRateProvider, FrankfurterProvider, OpenExchangeRatesProvi
7
7
  export type { ExchangeRateProvider } from './exchange';
8
8
  export { MockPaymentProcessor, makeStripeAdapter, makePayPalAdapter, makeAdyenAdapter, makeSquareAdapter, makeMollieAdapter, makeBraintreeAdapter, makeRazorpayAdapter, makePayUAdapter, makePrzelewy24Adapter, makeTpayAdapter, makeAutopayAdapter, makeBlikAdapter, makeKlarnaAdapter, makeCoinbaseCommerceAdapter, NICE_PAYMENT_PROCESSORS, } from './processors';
9
9
  export type { PaymentProcessor, ProcessorExecutor } from './processors';
10
+ export { NICE_PAYMENT_PROVIDER_PROFILES, NICE_PAYMENT_PROVIDER_LIST, findPaymentProviderProfile, } from './providerProfiles';
11
+ export type { PaymentProviderProfile, PaymentProviderType, PaymentProviderCredential, } from './providerProfiles';
10
12
  export { useNiceMoney, useNiceExchangeRate, useNicePayment } from './hooks';
11
13
  export { NiceMoney, NICE_CURRENCY_CODES } from './components/NiceMoney';
12
14
  export type { NiceMoneyProps } from './components/NiceMoney';
@@ -24,3 +26,7 @@ export { NiceCurrencyConverter } from './components/NiceCurrencyConverter';
24
26
  export type { NiceCurrencyConverterProps } from './components/NiceCurrencyConverter';
25
27
  export { NiceTaxBreakdown } from './components/NiceTaxBreakdown';
26
28
  export type { NiceTaxBreakdownProps, NiceTaxBreakdownLine } from './components/NiceTaxBreakdown';
29
+ export { NicePaymentMethodSelector } from './components/NicePaymentMethodSelector';
30
+ export type { NicePaymentMethodSelectorProps, NicePaymentMethod, } from './components/NicePaymentMethodSelector';
31
+ export { NicePaymentProviderConfig } from './components/NicePaymentProviderConfig';
32
+ export type { NicePaymentProviderConfigProps, NicePaymentProviderConfigValue, } from './components/NicePaymentProviderConfig';