@inflow_pay/sdk 1.0.0 → 1.2.0-beta.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/react.umd.js CHANGED
@@ -1,25 +1,4 @@
1
- (function(T,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],g):(T=typeof globalThis<"u"?globalThis:T||self,g(T.InflowPaySDKReact={},T.React))})(this,function(T,g){"use strict";var j={exports:{}},O={};/**
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 V;function ae(){if(V)return O;V=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(a,o,i){var l=null;if(i!==void 0&&(l=""+i),o.key!==void 0&&(l=""+o.key),"key"in o){i={};for(var c in o)c!=="key"&&(i[c]=o[c])}else i=o;return o=i.ref,{$$typeof:n,type:a,key:l,ref:o!==void 0?o:null,props:i}}return O.Fragment=t,O.jsx=r,O.jsxs=r,O}var A={};/**
10
- * @license React
11
- * react-jsx-runtime.development.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 X;function le(){return X||(X=1,process.env.NODE_ENV!=="production"&&function(){function n(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case R:return"Fragment";case M:return"Profiler";case $:return"StrictMode";case $e:return"Suspense";case Ye:return"SuspenseList";case ze: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 C:return"Portal";case Ke:return e.displayName||"Context";case x:return(e._context.displayName||"Context")+".Consumer";case Fe:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case We:return s=e.displayName||null,s!==null?s:n(e.type)||"Memo";case Y:s=e._payload,e=e._init;try{return n(e(s))}catch{}}return null}function t(e){return""+e}function r(e){try{t(e);var s=!1}catch{s=!0}if(s){s=console;var d=s.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return d.call(s,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),t(e)}}function a(e){if(e===R)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===Y)return"<...>";try{var s=n(e);return s?"<"+s+">":"<...>"}catch{return"<...>"}}function o(){var e=W.A;return e===null?null:e.getOwner()}function i(){return Error("react-stack-top-frame")}function l(e){if(te.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function c(e,s){function d(){ne||(ne=!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)",s))}d.isReactWarning=!0,Object.defineProperty(e,"key",{get:d,configurable:!0})}function y(){var e=n(this.type);return re[e]||(re[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 w(e,s,d,f,H,G){var m=d.ref;return e={$$typeof:v,type:e,key:s,props:d,_owner:f},(m!==void 0?m:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:y}):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:H}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function S(e,s,d,f,H,G){var m=s.children;if(m!==void 0)if(f)if(Be(m)){for(f=0;f<m.length;f++)b(m[f]);Object.freeze&&Object.freeze(m)}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 b(m);if(te.call(s,"key")){m=n(e);var D=Object.keys(s).filter(function(Ve){return Ve!=="key"});f=0<D.length?"{key: someKey, "+D.join(": ..., ")+": ...}":"{key: someKey}",se[m+f]||(D=0<D.length?"{"+D.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
- let props = %s;
19
- <%s {...props} />
20
- React keys must be passed directly to JSX without using spread:
21
- let props = %s;
22
- <%s key={someKey} {...props} />`,f,m,D,m),se[m+f]=!0)}if(m=null,d!==void 0&&(r(d),m=""+d),l(s)&&(r(s.key),m=""+s.key),"key"in s){d={};for(var B in s)B!=="key"&&(d[B]=s[B])}else d=s;return m&&c(d,typeof e=="function"?e.displayName||e.name||"Unknown":e),w(e,m,d,o(),H,G)}function b(e){u(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===Y&&(e._payload.status==="fulfilled"?u(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function u(e){return typeof e=="object"&&e!==null&&e.$$typeof===v}var h=g,v=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),Ke=Symbol.for("react.context"),Fe=Symbol.for("react.forward_ref"),$e=Symbol.for("react.suspense"),Ye=Symbol.for("react.suspense_list"),We=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),ze=Symbol.for("react.activity"),Ge=Symbol.for("react.client.reference"),W=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=Object.prototype.hasOwnProperty,Be=Array.isArray,z=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(e){return e()}};var ne,re={},ie=h.react_stack_bottom_frame.bind(h,i)(),oe=z(a(i)),se={};A.Fragment=R,A.jsx=function(e,s,d){var f=1e4>W.recentlyCreatedOwnerStacks++;return S(e,s,d,!1,f?Error("react-stack-top-frame"):ie,f?z(a(e)):oe)},A.jsxs=function(e,s,d){var f=1e4>W.recentlyCreatedOwnerStacks++;return S(e,s,d,!0,f?Error("react-stack-top-frame"):ie,f?z(a(e)):oe)}}()),A}process.env.NODE_ENV==="production"?j.exports=ae():j.exports=le();var J=j.exports;const P={OVERLAY:999999,MODAL:1e6,LOADER:1e3},p={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"},ce=["https://dev.api.inflowpay.xyz","https://pre-prod.api.inflowpay.xyz","https://api.inflowpay.xyz"],I={OVERLAY:"inflowpay-sdk-overlay",LOADER:"inflowpay-loader",LOADER_STYLES:"inflowpay-loader-styles",THREE_DS_OVERLAY:"inflowpay-3ds-overlay"},N={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 de(n){return{inputBgColor:n?"#2d2d2d":"#F5F5F5",shimmerBase:n?"#3d3d3d":"#E5E5E5",shimmerLight:n?"#4d4d4d":"#F0F0F0"}}function ue(n){return`linear-gradient(90deg, ${n.shimmerBase} 25%, ${n.shimmerLight} 50%, ${n.shimmerBase} 75%)`}function fe(){return`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`)):typeof define==`function`&&define.amd?define([`exports`,`react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.InflowPaySDKReact={},e.React))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),r={OVERLAY:999999,MODAL:1e6,LOADER:1e3},i={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`},a=[`https://dev.api.inflowpay.xyz`,`https://pre-prod.api.inflowpay.xyz`,`https://api.inflowpay.xyz`],o={OVERLAY:`inflowpay-sdk-overlay`,LOADER:`inflowpay-loader`,LOADER_STYLES:`inflowpay-loader-styles`,THREE_DS_OVERLAY:`inflowpay-3ds-overlay`,THREE_DS_CLOSE:`inflowpay-3ds-close`},s={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 c(e){return{inputBgColor:e?`#2d2d2d`:`#F5F5F5`,shimmerBase:e?`#3d3d3d`:`#E5E5E5`,shimmerLight:e?`#4d4d4d`:`#F0F0F0`}}function l(e){return`linear-gradient(90deg, ${e.shimmerBase} 25%, ${e.shimmerLight} 50%, ${e.shimmerBase} 75%)`}function u(){return`
23
2
  position: fixed;
24
3
  top: 0;
25
4
  left: 0;
@@ -29,115 +8,115 @@ React keys must be passed directly to JSX without using spread:
29
8
  display: flex;
30
9
  align-items: center;
31
10
  justify-content: center;
32
- z-index: ${P.OVERLAY};
33
- `}function me(){return`
11
+ z-index: ${r.OVERLAY};
12
+ `}function d(){return`
34
13
  position: relative;
35
- width: ${p.CONTAINER_WIDTH_PERCENT};
36
- max-width: ${p.CONTAINER_MAX_WIDTH};
37
- height: ${p.CONTAINER_HEIGHT_PERCENT};
38
- max-height: ${p.CONTAINER_MAX_HEIGHT};
14
+ width: ${i.CONTAINER_WIDTH_PERCENT};
15
+ max-width: ${i.CONTAINER_MAX_WIDTH};
16
+ height: ${i.CONTAINER_HEIGHT_PERCENT};
17
+ max-height: ${i.CONTAINER_MAX_HEIGHT};
39
18
  background: white;
40
19
  border-radius: 8px;
41
20
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
42
- `}function he(){return`
21
+ `}function f(){return`
43
22
  position: absolute;
44
23
  top: 10px;
45
24
  right: 10px;
46
- width: ${p.BUTTON_SIZE}px;
47
- height: ${p.BUTTON_SIZE}px;
25
+ width: ${i.BUTTON_SIZE}px;
26
+ height: ${i.BUTTON_SIZE}px;
48
27
  border: none;
49
28
  background: transparent;
50
29
  font-size: 24px;
51
30
  cursor: pointer;
52
- z-index: ${P.MODAL};
31
+ z-index: ${r.MODAL};
53
32
  color: #333;
54
33
  display: flex;
55
34
  align-items: center;
56
35
  justify-content: center;
57
- `}function pe(){return`
36
+ `}function p(){return`
58
37
  width: 100%;
59
38
  height: 100%;
60
39
  border: none;
61
40
  border-radius: 8px;
62
- `}function ge(n){return`
63
- width: ${n?"100%":p.DEFAULT_IFRAME_WIDTH};
64
- max-width: ${n?"none":"100%"};
65
- height: ${p.MIN_HEIGHT}px;
66
- min-height: ${p.MIN_HEIGHT}px;
41
+ `}function m(e){return`
42
+ width: ${e?`100%`:i.DEFAULT_IFRAME_WIDTH};
43
+ max-width: ${e?`none`:`100%`};
44
+ height: ${i.MIN_HEIGHT}px;
45
+ min-height: ${i.MIN_HEIGHT}px;
67
46
  border: none;
68
47
  display: block;
69
48
  transition: height 0.2s ease;
70
- `}function Ee(){return`
49
+ `}function h(){return`
71
50
  position: absolute;
72
51
  top: 0;
73
52
  left: 0;
74
53
  width: 100%;
75
54
  height: 100%;
76
- z-index: ${P.LOADER};
55
+ z-index: ${r.LOADER};
77
56
  padding: 20px;
78
57
  box-sizing: border-box;
79
58
  display: flex;
80
59
  flex-direction: column;
81
60
  align-items: center;
82
- `}function ye(n){return`
83
- width: ${n?"100%":p.DEFAULT_IFRAME_WIDTH};
61
+ `}function g(e){return`
62
+ width: ${e?`100%`:i.DEFAULT_IFRAME_WIDTH};
84
63
  max-width: 100%;
85
64
  margin: 0 auto;
86
- `}function we(n){return`
65
+ `}function _(e){return`
87
66
  display: flex;
88
67
  align-items: center;
89
68
  justify-content: center;
90
69
  gap: 6px;
91
- background-color: ${n};
70
+ background-color: ${e};
92
71
  padding: 8px;
93
72
  border-radius: 8px;
94
73
  margin-bottom: 20px;
95
- `}function _(n){return`
96
- background: ${n};
74
+ `}function v(e){return`
75
+ background: ${e};
97
76
  background-size: 200% 100%;
98
77
  animation: inflowpay-shimmer 1.5s infinite;
99
- `}function Se(n){return`
78
+ `}function y(e){return`
100
79
  flex: 1;
101
80
  min-width: 0;
102
81
  height: 32px;
103
82
  border-radius: 6px;
104
- ${_(n)}
105
- `}function be(n){return`
83
+ ${v(e)}
84
+ `}function b(e){return`
106
85
  width: 21.5%;
107
86
  flex-shrink: 0;
108
87
  height: 32px;
109
88
  border-radius: 6px;
110
- ${_(n)}
111
- `}function ve(n){return`
89
+ ${v(e)}
90
+ `}function x(e){return`
112
91
  width: 17.5%;
113
92
  flex-shrink: 0;
114
93
  height: 32px;
115
94
  border-radius: 6px;
116
- ${_(n)}
117
- `}function Te(n){return`
95
+ ${v(e)}
96
+ `}function S(e){return`
118
97
  width: 100%;
119
98
  height: 42px;
120
99
  border-radius: 8px;
121
- ${_(n)}
100
+ ${v(e)}
122
101
  margin-bottom: 16px;
123
- `}function xe(){return`
102
+ `}function C(){return`
124
103
  display: flex;
125
104
  flex-direction: column;
126
105
  align-items: center;
127
106
  gap: 4px;
128
107
  width: 100%;
129
108
  margin-top: 16px;
130
- `}function Ie(n){return`
109
+ `}function w(e){return`
131
110
  width: 10px;
132
111
  height: 10px;
133
112
  border-radius: 50%;
134
- ${_(n)}
135
- `}function Re(n){return`
113
+ ${v(e)}
114
+ `}function T(e){return`
136
115
  width: 80%;
137
116
  height: 16px;
138
117
  border-radius: 4px;
139
- ${_(n)}
140
- `}const _e=`
118
+ ${v(e)}
119
+ `}var E=`
141
120
  @keyframes inflowpay-shimmer {
142
121
  0% {
143
122
  background-position: -200% 0;
@@ -146,7 +125,7 @@ React keys must be passed directly to JSX without using spread:
146
125
  background-position: 200% 0;
147
126
  }
148
127
  }
149
- `;function Ce(){return`
128
+ `;function D(){return`
150
129
  position: fixed;
151
130
  top: 0;
152
131
  left: 0;
@@ -156,35 +135,40 @@ React keys must be passed directly to JSX without using spread:
156
135
  display: flex;
157
136
  align-items: center;
158
137
  justify-content: center;
159
- z-index: ${P.OVERLAY};
160
- `}function De(){return`
138
+ z-index: ${r.OVERLAY};
139
+ `}function O(){return`
161
140
  position: relative;
162
- width: ${p.CONTAINER_WIDTH_PERCENT};
163
- max-width: ${p.CONTAINER_MAX_WIDTH};
164
- height: ${p.CONTAINER_HEIGHT_PERCENT};
165
- max-height: ${p.CONTAINER_MAX_HEIGHT};
141
+ width: ${i.CONTAINER_WIDTH_PERCENT};
142
+ max-width: ${i.CONTAINER_MAX_WIDTH};
143
+ height: ${i.CONTAINER_HEIGHT_PERCENT};
144
+ max-height: ${i.CONTAINER_MAX_HEIGHT};
166
145
  background: white;
167
146
  border-radius: 16px;
168
147
  overflow: hidden;
169
148
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
170
149
  display: flex;
171
150
  flex-direction: column;
172
- `}function Oe(){return`
151
+ `}function k(){return`
173
152
  display: flex;
174
153
  align-items: center;
175
154
  justify-content: space-between;
176
155
  padding: 15px 20px;
177
156
  border-bottom: 1px solid #e5e5e5;
178
- `}function Ae(){return`
157
+ `}function A(){return`
179
158
  flex: 1;
180
159
  position: relative;
181
160
  overflow-y: auto;
182
161
  overflow-x: hidden;
183
- `}function ke(){return`
162
+ `}function j(){return`
184
163
  width: 100%;
185
164
  height: 100%;
186
165
  border: none;
187
- `}class Z{constructor(t,r={}){this.loaderElement=null,this.container=t,this.config=r}show(t){t&&(t.style.display="none");const r=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,a=de(r),o=ue(a),i=document.createElement("div");i.id=I.LOADER,i.style.cssText=Ee();const l=document.createElement("div");l.style.cssText=ye(this.config.fillParent||!1);const c=document.createElement("div");c.style.cssText=we(a.inputBgColor);const y=document.createElement("div");y.className="inflowpay-skeleton",y.style.cssText=Se(o);const w=document.createElement("div");w.className="inflowpay-skeleton",w.style.cssText=be(o);const S=document.createElement("div");S.className="inflowpay-skeleton",S.style.cssText=ve(o),c.appendChild(y),c.appendChild(w),c.appendChild(S);const b=document.createElement("div");b.className="inflowpay-skeleton",b.style.cssText=Te(o);const u=document.createElement("div");u.style.cssText=xe();const h=document.createElement("div");h.className="inflowpay-skeleton",h.style.cssText=Ie(o);const v=document.createElement("div");v.className="inflowpay-skeleton",v.style.cssText=Re(o),u.appendChild(h),u.appendChild(v),l.appendChild(c),l.appendChild(b),l.appendChild(u),i.appendChild(l),this.injectShimmerStyles(),this.container.appendChild(i),this.loaderElement=i}hide(t){const r=document.getElementById(I.LOADER);r&&r.remove(),this.loaderElement=null,t&&(t.style.display="")}injectShimmerStyles(){if(!document.getElementById(I.LOADER_STYLES)){const t=document.createElement("style");t.id=I.LOADER_STYLES,t.textContent=_e,document.head.appendChild(t)}}}const E=class E{constructor(t){this.config=t}open(t,r,a){return this.config.debug&&(console.log("[SDK] open3DSModal called with URL:",t),console.log("[SDK] Session ID:",r,"Payment ID:",a)),E.activeModal&&(console.warn("[SDK] Closing existing modal before opening new one"),E.activeModal.overlay.remove(),E.activeModal=null),new Promise(o=>{const i=document.createElement("div");i.id=I.THREE_DS_OVERLAY,i.style.cssText=Ce();const l=document.createElement("div");l.style.cssText=De();const c=document.createElement("div");c.style.cssText=Oe(),c.innerHTML=`
166
+ `}var M=class{constructor(e,t={}){this.loaderElement=null,this.container=e,this.config=t}show(e){e&&(e.style.display=`none`);let t=c(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches),n=l(t),r=document.createElement(`div`);r.id=o.LOADER,r.style.cssText=h();let i=document.createElement(`div`);i.style.cssText=g(this.config.fillParent||!1);let a=document.createElement(`div`);a.style.cssText=_(t.inputBgColor);let s=document.createElement(`div`);s.className=`inflowpay-skeleton`,s.style.cssText=y(n);let u=document.createElement(`div`);u.className=`inflowpay-skeleton`,u.style.cssText=b(n);let d=document.createElement(`div`);d.className=`inflowpay-skeleton`,d.style.cssText=x(n),a.appendChild(s),a.appendChild(u),a.appendChild(d);let f=document.createElement(`div`);f.className=`inflowpay-skeleton`,f.style.cssText=S(n);let p=document.createElement(`div`);p.style.cssText=C();let m=document.createElement(`div`);m.className=`inflowpay-skeleton`,m.style.cssText=w(n);let v=document.createElement(`div`);v.className=`inflowpay-skeleton`,v.style.cssText=T(n),p.appendChild(m),p.appendChild(v),i.appendChild(a),i.appendChild(f),i.appendChild(p),r.appendChild(i),this.injectShimmerStyles(),this.container.appendChild(r),this.loaderElement=r}hide(e){let t=document.getElementById(o.LOADER);t&&t.remove(),this.loaderElement=null,e&&(e.style.display=``)}injectShimmerStyles(){if(!document.getElementById(o.LOADER_STYLES)){let e=document.createElement(`style`);e.id=o.LOADER_STYLES,e.textContent=E,document.head.appendChild(e)}}},N,P=class e{constructor(e){this.config=e}open(t,n,r){return this.config.debug&&(console.log(`[SDK] open3DSModal called with URL:`,t),console.log(`[SDK] Session ID:`,n,`Payment ID:`,r)),e.activeModal&&(console.warn(`[SDK] Closing existing modal before opening new one`),e.activeModal.overlay.remove(),e.activeModal=null),new Promise(i=>{let a=document.createElement(`div`);a.id=o.THREE_DS_OVERLAY,a.style.cssText=D();let s=document.createElement(`div`);s.style.cssText=O();let c=document.createElement(`div`);c.style.cssText=k(),c.innerHTML=`
188
167
  <h3 style="margin: 0; font-size: 18px; font-weight: 600;">Secure Payment Authentication</h3>
189
- `;const y=document.createElement("div");y.style.cssText=Ae();const w=document.createElement("iframe");w.src=t,w.style.cssText=ke(),w.setAttribute("allow","payment"),w.setAttribute("sandbox","allow-forms allow-scripts allow-same-origin allow-popups"),y.appendChild(w),l.appendChild(c),l.appendChild(y),i.appendChild(l),document.body.appendChild(i),E.activeModal={overlay:i,sessionId:r,paymentId:a};const S=b=>{if(!b.data)return;if(!this.isAllowedOrigin(b.origin)){this.config.debug&&console.warn("[SDK] Rejected 3DS message from unauthorized origin:",b.origin);return}const u=b.data,h=u.type==="THREE_DS_COMPLETE"||u.type==="3ds-complete",v=u.status==="success",C=u.status==="failed"||u.status==="failure";if(h&&v){i.remove(),window.removeEventListener("message",S),o(!0);return}if(v&&!h){i.remove(),window.removeEventListener("message",S),o(!0);return}if(h&&C||u.type==="3ds-failed"||C){i.remove(),window.removeEventListener("message",S),o(!1);return}};window.addEventListener("message",S)})}static close(t){if(!E.activeModal){console.log("[SDK] No active modal to close");return}if(t&&E.activeModal.sessionId!==t){console.warn(`[SDK] Session ID mismatch: webhook for ${t}, but modal is for ${E.activeModal.sessionId}. Ignoring close request.`);return}console.log("[SDK] Closing modal for session:",t||E.activeModal.sessionId),E.activeModal.overlay.remove(),E.activeModal=null}static isModalOpen(){return E.activeModal!==null}static getCurrentSessionId(){return E.activeModal?.sessionId||null}isAllowedOrigin(t){return!!(ce.includes(t)||(this.config.environment==="sandbox"||this.config.environment==="development")&&(t.includes("localhost")||t.includes("127.0.0.1")))}};E.activeModal=null;let k=E;class U{static createOverlay(t,r){const a=document.createElement("div");a.id=I.OVERLAY,a.style.cssText=fe();const o=document.createElement("div");o.style.cssText=me();const i=document.createElement("button");i.innerHTML="×",i.style.cssText=he(),i.onclick=r;const l=document.createElement("iframe");return l.src=t,l.style.cssText=pe(),l.setAttribute("allow","payment"),o.appendChild(i),o.appendChild(l),a.appendChild(o),a.addEventListener("click",c=>{c.target===a&&r()}),{overlay:a,container:o,iframe:l}}static removeOverlay(){const t=document.getElementById(I.OVERLAY);t&&t.remove()}}const Le=["en","de","es","fr","it","nl","pl","pt"];function Pe(){if(typeof window>"u")return"en";try{const t=(navigator.language||navigator.userLanguage||"").split("-")[0].toLowerCase();if(Le.includes(t))return t}catch{}return"en"}function K(n){return n.includes("_local_")||n.startsWith("inflow_local_")?"sandbox":n.includes("_prod_")&&!n.includes("_preprod_")?"production":n.includes("_preprod_")||n.startsWith("inflow_preprod_")?"preprod":n.includes("_dev_")?"development":"sandbox"}function q(n){switch(K(n)){case"production":return N.PRODUCTION;case"preprod":return N.PREPROD;case"development":return N.DEVELOPMENT;case"sandbox":default:return N.LOCAL}}class Ne{constructor(t){if(this.iframe=null,this.messageListener=null,this.containerElement=null,this.loaderManager=null,this.config=t,this.iframeUrl=t.iframeUrl||q(t.publicKey||""),this.environment=K(t.publicKey||""),this.usePopup=!t.container,t.container)if(typeof t.container=="string"){if(this.containerElement=document.querySelector(t.container),!this.containerElement)throw new Error(`Container not found: ${t.container}`)}else this.containerElement=t.container;this.modalManager=new k({environment:this.environment,debug:this.config.debug})}init(){this.iframe||(this.createIframe(),this.addMessageListener())}createIframe(){const t=new URL(this.iframeUrl);this.config.publicKey&&t.searchParams.set("publicKey",this.config.publicKey),this.config.config?.paymentId&&t.searchParams.set("paymentId",this.config.config.paymentId),this.config.locale&&t.searchParams.set("locale",this.config.locale);const r=t.toString();if(this.usePopup){const{overlay:a,container:o,iframe:i}=U.createOverlay(r,()=>this.close());this.iframe=i,document.body.appendChild(a),this.loaderManager=new Z(o,{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 a=this.containerElement.getAttribute("style")||"";a.includes("min-height")||(this.containerElement.style.minHeight=`${p.MIN_HEIGHT}px`),a.includes("position")||(this.containerElement.style.position="relative"),a.includes("overflow")||(this.containerElement.style.overflow="hidden")}this.iframe=document.createElement("iframe"),this.iframe.src=r,this.iframe.style.cssText=ge(this.config.config?.style?.fillParent||!1),this.iframe.setAttribute("allow","payment"),this.containerElement.appendChild(this.iframe),this.loaderManager=new Z(this.containerElement,{fillParent:this.config.config?.style?.fillParent}),this.loaderManager.show(this.iframe)}}addMessageListener(){this.messageListener=t=>{const r=new URL(this.iframeUrl).origin;let o=t.origin===r;if(o||((this.environment==="sandbox"||this.environment==="development")&&(o=(t.origin.includes("localhost")||t.origin.includes("127.0.0.1"))&&(r.includes("localhost")||r.includes("127.0.0.1"))),o||(o=t.origin==="https://dev.iframe.inflowpay.com"||t.origin==="https://pre-prod.iframe.inflowpay.xyz"||t.origin==="https://iframe.inflowpay.xyz")),!o){this.config.debug&&console.warn("[SDK] Rejected message from unauthorized origin:",t.origin);return}const i=t.data;if(!(!i||!i.type))switch(i.type){case"iframe-ready":this.loaderManager&&this.loaderManager.hide(this.iframe||void 0),this.sendConfigToIframe();break;case"content-height":if(i.height&&this.iframe){const l=Math.max(i.height,p.MIN_HEIGHT);this.iframe.style.height=`${l}px`,this.containerElement&&(this.containerElement.style.minHeight=`${l}px`)}break;case"close":this.close();break;case"success":this.config.onSuccess&&this.config.onSuccess(i.data);break;case"error":this.config.onError&&this.config.onError(i.data);break;case"3ds-required":if(this.config.debug&&(console.log("[SDK] Received 3DS request:",i.threeDsSessionUrl),console.log("[SDK] Session ID:",i.sessionId)),i.threeDsSessionUrl){const l=i.sessionId,c=i.paymentId||this.config.config?.paymentId||"";i.sessionId||console.warn("[SDK] No session ID provided by iframe"),this.config.debug&&console.log("[SDK] Opening 3DS modal with session ID:",l),this.modalManager.open(i.threeDsSessionUrl,l,c).then(y=>{this.config.debug&&console.log("[SDK] 3DS modal closed, result:",y)})}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:",i.sessionId)),k.close(i.sessionId);break;case"3ds-failed":this.config.debug&&(console.log("[SDK] 3DS failed, closing modal..."),console.log("[SDK] Session ID from webhook:",i.sessionId)),k.close(i.sessionId);break;default:this.config.debug&&console.log("SDK: Received message:",i)}},window.addEventListener("message",this.messageListener)}sendConfigToIframe(){if(!this.iframe||!this.iframe.contentWindow){this.iframe&&(this.iframe.onload=()=>{this.sendConfigToIframe()});return}const t={type:"sdkData",config:{...this.config.config||{},paymentId:this.config.config?.paymentId},data:{publicKey:this.config.publicKey}},r=this.getTargetOrigin();this.iframe.contentWindow.postMessage(t,r)}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?U.removeOverlay():this.containerElement&&(this.containerElement.innerHTML=""),this.iframe=null}switchToSuccessState(t){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){U.removeOverlay(),this.iframe=null;return}const r=this.config.config?.showDefaultSuccessUI??!0;!r&&this.containerElement&&(this.containerElement.innerHTML=""),r||(this.iframe=null)}getTargetOrigin(){return this.environment==="production"||this.environment==="preprod"?new URL(this.iframeUrl).origin:"*"}destroy(){this.close()}}let Me=class{constructor(t,r){this.mounted=!1;let a;if(typeof r.container=="string"){if(a=document.querySelector(r.container),!a)throw new Error(`Container not found: ${r.container}`)}else a=r.container;this.container=a,this.sdk=new Ne({publicKey:t.publicKey,container:this.container,locale:t.locale??Pe(),config:{paymentId:r.paymentId,...r.style&&{style:r.style},...r.buttonText&&{buttonText:r.buttonText},...r.placeholders&&{placeholders:r.placeholders},...r.showDefaultSuccessUI!==void 0&&{showDefaultSuccessUI:r.showDefaultSuccessUI}},onSuccess:o=>{r.onComplete&&r.onComplete({status:L.SUCCESS,paymentId:r.paymentId}),this.sdk.switchToSuccessState(o)},onError:o=>{r.onError?r.onError(o):r.onComplete&&r.onComplete({status:L.FAILED,paymentId:r.paymentId,error:o})},onClose:()=>{r.onClose&&r.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 Q{constructor(t){if(!t.publicKey||typeof t.publicKey!="string")throw new Error("API key is required");this.config=t,this.timeout=3e4,this.iframeUrl=q(t.publicKey);const r=K(t.publicKey);this.debug=r==="sandbox"||r==="development"}createCardElement(t){return new Me({publicKey:this.config.publicKey,iframeUrl:this.iframeUrl,timeout:this.timeout,debug:this.debug,locale:this.config.locale},t)}getIframeUrl(){return this.iframeUrl}getApiKey(){return this.config.publicKey}}var L=(n=>(n.SUCCESS="SUCCESS",n.FAILED="FAILED",n))(L||{}),ee=(n=>(n.THREE_DS_FAILED="THREE_DS_FAILED",n.PAYMENT_PROCESSING_ERROR="PAYMENT_PROCESSING_ERROR",n))(ee||{});const F=g.createContext(null);function He({config:n,children:t}){const[r]=g.useState(()=>{const a={publicKey:n.publicKey,locale:n.locale};return new Q(a)});return J.jsx(F.Provider,{value:{sdk:r},children:t})}function je(){const n=g.useContext(F);if(!n)throw new Error("useInflowPay must be used within InflowPayProvider");return n.sdk}function Ue(n){const{paymentId:t,onReady:r,onChange:a,onComplete:o,onError:i,style:l,buttonText:c,placeholders:y,showDefaultSuccessUI:w,config:S}=n,b=g.useContext(F),u=g.useRef(null),h=g.useRef(null),[v,C]=g.useState(!1),R=b?.sdk||(S?new Q({publicKey:S.publicKey,locale:S.locale}):null);if(!R)throw new Error("CardElement must be used within InflowPayProvider or have a config prop");return g.useEffect(()=>{if(!u.current)return;u.current.id||(u.current.id=`inflowpay-card-element-${Date.now()}`);const $={container:u.current,paymentId:t,...l&&{style:l},...c&&{buttonText:c},...y&&{placeholders:y},...w!==void 0&&{showDefaultSuccessUI:w},onComplete:x=>{o&&o(x)},onError:x=>{i?i(x):o&&o({status:L.FAILED,paymentId:t,error:x})},onClose:()=>{}},M=R.createCardElement($);if(h.current=M,M.mount(),C(!0),r){const x=setTimeout(()=>{r()},100);return()=>clearTimeout(x)}},[t,R,o,i,r,l,c,y,w]),g.useEffect(()=>{a&&v&&a({complete:!1})},[v,a]),g.useEffect(()=>()=>{h.current&&(h.current.destroy(),h.current=null)},[]),J.jsx("div",{ref:u,style:{width:l?.fillParent?"100%":"344px"}})}T.CardElement=Ue,T.InflowPayProvider=He,T.PaymentResultErrorCode=ee,T.PaymentResultStatus=L,T.useInflowPay=je,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
190
- //# sourceMappingURL=react.umd.js.map
168
+ `;let l=document.createElement(`div`);l.style.cssText=A();let u=document.createElement(`iframe`);u.src=t,u.style.cssText=j(),u.setAttribute(`allow`,`payment`),u.setAttribute(`sandbox`,`allow-forms allow-scripts allow-same-origin allow-popups`),l.appendChild(u),s.appendChild(c),s.appendChild(l),a.appendChild(s),document.body.appendChild(a),e.activeModal={overlay:a,sessionId:n,paymentId:r};let d=e=>{if(!e.data)return;if(!this.isAllowedOrigin(e.origin)){this.config.debug&&console.warn(`[SDK] Rejected 3DS message from unauthorized origin:`,e.origin);return}let t=e.data,n=t.type===`THREE_DS_COMPLETE`||t.type===`3ds-complete`,r=t.status===`success`,o=t.status===`failed`||t.status===`failure`;if(n&&r){a.remove(),window.removeEventListener(`message`,d),i(!0);return}if(r&&!n){a.remove(),window.removeEventListener(`message`,d),i(!0);return}if(n&&o||t.type===`3ds-failed`||o){a.remove(),window.removeEventListener(`message`,d),i(!1);return}};window.addEventListener(`message`,d)})}static close(t){if(!e.activeModal){console.log(`[SDK] No active modal to close`);return}if(t&&e.activeModal.sessionId!==t){console.warn(`[SDK] Session ID mismatch: webhook for ${t}, but modal is for ${e.activeModal.sessionId}. Ignoring close request.`);return}console.log(`[SDK] Closing modal for session:`,t||e.activeModal.sessionId),e.activeModal.overlay.remove(),e.activeModal=null}static isModalOpen(){return e.activeModal!==null}static getCurrentSessionId(){return e.activeModal?.sessionId||null}isAllowedOrigin(e){return!!(a.includes(e)||(this.config.environment===`sandbox`||this.config.environment===`development`)&&(e.includes(`localhost`)||e.includes(`127.0.0.1`)))}};N=P,N.activeModal=null;var F=class{static createOverlay(e,t){let n=document.createElement(`div`);n.id=o.OVERLAY,n.style.cssText=u();let r=document.createElement(`div`);r.style.cssText=d();let i=document.createElement(`button`);i.innerHTML=`×`,i.style.cssText=f(),i.onclick=t;let a=document.createElement(`iframe`);return a.src=e,a.style.cssText=p(),a.setAttribute(`allow`,`payment`),r.appendChild(i),r.appendChild(a),n.appendChild(r),n.addEventListener(`click`,e=>{e.target===n&&t()}),{overlay:n,container:r,iframe:a}}static removeOverlay(){let e=document.getElementById(o.OVERLAY);e&&e.remove()}},I=[`en`,`de`,`es`,`fr`,`it`,`nl`,`pl`,`pt`];function L(){if(typeof window>`u`)return`en`;try{let e=(navigator.language||navigator.userLanguage||``).split(`-`)[0].toLowerCase();if(I.includes(e))return e}catch{}return`en`}function R(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`}function z(e){switch(R(e)){case`production`:return s.PRODUCTION;case`preprod`:return s.PREPROD;case`development`:return s.DEVELOPMENT;default:return s.LOCAL}}var B=class{constructor(e){if(this.iframe=null,this.messageListener=null,this.containerElement=null,this.loaderManager=null,this.config=e,this.iframeUrl=e.iframeUrl||z(e.publicKey||``),this.environment=R(e.publicKey||``),this.usePopup=!e.container,e.container)if(typeof e.container==`string`){if(this.containerElement=document.querySelector(e.container),!this.containerElement)throw Error(`Container not found: ${e.container}`)}else this.containerElement=e.container;this.modalManager=new P({environment:this.environment,debug:this.config.debug})}init(){this.iframe||(this.createIframe(),this.addMessageListener())}createIframe(){let e=new URL(this.iframeUrl);this.config.publicKey&&e.searchParams.set(`publicKey`,this.config.publicKey),this.config.config?.paymentId&&e.searchParams.set(`paymentId`,this.config.config.paymentId),this.config.config?.setupId&&e.searchParams.set(`setupId`,this.config.config.setupId),this.config.locale&&e.searchParams.set(`locale`,this.config.locale);let t=e.toString();if(this.usePopup){let{overlay:e,container:n,iframe:r}=F.createOverlay(t,()=>this.close());this.iframe=r,document.body.appendChild(e),this.loaderManager=new M(n,{fillParent:this.config.config?.style?.fillParent}),this.loaderManager.show(this.iframe)}else{if(!this.containerElement)throw Error(`Container element is required for inline mode`);if(this.containerElement.innerHTML=``,this.containerElement instanceof HTMLElement){let e=this.containerElement.getAttribute(`style`)||``;e.includes(`min-height`)||(this.containerElement.style.minHeight=`${i.MIN_HEIGHT}px`),e.includes(`position`)||(this.containerElement.style.position=`relative`),e.includes(`overflow`)||(this.containerElement.style.overflow=`hidden`)}this.iframe=document.createElement(`iframe`),this.iframe.src=t,this.iframe.style.cssText=m(this.config.config?.style?.fillParent||!1),this.iframe.setAttribute(`allow`,`payment`),this.containerElement.appendChild(this.iframe),this.loaderManager=new M(this.containerElement,{fillParent:this.config.config?.style?.fillParent}),this.loaderManager.show(this.iframe)}}addMessageListener(){this.messageListener=e=>{let t=new URL(this.iframeUrl).origin,n=e.origin===t;if(n||((this.environment===`sandbox`||this.environment===`development`)&&(n=(e.origin.includes(`localhost`)||e.origin.includes(`127.0.0.1`))&&(t.includes(`localhost`)||t.includes(`127.0.0.1`))),n||(n=e.origin===`https://dev.iframe.inflowpay.com`||e.origin===`https://pre-prod.iframe.inflowpay.xyz`||e.origin===`https://iframe.inflowpay.xyz`)),!n){this.config.debug&&console.warn(`[SDK] Rejected message from unauthorized origin:`,e.origin);return}let r=e.data;if(!(!r||!r.type))switch(r.type){case`iframe-ready`:this.loaderManager&&this.loaderManager.hide(this.iframe||void 0),this.sendConfigToIframe();break;case`content-height`:r.height&&this.iframe&&(this.iframe.style.height=`${r.height}px`,this.containerElement&&(this.containerElement.style.minHeight=`${r.height}px`));break;case`close`:this.close();break;case`success`:this.config.onSuccess&&this.config.onSuccess(r.data);break;case`error`:this.config.onError&&this.config.onError(r.data);break;case`3ds-required`:if(this.config.debug&&(console.log(`[SDK] Received 3DS request:`,r.threeDsSessionUrl),console.log(`[SDK] Session ID:`,r.sessionId)),r.threeDsSessionUrl){let e=r.sessionId,t=r.paymentId||r.setupId||this.config.config?.paymentId||this.config.config?.setupId||``;r.sessionId||console.warn(`[SDK] No session ID provided by iframe`),this.config.debug&&console.log(`[SDK] Opening 3DS modal with session ID:`,e),this.modalManager.open(r.threeDsSessionUrl,e,t).then(e=>{this.config.debug&&console.log(`[SDK] 3DS modal closed, result:`,e)})}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:`,r.sessionId)),P.close(r.sessionId);break;case`3ds-failed`:this.config.debug&&(console.log(`[SDK] 3DS failed, closing modal...`),console.log(`[SDK] Session ID from webhook:`,r.sessionId)),P.close(r.sessionId);break;default:this.config.debug&&console.log(`SDK: Received message:`,r)}},window.addEventListener(`message`,this.messageListener)}sendConfigToIframe(){if(!this.iframe||!this.iframe.contentWindow){this.iframe&&(this.iframe.onload=()=>{this.sendConfigToIframe()});return}let e={type:`sdkData`,config:{...this.config.config||{},paymentId:this.config.config?.paymentId,setupId:this.config.config?.setupId},data:{publicKey:this.config.publicKey}},t=this.getTargetOrigin();this.iframe.contentWindow.postMessage(e,t)}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?F.removeOverlay():this.containerElement&&(this.containerElement.innerHTML=``),this.iframe=null}switchToSuccessState(e){if(this.loaderManager&&(this.loaderManager.hide(this.iframe||void 0),this.loaderManager=null),this.usePopup){this.messageListener&&(window.removeEventListener(`message`,this.messageListener),this.messageListener=null),F.removeOverlay(),this.iframe=null;return}!(this.config.config?.showDefaultSuccessUI??!0)&&this.containerElement&&(this.containerElement.innerHTML=``,this.iframe=null)}getTargetOrigin(){return this.environment===`production`||this.environment===`preprod`?new URL(this.iframeUrl).origin:`*`}destroy(){this.close()}},V=class{constructor(e,t){if(this.mounted=!1,!t.paymentId&&!t.setupId)throw Error(`CardElement: paymentId or setupId is required`);if(t.paymentId&&t.setupId)throw Error(`CardElement: paymentId and setupId are mutually exclusive`);let n;if(typeof t.container==`string`){if(n=document.querySelector(t.container),!n)throw Error(`Container not found: ${t.container}`)}else n=t.container;this.container=n;let r=!!t.setupId;this.sdk=new B({publicKey:e.publicKey,container:this.container,locale:e.locale??L(),config:{...t.paymentId&&{paymentId:t.paymentId},...t.setupId&&{setupId:t.setupId},...t.style&&{style:t.style},...t.buttonText&&{buttonText:t.buttonText},...t.placeholders&&{placeholders:t.placeholders},...t.showDefaultSuccessUI!==void 0&&{showDefaultSuccessUI:t.showDefaultSuccessUI}},onSuccess:e=>{t.onComplete&&(r?t.onComplete({status:U.SUCCESS,setupId:t.setupId}):t.onComplete({status:U.SUCCESS,paymentId:t.paymentId})),this.sdk.switchToSuccessState(e)},onError:e=>{t.onError?t.onError(e):t.onComplete&&(r?t.onComplete({status:U.FAILED,setupId:t.setupId,error:e}):t.onComplete({status:U.FAILED,paymentId:t.paymentId,error:e}))},onClose:()=>{t.onClose&&t.onClose()}})}mount(){if(this.mounted)throw Error(`CardElement is already mounted`);this.sdk.init(),this.mounted=!0}destroy(){this.mounted&&(this.sdk.destroy(),this.mounted=!1)}},H=class{constructor(e){if(!e.publicKey||typeof e.publicKey!=`string`)throw Error(`API key is required`);this.config=e,this.timeout=3e4,this.iframeUrl=z(e.publicKey);let t=R(e.publicKey);this.debug=t===`sandbox`||t===`development`}createCardElement(e){return new V({publicKey:this.config.publicKey,iframeUrl:this.iframeUrl,timeout:this.timeout,debug:this.debug,locale:this.config.locale},e)}getIframeUrl(){return this.iframeUrl}getApiKey(){return this.config.publicKey}},U=function(e){return e.SUCCESS=`SUCCESS`,e.FAILED=`FAILED`,e}({}),W=function(e){return e.THREE_DS_FAILED=`THREE_DS_FAILED`,e.PAYMENT_PROCESSING_ERROR=`PAYMENT_PROCESSING_ERROR`,e}({}),G=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),K=n((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D: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 g:return`Portal`;case x:return e.displayName||`Context`;case b: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`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!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)",t))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[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?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),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:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);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 f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
169
+ let props = %s;
170
+ <%s {...props} />
171
+ React keys must be passed directly to JSX without using spread:
172
+ let props = %s;
173
+ <%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),q=n(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=G():t.exports=K()}))(),J=(0,t.createContext)(null);function Y({config:e,children:n}){let[r]=(0,t.useState)(()=>new H({publicKey:e.publicKey,locale:e.locale}));return(0,q.jsx)(J.Provider,{value:{sdk:r},children:n})}function X(){let e=(0,t.useContext)(J);if(!e)throw Error(`useInflowPay must be used within InflowPayProvider`);return e.sdk}function Z(e){let{paymentId:n,setupId:r,onReady:i,onChange:a,onComplete:o,onError:s,style:c,buttonText:l,placeholders:u,showDefaultSuccessUI:d,config:f}=e,p=(0,t.useContext)(J),m=(0,t.useRef)(null),h=(0,t.useRef)(null),[g,_]=(0,t.useState)(!1),v=p?.sdk||(f?new H({publicKey:f.publicKey,locale:f.locale}):null);if(!v)throw Error(`CardElement must be used within InflowPayProvider or have a config prop`);return(0,t.useEffect)(()=>{if(!m.current)return;m.current.id||(m.current.id=`inflowpay-card-element-${Date.now()}`);let e={container:m.current,...n&&{paymentId:n},...r&&{setupId:r},...c&&{style:c},...l&&{buttonText:l},...u&&{placeholders:u},...d!==void 0&&{showDefaultSuccessUI:d},onComplete:e=>{o&&o(e)},onError:e=>{s?s(e):o&&o(r?{status:U.FAILED,setupId:r,error:e}:{status:U.FAILED,paymentId:n,error:e})},onClose:()=>{}},t=v.createCardElement(e);if(h.current=t,t.mount(),_(!0),i){let e=setTimeout(()=>{i()},100);return()=>clearTimeout(e)}},[n,r,v,o,s,i,c,l,u,d]),(0,t.useEffect)(()=>{a&&g&&a({complete:!1})},[g,a]),(0,t.useEffect)(()=>()=>{h.current&&(h.current.destroy(),h.current=null)},[]),(0,q.jsx)(`div`,{ref:m,style:{width:c?.fillParent?`100%`:`344px`}})}e.CardElement=Z,e.InflowPayProvider=Y,e.PaymentResultErrorCode=W,e.PaymentResultStatus=U,e.useInflowPay=X});
174
+ //# sourceMappingURL=react.umd.js.map