@inflow_pay/sdk 0.7.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk.umd.js CHANGED
@@ -1,178 +1,218 @@
1
- (function(d,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(d=typeof globalThis<"u"?globalThis:d||self,p(d.InflowPaySDK={}))})(this,function(d){"use strict";class p{constructor(e){if(this.iframe=null,this.messageListener=null,this.containerElement=null,this.config=e,this.iframeUrl=e.iframeUrl||"http://localhost:3000/iframe/checkout",this.environment=this.getEnvironmentFromApiKey(e.apiKey||""),this.usePopup=!e.container,e.container)if(typeof e.container=="string"){if(this.containerElement=document.querySelector(e.container),!this.containerElement)throw new Error(`Container not found: ${e.container}`)}else this.containerElement=e.container}init(){this.iframe||(this.createIframe(),this.addMessageListener())}createIframe(){const e=new URL(this.iframeUrl);this.config.apiKey&&e.searchParams.set("apiKey",this.config.apiKey),this.config.config?.paymentId&&e.searchParams.set("paymentId",this.config.config.paymentId);const t=e.toString();if(this.usePopup){const i=document.createElement("div");i.id="inflowpay-sdk-overlay",i.style.cssText=`
2
- position: fixed;
3
- top: 0;
4
- left: 0;
5
- width: 100%;
6
- height: 100%;
7
- background-color: rgba(0, 0, 0, 0.5);
8
- display: flex;
9
- align-items: center;
10
- justify-content: center;
11
- z-index: 999999;
12
- `;const o=document.createElement("div");o.style.cssText=`
13
- position: relative;
14
- width: 90%;
15
- max-width: 500px;
16
- height: 90%;
17
- max-height: 600px;
18
- background: white;
19
- border-radius: 8px;
20
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
21
- `;const n=document.createElement("button");n.innerHTML="×",n.style.cssText=`
22
- position: absolute;
23
- top: 10px;
24
- right: 10px;
25
- width: 30px;
26
- height: 30px;
27
- border: none;
28
- background: transparent;
29
- font-size: 24px;
30
- cursor: pointer;
31
- z-index: 1000000;
32
- color: #333;
33
- display: flex;
34
- align-items: center;
35
- justify-content: center;
36
- `,n.onclick=()=>this.close(),this.iframe=document.createElement("iframe"),this.iframe.src=t,this.iframe.style.cssText=`
37
- width: 100%;
38
- height: 100%;
39
- border: none;
40
- border-radius: 8px;
41
- `,this.iframe.setAttribute("allow","payment"),o.appendChild(n),o.appendChild(this.iframe),i.appendChild(o),document.body.appendChild(i),this.showLoader(o),i.addEventListener("click",s=>{s.target===i&&this.close()})}else{if(!this.containerElement)throw new Error("Container element is required for inline mode");if(this.containerElement.innerHTML="",this.containerElement instanceof HTMLElement){const n=this.containerElement.getAttribute("style")||"";n.includes("min-height")||(this.containerElement.style.minHeight="196px"),n.includes("position")||(this.containerElement.style.position="relative"),n.includes("overflow")||(this.containerElement.style.overflow="hidden")}this.iframe=document.createElement("iframe"),this.iframe.src=t;const i=this.config.config?.style?.fillParent?"100%":"344px",o=this.config.config?.style?.fillParent?"none":"100%";this.iframe.style.cssText=`
42
- width: ${i};
43
- max-width: ${o};
44
- height: 196px;
45
- min-height: 196px;
46
- border: none;
47
- display: block;
48
- transition: height 0.2s ease;
49
- `,this.iframe.setAttribute("allow","payment"),this.containerElement.appendChild(this.iframe),this.showLoader(this.containerElement)}}addMessageListener(){this.messageListener=e=>{const t=new URL(this.iframeUrl).origin;let o=e.origin===t;if(o||((this.environment==="sandbox"||this.environment==="development")&&(o=(e.origin.includes("localhost")||e.origin.includes("127.0.0.1"))&&(t.includes("localhost")||t.includes("127.0.0.1"))),o||(o=e.origin==="https://dev.api.inflowpay.com"||e.origin==="https://pre-prod.api.inflowpay.xyz"||e.origin==="https://api.inflowpay.xyz")),!o){this.config.debug&&console.warn("[SDK] Rejected message from unauthorized origin:",e.origin);return}const n=e.data;if(!(!n||!n.type))switch(n.type){case"iframe-ready":this.hideLoader(),this.sendConfigToIframe();break;case"content-height":if(n.height&&this.iframe){const s=Math.max(n.height,196);this.iframe.style.height=`${s}px`,this.containerElement&&(this.containerElement.style.minHeight=`${s}px`)}break;case"close":this.close();break;case"success":this.config.onSuccess&&this.config.onSuccess(n.data);break;case"error":this.config.onError&&this.config.onError(n.data);break;case"3ds-required":this.config.debug&&console.log("[SDK] Received 3DS request:",n.threeDsSessionUrl),n.threeDsSessionUrl?(this.config.debug&&console.log("[SDK] Opening 3DS modal..."),this.open3DSModal(n.threeDsSessionUrl).then(s=>{if(this.config.debug&&console.log("[SDK] 3DS modal closed, result:",s),this.iframe&&this.iframe.contentWindow){const a=this.getTargetOrigin();this.iframe.contentWindow.postMessage({type:"3ds-result",success:s,paymentId:n.paymentId||this.config.config?.paymentId},a)}})):this.config.debug&&console.error("[SDK] 3DS required but no threeDsSessionUrl provided");break;default:this.config.debug&&console.log("SDK: Received message:",n)}},window.addEventListener("message",this.messageListener)}sendConfigToIframe(){if(!this.iframe||!this.iframe.contentWindow){this.iframe&&(this.iframe.onload=()=>{this.sendConfigToIframe()});return}const e={type:"sdkData",config:{...this.config.config||{},paymentId:this.config.config?.paymentId},data:{apiKey:this.config.apiKey}},t=this.getTargetOrigin();this.iframe.contentWindow.postMessage(e,t)}showLoader(e){this.iframe&&(this.iframe.style.display="none");const t=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,i=t?"#2d2d2d":"#F5F5F5",o=t?"#3d3d3d":"#E5E5E5",s=`linear-gradient(90deg, ${o} 25%, ${t?"#4d4d4d":"#F0F0F0"} 50%, ${o} 75%)`,a=document.createElement("div");a.id="inflowpay-loader";const w=this.config.config?.style?.fillParent?"100%":"344px";a.style.cssText=`
50
- position: absolute;
51
- top: 0;
52
- left: 0;
53
- width: 100%;
54
- height: 100%;
55
- z-index: 1000;
56
- padding: 20px;
57
- box-sizing: border-box;
58
- display: flex;
59
- flex-direction: column;
60
- align-items: center;
61
- font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
62
- `;const h=document.createElement("div");h.style.cssText=`
63
- width: ${w};
64
- max-width: 100%;
65
- margin: 0 auto;
66
- font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
67
- `;const c=document.createElement("div");c.style.cssText=`
68
- display: flex;
69
- align-items: center;
70
- justify-content: center;
71
- gap: 6px;
72
- background-color: ${i};
73
- padding: 8px;
74
- border-radius: 8px;
75
- margin-bottom: 20px;
76
- `;const l=document.createElement("div");l.className="inflowpay-skeleton",l.style.cssText=`
77
- flex: 1;
78
- min-width: 0;
79
- height: 32px;
80
- border-radius: 6px;
81
- background: ${s};
82
- background-size: 200% 100%;
83
- animation: inflowpay-shimmer 1.5s infinite;
84
- `;const g=document.createElement("div");g.className="inflowpay-skeleton",g.style.cssText=`
85
- width: 21.5%;
86
- flex-shrink: 0;
87
- height: 32px;
88
- border-radius: 6px;
89
- background: ${s};
90
- background-size: 200% 100%;
91
- animation: inflowpay-shimmer 1.5s infinite;
92
- `;const m=document.createElement("div");m.className="inflowpay-skeleton",m.style.cssText=`
93
- width: 17.5%;
94
- flex-shrink: 0;
95
- height: 32px;
96
- border-radius: 6px;
97
- background: ${s};
98
- background-size: 200% 100%;
99
- animation: inflowpay-shimmer 1.5s infinite;
100
- `,c.appendChild(l),c.appendChild(g),c.appendChild(m);const f=document.createElement("div");f.className="inflowpay-skeleton",f.style.cssText=`
101
- width: 100%;
102
- height: 42px;
103
- border-radius: 8px;
104
- background: ${s};
105
- background-size: 200% 100%;
106
- animation: inflowpay-shimmer 1.5s infinite;
107
- margin-bottom: 16px;
108
- `;const u=document.createElement("div");u.style.cssText=`
109
- display: flex;
110
- flex-direction: column;
111
- align-items: center;
112
- gap: 4px;
113
- width: 100%;
114
- margin-top: 16px;
115
- `;const y=document.createElement("div");y.className="inflowpay-skeleton",y.style.cssText=`
116
- width: 10px;
117
- height: 10px;
118
- border-radius: 50%;
119
- background: ${s};
120
- background-size: 200% 100%;
121
- animation: inflowpay-shimmer 1.5s infinite;
122
- `;const x=document.createElement("div");if(x.className="inflowpay-skeleton",x.style.cssText=`
123
- width: 80%;
124
- height: 16px;
125
- border-radius: 4px;
126
- background: ${s};
127
- background-size: 200% 100%;
128
- animation: inflowpay-shimmer 1.5s infinite;
129
- `,u.appendChild(y),u.appendChild(x),h.appendChild(c),h.appendChild(f),h.appendChild(u),a.appendChild(h),!document.getElementById("inflowpay-loader-styles")){const E=document.createElement("style");E.id="inflowpay-loader-styles",E.textContent=`
130
- @keyframes inflowpay-shimmer {
131
- 0% {
132
- background-position: -200% 0;
133
- }
134
- 100% {
135
- background-position: 200% 0;
136
- }
137
- }
138
- `,document.head.appendChild(E)}e.appendChild(a)}hideLoader(){const e=document.getElementById("inflowpay-loader");e&&e.remove(),this.iframe&&(this.iframe.style.display="")}close(){if(this.config.onClose&&this.config.onClose(),this.hideLoader(),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null),this.usePopup){const e=document.getElementById("inflowpay-sdk-overlay");e&&e.remove()}else this.containerElement&&(this.containerElement.innerHTML="");this.iframe=null}open3DSModal(e){return this.config.debug&&console.log("[SDK] open3DSModal called with URL:",e),new Promise(t=>{const i=document.createElement("div");i.id="inflowpay-3ds-overlay",i.style.cssText=`
139
- position: fixed;
140
- top: 0;
141
- left: 0;
142
- width: 100%;
143
- height: 100%;
144
- background-color: rgba(0, 0, 0, 0.7);
145
- display: flex;
146
- align-items: center;
147
- justify-content: center;
148
- z-index: 999999;
149
- `;const o=document.createElement("div");o.style.cssText=`
150
- position: relative;
151
- width: 90%;
152
- max-width: 500px;
153
- height: 90%;
154
- max-height: 600px;
155
- background: white;
156
- border-radius: 8px;
157
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
158
- display: flex;
159
- flex-direction: column;
160
- `;const n=document.createElement("div");n.style.cssText=`
161
- display: flex;
162
- align-items: center;
163
- justify-content: space-between;
164
- padding: 15px 20px;
165
- border-bottom: 1px solid #e5e5e5;
166
- `,n.innerHTML=`
1
+ (function(W,V){typeof exports=="object"&&typeof module<"u"?V(exports):typeof define=="function"&&define.amd?define(["exports"],V):(W=typeof globalThis<"u"?globalThis:W||self,V(W.InflowPaySDK={}))})(this,function(W){"use strict";var V={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ke;function et(){if(ke)return V;ke=1;var u=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function c(w,m,a){var T=null;if(a!==void 0&&(T=""+a),m.key!==void 0&&(T=""+m.key),"key"in m){a={};for(var O in m)O!=="key"&&(a[O]=m[O])}else a=m;return m=a.ref,{$$typeof:u,type:w,key:T,ref:m!==void 0?m:null,props:a}}return V.Fragment=r,V.jsx=c,V.jsxs=c,V}var me={},be={exports:{}},h={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Ie;function tt(){if(Ie)return h;Ie=1;var u=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),T=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),M=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),k=Symbol.iterator;function x(t){return t===null||typeof t!="object"?null:(t=k&&t[k]||t["@@iterator"],typeof t=="function"?t:null)}var H={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},G=Object.assign,Z={};function F(t,o,l){this.props=t,this.context=o,this.refs=Z,this.updater=l||H}F.prototype.isReactComponent={},F.prototype.setState=function(t,o){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,o,"setState")},F.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function J(){}J.prototype=F.prototype;function ie(t,o,l){this.props=t,this.context=o,this.refs=Z,this.updater=l||H}var ee=ie.prototype=new J;ee.constructor=ie,G(ee,F.prototype),ee.isPureReactComponent=!0;var K=Array.isArray;function ae(){}var b={H:null,A:null,T:null,S:null},fe=Object.prototype.hasOwnProperty;function U(t,o,l){var f=l.ref;return{$$typeof:u,type:t,key:o,ref:f!==void 0?f:null,props:l}}function te(t,o){return U(t.type,o,t.props)}function ue(t){return typeof t=="object"&&t!==null&&t.$$typeof===u}function R(t){var o={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(l){return o[l]})}var ne=/\/+/g;function B(t,o){return typeof t=="object"&&t!==null&&t.key!=null?R(""+t.key):o.toString(36)}function z(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(ae,ae):(t.status="pending",t.then(function(o){t.status==="pending"&&(t.status="fulfilled",t.value=o)},function(o){t.status==="pending"&&(t.status="rejected",t.reason=o)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function Y(t,o,l,f,y){var S=typeof t;(S==="undefined"||S==="boolean")&&(t=null);var p=!1;if(t===null)p=!0;else switch(S){case"bigint":case"string":case"number":p=!0;break;case"object":switch(t.$$typeof){case u:case r:p=!0;break;case I:return p=t._init,Y(p(t._payload),o,l,f,y)}}if(p)return y=y(t),p=f===""?"."+B(t,0):f,K(y)?(l="",p!=null&&(l=p.replace(ne,"$&/")+"/"),Y(y,o,l,"",function(Q){return Q})):y!=null&&(ue(y)&&(y=te(y,l+(y.key==null||t&&t.key===y.key?"":(""+y.key).replace(ne,"$&/")+"/")+p)),o.push(y)),1;p=0;var D=f===""?".":f+":";if(K(t))for(var A=0;A<t.length;A++)f=t[A],S=D+B(f,A),p+=Y(f,o,l,S,y);else if(A=x(t),typeof A=="function")for(t=A.call(t),A=0;!(f=t.next()).done;)f=f.value,S=D+B(f,A++),p+=Y(f,o,l,S,y);else if(S==="object"){if(typeof t.then=="function")return Y(z(t),o,l,f,y);throw o=String(t),Error("Objects are not valid as a React child (found: "+(o==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":o)+"). If you meant to render a collection of children, use an array instead.")}return p}function q(t,o,l){if(t==null)return t;var f=[],y=0;return Y(t,f,"","",function(S){return o.call(l,S,y++)}),f}function re(t){if(t._status===-1){var o=t._result;o=o(),o.then(function(l){(t._status===0||t._status===-1)&&(t._status=1,t._result=l)},function(l){(t._status===0||t._status===-1)&&(t._status=2,t._result=l)}),t._status===-1&&(t._status=0,t._result=o)}if(t._status===1)return t._result.default;throw t._result}var X=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ce={map:q,forEach:function(t,o,l){q(t,function(){o.apply(this,arguments)},l)},count:function(t){var o=0;return q(t,function(){o++}),o},toArray:function(t){return q(t,function(o){return o})||[]},only:function(t){if(!ue(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};return h.Activity=N,h.Children=ce,h.Component=F,h.Fragment=c,h.Profiler=m,h.PureComponent=ie,h.StrictMode=w,h.Suspense=P,h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=b,h.__COMPILER_RUNTIME={__proto__:null,c:function(t){return b.H.useMemoCache(t)}},h.cache=function(t){return function(){return t.apply(null,arguments)}},h.cacheSignal=function(){return null},h.cloneElement=function(t,o,l){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var f=G({},t.props),y=t.key;if(o!=null)for(S in o.key!==void 0&&(y=""+o.key),o)!fe.call(o,S)||S==="key"||S==="__self"||S==="__source"||S==="ref"&&o.ref===void 0||(f[S]=o[S]);var S=arguments.length-2;if(S===1)f.children=l;else if(1<S){for(var p=Array(S),D=0;D<S;D++)p[D]=arguments[D+2];f.children=p}return U(t.type,y,f)},h.createContext=function(t){return t={$$typeof:T,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:a,_context:t},t},h.createElement=function(t,o,l){var f,y={},S=null;if(o!=null)for(f in o.key!==void 0&&(S=""+o.key),o)fe.call(o,f)&&f!=="key"&&f!=="__self"&&f!=="__source"&&(y[f]=o[f]);var p=arguments.length-2;if(p===1)y.children=l;else if(1<p){for(var D=Array(p),A=0;A<p;A++)D[A]=arguments[A+2];y.children=D}if(t&&t.defaultProps)for(f in p=t.defaultProps,p)y[f]===void 0&&(y[f]=p[f]);return U(t,S,y)},h.createRef=function(){return{current:null}},h.forwardRef=function(t){return{$$typeof:O,render:t}},h.isValidElement=ue,h.lazy=function(t){return{$$typeof:I,_payload:{_status:-1,_result:t},_init:re}},h.memo=function(t,o){return{$$typeof:M,type:t,compare:o===void 0?null:o}},h.startTransition=function(t){var o=b.T,l={};b.T=l;try{var f=t(),y=b.S;y!==null&&y(l,f),typeof f=="object"&&f!==null&&typeof f.then=="function"&&f.then(ae,X)}catch(S){X(S)}finally{o!==null&&l.types!==null&&(o.types=l.types),b.T=o}},h.unstable_useCacheRefresh=function(){return b.H.useCacheRefresh()},h.use=function(t){return b.H.use(t)},h.useActionState=function(t,o,l){return b.H.useActionState(t,o,l)},h.useCallback=function(t,o){return b.H.useCallback(t,o)},h.useContext=function(t){return b.H.useContext(t)},h.useDebugValue=function(){},h.useDeferredValue=function(t,o){return b.H.useDeferredValue(t,o)},h.useEffect=function(t,o){return b.H.useEffect(t,o)},h.useEffectEvent=function(t){return b.H.useEffectEvent(t)},h.useId=function(){return b.H.useId()},h.useImperativeHandle=function(t,o,l){return b.H.useImperativeHandle(t,o,l)},h.useInsertionEffect=function(t,o){return b.H.useInsertionEffect(t,o)},h.useLayoutEffect=function(t,o){return b.H.useLayoutEffect(t,o)},h.useMemo=function(t,o){return b.H.useMemo(t,o)},h.useOptimistic=function(t,o){return b.H.useOptimistic(t,o)},h.useReducer=function(t,o,l){return b.H.useReducer(t,o,l)},h.useRef=function(t){return b.H.useRef(t)},h.useState=function(t){return b.H.useState(t)},h.useSyncExternalStore=function(t,o,l){return b.H.useSyncExternalStore(t,o,l)},h.useTransition=function(){return b.H.useTransition()},h.version="19.2.4",h}var pe={exports:{}};/**
18
+ * @license React
19
+ * react.development.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */pe.exports;var De;function nt(){return De||(De=1,function(u,r){process.env.NODE_ENV!=="production"&&function(){function c(e,n){Object.defineProperty(a.prototype,e,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",n[0],n[1])}})}function w(e){return e===null||typeof e!="object"?null:(e=Ye&&e[Ye]||e["@@iterator"],typeof e=="function"?e:null)}function m(e,n){e=(e=e.constructor)&&(e.displayName||e.name)||"ReactClass";var s=e+"."+n;$e[s]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",n,e),$e[s]=!0)}function a(e,n,s){this.props=e,this.context=n,this.refs=Oe,this.updater=s||We}function T(){}function O(e,n,s){this.props=e,this.context=n,this.refs=Oe,this.updater=s||We}function P(){}function M(e){return""+e}function I(e){try{M(e);var n=!1}catch{n=!0}if(n){n=console;var s=n.error,i=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",i),M(e)}}function N(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Pt?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case t:return"Fragment";case l:return"Profiler";case o:return"StrictMode";case p:return"Suspense";case D:return"SuspenseList";case Ue:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case ce:return"Portal";case y:return e.displayName||"Context";case f:return(e._context.displayName||"Context")+".Consumer";case S:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case A:return n=e.displayName||null,n!==null?n:N(e.type)||"Memo";case Q:n=e._payload,e=e._init;try{return N(e(n))}catch{}}return null}function k(e){if(e===t)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===Q)return"<...>";try{var n=N(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function x(){var e=E.A;return e===null?null:e.getOwner()}function H(){return Error("react-stack-top-frame")}function G(e){if(ve.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function Z(e,n){function s(){Ge||(Ge=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}function F(){var e=N(this.type);return Be[e]||(Be[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function J(e,n,s,i,d,_){var g=s.ref;return e={$$typeof:X,type:e,key:n,props:s,_owner:i},(g!==void 0?g:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:F}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:d}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:_}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function ie(e,n){return n=J(e.type,n,e.props,e._owner,e._debugStack,e._debugTask),e._store&&(n._store.validated=e._store.validated),n}function ee(e){K(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===Q&&(e._payload.status==="fulfilled"?K(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function K(e){return typeof e=="object"&&e!==null&&e.$$typeof===X}function ae(e){var n={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(s){return n[s]})}function b(e,n){return typeof e=="object"&&e!==null&&e.key!=null?(I(e.key),ae(""+e.key)):n.toString(36)}function fe(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(P,P):(e.status="pending",e.then(function(n){e.status==="pending"&&(e.status="fulfilled",e.value=n)},function(n){e.status==="pending"&&(e.status="rejected",e.reason=n)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function U(e,n,s,i,d){var _=typeof e;(_==="undefined"||_==="boolean")&&(e=null);var g=!1;if(e===null)g=!0;else switch(_){case"bigint":case"string":case"number":g=!0;break;case"object":switch(e.$$typeof){case X:case ce:g=!0;break;case Q:return g=e._init,U(g(e._payload),n,s,i,d)}}if(g){g=e,d=d(g);var C=i===""?"."+b(g,0):i;return ze(d)?(s="",C!=null&&(s=C.replace(Xe,"$&/")+"/"),U(d,n,s,"",function(oe){return oe})):d!=null&&(K(d)&&(d.key!=null&&(g&&g.key===d.key||I(d.key)),s=ie(d,s+(d.key==null||g&&g.key===d.key?"":(""+d.key).replace(Xe,"$&/")+"/")+C),i!==""&&g!=null&&K(g)&&g.key==null&&g._store&&!g._store.validated&&(s._store.validated=2),d=s),n.push(d)),1}if(g=0,C=i===""?".":i+":",ze(e))for(var v=0;v<e.length;v++)i=e[v],_=C+b(i,v),g+=U(i,n,s,_,d);else if(v=w(e),typeof v=="function")for(v===e.entries&&(Ve||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Ve=!0),e=v.call(e),v=0;!(i=e.next()).done;)i=i.value,_=C+b(i,v++),g+=U(i,n,s,_,d);else if(_==="object"){if(typeof e.then=="function")return U(fe(e),n,s,i,d);throw n=String(e),Error("Objects are not valid as a React child (found: "+(n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.")}return g}function te(e,n,s){if(e==null)return e;var i=[],d=0;return U(e,i,"","",function(_){return n.call(s,_,d++)}),i}function ue(e){if(e._status===-1){var n=e._ioInfo;n!=null&&(n.start=n.end=performance.now()),n=e._result;var s=n();if(s.then(function(d){if(e._status===0||e._status===-1){e._status=1,e._result=d;var _=e._ioInfo;_!=null&&(_.end=performance.now()),s.status===void 0&&(s.status="fulfilled",s.value=d)}},function(d){if(e._status===0||e._status===-1){e._status=2,e._result=d;var _=e._ioInfo;_!=null&&(_.end=performance.now()),s.status===void 0&&(s.status="rejected",s.reason=d)}}),n=e._ioInfo,n!=null){n.value=s;var i=s.displayName;typeof i=="string"&&(n.name=i)}e._status===-1&&(e._status=0,e._result=s)}if(e._status===1)return n=e._result,n===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
26
+
27
+ Your code should look like:
28
+ const MyComponent = lazy(() => import('./MyComponent'))
29
+
30
+ Did you accidentally put curly braces around the import?`,n),"default"in n||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
31
+
32
+ Your code should look like:
33
+ const MyComponent = lazy(() => import('./MyComponent'))`,n),n.default;throw e._result}function R(){var e=E.H;return e===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
34
+ 1. You might have mismatching versions of React and the renderer (such as React DOM)
35
+ 2. You might be breaking the Rules of Hooks
36
+ 3. You might have more than one copy of React in the same app
37
+ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),e}function ne(){E.asyncTransitions--}function B(e){if(we===null)try{var n=("require"+Math.random()).slice(0,7);we=(u&&u[n]).call(u,"timers").setImmediate}catch{we=function(i){Ze===!1&&(Ze=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var d=new MessageChannel;d.port1.onmessage=i,d.port2.postMessage(void 0)}}return we(e)}function z(e){return 1<e.length&&typeof AggregateError=="function"?new AggregateError(e):e[0]}function Y(e,n){n!==Te-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Te=n}function q(e,n,s){var i=E.actQueue;if(i!==null)if(i.length!==0)try{re(i),B(function(){return q(e,n,s)});return}catch(d){E.thrownErrors.push(d)}else E.actQueue=null;0<E.thrownErrors.length?(i=z(E.thrownErrors),E.thrownErrors.length=0,s(i)):n(e)}function re(e){if(!Ae){Ae=!0;var n=0;try{for(;n<e.length;n++){var s=e[n];do{E.didUsePromise=!1;var i=s(!1);if(i!==null){if(E.didUsePromise){e[n]=s,e.splice(0,n);return}s=i}else break}while(!0)}e.length=0}catch(d){e.splice(0,n+1),E.thrownErrors.push(d)}finally{Ae=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var X=Symbol.for("react.transitional.element"),ce=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),y=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),Ue=Symbol.for("react.activity"),Ye=Symbol.iterator,$e={},We={isMounted:function(){return!1},enqueueForceUpdate:function(e){m(e,"forceUpdate")},enqueueReplaceState:function(e){m(e,"replaceState")},enqueueSetState:function(e){m(e,"setState")}},Ke=Object.assign,Oe={};Object.freeze(Oe),a.prototype.isReactComponent={},a.prototype.setState=function(e,n){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,n,"setState")},a.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var $={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(ge in $)$.hasOwnProperty(ge)&&c(ge,$[ge]);T.prototype=a.prototype,$=O.prototype=new T,$.constructor=O,Ke($,a.prototype),$.isPureReactComponent=!0;var ze=Array.isArray,Pt=Symbol.for("react.client.reference"),E={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},ve=Object.prototype.hasOwnProperty,qe=console.createTask?console.createTask:function(){return null};$={react_stack_bottom_frame:function(e){return e()}};var Ge,Fe,Be={},xt=$.react_stack_bottom_frame.bind($,H)(),Lt=qe(k(H)),Ve=!1,Xe=/\/+/g,Qe=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ze=!1,we=null,Te=0,Se=!1,Ae=!1,Je=typeof queueMicrotask=="function"?function(e){queueMicrotask(function(){return queueMicrotask(e)})}:B;$=Object.freeze({__proto__:null,c:function(e){return R().useMemoCache(e)}});var ge={map:te,forEach:function(e,n,s){te(e,function(){n.apply(this,arguments)},s)},count:function(e){var n=0;return te(e,function(){n++}),n},toArray:function(e){return te(e,function(n){return n})||[]},only:function(e){if(!K(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};r.Activity=Ue,r.Children=ge,r.Component=a,r.Fragment=t,r.Profiler=l,r.PureComponent=O,r.StrictMode=o,r.Suspense=p,r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=E,r.__COMPILER_RUNTIME=$,r.act=function(e){var n=E.actQueue,s=Te;Te++;var i=E.actQueue=n!==null?n:[],d=!1;try{var _=e()}catch(v){E.thrownErrors.push(v)}if(0<E.thrownErrors.length)throw Y(n,s),e=z(E.thrownErrors),E.thrownErrors.length=0,e;if(_!==null&&typeof _=="object"&&typeof _.then=="function"){var g=_;return Je(function(){d||Se||(Se=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(v,oe){d=!0,g.then(function(de){if(Y(n,s),s===0){try{re(i),B(function(){return q(de,v,oe)})}catch(jt){E.thrownErrors.push(jt)}if(0<E.thrownErrors.length){var Mt=z(E.thrownErrors);E.thrownErrors.length=0,oe(Mt)}}else v(de)},function(de){Y(n,s),0<E.thrownErrors.length&&(de=z(E.thrownErrors),E.thrownErrors.length=0),oe(de)})}}}var C=_;if(Y(n,s),s===0&&(re(i),i.length!==0&&Je(function(){d||Se||(Se=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),E.actQueue=null),0<E.thrownErrors.length)throw e=z(E.thrownErrors),E.thrownErrors.length=0,e;return{then:function(v,oe){d=!0,s===0?(E.actQueue=i,B(function(){return q(C,v,oe)})):v(C)}}},r.cache=function(e){return function(){return e.apply(null,arguments)}},r.cacheSignal=function(){return null},r.captureOwnerStack=function(){var e=E.getCurrentStack;return e===null?null:e()},r.cloneElement=function(e,n,s){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var i=Ke({},e.props),d=e.key,_=e._owner;if(n!=null){var g;e:{if(ve.call(n,"ref")&&(g=Object.getOwnPropertyDescriptor(n,"ref").get)&&g.isReactWarning){g=!1;break e}g=n.ref!==void 0}g&&(_=x()),G(n)&&(I(n.key),d=""+n.key);for(C in n)!ve.call(n,C)||C==="key"||C==="__self"||C==="__source"||C==="ref"&&n.ref===void 0||(i[C]=n[C])}var C=arguments.length-2;if(C===1)i.children=s;else if(1<C){g=Array(C);for(var v=0;v<C;v++)g[v]=arguments[v+2];i.children=g}for(i=J(e.type,d,i,_,e._debugStack,e._debugTask),d=2;d<arguments.length;d++)ee(arguments[d]);return i},r.createContext=function(e){return e={$$typeof:y,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:f,_context:e},e._currentRenderer=null,e._currentRenderer2=null,e},r.createElement=function(e,n,s){for(var i=2;i<arguments.length;i++)ee(arguments[i]);i={};var d=null;if(n!=null)for(v in Fe||!("__self"in n)||"key"in n||(Fe=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),G(n)&&(I(n.key),d=""+n.key),n)ve.call(n,v)&&v!=="key"&&v!=="__self"&&v!=="__source"&&(i[v]=n[v]);var _=arguments.length-2;if(_===1)i.children=s;else if(1<_){for(var g=Array(_),C=0;C<_;C++)g[C]=arguments[C+2];Object.freeze&&Object.freeze(g),i.children=g}if(e&&e.defaultProps)for(v in _=e.defaultProps,_)i[v]===void 0&&(i[v]=_[v]);d&&Z(i,typeof e=="function"?e.displayName||e.name||"Unknown":e);var v=1e4>E.recentlyCreatedOwnerStacks++;return J(e,d,i,x(),v?Error("react-stack-top-frame"):xt,v?qe(k(e)):Lt)},r.createRef=function(){var e={current:null};return Object.seal(e),e},r.forwardRef=function(e){e!=null&&e.$$typeof===A?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof e!="function"?console.error("forwardRef requires a render function but was given %s.",e===null?"null":typeof e):e.length!==0&&e.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",e.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),e!=null&&e.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var n={$$typeof:S,render:e},s;return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return s},set:function(i){s=i,e.name||e.displayName||(Object.defineProperty(e,"name",{value:i}),e.displayName=i)}}),n},r.isValidElement=K,r.lazy=function(e){e={_status:-1,_result:e};var n={$$typeof:Q,_payload:e,_init:ue},s={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return e._ioInfo=s,n._debugInfo=[{awaited:s}],n},r.memo=function(e,n){e==null&&console.error("memo: The first argument must be a component. Instead received: %s",e===null?"null":typeof e),n={$$typeof:A,type:e,compare:n===void 0?null:n};var s;return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return s},set:function(i){s=i,e.name||e.displayName||(Object.defineProperty(e,"name",{value:i}),e.displayName=i)}}),n},r.startTransition=function(e){var n=E.T,s={};s._updatedFibers=new Set,E.T=s;try{var i=e(),d=E.S;d!==null&&d(s,i),typeof i=="object"&&i!==null&&typeof i.then=="function"&&(E.asyncTransitions++,i.then(ne,ne),i.then(P,Qe))}catch(_){Qe(_)}finally{n===null&&s._updatedFibers&&(e=s._updatedFibers.size,s._updatedFibers.clear(),10<e&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),n!==null&&s.types!==null&&(n.types!==null&&n.types!==s.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),n.types=s.types),E.T=n}},r.unstable_useCacheRefresh=function(){return R().useCacheRefresh()},r.use=function(e){return R().use(e)},r.useActionState=function(e,n,s){return R().useActionState(e,n,s)},r.useCallback=function(e,n){return R().useCallback(e,n)},r.useContext=function(e){var n=R();return e.$$typeof===f&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),n.useContext(e)},r.useDebugValue=function(e,n){return R().useDebugValue(e,n)},r.useDeferredValue=function(e,n){return R().useDeferredValue(e,n)},r.useEffect=function(e,n){return e==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),R().useEffect(e,n)},r.useEffectEvent=function(e){return R().useEffectEvent(e)},r.useId=function(){return R().useId()},r.useImperativeHandle=function(e,n,s){return R().useImperativeHandle(e,n,s)},r.useInsertionEffect=function(e,n){return e==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),R().useInsertionEffect(e,n)},r.useLayoutEffect=function(e,n){return e==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),R().useLayoutEffect(e,n)},r.useMemo=function(e,n){return R().useMemo(e,n)},r.useOptimistic=function(e,n){return R().useOptimistic(e,n)},r.useReducer=function(e,n,s){return R().useReducer(e,n,s)},r.useRef=function(e){return R().useRef(e)},r.useState=function(e){return R().useState(e)},r.useSyncExternalStore=function(e,n,s){return R().useSyncExternalStore(e,n,s)},r.useTransition=function(){return R().useTransition()},r.version="19.2.4",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()}(pe,pe.exports)),pe.exports}process.env.NODE_ENV==="production"?be.exports=tt():be.exports=nt();var Ne=be.exports;/**
38
+ * @license React
39
+ * react-jsx-runtime.development.js
40
+ *
41
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
42
+ *
43
+ * This source code is licensed under the MIT license found in the
44
+ * LICENSE file in the root directory of this source tree.
45
+ */var Pe;function rt(){return Pe||(Pe=1,process.env.NODE_ENV!=="production"&&function(){function u(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ue?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Z:return"Fragment";case J:return"Profiler";case F:return"StrictMode";case ae:return"Suspense";case b:return"SuspenseList";case te:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case G:return"Portal";case ee:return t.displayName||"Context";case ie:return(t._context.displayName||"Context")+".Consumer";case K:var o=t.render;return t=t.displayName,t||(t=o.displayName||o.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case fe:return o=t.displayName||null,o!==null?o:u(t.type)||"Memo";case U:o=t._payload,t=t._init;try{return u(t(o))}catch{}}return null}function r(t){return""+t}function c(t){try{r(t);var o=!1}catch{o=!0}if(o){o=console;var l=o.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return l.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),r(t)}}function w(t){if(t===Z)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===U)return"<...>";try{var o=u(t);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function m(){var t=R.A;return t===null?null:t.getOwner()}function a(){return Error("react-stack-top-frame")}function T(t){if(ne.call(t,"key")){var o=Object.getOwnPropertyDescriptor(t,"key").get;if(o&&o.isReactWarning)return!1}return t.key!==void 0}function O(t,o){function l(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",o))}l.isReactWarning=!0,Object.defineProperty(t,"key",{get:l,configurable:!0})}function P(){var t=u(this.type);return q[t]||(q[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function M(t,o,l,f,y,S){var p=l.ref;return t={$$typeof:H,type:t,key:o,props:l,_owner:f},(p!==void 0?p:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:P}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:y}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:S}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function I(t,o,l,f,y,S){var p=o.children;if(p!==void 0)if(f)if(B(p)){for(f=0;f<p.length;f++)N(p[f]);Object.freeze&&Object.freeze(p)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else N(p);if(ne.call(o,"key")){p=u(t);var D=Object.keys(o).filter(function(Q){return Q!=="key"});f=0<D.length?"{key: someKey, "+D.join(": ..., ")+": ...}":"{key: someKey}",ce[p+f]||(D=0<D.length?"{"+D.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
46
+ let props = %s;
47
+ <%s {...props} />
48
+ React keys must be passed directly to JSX without using spread:
49
+ let props = %s;
50
+ <%s key={someKey} {...props} />`,f,p,D,p),ce[p+f]=!0)}if(p=null,l!==void 0&&(c(l),p=""+l),T(o)&&(c(o.key),p=""+o.key),"key"in o){l={};for(var A in o)A!=="key"&&(l[A]=o[A])}else l=o;return p&&O(l,typeof t=="function"?t.displayName||t.name||"Unknown":t),M(t,p,l,m(),y,S)}function N(t){k(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===U&&(t._payload.status==="fulfilled"?k(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function k(t){return typeof t=="object"&&t!==null&&t.$$typeof===H}var x=Ne,H=Symbol.for("react.transitional.element"),G=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),J=Symbol.for("react.profiler"),ie=Symbol.for("react.consumer"),ee=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),fe=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),ue=Symbol.for("react.client.reference"),R=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=Object.prototype.hasOwnProperty,B=Array.isArray,z=console.createTask?console.createTask:function(){return null};x={react_stack_bottom_frame:function(t){return t()}};var Y,q={},re=x.react_stack_bottom_frame.bind(x,a)(),X=z(w(a)),ce={};me.Fragment=Z,me.jsx=function(t,o,l){var f=1e4>R.recentlyCreatedOwnerStacks++;return I(t,o,l,!1,f?Error("react-stack-top-frame"):re,f?z(w(t)):X)},me.jsxs=function(t,o,l){var f=1e4>R.recentlyCreatedOwnerStacks++;return I(t,o,l,!0,f?Error("react-stack-top-frame"):re,f?z(w(t)):X)}}()),me}process.env.NODE_ENV==="production"?et():rt();var ye=(u=>(u.SUCCESS="SUCCESS",u.FAILED="FAILED",u))(ye||{}),xe=(u=>(u.THREE_DS_FAILED="THREE_DS_FAILED",u.PAYMENT_PROCESSING_ERROR="PAYMENT_PROCESSING_ERROR",u))(xe||{});Ne.createContext(null);const Ee={OVERLAY:999999,MODAL:1e6,LOADER:1e3},L={MIN_HEIGHT:196,CONTAINER_MAX_WIDTH:"500px",CONTAINER_WIDTH_PERCENT:"90%",CONTAINER_HEIGHT_PERCENT:"90%",CONTAINER_MAX_HEIGHT:"600px",BUTTON_SIZE:30,DEFAULT_IFRAME_WIDTH:"344px"},ot=["https://dev.api.inflowpay.xyz","https://pre-prod.api.inflowpay.xyz","https://api.inflowpay.xyz"],se={OVERLAY:"inflowpay-sdk-overlay",LOADER:"inflowpay-loader",LOADER_STYLES:"inflowpay-loader-styles",THREE_DS_OVERLAY:"inflowpay-3ds-overlay"},_e={PRODUCTION:"https://iframe.inflowpay.com/iframe/checkout",PREPROD:"https://preprod.iframe.inflowpay.com/iframe/checkout",DEVELOPMENT:"https://dev.iframe.inflowpay.com/iframe/checkout",LOCAL:"http://localhost:3010/iframe/checkout"};function st(u){return{inputBgColor:u?"#2d2d2d":"#F5F5F5",shimmerBase:u?"#3d3d3d":"#E5E5E5",shimmerLight:u?"#4d4d4d":"#F0F0F0"}}function it(u){return`linear-gradient(90deg, ${u.shimmerBase} 25%, ${u.shimmerLight} 50%, ${u.shimmerBase} 75%)`}function at(){return`
51
+ position: fixed;
52
+ top: 0;
53
+ left: 0;
54
+ width: 100%;
55
+ height: 100%;
56
+ background-color: rgba(0, 0, 0, 0.5);
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: center;
60
+ z-index: ${Ee.OVERLAY};
61
+ `}function ut(){return`
62
+ position: relative;
63
+ width: ${L.CONTAINER_WIDTH_PERCENT};
64
+ max-width: ${L.CONTAINER_MAX_WIDTH};
65
+ height: ${L.CONTAINER_HEIGHT_PERCENT};
66
+ max-height: ${L.CONTAINER_MAX_HEIGHT};
67
+ background: white;
68
+ border-radius: 8px;
69
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
70
+ `}function ct(){return`
71
+ position: absolute;
72
+ top: 10px;
73
+ right: 10px;
74
+ width: ${L.BUTTON_SIZE}px;
75
+ height: ${L.BUTTON_SIZE}px;
76
+ border: none;
77
+ background: transparent;
78
+ font-size: 24px;
79
+ cursor: pointer;
80
+ z-index: ${Ee.MODAL};
81
+ color: #333;
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ `}function lt(){return`
86
+ width: 100%;
87
+ height: 100%;
88
+ border: none;
89
+ border-radius: 8px;
90
+ `}function ft(u){return`
91
+ width: ${u?"100%":L.DEFAULT_IFRAME_WIDTH};
92
+ max-width: ${u?"none":"100%"};
93
+ height: ${L.MIN_HEIGHT}px;
94
+ min-height: ${L.MIN_HEIGHT}px;
95
+ border: none;
96
+ display: block;
97
+ transition: height 0.2s ease;
98
+ `}function dt(){return`
99
+ position: absolute;
100
+ top: 0;
101
+ left: 0;
102
+ width: 100%;
103
+ height: 100%;
104
+ z-index: ${Ee.LOADER};
105
+ padding: 20px;
106
+ box-sizing: border-box;
107
+ display: flex;
108
+ flex-direction: column;
109
+ align-items: center;
110
+ `}function mt(u){return`
111
+ width: ${u?"100%":L.DEFAULT_IFRAME_WIDTH};
112
+ max-width: 100%;
113
+ margin: 0 auto;
114
+ `}function pt(u){return`
115
+ display: flex;
116
+ align-items: center;
117
+ justify-content: center;
118
+ gap: 6px;
119
+ background-color: ${u};
120
+ padding: 8px;
121
+ border-radius: 8px;
122
+ margin-bottom: 20px;
123
+ `}function le(u){return`
124
+ background: ${u};
125
+ background-size: 200% 100%;
126
+ animation: inflowpay-shimmer 1.5s infinite;
127
+ `}function ht(u){return`
128
+ flex: 1;
129
+ min-width: 0;
130
+ height: 32px;
131
+ border-radius: 6px;
132
+ ${le(u)}
133
+ `}function gt(u){return`
134
+ width: 21.5%;
135
+ flex-shrink: 0;
136
+ height: 32px;
137
+ border-radius: 6px;
138
+ ${le(u)}
139
+ `}function yt(u){return`
140
+ width: 17.5%;
141
+ flex-shrink: 0;
142
+ height: 32px;
143
+ border-radius: 6px;
144
+ ${le(u)}
145
+ `}function Et(u){return`
146
+ width: 100%;
147
+ height: 42px;
148
+ border-radius: 8px;
149
+ ${le(u)}
150
+ margin-bottom: 16px;
151
+ `}function _t(){return`
152
+ display: flex;
153
+ flex-direction: column;
154
+ align-items: center;
155
+ gap: 4px;
156
+ width: 100%;
157
+ margin-top: 16px;
158
+ `}function vt(u){return`
159
+ width: 10px;
160
+ height: 10px;
161
+ border-radius: 50%;
162
+ ${le(u)}
163
+ `}function wt(u){return`
164
+ width: 80%;
165
+ height: 16px;
166
+ border-radius: 4px;
167
+ ${le(u)}
168
+ `}const Tt=`
169
+ @keyframes inflowpay-shimmer {
170
+ 0% {
171
+ background-position: -200% 0;
172
+ }
173
+ 100% {
174
+ background-position: 200% 0;
175
+ }
176
+ }
177
+ `;function St(){return`
178
+ position: fixed;
179
+ top: 0;
180
+ left: 0;
181
+ width: 100%;
182
+ height: 100%;
183
+ background-color: rgba(0, 0, 0, 0.7);
184
+ display: flex;
185
+ align-items: center;
186
+ justify-content: center;
187
+ z-index: ${Ee.OVERLAY};
188
+ `}function bt(){return`
189
+ position: relative;
190
+ width: ${L.CONTAINER_WIDTH_PERCENT};
191
+ max-width: ${L.CONTAINER_MAX_WIDTH};
192
+ height: ${L.CONTAINER_HEIGHT_PERCENT};
193
+ max-height: ${L.CONTAINER_MAX_HEIGHT};
194
+ background: white;
195
+ border-radius: 16px;
196
+ overflow: hidden;
197
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
198
+ display: flex;
199
+ flex-direction: column;
200
+ `}function Rt(){return`
201
+ display: flex;
202
+ align-items: center;
203
+ justify-content: space-between;
204
+ padding: 15px 20px;
205
+ border-bottom: 1px solid #e5e5e5;
206
+ `}function Ct(){return`
207
+ flex: 1;
208
+ position: relative;
209
+ overflow-y: auto;
210
+ overflow-x: hidden;
211
+ `}function Ot(){return`
212
+ width: 100%;
213
+ height: 100%;
214
+ border: none;
215
+ `}class Le{constructor(r,c={}){this.loaderElement=null,this.container=r,this.config=c}show(r){r&&(r.style.display="none");const c=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,w=st(c),m=it(w),a=document.createElement("div");a.id=se.LOADER,a.style.cssText=dt();const T=document.createElement("div");T.style.cssText=mt(this.config.fillParent||!1);const O=document.createElement("div");O.style.cssText=pt(w.inputBgColor);const P=document.createElement("div");P.className="inflowpay-skeleton",P.style.cssText=ht(m);const M=document.createElement("div");M.className="inflowpay-skeleton",M.style.cssText=gt(m);const I=document.createElement("div");I.className="inflowpay-skeleton",I.style.cssText=yt(m),O.appendChild(P),O.appendChild(M),O.appendChild(I);const N=document.createElement("div");N.className="inflowpay-skeleton",N.style.cssText=Et(m);const k=document.createElement("div");k.style.cssText=_t();const x=document.createElement("div");x.className="inflowpay-skeleton",x.style.cssText=vt(m);const H=document.createElement("div");H.className="inflowpay-skeleton",H.style.cssText=wt(m),k.appendChild(x),k.appendChild(H),T.appendChild(O),T.appendChild(N),T.appendChild(k),a.appendChild(T),this.injectShimmerStyles(),this.container.appendChild(a),this.loaderElement=a}hide(r){const c=document.getElementById(se.LOADER);c&&c.remove(),this.loaderElement=null,r&&(r.style.display="")}injectShimmerStyles(){if(!document.getElementById(se.LOADER_STYLES)){const r=document.createElement("style");r.id=se.LOADER_STYLES,r.textContent=Tt,document.head.appendChild(r)}}}const j=class j{constructor(r){this.config=r}open(r,c,w){return this.config.debug&&(console.log("[SDK] open3DSModal called with URL:",r),console.log("[SDK] Session ID:",c,"Payment ID:",w)),j.activeModal&&(console.warn("[SDK] Closing existing modal before opening new one"),j.activeModal.overlay.remove(),j.activeModal=null),new Promise(m=>{const a=document.createElement("div");a.id=se.THREE_DS_OVERLAY,a.style.cssText=St();const T=document.createElement("div");T.style.cssText=bt();const O=document.createElement("div");O.style.cssText=Rt(),O.innerHTML=`
167
216
  <h3 style="margin: 0; font-size: 18px; font-weight: 600;">Secure Payment Authentication</h3>
168
- <button id="inflowpay-3ds-close" style="background: none; border: none; font-size: 24px; cursor: pointer; padding: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; color: #333;">×</button>
169
- `;const s=document.createElement("div");s.style.cssText=`
170
- flex: 1;
171
- position: relative;
172
- overflow: hidden;
173
- `;const a=document.createElement("iframe");a.src=e,a.style.cssText=`
174
- width: 100%;
175
- height: 100%;
176
- border: none;
177
- `,a.setAttribute("allow","payment"),a.setAttribute("sandbox","allow-forms allow-scripts allow-same-origin allow-popups"),s.appendChild(a),o.appendChild(n),o.appendChild(s),i.appendChild(o),document.body.appendChild(i);const w=i.querySelector("#inflowpay-3ds-close"),h=()=>{i.remove(),window.removeEventListener("message",c),t(!1)};w?.addEventListener("click",h);const c=l=>{if(!l.data)return;const g=["https://dev.api.inflowpay.com","https://pre-prod.api.inflowpay.xyz","https://api.inflowpay.xyz"];if(this.environment==="sandbox"||this.environment==="development"){if(!(l.origin.includes("localhost")||l.origin.includes("127.0.0.1"))){if(!g.includes(l.origin)){this.config.debug&&console.warn("[SDK] Rejected 3DS message from unauthorized origin:",l.origin);return}}}else if(!g.includes(l.origin)){this.config.debug&&console.warn("[SDK] Rejected 3DS message from unauthorized origin:",l.origin);return}const m=l.data,f=m.type==="THREE_DS_COMPLETE"||m.type==="3ds-complete",u=m.status==="success",y=m.status==="failed"||m.status==="failure";if(f&&u){i.remove(),window.removeEventListener("message",c),t(!0);return}if(u&&!f){i.remove(),window.removeEventListener("message",c),t(!0);return}if(f&&y||m.type==="3ds-failed"||y){i.remove(),window.removeEventListener("message",c),t(!1);return}};window.addEventListener("message",c)})}getTargetOrigin(){return this.environment==="production"||this.environment==="preprod"?new URL(this.iframeUrl).origin:"*"}getEnvironmentFromApiKey(e){return!e||e.includes("_local_")||e.startsWith("inflow_local_")?"sandbox":e.includes("_prod_")&&!e.includes("_preprod_")?"production":e.includes("_preprod_")||e.startsWith("inflow_preprod_")?"preprod":e.includes("_dev_")?"development":"sandbox"}destroy(){this.close()}}class b{constructor(e,t){this.mounted=!1;let i;if(typeof t.container=="string"){if(i=document.querySelector(t.container),!i)throw new Error(`Container not found: ${t.container}`)}else i=t.container;this.container=i,this.sdk=new p({iframeUrl:e.iframeUrl,apiKey:e.apiKey,container:this.container,config:{paymentId:t.paymentId,...t.style&&{style:t.style},...t.buttonText&&{buttonText:t.buttonText},...t.placeholders&&{placeholders:t.placeholders}},onSuccess:o=>{t.onComplete&&t.onComplete({status:o?.data?.transaction?.status||"CHECKOUT_SUCCESS",data:o})},onError:o=>{t.onError?t.onError(o):t.onComplete&&t.onComplete({status:"PAYMENT_FAILED",error:o})},onClose:()=>{t.onClose&&t.onClose()}})}mount(){if(this.mounted)throw new Error("CardElement is already mounted");this.sdk.init(),this.mounted=!0}destroy(){this.mounted&&(this.sdk.destroy(),this.mounted=!1)}}class C{constructor(e){if(!e.apiKey||typeof e.apiKey!="string")throw new Error("API key is required");let t=e.iframeUrl;const i=this.getEnvironmentFromApiKey(e.apiKey);t||(i==="production"?t="https://api.inflowpay.xyz/iframe/checkout":i==="preprod"?t="https://pre-prod.api.inflowpay.xyz/iframe/checkout":i==="development"?t="https://dev.api.inflowpay.com/iframe/checkout":t="http://localhost:3000/iframe/checkout");const o=e.debug??!1;o&&(i==="production"||i==="preprod")&&console.warn("[InflowPay SDK] Debug mode is not allowed in production/pre-prod environments. Debug mode disabled.");const n=o&&(i==="sandbox"||i==="development");this.config={apiKey:e.apiKey,iframeUrl:t,timeout:e.timeout??3e4,debug:n}}createCardElement(e){return new b(this.config,e)}getIframeUrl(){return this.config.iframeUrl}getApiKey(){return this.config.apiKey}getEnvironmentFromApiKey(e){return e.includes("_local_")||e.startsWith("inflow_local_")?"sandbox":e.includes("_prod_")&&!e.includes("_preprod_")?"production":e.includes("_preprod_")||e.startsWith("inflow_preprod_")?"preprod":e.includes("_dev_")?"development":"sandbox"}}class k{constructor(e){const t={apiKey:e.config.apiKey,iframeUrl:e.config.iframeUrl,timeout:e.config.timeout,debug:e.config.debug};this.sdk=new C(t)}createCardElement(e){let t;if(e.container)t=e.container;else{const n=document.createElement("div");n.id="inflowpay-card-element-container",document.body.appendChild(n),t=n}const i={container:t,paymentId:e.paymentId,...e.style&&{style:e.style},...e.buttonText&&{buttonText:e.buttonText},...e.placeholders&&{placeholders:e.placeholders},onComplete:n=>{e.onComplete&&e.onComplete(n)},onError:e.onError,onClose:e.onClose},o=this.sdk.createCardElement(i);if(e.onReady){const n=o.mount.bind(o);o.mount=()=>{n(),setTimeout(()=>{e.onReady&&e.onReady()},100)}}return e.onChange&&setTimeout(()=>{e.onChange&&e.onChange({complete:!1})},100),o}getSDK(){return this.sdk}}var S=(r=>(r.INITIATION="INITIATION",r.CHECKOUT_PENDING="CHECKOUT_PENDING",r.CHECKOUT_SUCCESS="CHECKOUT_SUCCESS",r.CHECKOUT_CANCELED="CHECKOUT_CANCELED",r.CANCELED="CANCELED",r.PAYMENT_RECEIVED="PAYMENT_RECEIVED",r.PAYMENT_SUCCESS="PAYMENT_SUCCESS",r.PAYMENT_FAILED="PAYMENT_FAILED",r))(S||{});const v="0.7.0";d.CardElement=b,d.InflowPayProvider=k,d.PaymentSDK=C,d.PaymentStatus=S,d.SDK=p,d.VERSION=v,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
217
+ `;const P=document.createElement("div");P.style.cssText=Ct();const M=document.createElement("iframe");M.src=r,M.style.cssText=Ot(),M.setAttribute("allow","payment"),M.setAttribute("sandbox","allow-forms allow-scripts allow-same-origin allow-popups"),P.appendChild(M),T.appendChild(O),T.appendChild(P),a.appendChild(T),document.body.appendChild(a),j.activeModal={overlay:a,sessionId:c,paymentId:w};const I=N=>{if(!N.data)return;if(!this.isAllowedOrigin(N.origin)){this.config.debug&&console.warn("[SDK] Rejected 3DS message from unauthorized origin:",N.origin);return}const k=N.data,x=k.type==="THREE_DS_COMPLETE"||k.type==="3ds-complete",H=k.status==="success",G=k.status==="failed"||k.status==="failure";if(x&&H){a.remove(),window.removeEventListener("message",I),m(!0);return}if(H&&!x){a.remove(),window.removeEventListener("message",I),m(!0);return}if(x&&G||k.type==="3ds-failed"||G){a.remove(),window.removeEventListener("message",I),m(!1);return}};window.addEventListener("message",I)})}static close(r){if(!j.activeModal){console.log("[SDK] No active modal to close");return}if(r&&j.activeModal.sessionId!==r){console.warn(`[SDK] Session ID mismatch: webhook for ${r}, but modal is for ${j.activeModal.sessionId}. Ignoring close request.`);return}console.log("[SDK] Closing modal for session:",r||j.activeModal.sessionId),j.activeModal.overlay.remove(),j.activeModal=null}static isModalOpen(){return j.activeModal!==null}static getCurrentSessionId(){return j.activeModal?.sessionId||null}isAllowedOrigin(r){return!!(ot.includes(r)||(this.config.environment==="sandbox"||this.config.environment==="development")&&(r.includes("localhost")||r.includes("127.0.0.1")))}};j.activeModal=null;let he=j;class Re{static createOverlay(r,c){const w=document.createElement("div");w.id=se.OVERLAY,w.style.cssText=at();const m=document.createElement("div");m.style.cssText=ut();const a=document.createElement("button");a.innerHTML="×",a.style.cssText=ct(),a.onclick=c;const T=document.createElement("iframe");return T.src=r,T.style.cssText=lt(),T.setAttribute("allow","payment"),m.appendChild(a),m.appendChild(T),w.appendChild(m),w.addEventListener("click",O=>{O.target===w&&c()}),{overlay:w,container:m,iframe:T}}static removeOverlay(){const r=document.getElementById(se.OVERLAY);r&&r.remove()}}const At=["en","de","es","fr","it","nl","pl","pt"];function kt(){if(typeof window>"u")return"en";try{const r=(navigator.language||navigator.userLanguage||"").split("-")[0].toLowerCase();if(At.includes(r))return r}catch{}return"en"}function Ce(u){return u.includes("_local_")||u.startsWith("inflow_local_")?"sandbox":u.includes("_prod_")&&!u.includes("_preprod_")?"production":u.includes("_preprod_")||u.startsWith("inflow_preprod_")?"preprod":u.includes("_dev_")?"development":"sandbox"}function Me(u){switch(Ce(u)){case"production":return _e.PRODUCTION;case"preprod":return _e.PREPROD;case"development":return _e.DEVELOPMENT;case"sandbox":default:return _e.LOCAL}}class It{constructor(r){if(this.iframe=null,this.messageListener=null,this.containerElement=null,this.loaderManager=null,this.config=r,this.iframeUrl=r.iframeUrl||Me(r.publicKey||""),this.environment=Ce(r.publicKey||""),this.usePopup=!r.container,r.container)if(typeof r.container=="string"){if(this.containerElement=document.querySelector(r.container),!this.containerElement)throw new Error(`Container not found: ${r.container}`)}else this.containerElement=r.container;this.modalManager=new he({environment:this.environment,debug:this.config.debug})}init(){this.iframe||(this.createIframe(),this.addMessageListener())}createIframe(){const r=new URL(this.iframeUrl);this.config.publicKey&&r.searchParams.set("publicKey",this.config.publicKey),this.config.config?.paymentId&&r.searchParams.set("paymentId",this.config.config.paymentId),this.config.locale&&r.searchParams.set("locale",this.config.locale);const c=r.toString();if(this.usePopup){const{overlay:w,container:m,iframe:a}=Re.createOverlay(c,()=>this.close());this.iframe=a,document.body.appendChild(w),this.loaderManager=new Le(m,{fillParent:this.config.config?.style?.fillParent}),this.loaderManager.show(this.iframe)}else{if(!this.containerElement)throw new Error("Container element is required for inline mode");if(this.containerElement.innerHTML="",this.containerElement instanceof HTMLElement){const w=this.containerElement.getAttribute("style")||"";w.includes("min-height")||(this.containerElement.style.minHeight=`${L.MIN_HEIGHT}px`),w.includes("position")||(this.containerElement.style.position="relative"),w.includes("overflow")||(this.containerElement.style.overflow="hidden")}this.iframe=document.createElement("iframe"),this.iframe.src=c,this.iframe.style.cssText=ft(this.config.config?.style?.fillParent||!1),this.iframe.setAttribute("allow","payment"),this.containerElement.appendChild(this.iframe),this.loaderManager=new Le(this.containerElement,{fillParent:this.config.config?.style?.fillParent}),this.loaderManager.show(this.iframe)}}addMessageListener(){this.messageListener=r=>{const c=new URL(this.iframeUrl).origin;let m=r.origin===c;if(m||((this.environment==="sandbox"||this.environment==="development")&&(m=(r.origin.includes("localhost")||r.origin.includes("127.0.0.1"))&&(c.includes("localhost")||c.includes("127.0.0.1"))),m||(m=r.origin==="https://dev.iframe.inflowpay.com"||r.origin==="https://pre-prod.iframe.inflowpay.xyz"||r.origin==="https://iframe.inflowpay.xyz")),!m){this.config.debug&&console.warn("[SDK] Rejected message from unauthorized origin:",r.origin);return}const a=r.data;if(!(!a||!a.type))switch(a.type){case"iframe-ready":this.loaderManager&&this.loaderManager.hide(this.iframe||void 0),this.sendConfigToIframe();break;case"content-height":if(a.height&&this.iframe){const T=Math.max(a.height,L.MIN_HEIGHT);this.iframe.style.height=`${T}px`,this.containerElement&&(this.containerElement.style.minHeight=`${T}px`)}break;case"close":this.close();break;case"success":this.config.onSuccess&&this.config.onSuccess(a.data);break;case"error":this.config.onError&&this.config.onError(a.data);break;case"3ds-required":if(this.config.debug&&(console.log("[SDK] Received 3DS request:",a.threeDsSessionUrl),console.log("[SDK] Session ID:",a.sessionId)),a.threeDsSessionUrl){const T=a.sessionId,O=a.paymentId||this.config.config?.paymentId||"";a.sessionId||console.warn("[SDK] No session ID provided by iframe"),this.config.debug&&console.log("[SDK] Opening 3DS modal with session ID:",T),this.modalManager.open(a.threeDsSessionUrl,T,O).then(P=>{this.config.debug&&console.log("[SDK] 3DS modal closed, result:",P)})}else this.config.debug&&console.error("[SDK] 3DS required but no threeDsSessionUrl provided");break;case"3ds-success":this.config.debug&&(console.log("[SDK] 3DS completed, closing modal..."),console.log("[SDK] Session ID from webhook:",a.sessionId)),he.close(a.sessionId);break;case"3ds-failed":this.config.debug&&(console.log("[SDK] 3DS failed, closing modal..."),console.log("[SDK] Session ID from webhook:",a.sessionId)),he.close(a.sessionId);break;default:this.config.debug&&console.log("SDK: Received message:",a)}},window.addEventListener("message",this.messageListener)}sendConfigToIframe(){if(!this.iframe||!this.iframe.contentWindow){this.iframe&&(this.iframe.onload=()=>{this.sendConfigToIframe()});return}const r={type:"sdkData",config:{...this.config.config||{},paymentId:this.config.config?.paymentId},data:{publicKey:this.config.publicKey}},c=this.getTargetOrigin();this.iframe.contentWindow.postMessage(r,c)}close(){this.config.onClose&&this.config.onClose(),this.loaderManager&&(this.loaderManager.hide(this.iframe||void 0),this.loaderManager=null),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null),this.usePopup?Re.removeOverlay():this.containerElement&&(this.containerElement.innerHTML=""),this.iframe=null}switchToSuccessState(r){if(this.loaderManager&&(this.loaderManager.hide(this.iframe||void 0),this.loaderManager=null),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null),this.usePopup){Re.removeOverlay(),this.iframe=null;return}const c=this.config.config?.showDefaultSuccessUI??!0;!c&&this.containerElement&&(this.containerElement.innerHTML=""),c||(this.iframe=null)}getTargetOrigin(){return this.environment==="production"||this.environment==="preprod"?new URL(this.iframeUrl).origin:"*"}destroy(){this.close()}}class je{constructor(r,c){this.mounted=!1;let w;if(typeof c.container=="string"){if(w=document.querySelector(c.container),!w)throw new Error(`Container not found: ${c.container}`)}else w=c.container;this.container=w,this.sdk=new It({publicKey:r.publicKey,container:this.container,locale:r.locale??kt(),config:{paymentId:c.paymentId,...c.style&&{style:c.style},...c.buttonText&&{buttonText:c.buttonText},...c.placeholders&&{placeholders:c.placeholders},...c.showDefaultSuccessUI!==void 0&&{showDefaultSuccessUI:c.showDefaultSuccessUI}},onSuccess:m=>{c.onComplete&&c.onComplete({status:ye.SUCCESS,paymentId:c.paymentId}),this.sdk.switchToSuccessState(m)},onError:m=>{c.onError?c.onError(m):c.onComplete&&c.onComplete({status:ye.FAILED,paymentId:c.paymentId,error:m})},onClose:()=>{c.onClose&&c.onClose()}})}mount(){if(this.mounted)throw new Error("CardElement is already mounted");this.sdk.init(),this.mounted=!0}destroy(){this.mounted&&(this.sdk.destroy(),this.mounted=!1)}}class He{constructor(r){if(!r.publicKey||typeof r.publicKey!="string")throw new Error("API key is required");this.config=r,this.timeout=3e4,this.iframeUrl=Me(r.publicKey);const c=Ce(r.publicKey);this.debug=c==="sandbox"||c==="development"}createCardElement(r){return new je({publicKey:this.config.publicKey,iframeUrl:this.iframeUrl,timeout:this.timeout,debug:this.debug,locale:this.config.locale},r)}getIframeUrl(){return this.iframeUrl}getApiKey(){return this.config.publicKey}}class Dt{constructor(r){const c={publicKey:r.config.publicKey,locale:r.config.locale};this.sdk=new He(c)}createCardElement(r){let c;if(r.container)c=r.container;else{const a=document.createElement("div");a.id="inflowpay-card-element-container",document.body.appendChild(a),c=a}const w={container:c,paymentId:r.paymentId,...r.style&&{style:r.style},...r.buttonText&&{buttonText:r.buttonText},...r.placeholders&&{placeholders:r.placeholders},onComplete:a=>{r.onComplete&&r.onComplete(a)},onError:r.onError,onClose:r.onClose},m=this.sdk.createCardElement(w);if(r.onReady){const a=m.mount.bind(m);m.mount=()=>{a(),setTimeout(()=>{r.onReady&&r.onReady()},100)}}return r.onChange&&setTimeout(()=>{r.onChange&&r.onChange({complete:!1})},100),m}getSDK(){return this.sdk}}const Nt="0.8.0";W.CardElement=je,W.InflowPayProvider=Dt,W.PaymentResultErrorCode=xe,W.PaymentResultStatus=ye,W.PaymentSDK=He,W.VERSION=Nt,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})});
178
218
  //# sourceMappingURL=sdk.umd.js.map