@tap-payments/connect-v2 0.0.25-test → 0.0.26-test
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/build/index.cjs.js +1 -1
- package/build/index.esm.js +282 -182
- package/package.json +1 -1
package/build/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),f=require("react"),A=require("react-dom");function R(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const u=R(f);var g=(e=>(e.PAGE="page",e.POPUP="popup",e.CONTENT="content",e))(g||{}),_=(e=>(e.AUTH="auth",e.MERCHANT="merchant",e))(_||{}),y=(e=>(e.SET_PASSWORD="set_password",e.RESET_PASSWORD="reset_password",e))(y||{}),C=(e=>(e.DARK="dark",e.LIGHT="light",e))(C||{}),O=(e=>(e.AR="ar",e.EN="en",e))(O||{}),E=(e=>(e.STRAIGHT="straight",e.CURVED="curved",e))(E||{}),b=(e=>(e.LEFT="left",e.RIGHT="right",e.UP="up",e.DOWN="down",e))(b||{}),l=(e=>(e.ON_CLOSE="connect:onClose",e.ON_ERROR="connect:onError",e.ON_SUCCESS="connect:onSuccess",e.ON_READY="connect:onReady",e.ON_LOADED="connect:onLoaded",e))(l||{}),h=(e=>(e.PROFILE_TOKEN="profile_token",e.THEME="theme",e.LANGUAGE="lang",e))(h||{});const L=({outerStartColor:e="rgba(244, 244, 244, 1)",outerEndColor:n="rgba(238, 238, 238, 1)",innerStartColor:r="rgba(244, 244, 244, 1)",innerEndColor:o="rgba(238, 238, 238, 1)",duration:s=3,toggleAnimation:i=!1})=>t.jsx("div",{style:{position:"relative",width:"135px",height:"135px"},children:t.jsx("div",{style:{position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",opacity:.9},children:t.jsxs("svg",{width:"199",height:"197",viewBox:"0 0 199 197",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsxs("g",{filter:"url(#filter0_dddi_1427_22275)",children:[t.jsx("circle",{cx:"89.5",cy:"86.5",r:"67.5",fill:"none",stroke:"url(#strokeGradientOuter_1427_22275)",strokeWidth:"9.6",strokeLinecap:"round",strokeDasharray:"425 125",children:i&&t.jsxs(t.Fragment,{children:[t.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 89.5 86.5",to:"360 89.5 86.5",dur:`${s/3}s`,repeatCount:"indefinite"}),t.jsx("animate",{attributeName:"stroke-dashoffset",values:"0; 425; 425; 0; 0",keyTimes:"0; 0.45; 0.55; 0.9; 1",dur:`${s}s`,repeatCount:"indefinite"})]})}),t.jsx("circle",{cx:"89.5",cy:"86.5",r:"48",fill:"none",stroke:"url(#strokeGradientInner_1427_22275)",strokeWidth:"9.6",strokeLinecap:"round",strokeDasharray:"300 100",children:i&&t.jsxs(t.Fragment,{children:[t.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"360 89.5 86.5",to:"0 89.5 86.5",dur:`${s/3}s`,repeatCount:"indefinite"}),t.jsx("animate",{attributeName:"stroke-dashoffset",values:"0; -300; -300; 0; 0",keyTimes:"0; 0.45; 0.55; 0.9; 1",dur:`${s}s`,repeatCount:"indefinite"})]})})]}),t.jsxs("defs",{children:[t.jsxs("filter",{id:"filter0_dddi_1427_22275",x:"0.882668",y:"0.899429",width:"198.08",height:"195.314",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[t.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),t.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),t.jsx("feOffset",{dy:"1.68224"}),t.jsx("feGaussianBlur",{stdDeviation:"4.20656"}),t.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),t.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.824495 0 0 0 0 0.824495 0 0 0 0 0.824495 0 0 0 1 0"}),t.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_1427_22275"}),t.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),t.jsx("feOffset",{dx:"22.3542",dy:"22.6047"}),t.jsx("feGaussianBlur",{stdDeviation:"9.80447"}),t.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),t.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.740723 0 0 0 0 0.740723 0 0 0 0 0.740723 0 0 0 0.6 0"}),t.jsx("feBlend",{mode:"normal",in2:"effect1_dropShadow_1427_22275",result:"effect2_dropShadow_1427_22275"}),t.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),t.jsx("feOffset",{dx:"-6.03352",dy:"-3.01676"}),t.jsx("feGaussianBlur",{stdDeviation:"7.5419"}),t.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),t.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.7 0"}),t.jsx("feBlend",{mode:"normal",in2:"effect2_dropShadow_1427_22275",result:"effect3_dropShadow_1427_22275"}),t.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect3_dropShadow_1427_22275",result:"shape"}),t.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),t.jsx("feOffset",{dy:"1.50838"}),t.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),t.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"}),t.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect4_innerShadow_1427_22275"})]}),t.jsxs("linearGradient",{id:"strokeGradientOuter_1427_22275",x1:"89.5",y1:"19",x2:"89.5",y2:"154",gradientUnits:"userSpaceOnUse",children:[t.jsx("stop",{stopColor:e}),t.jsx("stop",{offset:"1",stopColor:n})]}),t.jsxs("linearGradient",{id:"strokeGradientInner_1427_22275",x1:"89.4991",y1:"38.2849",x2:"89.4991",y2:"134.713",gradientUnits:"userSpaceOnUse",children:[t.jsx("stop",{stopColor:r}),t.jsx("stop",{offset:"1",stopColor:o})]})]})]})})}),T=f.memo(L),N=f.createContext({}),v=()=>f.useContext(N);function U({children:e,props:n}){const[r,o]=f.useState(!1),s=a=>{o(a)},i=()=>{o(!1)};return t.jsx(N.Provider,{value:{...n,onLoadingHandler:s,loading:r,onLoaded:i},children:e})}const G="https://68b564fae5dc090291aeddd7.mockapi.io/api/config",I="https://68b564fae5dc090291aeddd7.mockapi.io/api/config",P="https://68b564fae5dc090291aeddd7.mockapi.io/api/config",D="tap-connect-sdk-iframe",x="https://connect.alpha.tap.company",F=({src:e})=>{const{loading:n}=v();return t.jsxs(t.Fragment,{children:[n&&t.jsx(T,{toggleAnimation:!0}),e&&t.jsx("iframe",{id:D,title:"connect",src:e,style:{width:"100%",height:"100%",border:"none",position:"absolute",top:0,left:0}})]})};var M=function(e){var n,r;return((r=(n=e==null?void 0:e.response)===null||n===void 0?void 0:n.data)===null||r===void 0?void 0:r.errors)!==void 0},B=function(e){return e instanceof Error},$=function(e){return typeof e=="string"},H=function(e){try{var n=e.response.data.errors,r=n[0],o=r.description,s=r.code;return{message:o,code:s}}catch(i){return{message:i.message,code:"UNKNOWN"}}},W=function(e){try{var n=e.message,r=n.split("::"),o=r[0],s=r[1];return{message:s,code:o}}catch(i){return{message:i.message,code:"UNKNOWN"}}},K=function(e){try{var n=e.split("::"),r=n[0],o=n[1];return{message:o,code:r}}catch(s){return{message:s,code:"UNKNOWN"}}},q=function(){function e(n){if(Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),M(n)){var r=H(n);this.code=r.code,this.message=r.message}else if(B(n)){var r=W(n);this.code=r.code,this.message=r.message}else if($(n)){var r=K(n);this.code=r.code,this.message=r.message}else this.code="UNKNOWN",this.message="Unknown error"}return Object.defineProperty(e.prototype,"getCode",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.code}}),Object.defineProperty(e.prototype,"getMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.message}}),Object.defineProperty(e.prototype,"getClientError",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{message:this.message,code:this.code}}}),e}();const Y=(e="tap-connect-sdk-element")=>{const n=document.getElementById(e);if(n)return n;const r=document.createElement("div");return r.setAttribute("id",e),document.body.prepend(r),r},z=e=>e?["sa","sau"].includes(e.toLowerCase()):!1,J=e=>e==="dr",V=(e="")=>{const[n,r]=e.split("-");return z(n)?J(r)?P:I:G},Q=()=>{const[e,n]=u.useState(""),{onError:r,onLoadingHandler:o,loginMode:s,region:i,...a}=v(),p=async()=>{o(!0);try{const c=await fetch(V(i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!c.ok)throw new Error(`${c.status}::${c.statusText}`);const d=await c.json();if(!d.redirect_url){const m=new URLSearchParams;a!=null&&a.theme&&m.append(h.THEME,a.theme),a!=null&&a.language&&m.append(h.LANGUAGE,a.language),m.append(h.PROFILE_TOKEN,d.id);const k=s?`${x}/auth`:x;d.redirect_url=`${k}?${m.toString()}`}if(a.mode!==g.PAGE)return n(d.redirect_url);window.location.href=d.redirect_url}catch(c){const d=new q(c);r==null||r(d.getClientError()),o(!1)}};return u.useEffect(()=>{p()},[]),{connectLink:e}},X=()=>{const{onSuccess:e,onClose:n,onError:r,onReady:o,onLoaded:s}=v(),i=u.useCallback(async a=>{if(a.origin!==x)return;const{data:p,event:c}=a.data;switch(c){case l.ON_CLOSE:n==null||n();break;case l.ON_ERROR:r==null||r(p);break;case l.ON_SUCCESS:e(p);break;case l.ON_LOADED:s();break;case l.ON_READY:o==null||o();break}},[n,r,s,o,e]);u.useEffect(()=>(window.addEventListener("message",i,!1),()=>{window.removeEventListener("message",i)}),[i])},Z=()=>{const{connectLink:e}=Q();return X(),t.jsx("div",{id:"tap-connect-main-container",style:{display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.5)",position:"fixed",top:0,left:0,width:"100%",height:"100%"},children:t.jsx(F,{src:e})})},ee=e=>t.jsx(U,{props:e,children:e.open&&t.jsx(Z,{})}),w=u.memo(ee);var S,j=A;S=j.createRoot,j.hydrateRoot;const te=(e,n)=>{const r=Y(e),o=S(r);return o.render(t.jsx(w,{...n})),{unmount:()=>o.unmount()}};exports.ConnectDialogEdgeFormat=E;exports.ConnectDialogTransition=b;exports.ConnectElement=w;exports.ConnectLanguage=O;exports.ConnectMode=g;exports.ConnectPasswordOperationType=y;exports.ConnectScope=_;exports.ConnectTheme=C;exports.renderConnectElement=te;
|
package/build/index.esm.js
CHANGED
|
@@ -1,134 +1,234 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as t, jsxs as d, Fragment as v } from "react/jsx-runtime";
|
|
2
|
+
import * as f from "react";
|
|
3
3
|
import g from "react";
|
|
4
|
-
import
|
|
5
|
-
var O = /* @__PURE__ */ ((e) => (e.PAGE = "page", e.POPUP = "popup", e.CONTENT = "content", e))(O || {}),
|
|
6
|
-
const
|
|
4
|
+
import w from "react-dom";
|
|
5
|
+
var O = /* @__PURE__ */ ((e) => (e.PAGE = "page", e.POPUP = "popup", e.CONTENT = "content", e))(O || {}), x = /* @__PURE__ */ ((e) => (e.AUTH = "auth", e.MERCHANT = "merchant", e))(x || {}), k = /* @__PURE__ */ ((e) => (e.SET_PASSWORD = "set_password", e.RESET_PASSWORD = "reset_password", e))(k || {}), S = /* @__PURE__ */ ((e) => (e.DARK = "dark", e.LIGHT = "light", e))(S || {}), A = /* @__PURE__ */ ((e) => (e.AR = "ar", e.EN = "en", e))(A || {}), R = /* @__PURE__ */ ((e) => (e.STRAIGHT = "straight", e.CURVED = "curved", e))(R || {}), L = /* @__PURE__ */ ((e) => (e.LEFT = "left", e.RIGHT = "right", e.UP = "up", e.DOWN = "down", e))(L || {}), u = /* @__PURE__ */ ((e) => (e.ON_CLOSE = "connect:onClose", e.ON_ERROR = "connect:onError", e.ON_SUCCESS = "connect:onSuccess", e.ON_READY = "connect:onReady", e.ON_LOADED = "connect:onLoaded", e))(u || {}), h = /* @__PURE__ */ ((e) => (e.PROFILE_TOKEN = "profile_token", e.THEME = "theme", e.LANGUAGE = "lang", e))(h || {});
|
|
6
|
+
const U = ({
|
|
7
|
+
outerStartColor: e = "rgba(244, 244, 244, 1)",
|
|
8
|
+
outerEndColor: n = "rgba(238, 238, 238, 1)",
|
|
9
|
+
innerStartColor: r = "rgba(244, 244, 244, 1)",
|
|
10
|
+
innerEndColor: o = "rgba(238, 238, 238, 1)",
|
|
11
|
+
duration: a = 3,
|
|
12
|
+
toggleAnimation: i = !1
|
|
13
|
+
}) => /* @__PURE__ */ t(
|
|
7
14
|
"div",
|
|
8
15
|
{
|
|
9
16
|
style: {
|
|
10
|
-
position: "
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
alignItems: "center",
|
|
14
|
-
width: "100%",
|
|
15
|
-
height: "100%"
|
|
17
|
+
position: "relative",
|
|
18
|
+
width: "135px",
|
|
19
|
+
height: "135px"
|
|
16
20
|
},
|
|
17
|
-
children: /* @__PURE__ */
|
|
21
|
+
children: /* @__PURE__ */ t(
|
|
18
22
|
"div",
|
|
19
23
|
{
|
|
20
24
|
style: {
|
|
21
|
-
position: "
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
position: "absolute",
|
|
26
|
+
display: "flex",
|
|
27
|
+
justifyContent: "center",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
width: "100%",
|
|
30
|
+
height: "100%",
|
|
31
|
+
opacity: 0.9
|
|
24
32
|
},
|
|
25
|
-
children: /* @__PURE__ */
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
33
|
+
children: /* @__PURE__ */ d("svg", { width: "199", height: "197", viewBox: "0 0 199 197", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
34
|
+
/* @__PURE__ */ d("g", { filter: "url(#filter0_dddi_1427_22275)", children: [
|
|
35
|
+
/* @__PURE__ */ t(
|
|
36
|
+
"circle",
|
|
37
|
+
{
|
|
38
|
+
cx: "89.5",
|
|
39
|
+
cy: "86.5",
|
|
40
|
+
r: "67.5",
|
|
41
|
+
fill: "none",
|
|
42
|
+
stroke: "url(#strokeGradientOuter_1427_22275)",
|
|
43
|
+
strokeWidth: "9.6",
|
|
44
|
+
strokeLinecap: "round",
|
|
45
|
+
strokeDasharray: "425 125",
|
|
46
|
+
children: i && /* @__PURE__ */ d(v, { children: [
|
|
47
|
+
/* @__PURE__ */ t(
|
|
48
|
+
"animateTransform",
|
|
49
|
+
{
|
|
50
|
+
attributeName: "transform",
|
|
51
|
+
type: "rotate",
|
|
52
|
+
from: "0 89.5 86.5",
|
|
53
|
+
to: "360 89.5 86.5",
|
|
54
|
+
dur: `${a / 3}s`,
|
|
55
|
+
repeatCount: "indefinite"
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ t(
|
|
59
|
+
"animate",
|
|
60
|
+
{
|
|
61
|
+
attributeName: "stroke-dashoffset",
|
|
62
|
+
values: "0; 425; 425; 0; 0",
|
|
63
|
+
keyTimes: "0; 0.45; 0.55; 0.9; 1",
|
|
64
|
+
dur: `${a}s`,
|
|
65
|
+
repeatCount: "indefinite"
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] })
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ t(
|
|
72
|
+
"circle",
|
|
73
|
+
{
|
|
74
|
+
cx: "89.5",
|
|
75
|
+
cy: "86.5",
|
|
76
|
+
r: "48",
|
|
77
|
+
fill: "none",
|
|
78
|
+
stroke: "url(#strokeGradientInner_1427_22275)",
|
|
79
|
+
strokeWidth: "9.6",
|
|
80
|
+
strokeLinecap: "round",
|
|
81
|
+
strokeDasharray: "300 100",
|
|
82
|
+
children: i && /* @__PURE__ */ d(v, { children: [
|
|
83
|
+
/* @__PURE__ */ t(
|
|
84
|
+
"animateTransform",
|
|
85
|
+
{
|
|
86
|
+
attributeName: "transform",
|
|
87
|
+
type: "rotate",
|
|
88
|
+
from: "360 89.5 86.5",
|
|
89
|
+
to: "0 89.5 86.5",
|
|
90
|
+
dur: `${a / 3}s`,
|
|
91
|
+
repeatCount: "indefinite"
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ t(
|
|
95
|
+
"animate",
|
|
96
|
+
{
|
|
97
|
+
attributeName: "stroke-dashoffset",
|
|
98
|
+
values: "0; -300; -300; 0; 0",
|
|
99
|
+
keyTimes: "0; 0.45; 0.55; 0.9; 1",
|
|
100
|
+
dur: `${a}s`,
|
|
101
|
+
repeatCount: "indefinite"
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] })
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] }),
|
|
108
|
+
/* @__PURE__ */ d("defs", { children: [
|
|
109
|
+
/* @__PURE__ */ d(
|
|
110
|
+
"filter",
|
|
111
|
+
{
|
|
112
|
+
id: "filter0_dddi_1427_22275",
|
|
113
|
+
x: "0.882668",
|
|
114
|
+
y: "0.899429",
|
|
115
|
+
width: "198.08",
|
|
116
|
+
height: "195.314",
|
|
117
|
+
filterUnits: "userSpaceOnUse",
|
|
118
|
+
colorInterpolationFilters: "sRGB",
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ t("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
121
|
+
/* @__PURE__ */ t(
|
|
122
|
+
"feColorMatrix",
|
|
123
|
+
{
|
|
124
|
+
in: "SourceAlpha",
|
|
125
|
+
type: "matrix",
|
|
126
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
127
|
+
result: "hardAlpha"
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ t("feOffset", { dy: "1.68224" }),
|
|
131
|
+
/* @__PURE__ */ t("feGaussianBlur", { stdDeviation: "4.20656" }),
|
|
132
|
+
/* @__PURE__ */ t("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
133
|
+
/* @__PURE__ */ t("feColorMatrix", { type: "matrix", values: "0 0 0 0 0.824495 0 0 0 0 0.824495 0 0 0 0 0.824495 0 0 0 1 0" }),
|
|
134
|
+
/* @__PURE__ */ t("feBlend", { mode: "normal", in2: "BackgroundImageFix", result: "effect1_dropShadow_1427_22275" }),
|
|
135
|
+
/* @__PURE__ */ t(
|
|
136
|
+
"feColorMatrix",
|
|
137
|
+
{
|
|
138
|
+
in: "SourceAlpha",
|
|
139
|
+
type: "matrix",
|
|
140
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
141
|
+
result: "hardAlpha"
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ t("feOffset", { dx: "22.3542", dy: "22.6047" }),
|
|
145
|
+
/* @__PURE__ */ t("feGaussianBlur", { stdDeviation: "9.80447" }),
|
|
146
|
+
/* @__PURE__ */ t("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
147
|
+
/* @__PURE__ */ t("feColorMatrix", { type: "matrix", values: "0 0 0 0 0.740723 0 0 0 0 0.740723 0 0 0 0 0.740723 0 0 0 0.6 0" }),
|
|
148
|
+
/* @__PURE__ */ t("feBlend", { mode: "normal", in2: "effect1_dropShadow_1427_22275", result: "effect2_dropShadow_1427_22275" }),
|
|
149
|
+
/* @__PURE__ */ t(
|
|
150
|
+
"feColorMatrix",
|
|
151
|
+
{
|
|
152
|
+
in: "SourceAlpha",
|
|
153
|
+
type: "matrix",
|
|
154
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
155
|
+
result: "hardAlpha"
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ t("feOffset", { dx: "-6.03352", dy: "-3.01676" }),
|
|
159
|
+
/* @__PURE__ */ t("feGaussianBlur", { stdDeviation: "7.5419" }),
|
|
160
|
+
/* @__PURE__ */ t("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
161
|
+
/* @__PURE__ */ t("feColorMatrix", { type: "matrix", values: "0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.7 0" }),
|
|
162
|
+
/* @__PURE__ */ t("feBlend", { mode: "normal", in2: "effect2_dropShadow_1427_22275", result: "effect3_dropShadow_1427_22275" }),
|
|
163
|
+
/* @__PURE__ */ t("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect3_dropShadow_1427_22275", result: "shape" }),
|
|
164
|
+
/* @__PURE__ */ t(
|
|
165
|
+
"feColorMatrix",
|
|
166
|
+
{
|
|
167
|
+
in: "SourceAlpha",
|
|
168
|
+
type: "matrix",
|
|
169
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
170
|
+
result: "hardAlpha"
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
/* @__PURE__ */ t("feOffset", { dy: "1.50838" }),
|
|
174
|
+
/* @__PURE__ */ t("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
175
|
+
/* @__PURE__ */ t("feColorMatrix", { type: "matrix", values: "0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0" }),
|
|
176
|
+
/* @__PURE__ */ t("feBlend", { mode: "normal", in2: "shape", result: "effect4_innerShadow_1427_22275" })
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
/* @__PURE__ */ d(
|
|
181
|
+
"linearGradient",
|
|
182
|
+
{
|
|
183
|
+
id: "strokeGradientOuter_1427_22275",
|
|
184
|
+
x1: "89.5",
|
|
185
|
+
y1: "19",
|
|
186
|
+
x2: "89.5",
|
|
187
|
+
y2: "154",
|
|
188
|
+
gradientUnits: "userSpaceOnUse",
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ t("stop", { stopColor: e }),
|
|
191
|
+
/* @__PURE__ */ t("stop", { offset: "1", stopColor: n })
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
/* @__PURE__ */ d(
|
|
196
|
+
"linearGradient",
|
|
197
|
+
{
|
|
198
|
+
id: "strokeGradientInner_1427_22275",
|
|
199
|
+
x1: "89.4991",
|
|
200
|
+
y1: "38.2849",
|
|
201
|
+
x2: "89.4991",
|
|
202
|
+
y2: "134.713",
|
|
203
|
+
gradientUnits: "userSpaceOnUse",
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ t("stop", { stopColor: r }),
|
|
206
|
+
/* @__PURE__ */ t("stop", { offset: "1", stopColor: o })
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
] })
|
|
211
|
+
] })
|
|
112
212
|
}
|
|
113
213
|
)
|
|
114
214
|
}
|
|
115
|
-
),
|
|
116
|
-
function
|
|
117
|
-
const [
|
|
118
|
-
|
|
215
|
+
), G = g.memo(U), C = g.createContext({}), y = () => g.useContext(C);
|
|
216
|
+
function T({ children: e, props: n }) {
|
|
217
|
+
const [r, o] = g.useState(!1), a = (s) => {
|
|
218
|
+
o(s);
|
|
119
219
|
}, i = () => {
|
|
120
|
-
|
|
220
|
+
o(!1);
|
|
121
221
|
};
|
|
122
|
-
return /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ t(C.Provider, { value: { ...n, onLoadingHandler: a, loading: r, onLoaded: i }, children: e });
|
|
123
223
|
}
|
|
124
|
-
const
|
|
125
|
-
const { loading:
|
|
126
|
-
return /* @__PURE__ */
|
|
127
|
-
|
|
128
|
-
e && /* @__PURE__ */
|
|
224
|
+
const I = "https://68b564fae5dc090291aeddd7.mockapi.io/api/config", P = "https://68b564fae5dc090291aeddd7.mockapi.io/api/config", D = "https://68b564fae5dc090291aeddd7.mockapi.io/api/config", B = "tap-connect-sdk-iframe", _ = "https://connect.alpha.tap.company", $ = ({ src: e }) => {
|
|
225
|
+
const { loading: n } = y();
|
|
226
|
+
return /* @__PURE__ */ d(v, { children: [
|
|
227
|
+
n && /* @__PURE__ */ t(G, { toggleAnimation: !0 }),
|
|
228
|
+
e && /* @__PURE__ */ t(
|
|
129
229
|
"iframe",
|
|
130
230
|
{
|
|
131
|
-
id:
|
|
231
|
+
id: B,
|
|
132
232
|
title: "connect",
|
|
133
233
|
src: e,
|
|
134
234
|
style: {
|
|
@@ -143,18 +243,18 @@ const P = "https://68b564fae5dc090291aeddd7.mockapi.io/api/config", G = "https:/
|
|
|
143
243
|
)
|
|
144
244
|
] });
|
|
145
245
|
};
|
|
146
|
-
var
|
|
147
|
-
var
|
|
148
|
-
return ((
|
|
149
|
-
}, W = function(e) {
|
|
150
|
-
return e instanceof Error;
|
|
246
|
+
var j = function(e) {
|
|
247
|
+
var n, r;
|
|
248
|
+
return ((r = (n = e == null ? void 0 : e.response) === null || n === void 0 ? void 0 : n.data) === null || r === void 0 ? void 0 : r.errors) !== void 0;
|
|
151
249
|
}, F = function(e) {
|
|
250
|
+
return e instanceof Error;
|
|
251
|
+
}, M = function(e) {
|
|
152
252
|
return typeof e == "string";
|
|
153
|
-
},
|
|
253
|
+
}, H = function(e) {
|
|
154
254
|
try {
|
|
155
|
-
var
|
|
255
|
+
var n = e.response.data.errors, r = n[0], o = r.description, a = r.code;
|
|
156
256
|
return {
|
|
157
|
-
message:
|
|
257
|
+
message: o,
|
|
158
258
|
code: a
|
|
159
259
|
};
|
|
160
260
|
} catch (i) {
|
|
@@ -163,12 +263,12 @@ var H = function(e) {
|
|
|
163
263
|
code: "UNKNOWN"
|
|
164
264
|
};
|
|
165
265
|
}
|
|
166
|
-
},
|
|
266
|
+
}, W = function(e) {
|
|
167
267
|
try {
|
|
168
|
-
var
|
|
268
|
+
var n = e.message, r = n.split("::"), o = r[0], a = r[1];
|
|
169
269
|
return {
|
|
170
270
|
message: a,
|
|
171
|
-
code:
|
|
271
|
+
code: o
|
|
172
272
|
};
|
|
173
273
|
} catch (i) {
|
|
174
274
|
return {
|
|
@@ -176,12 +276,12 @@ var H = function(e) {
|
|
|
176
276
|
code: "UNKNOWN"
|
|
177
277
|
};
|
|
178
278
|
}
|
|
179
|
-
},
|
|
279
|
+
}, K = function(e) {
|
|
180
280
|
try {
|
|
181
|
-
var
|
|
281
|
+
var n = e.split("::"), r = n[0], o = n[1];
|
|
182
282
|
return {
|
|
183
|
-
message:
|
|
184
|
-
code:
|
|
283
|
+
message: o,
|
|
284
|
+
code: r
|
|
185
285
|
};
|
|
186
286
|
} catch (a) {
|
|
187
287
|
return {
|
|
@@ -190,7 +290,7 @@ var H = function(e) {
|
|
|
190
290
|
};
|
|
191
291
|
}
|
|
192
292
|
}, Y = function() {
|
|
193
|
-
function e(
|
|
293
|
+
function e(n) {
|
|
194
294
|
if (Object.defineProperty(this, "code", {
|
|
195
295
|
enumerable: !0,
|
|
196
296
|
configurable: !0,
|
|
@@ -201,15 +301,15 @@ var H = function(e) {
|
|
|
201
301
|
configurable: !0,
|
|
202
302
|
writable: !0,
|
|
203
303
|
value: void 0
|
|
204
|
-
}),
|
|
205
|
-
var
|
|
206
|
-
this.code =
|
|
207
|
-
} else if (
|
|
208
|
-
var
|
|
209
|
-
this.code =
|
|
210
|
-
} else if (
|
|
211
|
-
var
|
|
212
|
-
this.code =
|
|
304
|
+
}), j(n)) {
|
|
305
|
+
var r = H(n);
|
|
306
|
+
this.code = r.code, this.message = r.message;
|
|
307
|
+
} else if (F(n)) {
|
|
308
|
+
var r = W(n);
|
|
309
|
+
this.code = r.code, this.message = r.message;
|
|
310
|
+
} else if (M(n)) {
|
|
311
|
+
var r = K(n);
|
|
312
|
+
this.code = r.code, this.message = r.message;
|
|
213
313
|
} else
|
|
214
314
|
this.code = "UNKNOWN", this.message = "Unknown error";
|
|
215
315
|
}
|
|
@@ -240,16 +340,16 @@ var H = function(e) {
|
|
|
240
340
|
}), e;
|
|
241
341
|
}();
|
|
242
342
|
const q = (e = "tap-connect-sdk-element") => {
|
|
243
|
-
const
|
|
244
|
-
if (
|
|
245
|
-
const
|
|
246
|
-
return
|
|
343
|
+
const n = document.getElementById(e);
|
|
344
|
+
if (n) return n;
|
|
345
|
+
const r = document.createElement("div");
|
|
346
|
+
return r.setAttribute("id", e), document.body.prepend(r), r;
|
|
247
347
|
}, J = (e) => e ? ["sa", "sau"].includes(e.toLowerCase()) : !1, V = (e) => e === "dr", z = (e = "") => {
|
|
248
|
-
const [
|
|
249
|
-
return J(
|
|
348
|
+
const [n, r] = e.split("-");
|
|
349
|
+
return J(n) ? V(r) ? D : P : I;
|
|
250
350
|
}, Q = () => {
|
|
251
|
-
const [e,
|
|
252
|
-
|
|
351
|
+
const [e, n] = f.useState(""), { onError: r, onLoadingHandler: o, loginMode: a, region: i, ...s } = y(), p = async () => {
|
|
352
|
+
o(!0);
|
|
253
353
|
try {
|
|
254
354
|
const c = await fetch(z(i), {
|
|
255
355
|
method: "POST",
|
|
@@ -260,54 +360,54 @@ const q = (e = "tap-connect-sdk-element") => {
|
|
|
260
360
|
});
|
|
261
361
|
if (!c.ok)
|
|
262
362
|
throw new Error(`${c.status}::${c.statusText}`);
|
|
263
|
-
const
|
|
264
|
-
if (!
|
|
363
|
+
const l = await c.json();
|
|
364
|
+
if (!l.redirect_url) {
|
|
265
365
|
const m = new URLSearchParams();
|
|
266
|
-
s != null && s.theme && m.append(h.THEME, s.theme), s != null && s.language && m.append(h.LANGUAGE, s.language), m.append(h.PROFILE_TOKEN,
|
|
267
|
-
const
|
|
268
|
-
|
|
366
|
+
s != null && s.theme && m.append(h.THEME, s.theme), s != null && s.language && m.append(h.LANGUAGE, s.language), m.append(h.PROFILE_TOKEN, l.id);
|
|
367
|
+
const b = a ? `${_}/auth` : _;
|
|
368
|
+
l.redirect_url = `${b}?${m.toString()}`;
|
|
269
369
|
}
|
|
270
|
-
if (s.mode !== O.PAGE) return
|
|
271
|
-
window.location.href =
|
|
370
|
+
if (s.mode !== O.PAGE) return n(l.redirect_url);
|
|
371
|
+
window.location.href = l.redirect_url;
|
|
272
372
|
} catch (c) {
|
|
273
|
-
const
|
|
274
|
-
|
|
373
|
+
const l = new Y(c);
|
|
374
|
+
r == null || r(l.getClientError()), o(!1);
|
|
275
375
|
}
|
|
276
376
|
};
|
|
277
|
-
return
|
|
278
|
-
|
|
377
|
+
return f.useEffect(() => {
|
|
378
|
+
p();
|
|
279
379
|
}, []), { connectLink: e };
|
|
280
380
|
}, X = () => {
|
|
281
|
-
const { onSuccess: e, onClose:
|
|
381
|
+
const { onSuccess: e, onClose: n, onError: r, onReady: o, onLoaded: a } = y(), i = f.useCallback(
|
|
282
382
|
async (s) => {
|
|
283
|
-
if (s.origin !==
|
|
284
|
-
const { data:
|
|
383
|
+
if (s.origin !== _) return;
|
|
384
|
+
const { data: p, event: c } = s.data;
|
|
285
385
|
switch (c) {
|
|
286
386
|
case u.ON_CLOSE:
|
|
287
|
-
|
|
387
|
+
n == null || n();
|
|
288
388
|
break;
|
|
289
389
|
case u.ON_ERROR:
|
|
290
|
-
|
|
390
|
+
r == null || r(p);
|
|
291
391
|
break;
|
|
292
392
|
case u.ON_SUCCESS:
|
|
293
|
-
e(
|
|
393
|
+
e(p);
|
|
294
394
|
break;
|
|
295
395
|
case u.ON_LOADED:
|
|
296
396
|
a();
|
|
297
397
|
break;
|
|
298
398
|
case u.ON_READY:
|
|
299
|
-
|
|
399
|
+
o == null || o();
|
|
300
400
|
break;
|
|
301
401
|
}
|
|
302
402
|
},
|
|
303
|
-
[
|
|
403
|
+
[n, r, a, o, e]
|
|
304
404
|
);
|
|
305
|
-
|
|
405
|
+
f.useEffect(() => (window.addEventListener("message", i, !1), () => {
|
|
306
406
|
window.removeEventListener("message", i);
|
|
307
407
|
}), [i]);
|
|
308
408
|
}, Z = () => {
|
|
309
409
|
const { connectLink: e } = Q();
|
|
310
|
-
return X(), /* @__PURE__ */
|
|
410
|
+
return X(), /* @__PURE__ */ t(
|
|
311
411
|
"div",
|
|
312
412
|
{
|
|
313
413
|
id: "tap-connect-main-container",
|
|
@@ -322,24 +422,24 @@ const q = (e = "tap-connect-sdk-element") => {
|
|
|
322
422
|
width: "100%",
|
|
323
423
|
height: "100%"
|
|
324
424
|
},
|
|
325
|
-
children: /* @__PURE__ */
|
|
425
|
+
children: /* @__PURE__ */ t($, { src: e })
|
|
326
426
|
}
|
|
327
427
|
);
|
|
328
|
-
}, ee = (e) => /* @__PURE__ */
|
|
329
|
-
var
|
|
330
|
-
|
|
331
|
-
const
|
|
332
|
-
const
|
|
333
|
-
return
|
|
428
|
+
}, ee = (e) => /* @__PURE__ */ t(T, { props: e, children: e.open && /* @__PURE__ */ t(Z, {}) }), te = f.memo(ee);
|
|
429
|
+
var N, E = w;
|
|
430
|
+
N = E.createRoot, E.hydrateRoot;
|
|
431
|
+
const ae = (e, n) => {
|
|
432
|
+
const r = q(e), o = N(r);
|
|
433
|
+
return o.render(/* @__PURE__ */ t(te, { ...n })), { unmount: () => o.unmount() };
|
|
334
434
|
};
|
|
335
435
|
export {
|
|
336
|
-
|
|
337
|
-
|
|
436
|
+
R as ConnectDialogEdgeFormat,
|
|
437
|
+
L as ConnectDialogTransition,
|
|
338
438
|
te as ConnectElement,
|
|
339
|
-
|
|
439
|
+
A as ConnectLanguage,
|
|
340
440
|
O as ConnectMode,
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
441
|
+
k as ConnectPasswordOperationType,
|
|
442
|
+
x as ConnectScope,
|
|
443
|
+
S as ConnectTheme,
|
|
444
|
+
ae as renderConnectElement
|
|
345
445
|
};
|