@tap-payments/connect-v2 0.0.24-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 -0
- package/build/index.d.ts +109 -5
- package/build/index.esm.js +445 -0
- package/package.json +17 -7
- package/build/App.d.ts +0 -2
- package/build/App.js +0 -24
- package/build/components/loader/Loader.d.ts +0 -9
- package/build/components/loader/Loader.js +0 -23
- package/build/components/loader/index.d.ts +0 -2
- package/build/components/loader/index.js +0 -2
- package/build/connect/Connect.d.ts +0 -4
- package/build/connect/Connect.js +0 -24
- package/build/connect/ConnectIFrame.d.ts +0 -5
- package/build/connect/ConnectIFrame.js +0 -16
- package/build/connect/index.d.ts +0 -3
- package/build/connect/index.js +0 -3
- package/build/connect/renderConnectElement.d.ts +0 -5
- package/build/connect/renderConnectElement.js +0 -12
- package/build/constants.d.ts +0 -5
- package/build/constants.js +0 -7
- package/build/context/index.d.ts +0 -15
- package/build/context/index.js +0 -14
- package/build/hooks/index.d.ts +0 -5
- package/build/hooks/index.js +0 -5
- package/build/hooks/useConfig.d.ts +0 -4
- package/build/hooks/useConfig.js +0 -52
- package/build/hooks/useEventListener.d.ts +0 -2
- package/build/hooks/useEventListener.js +0 -38
- package/build/hooks/usePostEvents.d.ts +0 -5
- package/build/hooks/usePostEvents.js +0 -11
- package/build/hooks/useStopScrolling.d.ts +0 -2
- package/build/hooks/useStopScrolling.js +0 -16
- package/build/index.js +0 -4
- package/build/main.d.ts +0 -1
- package/build/main.js +0 -4
- package/build/types/app.d.ts +0 -70
- package/build/types/app.js +0 -16
- package/build/types/events.d.ts +0 -7
- package/build/types/events.js +0 -8
- package/build/types/index.d.ts +0 -4
- package/build/types/index.js +0 -4
- package/build/types/searchParams.d.ts +0 -5
- package/build/types/searchParams.js +0 -6
- package/build/types/theme.d.ts +0 -18
- package/build/types/theme.js +0 -22
- package/build/utils/dom.d.ts +0 -1
- package/build/utils/dom.js +0 -9
- package/build/utils/index.d.ts +0 -2
- package/build/utils/index.js +0 -2
- package/build/utils/region.d.ts +0 -1
- package/build/utils/region.js +0 -16
|
@@ -0,0 +1 @@
|
|
|
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.d.ts
CHANGED
|
@@ -1,5 +1,109 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
1
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
2
|
+
import * as React_2 from 'react';
|
|
3
|
+
|
|
4
|
+
export declare type ConnectAppInfo = {
|
|
5
|
+
name: string;
|
|
6
|
+
identifier?: string;
|
|
7
|
+
version?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export declare enum ConnectDialogEdgeFormat {
|
|
11
|
+
STRAIGHT = "straight",
|
|
12
|
+
CURVED = "curved"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export declare enum ConnectDialogTransition {
|
|
16
|
+
LEFT = "left",
|
|
17
|
+
RIGHT = "right",
|
|
18
|
+
UP = "up",
|
|
19
|
+
DOWN = "down"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export declare const ConnectElement: React_2.MemoExoticComponent<(props: ConnectProps) => JSX_2.Element>;
|
|
23
|
+
|
|
24
|
+
export declare enum ConnectLanguage {
|
|
25
|
+
AR = "ar",
|
|
26
|
+
EN = "en"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export declare enum ConnectMode {
|
|
30
|
+
PAGE = "page",
|
|
31
|
+
POPUP = "popup",
|
|
32
|
+
CONTENT = "content"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export declare type ConnectNotification = {
|
|
36
|
+
email: boolean;
|
|
37
|
+
mobile?: boolean;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export declare enum ConnectPasswordOperationType {
|
|
41
|
+
SET_PASSWORD = "set_password",
|
|
42
|
+
RESET_PASSWORD = "reset_password"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare type ConnectPaymentProvider = {
|
|
46
|
+
technology_id: string;
|
|
47
|
+
settlement_by: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export declare type ConnectProps = {
|
|
51
|
+
onClose?: () => void;
|
|
52
|
+
onSuccess: (res: Record<string, string | number>) => void;
|
|
53
|
+
onError?: (error: CustomError) => void;
|
|
54
|
+
onReady?: () => void;
|
|
55
|
+
open: boolean;
|
|
56
|
+
theme?: ConnectTheme;
|
|
57
|
+
language?: ConnectLanguage;
|
|
58
|
+
publicKey: string;
|
|
59
|
+
merchantDomain: string;
|
|
60
|
+
appInfo: ConnectAppInfo;
|
|
61
|
+
businessCountryCode?: string;
|
|
62
|
+
scope: ConnectScope;
|
|
63
|
+
showBoard?: boolean;
|
|
64
|
+
leadId?: string;
|
|
65
|
+
platforms?: Array<string>;
|
|
66
|
+
paymentProvider?: ConnectPaymentProvider;
|
|
67
|
+
features?: {
|
|
68
|
+
poweredBy?: boolean;
|
|
69
|
+
merchantLogo?: boolean;
|
|
70
|
+
closeButton?: boolean;
|
|
71
|
+
dialogStartTransition?: ConnectDialogTransition;
|
|
72
|
+
dialogEndTransition?: ConnectDialogTransition;
|
|
73
|
+
dialogEdgeFormat?: ConnectDialogEdgeFormat;
|
|
74
|
+
};
|
|
75
|
+
postUrl?: string;
|
|
76
|
+
redirectUrl?: string;
|
|
77
|
+
data?: Array<string>;
|
|
78
|
+
mode?: ConnectMode;
|
|
79
|
+
notification?: ConnectNotification;
|
|
80
|
+
boardEditable?: boolean;
|
|
81
|
+
boardId?: string;
|
|
82
|
+
boardInfoId?: string;
|
|
83
|
+
userId?: string;
|
|
84
|
+
userType?: string;
|
|
85
|
+
operationType?: ConnectPasswordOperationType;
|
|
86
|
+
loginMode?: boolean;
|
|
87
|
+
region?: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export declare enum ConnectScope {
|
|
91
|
+
AUTH = "auth",
|
|
92
|
+
MERCHANT = "merchant"
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export declare enum ConnectTheme {
|
|
96
|
+
DARK = "dark",
|
|
97
|
+
LIGHT = "light"
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare type CustomError = {
|
|
101
|
+
code: string;
|
|
102
|
+
message: string;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export declare const renderConnectElement: (elementId: string, config: ConnectProps) => {
|
|
106
|
+
unmount: () => void;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export { }
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { jsx as t, jsxs as d, Fragment as v } from "react/jsx-runtime";
|
|
2
|
+
import * as f from "react";
|
|
3
|
+
import g from "react";
|
|
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(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
style: {
|
|
17
|
+
position: "relative",
|
|
18
|
+
width: "135px",
|
|
19
|
+
height: "135px"
|
|
20
|
+
},
|
|
21
|
+
children: /* @__PURE__ */ t(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
style: {
|
|
25
|
+
position: "absolute",
|
|
26
|
+
display: "flex",
|
|
27
|
+
justifyContent: "center",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
width: "100%",
|
|
30
|
+
height: "100%",
|
|
31
|
+
opacity: 0.9
|
|
32
|
+
},
|
|
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
|
+
] })
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
}
|
|
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);
|
|
219
|
+
}, i = () => {
|
|
220
|
+
o(!1);
|
|
221
|
+
};
|
|
222
|
+
return /* @__PURE__ */ t(C.Provider, { value: { ...n, onLoadingHandler: a, loading: r, onLoaded: i }, children: e });
|
|
223
|
+
}
|
|
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(
|
|
229
|
+
"iframe",
|
|
230
|
+
{
|
|
231
|
+
id: B,
|
|
232
|
+
title: "connect",
|
|
233
|
+
src: e,
|
|
234
|
+
style: {
|
|
235
|
+
width: "100%",
|
|
236
|
+
height: "100%",
|
|
237
|
+
border: "none",
|
|
238
|
+
position: "absolute",
|
|
239
|
+
top: 0,
|
|
240
|
+
left: 0
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] });
|
|
245
|
+
};
|
|
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;
|
|
249
|
+
}, F = function(e) {
|
|
250
|
+
return e instanceof Error;
|
|
251
|
+
}, M = function(e) {
|
|
252
|
+
return typeof e == "string";
|
|
253
|
+
}, H = function(e) {
|
|
254
|
+
try {
|
|
255
|
+
var n = e.response.data.errors, r = n[0], o = r.description, a = r.code;
|
|
256
|
+
return {
|
|
257
|
+
message: o,
|
|
258
|
+
code: a
|
|
259
|
+
};
|
|
260
|
+
} catch (i) {
|
|
261
|
+
return {
|
|
262
|
+
message: i.message,
|
|
263
|
+
code: "UNKNOWN"
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
}, W = function(e) {
|
|
267
|
+
try {
|
|
268
|
+
var n = e.message, r = n.split("::"), o = r[0], a = r[1];
|
|
269
|
+
return {
|
|
270
|
+
message: a,
|
|
271
|
+
code: o
|
|
272
|
+
};
|
|
273
|
+
} catch (i) {
|
|
274
|
+
return {
|
|
275
|
+
message: i.message,
|
|
276
|
+
code: "UNKNOWN"
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}, K = function(e) {
|
|
280
|
+
try {
|
|
281
|
+
var n = e.split("::"), r = n[0], o = n[1];
|
|
282
|
+
return {
|
|
283
|
+
message: o,
|
|
284
|
+
code: r
|
|
285
|
+
};
|
|
286
|
+
} catch (a) {
|
|
287
|
+
return {
|
|
288
|
+
message: a,
|
|
289
|
+
code: "UNKNOWN"
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}, Y = function() {
|
|
293
|
+
function e(n) {
|
|
294
|
+
if (Object.defineProperty(this, "code", {
|
|
295
|
+
enumerable: !0,
|
|
296
|
+
configurable: !0,
|
|
297
|
+
writable: !0,
|
|
298
|
+
value: void 0
|
|
299
|
+
}), Object.defineProperty(this, "message", {
|
|
300
|
+
enumerable: !0,
|
|
301
|
+
configurable: !0,
|
|
302
|
+
writable: !0,
|
|
303
|
+
value: void 0
|
|
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;
|
|
313
|
+
} else
|
|
314
|
+
this.code = "UNKNOWN", this.message = "Unknown error";
|
|
315
|
+
}
|
|
316
|
+
return Object.defineProperty(e.prototype, "getCode", {
|
|
317
|
+
enumerable: !1,
|
|
318
|
+
configurable: !0,
|
|
319
|
+
writable: !0,
|
|
320
|
+
value: function() {
|
|
321
|
+
return this.code;
|
|
322
|
+
}
|
|
323
|
+
}), Object.defineProperty(e.prototype, "getMessage", {
|
|
324
|
+
enumerable: !1,
|
|
325
|
+
configurable: !0,
|
|
326
|
+
writable: !0,
|
|
327
|
+
value: function() {
|
|
328
|
+
return this.message;
|
|
329
|
+
}
|
|
330
|
+
}), Object.defineProperty(e.prototype, "getClientError", {
|
|
331
|
+
enumerable: !1,
|
|
332
|
+
configurable: !0,
|
|
333
|
+
writable: !0,
|
|
334
|
+
value: function() {
|
|
335
|
+
return {
|
|
336
|
+
message: this.message,
|
|
337
|
+
code: this.code
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
}), e;
|
|
341
|
+
}();
|
|
342
|
+
const q = (e = "tap-connect-sdk-element") => {
|
|
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;
|
|
347
|
+
}, J = (e) => e ? ["sa", "sau"].includes(e.toLowerCase()) : !1, V = (e) => e === "dr", z = (e = "") => {
|
|
348
|
+
const [n, r] = e.split("-");
|
|
349
|
+
return J(n) ? V(r) ? D : P : I;
|
|
350
|
+
}, Q = () => {
|
|
351
|
+
const [e, n] = f.useState(""), { onError: r, onLoadingHandler: o, loginMode: a, region: i, ...s } = y(), p = async () => {
|
|
352
|
+
o(!0);
|
|
353
|
+
try {
|
|
354
|
+
const c = await fetch(z(i), {
|
|
355
|
+
method: "POST",
|
|
356
|
+
headers: {
|
|
357
|
+
"Content-Type": "application/json"
|
|
358
|
+
},
|
|
359
|
+
body: JSON.stringify(s)
|
|
360
|
+
});
|
|
361
|
+
if (!c.ok)
|
|
362
|
+
throw new Error(`${c.status}::${c.statusText}`);
|
|
363
|
+
const l = await c.json();
|
|
364
|
+
if (!l.redirect_url) {
|
|
365
|
+
const m = new URLSearchParams();
|
|
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()}`;
|
|
369
|
+
}
|
|
370
|
+
if (s.mode !== O.PAGE) return n(l.redirect_url);
|
|
371
|
+
window.location.href = l.redirect_url;
|
|
372
|
+
} catch (c) {
|
|
373
|
+
const l = new Y(c);
|
|
374
|
+
r == null || r(l.getClientError()), o(!1);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
return f.useEffect(() => {
|
|
378
|
+
p();
|
|
379
|
+
}, []), { connectLink: e };
|
|
380
|
+
}, X = () => {
|
|
381
|
+
const { onSuccess: e, onClose: n, onError: r, onReady: o, onLoaded: a } = y(), i = f.useCallback(
|
|
382
|
+
async (s) => {
|
|
383
|
+
if (s.origin !== _) return;
|
|
384
|
+
const { data: p, event: c } = s.data;
|
|
385
|
+
switch (c) {
|
|
386
|
+
case u.ON_CLOSE:
|
|
387
|
+
n == null || n();
|
|
388
|
+
break;
|
|
389
|
+
case u.ON_ERROR:
|
|
390
|
+
r == null || r(p);
|
|
391
|
+
break;
|
|
392
|
+
case u.ON_SUCCESS:
|
|
393
|
+
e(p);
|
|
394
|
+
break;
|
|
395
|
+
case u.ON_LOADED:
|
|
396
|
+
a();
|
|
397
|
+
break;
|
|
398
|
+
case u.ON_READY:
|
|
399
|
+
o == null || o();
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
[n, r, a, o, e]
|
|
404
|
+
);
|
|
405
|
+
f.useEffect(() => (window.addEventListener("message", i, !1), () => {
|
|
406
|
+
window.removeEventListener("message", i);
|
|
407
|
+
}), [i]);
|
|
408
|
+
}, Z = () => {
|
|
409
|
+
const { connectLink: e } = Q();
|
|
410
|
+
return X(), /* @__PURE__ */ t(
|
|
411
|
+
"div",
|
|
412
|
+
{
|
|
413
|
+
id: "tap-connect-main-container",
|
|
414
|
+
style: {
|
|
415
|
+
display: "flex",
|
|
416
|
+
alignItems: "center",
|
|
417
|
+
justifyContent: "center",
|
|
418
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
419
|
+
position: "fixed",
|
|
420
|
+
top: 0,
|
|
421
|
+
left: 0,
|
|
422
|
+
width: "100%",
|
|
423
|
+
height: "100%"
|
|
424
|
+
},
|
|
425
|
+
children: /* @__PURE__ */ t($, { src: e })
|
|
426
|
+
}
|
|
427
|
+
);
|
|
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() };
|
|
434
|
+
};
|
|
435
|
+
export {
|
|
436
|
+
R as ConnectDialogEdgeFormat,
|
|
437
|
+
L as ConnectDialogTransition,
|
|
438
|
+
te as ConnectElement,
|
|
439
|
+
A as ConnectLanguage,
|
|
440
|
+
O as ConnectMode,
|
|
441
|
+
k as ConnectPasswordOperationType,
|
|
442
|
+
x as ConnectScope,
|
|
443
|
+
S as ConnectTheme,
|
|
444
|
+
ae as renderConnectElement
|
|
445
|
+
};
|
package/package.json
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/connect-v2",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.26-test",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "build/index.js",
|
|
7
|
-
"module": "build/index.js",
|
|
6
|
+
"main": "build/index.cjs.js",
|
|
7
|
+
"module": "build/index.esm.js",
|
|
8
8
|
"types": "build/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"build",
|
|
11
11
|
"readme.md"
|
|
12
12
|
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"require": "./build/index.cjs.js",
|
|
16
|
+
"import": "./build/index.esm.js",
|
|
17
|
+
"types": "./build/index.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
13
20
|
"scripts": {
|
|
14
21
|
"clean": "rm -rf build*",
|
|
15
22
|
"dev": "vite",
|
|
16
23
|
"tsc:alias": "tsc-alias -p tsconfig.app.json",
|
|
17
|
-
"build": "
|
|
18
|
-
"build:
|
|
19
|
-
"build
|
|
20
|
-
"build:
|
|
24
|
+
"build:npm": "cross-env BUILD_TARGET=npm vite build --mode ${MODE:-development}",
|
|
25
|
+
"build:umd": "cross-env BUILD_TARGET=umd vite build --mode ${MODE:-development}",
|
|
26
|
+
"build": "yarn clean && yarn build:npm && yarn build:umd",
|
|
27
|
+
"build:production": "cross-env MODE=production npm run build",
|
|
28
|
+
"build:beta": "cross-env MODE=beta npm run build",
|
|
29
|
+
"build:development": "cross-env MODE=development npm run build",
|
|
21
30
|
"lint": "eslint .",
|
|
22
31
|
"lint:fix": "eslint . --fix",
|
|
23
32
|
"preview": "vite preview",
|
|
@@ -39,6 +48,7 @@
|
|
|
39
48
|
"@types/react": "^18.3.12",
|
|
40
49
|
"@types/react-dom": "^18.3.1",
|
|
41
50
|
"@vitejs/plugin-react": "^4.3.3",
|
|
51
|
+
"cross-env": "^10.0.0",
|
|
42
52
|
"eslint": "^9.13.0",
|
|
43
53
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
44
54
|
"eslint-plugin-react-refresh": "^0.4.14",
|
package/build/App.d.ts
DELETED
package/build/App.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { ConnectMode, ConnectScope, ConnectDialogTransition, ConnectTheme } from './types';
|
|
4
|
-
import { ConnectElement } from './connect';
|
|
5
|
-
function App() {
|
|
6
|
-
const [open, setOpen] = React.useState(true);
|
|
7
|
-
return (_jsx(ConnectElement, { open: open, mode: ConnectMode.POPUP, publicKey: 'pk_test_lat64TEDSvHrUOYAxVRe28PQ', merchantDomain: 'https://connect.dev.tap.company', appInfo: { name: 'SDK V2' }, scope: ConnectScope.MERCHANT, theme: ConnectTheme.LIGHT, features: {
|
|
8
|
-
closeButton: true,
|
|
9
|
-
poweredBy: true,
|
|
10
|
-
merchantLogo: false,
|
|
11
|
-
dialogStartTransition: ConnectDialogTransition.UP,
|
|
12
|
-
dialogEndTransition: ConnectDialogTransition.DOWN,
|
|
13
|
-
}, postUrl: 'https://203zq.wiremockapi.cloud/json', showBoard: true, boardEditable: true, onClose: () => {
|
|
14
|
-
console.log('onClose');
|
|
15
|
-
setOpen(false);
|
|
16
|
-
}, onError: (err) => {
|
|
17
|
-
console.log('error', err);
|
|
18
|
-
setOpen(false);
|
|
19
|
-
}, onSuccess: (res) => {
|
|
20
|
-
console.log('success', res);
|
|
21
|
-
setOpen(false);
|
|
22
|
-
} }));
|
|
23
|
-
}
|
|
24
|
-
export default App;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type LoaderProps = {
|
|
3
|
-
outerColor?: string;
|
|
4
|
-
innerColor?: string;
|
|
5
|
-
duration?: number;
|
|
6
|
-
toggleAnimation?: boolean;
|
|
7
|
-
};
|
|
8
|
-
declare const _default: React.MemoExoticComponent<({ outerColor, innerColor, duration, toggleAnimation }: LoaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
9
|
-
export default _default;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
const Loader = ({ outerColor = 'white', innerColor = 'white', duration = 3, toggleAnimation = false }) => {
|
|
4
|
-
return (_jsx("div", { style: {
|
|
5
|
-
position: 'absolute',
|
|
6
|
-
display: 'flex',
|
|
7
|
-
justifyContent: 'center',
|
|
8
|
-
alignItems: 'center',
|
|
9
|
-
width: '100%',
|
|
10
|
-
height: '100%',
|
|
11
|
-
}, children: _jsx("div", { style: {
|
|
12
|
-
position: 'relative',
|
|
13
|
-
width: '60px',
|
|
14
|
-
height: '60px',
|
|
15
|
-
}, children: _jsxs("svg", { viewBox: "25 25 50 50", style: {
|
|
16
|
-
transformOrigin: 'center center',
|
|
17
|
-
position: 'absolute',
|
|
18
|
-
top: 0,
|
|
19
|
-
left: 0,
|
|
20
|
-
margin: 'auto',
|
|
21
|
-
}, children: [_jsx("circle", { cx: "50", cy: "50", r: "20", fill: "none", stroke: outerColor, strokeWidth: "3.6px", strokeLinecap: "round", strokeDasharray: "125, 124", children: toggleAnimation && (_jsxs(_Fragment, { children: [_jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 50 50", to: "360 50 50", dur: `${duration || 0 / 3}s`, repeatCount: "indefinite" }), _jsx("animate", { attributeName: "stroke-dashoffset", values: "0; 122; 122; 0; 0", keyTimes: "0; 0.45; 0.55; 0.9; 1", dur: `${duration}s`, repeatCount: "indefinite" })] })) }), _jsx("circle", { cx: "50", cy: "50", r: "14", fill: "none", stroke: innerColor, strokeWidth: "3.6px", strokeLinecap: "round", strokeDasharray: "88, 124", children: toggleAnimation && (_jsxs(_Fragment, { children: [_jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "360 50 50", to: "0 50 50", dur: `${duration || 0 / 3}s`, repeatCount: "indefinite" }), _jsx("animate", { attributeName: "stroke-dashoffset", values: "0; -85; -85; 0; 0", keyTimes: "0; 0.45; 0.55; 0.9; 1", dur: `${duration}s`, repeatCount: "indefinite" })] })) })] }) }) }));
|
|
22
|
-
};
|
|
23
|
-
export default React.memo(Loader);
|
package/build/connect/Connect.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import ConnectIFrame from './ConnectIFrame';
|
|
4
|
-
import ConnectContextProvider from '../context';
|
|
5
|
-
import { useEventListener, useConfig } from '../hooks';
|
|
6
|
-
const Connect = () => {
|
|
7
|
-
const { connectLink } = useConfig();
|
|
8
|
-
useEventListener();
|
|
9
|
-
return (_jsx("div", { id: "tap-connect-main-container", style: {
|
|
10
|
-
display: 'flex',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
justifyContent: 'center',
|
|
13
|
-
background: 'rgba(0, 0, 0, 0.5)',
|
|
14
|
-
position: 'fixed',
|
|
15
|
-
top: 0,
|
|
16
|
-
left: 0,
|
|
17
|
-
width: '100%',
|
|
18
|
-
height: '100%',
|
|
19
|
-
}, children: _jsx(ConnectIFrame, { src: connectLink }) }));
|
|
20
|
-
};
|
|
21
|
-
const ConnectElement = (props) => {
|
|
22
|
-
return _jsx(ConnectContextProvider, { props: props, children: props.open && _jsx(Connect, {}) });
|
|
23
|
-
};
|
|
24
|
-
export default React.memo(ConnectElement);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Loader from '../components/loader';
|
|
3
|
-
import { useConnectContext } from '../context';
|
|
4
|
-
import { CONNECT_IFRAME_ID } from '../constants';
|
|
5
|
-
const ConnectIFrame = ({ src }) => {
|
|
6
|
-
const { loading } = useConnectContext();
|
|
7
|
-
return (_jsxs(_Fragment, { children: [loading && _jsx(Loader, { toggleAnimation: true }), src && (_jsx("iframe", { id: CONNECT_IFRAME_ID, title: "connect", src: src, style: {
|
|
8
|
-
width: '100%',
|
|
9
|
-
height: '100%',
|
|
10
|
-
border: 'none',
|
|
11
|
-
position: 'absolute',
|
|
12
|
-
top: 0,
|
|
13
|
-
left: 0,
|
|
14
|
-
} }))] }));
|
|
15
|
-
};
|
|
16
|
-
export default ConnectIFrame;
|
package/build/connect/index.d.ts
DELETED
package/build/connect/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createRoot } from 'react-dom/client';
|
|
3
|
-
import ConnectElement from './Connect';
|
|
4
|
-
import { findOrCreateElementAndInject } from '../utils';
|
|
5
|
-
const renderConnectElement = (elementId, config) => {
|
|
6
|
-
const element = findOrCreateElementAndInject(elementId);
|
|
7
|
-
const root = createRoot(element);
|
|
8
|
-
root.render(_jsx(ConnectElement, { ...config }));
|
|
9
|
-
const unmount = () => root.unmount();
|
|
10
|
-
return { unmount };
|
|
11
|
-
};
|
|
12
|
-
export default renderConnectElement;
|
package/build/constants.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const CONNECT_CONFIG_URL: string;
|
|
2
|
-
export declare const CONNECT_CONFIG_URL_SA: string;
|
|
3
|
-
export declare const CONNECT_CONFIG_URL_SA_DR: string;
|
|
4
|
-
export declare const CONNECT_IFRAME_ID = "tap-connect-sdk-iframe";
|
|
5
|
-
export declare const CONNECT_ORIGIN: string;
|
package/build/constants.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Added mock up api until api ready from Backend
|
|
2
|
-
export const CONNECT_CONFIG_URL = import.meta.env.VITE_CONNECT_CONFIG_URL;
|
|
3
|
-
export const CONNECT_CONFIG_URL_SA = import.meta.env.VITE_CONNECT_CONFIG_URL_SA;
|
|
4
|
-
export const CONNECT_CONFIG_URL_SA_DR = import.meta.env.VITE_CONNECT_CONFIG_URL_SA_DR;
|
|
5
|
-
export const CONNECT_IFRAME_ID = 'tap-connect-sdk-iframe';
|
|
6
|
-
// TODO: import.meta.env works only in vite build when do npm publish does not work find another way
|
|
7
|
-
export const CONNECT_ORIGIN = import.meta.env.VITE_CONNECT_ORIGIN || 'https://connect.alpha.tap.company';
|
package/build/context/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ConnectProps } from '../types';
|
|
3
|
-
type ConnectContextProps = ConnectProps & {
|
|
4
|
-
onLoaded: () => void;
|
|
5
|
-
loading: boolean;
|
|
6
|
-
onLoadingHandler: (val: boolean) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const ConnectContext: React.Context<ConnectContextProps>;
|
|
9
|
-
export declare const useConnectContext: () => ConnectContextProps;
|
|
10
|
-
type ConnectContextProvider = {
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
props: ConnectProps;
|
|
13
|
-
};
|
|
14
|
-
export default function ConnectContextProvider({ children, props }: ConnectContextProvider): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
package/build/context/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export const ConnectContext = React.createContext({});
|
|
4
|
-
export const useConnectContext = () => React.useContext(ConnectContext);
|
|
5
|
-
export default function ConnectContextProvider({ children, props }) {
|
|
6
|
-
const [loading, setLoading] = React.useState(false);
|
|
7
|
-
const onLoadingHandler = (val) => {
|
|
8
|
-
setLoading(val);
|
|
9
|
-
};
|
|
10
|
-
const onLoaded = () => {
|
|
11
|
-
setLoading(false);
|
|
12
|
-
};
|
|
13
|
-
return (_jsx(ConnectContext.Provider, { value: { ...props, onLoadingHandler, loading, onLoaded }, children: children }));
|
|
14
|
-
}
|
package/build/hooks/index.d.ts
DELETED
package/build/hooks/index.js
DELETED
package/build/hooks/useConfig.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { WebErrorHandler } from '@tap-payments/web-error-handing';
|
|
3
|
-
import { ConnectMode, SearchParams } from '../types';
|
|
4
|
-
import { useConnectContext } from '../context';
|
|
5
|
-
import { CONNECT_ORIGIN } from '../constants';
|
|
6
|
-
import { getBaseUrl } from '../utils';
|
|
7
|
-
const useConfig = () => {
|
|
8
|
-
const [connectLink, setConnectLink] = React.useState('');
|
|
9
|
-
const { onError, onLoadingHandler, loginMode, region, ...config } = useConnectContext();
|
|
10
|
-
const generateConfig = async () => {
|
|
11
|
-
onLoadingHandler(true);
|
|
12
|
-
try {
|
|
13
|
-
// TODO: Do we need further headers/data for the iframe scenario
|
|
14
|
-
// TODO: Add proper type for the response
|
|
15
|
-
const response = await fetch(getBaseUrl(region), {
|
|
16
|
-
method: 'POST',
|
|
17
|
-
headers: {
|
|
18
|
-
'Content-Type': 'application/json',
|
|
19
|
-
},
|
|
20
|
-
body: JSON.stringify(config),
|
|
21
|
-
});
|
|
22
|
-
if (!response.ok) {
|
|
23
|
-
throw new Error(`${response.status}::${response.statusText}`);
|
|
24
|
-
}
|
|
25
|
-
const data = await response.json();
|
|
26
|
-
// TODO: Adding for testing only
|
|
27
|
-
if (!data.redirect_url) {
|
|
28
|
-
const params = new URLSearchParams();
|
|
29
|
-
if (config?.theme)
|
|
30
|
-
params.append(SearchParams.THEME, config.theme);
|
|
31
|
-
if (config?.language)
|
|
32
|
-
params.append(SearchParams.LANGUAGE, config.language);
|
|
33
|
-
params.append(SearchParams.PROFILE_TOKEN, data.id);
|
|
34
|
-
const baseUrl = loginMode ? `${CONNECT_ORIGIN}/auth` : CONNECT_ORIGIN;
|
|
35
|
-
data.redirect_url = `${baseUrl}?${params.toString()}`;
|
|
36
|
-
}
|
|
37
|
-
if (config.mode !== ConnectMode.PAGE)
|
|
38
|
-
return setConnectLink(data.redirect_url);
|
|
39
|
-
window.location.href = data.redirect_url;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
const customError = new WebErrorHandler(error);
|
|
43
|
-
onError?.(customError.getClientError());
|
|
44
|
-
onLoadingHandler(false);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
React.useEffect(() => {
|
|
48
|
-
generateConfig();
|
|
49
|
-
}, []);
|
|
50
|
-
return { connectLink };
|
|
51
|
-
};
|
|
52
|
-
export default useConfig;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ConnectEvents } from '../types';
|
|
3
|
-
import { CONNECT_ORIGIN } from '../constants';
|
|
4
|
-
import { useConnectContext } from '../context';
|
|
5
|
-
const useEventListener = () => {
|
|
6
|
-
const { onSuccess, onClose, onError, onReady, onLoaded } = useConnectContext();
|
|
7
|
-
const handleEvent = React.useCallback(async (message) => {
|
|
8
|
-
if (message.origin !== CONNECT_ORIGIN)
|
|
9
|
-
return;
|
|
10
|
-
const { data, event } = message.data;
|
|
11
|
-
switch (event) {
|
|
12
|
-
case ConnectEvents.ON_CLOSE:
|
|
13
|
-
onClose?.();
|
|
14
|
-
break;
|
|
15
|
-
case ConnectEvents.ON_ERROR:
|
|
16
|
-
onError?.(data);
|
|
17
|
-
break;
|
|
18
|
-
case ConnectEvents.ON_SUCCESS:
|
|
19
|
-
onSuccess(data);
|
|
20
|
-
break;
|
|
21
|
-
case ConnectEvents.ON_LOADED:
|
|
22
|
-
onLoaded();
|
|
23
|
-
break;
|
|
24
|
-
case ConnectEvents.ON_READY:
|
|
25
|
-
onReady?.();
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}, [onClose, onError, onLoaded, onReady, onSuccess]);
|
|
31
|
-
React.useEffect(() => {
|
|
32
|
-
window.addEventListener('message', handleEvent, false);
|
|
33
|
-
return () => {
|
|
34
|
-
window.removeEventListener('message', handleEvent);
|
|
35
|
-
};
|
|
36
|
-
}, [handleEvent]);
|
|
37
|
-
};
|
|
38
|
-
export default useEventListener;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CONNECT_IFRAME_ID } from '../constants';
|
|
2
|
-
const usePostEvents = () => {
|
|
3
|
-
const send = (event, data) => {
|
|
4
|
-
const iframeEl = document.getElementById(CONNECT_IFRAME_ID);
|
|
5
|
-
if (!iframeEl)
|
|
6
|
-
return;
|
|
7
|
-
iframeEl.contentWindow?.postMessage({ event, data });
|
|
8
|
-
};
|
|
9
|
-
return { send };
|
|
10
|
-
};
|
|
11
|
-
export default usePostEvents;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
const useStopScrolling = () => {
|
|
3
|
-
const stopScrolling = () => {
|
|
4
|
-
document.body.style.overflow = 'hidden';
|
|
5
|
-
};
|
|
6
|
-
const startScrolling = () => {
|
|
7
|
-
document.body.style.overflow = 'auto';
|
|
8
|
-
};
|
|
9
|
-
React.useEffect(() => {
|
|
10
|
-
stopScrolling();
|
|
11
|
-
return () => {
|
|
12
|
-
startScrolling();
|
|
13
|
-
};
|
|
14
|
-
}, []);
|
|
15
|
-
};
|
|
16
|
-
export default useStopScrolling;
|
package/build/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ConnectMode, ConnectTheme, ConnectLanguage, ConnectScope, ConnectDialogTransition, ConnectDialogEdgeFormat, ConnectPasswordOperationType, } from './types';
|
|
2
|
-
import { ConnectElement, renderConnectElement } from './connect';
|
|
3
|
-
export { ConnectMode, ConnectTheme, ConnectLanguage, ConnectScope, ConnectDialogTransition, ConnectDialogEdgeFormat, ConnectPasswordOperationType, };
|
|
4
|
-
export { ConnectElement, renderConnectElement };
|
package/build/main.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/main.js
DELETED
package/build/types/app.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { ConnectDialogEdgeFormat, ConnectDialogTransition, ConnectLanguage, ConnectTheme } from './theme';
|
|
2
|
-
export type CustomError = {
|
|
3
|
-
code: string;
|
|
4
|
-
message: string;
|
|
5
|
-
};
|
|
6
|
-
export type ConnectAppInfo = {
|
|
7
|
-
name: string;
|
|
8
|
-
identifier?: string;
|
|
9
|
-
version?: string;
|
|
10
|
-
};
|
|
11
|
-
export type ConnectPaymentProvider = {
|
|
12
|
-
technology_id: string;
|
|
13
|
-
settlement_by: string;
|
|
14
|
-
};
|
|
15
|
-
export type ConnectNotification = {
|
|
16
|
-
email: boolean;
|
|
17
|
-
mobile?: boolean;
|
|
18
|
-
};
|
|
19
|
-
export declare enum ConnectMode {
|
|
20
|
-
PAGE = "page",
|
|
21
|
-
POPUP = "popup",
|
|
22
|
-
CONTENT = "content"
|
|
23
|
-
}
|
|
24
|
-
export declare enum ConnectScope {
|
|
25
|
-
AUTH = "auth",
|
|
26
|
-
MERCHANT = "merchant"
|
|
27
|
-
}
|
|
28
|
-
export declare enum ConnectPasswordOperationType {
|
|
29
|
-
SET_PASSWORD = "set_password",
|
|
30
|
-
RESET_PASSWORD = "reset_password"
|
|
31
|
-
}
|
|
32
|
-
export type ConnectProps = {
|
|
33
|
-
onClose?: () => void;
|
|
34
|
-
onSuccess: (res: Record<string, string | number>) => void;
|
|
35
|
-
onError?: (error: CustomError) => void;
|
|
36
|
-
onReady?: () => void;
|
|
37
|
-
open: boolean;
|
|
38
|
-
theme?: ConnectTheme;
|
|
39
|
-
language?: ConnectLanguage;
|
|
40
|
-
publicKey: string;
|
|
41
|
-
merchantDomain: string;
|
|
42
|
-
appInfo: ConnectAppInfo;
|
|
43
|
-
businessCountryCode?: string;
|
|
44
|
-
scope: ConnectScope;
|
|
45
|
-
showBoard?: boolean;
|
|
46
|
-
leadId?: string;
|
|
47
|
-
platforms?: Array<string>;
|
|
48
|
-
paymentProvider?: ConnectPaymentProvider;
|
|
49
|
-
features?: {
|
|
50
|
-
poweredBy?: boolean;
|
|
51
|
-
merchantLogo?: boolean;
|
|
52
|
-
closeButton?: boolean;
|
|
53
|
-
dialogStartTransition?: ConnectDialogTransition;
|
|
54
|
-
dialogEndTransition?: ConnectDialogTransition;
|
|
55
|
-
dialogEdgeFormat?: ConnectDialogEdgeFormat;
|
|
56
|
-
};
|
|
57
|
-
postUrl?: string;
|
|
58
|
-
redirectUrl?: string;
|
|
59
|
-
data?: Array<string>;
|
|
60
|
-
mode?: ConnectMode;
|
|
61
|
-
notification?: ConnectNotification;
|
|
62
|
-
boardEditable?: boolean;
|
|
63
|
-
boardId?: string;
|
|
64
|
-
boardInfoId?: string;
|
|
65
|
-
userId?: string;
|
|
66
|
-
userType?: string;
|
|
67
|
-
operationType?: ConnectPasswordOperationType;
|
|
68
|
-
loginMode?: boolean;
|
|
69
|
-
region?: string;
|
|
70
|
-
};
|
package/build/types/app.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export var ConnectMode;
|
|
2
|
-
(function (ConnectMode) {
|
|
3
|
-
ConnectMode["PAGE"] = "page";
|
|
4
|
-
ConnectMode["POPUP"] = "popup";
|
|
5
|
-
ConnectMode["CONTENT"] = "content";
|
|
6
|
-
})(ConnectMode || (ConnectMode = {}));
|
|
7
|
-
export var ConnectScope;
|
|
8
|
-
(function (ConnectScope) {
|
|
9
|
-
ConnectScope["AUTH"] = "auth";
|
|
10
|
-
ConnectScope["MERCHANT"] = "merchant";
|
|
11
|
-
})(ConnectScope || (ConnectScope = {}));
|
|
12
|
-
export var ConnectPasswordOperationType;
|
|
13
|
-
(function (ConnectPasswordOperationType) {
|
|
14
|
-
ConnectPasswordOperationType["SET_PASSWORD"] = "set_password";
|
|
15
|
-
ConnectPasswordOperationType["RESET_PASSWORD"] = "reset_password";
|
|
16
|
-
})(ConnectPasswordOperationType || (ConnectPasswordOperationType = {}));
|
package/build/types/events.d.ts
DELETED
package/build/types/events.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export var ConnectEvents;
|
|
2
|
-
(function (ConnectEvents) {
|
|
3
|
-
ConnectEvents["ON_CLOSE"] = "connect:onClose";
|
|
4
|
-
ConnectEvents["ON_ERROR"] = "connect:onError";
|
|
5
|
-
ConnectEvents["ON_SUCCESS"] = "connect:onSuccess";
|
|
6
|
-
ConnectEvents["ON_READY"] = "connect:onReady";
|
|
7
|
-
ConnectEvents["ON_LOADED"] = "connect:onLoaded";
|
|
8
|
-
})(ConnectEvents || (ConnectEvents = {}));
|
package/build/types/index.d.ts
DELETED
package/build/types/index.js
DELETED
package/build/types/theme.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare enum ConnectTheme {
|
|
2
|
-
DARK = "dark",
|
|
3
|
-
LIGHT = "light"
|
|
4
|
-
}
|
|
5
|
-
export declare enum ConnectLanguage {
|
|
6
|
-
AR = "ar",
|
|
7
|
-
EN = "en"
|
|
8
|
-
}
|
|
9
|
-
export declare enum ConnectDialogEdgeFormat {
|
|
10
|
-
STRAIGHT = "straight",
|
|
11
|
-
CURVED = "curved"
|
|
12
|
-
}
|
|
13
|
-
export declare enum ConnectDialogTransition {
|
|
14
|
-
LEFT = "left",
|
|
15
|
-
RIGHT = "right",
|
|
16
|
-
UP = "up",
|
|
17
|
-
DOWN = "down"
|
|
18
|
-
}
|
package/build/types/theme.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export var ConnectTheme;
|
|
2
|
-
(function (ConnectTheme) {
|
|
3
|
-
ConnectTheme["DARK"] = "dark";
|
|
4
|
-
ConnectTheme["LIGHT"] = "light";
|
|
5
|
-
})(ConnectTheme || (ConnectTheme = {}));
|
|
6
|
-
export var ConnectLanguage;
|
|
7
|
-
(function (ConnectLanguage) {
|
|
8
|
-
ConnectLanguage["AR"] = "ar";
|
|
9
|
-
ConnectLanguage["EN"] = "en";
|
|
10
|
-
})(ConnectLanguage || (ConnectLanguage = {}));
|
|
11
|
-
export var ConnectDialogEdgeFormat;
|
|
12
|
-
(function (ConnectDialogEdgeFormat) {
|
|
13
|
-
ConnectDialogEdgeFormat["STRAIGHT"] = "straight";
|
|
14
|
-
ConnectDialogEdgeFormat["CURVED"] = "curved";
|
|
15
|
-
})(ConnectDialogEdgeFormat || (ConnectDialogEdgeFormat = {}));
|
|
16
|
-
export var ConnectDialogTransition;
|
|
17
|
-
(function (ConnectDialogTransition) {
|
|
18
|
-
ConnectDialogTransition["LEFT"] = "left";
|
|
19
|
-
ConnectDialogTransition["RIGHT"] = "right";
|
|
20
|
-
ConnectDialogTransition["UP"] = "up";
|
|
21
|
-
ConnectDialogTransition["DOWN"] = "down";
|
|
22
|
-
})(ConnectDialogTransition || (ConnectDialogTransition = {}));
|
package/build/utils/dom.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const findOrCreateElementAndInject: (id?: string) => HTMLElement;
|
package/build/utils/dom.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export const findOrCreateElementAndInject = (id = 'tap-connect-sdk-element') => {
|
|
2
|
-
const elementExist = document.getElementById(id);
|
|
3
|
-
if (elementExist)
|
|
4
|
-
return elementExist;
|
|
5
|
-
const element = document.createElement('div');
|
|
6
|
-
element.setAttribute('id', id);
|
|
7
|
-
document.body.prepend(element);
|
|
8
|
-
return element;
|
|
9
|
-
};
|
package/build/utils/index.d.ts
DELETED
package/build/utils/index.js
DELETED
package/build/utils/region.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getBaseUrl: (region?: string | undefined) => string;
|
package/build/utils/region.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CONNECT_CONFIG_URL, CONNECT_CONFIG_URL_SA, CONNECT_CONFIG_URL_SA_DR } from '../constants';
|
|
2
|
-
const isSA = (country) => {
|
|
3
|
-
if (!country)
|
|
4
|
-
return false;
|
|
5
|
-
return ['sa', 'sau'].includes(country.toLowerCase());
|
|
6
|
-
};
|
|
7
|
-
const isDisasterRecoveryEnv = (type) => type === 'dr';
|
|
8
|
-
export const getBaseUrl = (region = '') => {
|
|
9
|
-
const [country, envType] = region.split('-');
|
|
10
|
-
if (isSA(country)) {
|
|
11
|
-
return isDisasterRecoveryEnv(envType) ? CONNECT_CONFIG_URL_SA_DR : CONNECT_CONFIG_URL_SA;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
return CONNECT_CONFIG_URL;
|
|
15
|
-
}
|
|
16
|
-
};
|