@tap-payments/connect-v2 0.0.30-test → 0.0.32-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 +172 -151
- package/package.json +1 -1
package/build/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),p=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(p);var v=(e=>(e.PAGE="page",e.POPUP="popup",e.CONTENT="content",e))(v||{}),_=(e=>(e.AUTH="auth",e.MERCHANT="merchant",e))(_||{}),j=(e=>(e.SET_PASSWORD="set_password",e.RESET_PASSWORD="reset_password",e))(j||{}),C=(e=>(e.DARK="dark",e.LIGHT="light",e))(C||{}),E=(e=>(e.AR="ar",e.EN="en",e))(E||{}),O=(e=>(e.STRAIGHT="straight",e.CURVED="curved",e))(O||{}),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.CONFIG_TOKEN="config_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",{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=p.memo(L),N=p.createContext({}),g=()=>p.useContext(N);function U({children:e,props:n}){const[r,o]=p.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://connect-mw.dev.tap.company/middleware/v3/connect",I="https://connect-mw.dev.tap.company/middleware/v3/connect",D="https://connect-mw.dev.tap.company/middleware/v3/connect",P="tap-connect-sdk-iframe",x="https://connect.alpha.tap.company",F=({src:e})=>{const{loading:n}=g();return t.jsxs(t.Fragment,{children:[n&&t.jsx(T,{toggleAnimation:!0}),e&&t.jsx("iframe",{id:P,title:"connect",src:e,style:{width:"100%",height:"100%",border:"none",position:"absolute",top:0,left:0}})]})};var B=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},M=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}),B(n)){var r=H(n);this.code=r.code,this.message=r.message}else if(M(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 z=(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},Y=e=>e?["sa","sau"].includes(e.toLowerCase()):!1,J=e=>e==="dr",V=(e="")=>{const[n,r]=e.split("-");return Y(n)?J(r)?D:I:G},Q=e=>{var n,r;return{open:e.open,theme:e.theme,operator:{public_key:e.publicKey},merchant_domain:e.merchantDomain,app_info:e.appInfo,business_country_code:e.businessCountryCode,scope:e.scope,board:{display:e.showBoard,editable:e.boardEditable},...e.leadId&&{lead:{id:e.leadId}},platforms:e.platforms,payment_provider:e.paymentProvider,features:e.features,...e.postUrl&&{post:{url:e.postUrl}},...e.redirectUrl&&{redirect:{url:e.redirectUrl}},data:e.data,mode:e.mode,notification:e.notification,...(((n=e.features)==null?void 0:n.dialogEdgeFormat)||e.language)&&{interface:{...((r=e.features)==null?void 0:r.dialogEdgeFormat)&&{edges:e.features.dialogEdgeFormat},locale:e.language}}}},X=()=>{const[e,n]=u.useState(""),{onError:r,onLoadingHandler:o,loginMode:s,region:i,...a}=g(),m=async()=>{o(!0);try{const d=await fetch(V(i),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a.publicKey}`,mdn:a.merchantDomain||x},body:JSON.stringify(Q(a))});if(!d.ok)throw new Error(`${d.status}::${d.statusText}`);const c=await d.json(),f=new URLSearchParams;a!=null&&a.theme&&f.append(h.THEME,a.theme),a!=null&&a.language&&f.append(h.LANGUAGE,a.language);const k=s?`${x}/auth`:x;if(f.append(h.CONFIG_TOKEN,c.token),c.connect.url=`${k}?${f.toString()}`,a.mode!==v.PAGE)return n(c.connect.url);window.location.href=c.connect.url}catch(d){const c=new q(d);r==null||r(c.getClientError()),o(!1)}};return u.useEffect(()=>{m()},[]),{connectLink:e}},Z=()=>{const{onSuccess:e,onClose:n,onError:r,onReady:o,onLoaded:s}=g(),i=u.useCallback(async a=>{if(a.origin!==x)return;const{data:m,event:d}=a.data;switch(d){case l.ON_CLOSE:n==null||n();break;case l.ON_ERROR:r==null||r(m);break;case l.ON_SUCCESS:e(m);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])},ee=()=>{const{connectLink:e}=X();return Z(),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})})},te=e=>t.jsx(U,{props:e,children:e.open&&t.jsx(ee,{})}),w=u.memo(te);var S,y=A;S=y.createRoot,y.hydrateRoot;const re=(e,n)=>{const r=z(e),o=S(r);return o.render(t.jsx(w,{...n})),{unmount:()=>o.unmount()}};exports.ConnectDialogEdgeFormat=O;exports.ConnectDialogTransition=b;exports.ConnectElement=w;exports.ConnectLanguage=E;exports.ConnectMode=v;exports.ConnectPasswordOperationType=j;exports.ConnectScope=_;exports.ConnectTheme=C;exports.renderConnectElement=re;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),p=require("react"),A=require("react-dom");function R(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const u=R(p);var g=(e=>(e.PAGE="page",e.POPUP="popup",e.CONTENT="content",e))(g||{}),j=(e=>(e.AUTH="auth",e.MERCHANT="merchant",e))(j||{}),C=(e=>(e.SET_PASSWORD="set_password",e.RESET_PASSWORD="reset_password",e))(C||{}),v=(e=>(e.DARK="dark",e.LIGHT="light",e))(v||{}),b=(e=>(e.AR="ar",e.EN="en",e))(b||{}),E=(e=>(e.STRAIGHT="straight",e.CURVED="curved",e))(E||{}),O=(e=>(e.LEFT="left",e.RIGHT="right",e.UP="up",e.DOWN="down",e))(O||{}),d=(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))(d||{}),f=(e=>(e.PROFILE_TOKEN="profile_token",e.CONFIG_TOKEN="config_token",e.THEME="theme",e.LANGUAGE="lang",e))(f||{});const T=({outerStartColor:e="rgba(244, 244, 244, 1)",outerEndColor:n="rgba(238, 238, 238, 1)",innerStartColor:t="rgba(244, 244, 244, 1)",innerEndColor:o="rgba(238, 238, 238, 1)",duration:s=3,toggleAnimation:i=!1})=>r.jsx("div",{style:{position:"relative",width:"135px",height:"135px"},children:r.jsx("div",{style:{position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",opacity:.9},children:r.jsxs("svg",{width:"199",height:"197",viewBox:"0 0 199 197",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsxs("g",{children:[r.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&&r.jsxs(r.Fragment,{children:[r.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 89.5 86.5",to:"360 89.5 86.5",dur:`${s/3}s`,repeatCount:"indefinite"}),r.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"})]})}),r.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&&r.jsxs(r.Fragment,{children:[r.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"360 89.5 86.5",to:"0 89.5 86.5",dur:`${s/3}s`,repeatCount:"indefinite"}),r.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"})]})})]}),r.jsxs("defs",{children:[r.jsxs("filter",{id:"filter0_dddi_1427_22275",x:"0.882668",y:"0.899429",width:"198.08",height:"195.314",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[r.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),r.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"}),r.jsx("feOffset",{dy:"1.68224"}),r.jsx("feGaussianBlur",{stdDeviation:"4.20656"}),r.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),r.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"}),r.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_1427_22275"}),r.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"}),r.jsx("feOffset",{dx:"22.3542",dy:"22.6047"}),r.jsx("feGaussianBlur",{stdDeviation:"9.80447"}),r.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),r.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"}),r.jsx("feBlend",{mode:"normal",in2:"effect1_dropShadow_1427_22275",result:"effect2_dropShadow_1427_22275"}),r.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"}),r.jsx("feOffset",{dx:"-6.03352",dy:"-3.01676"}),r.jsx("feGaussianBlur",{stdDeviation:"7.5419"}),r.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),r.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"}),r.jsx("feBlend",{mode:"normal",in2:"effect2_dropShadow_1427_22275",result:"effect3_dropShadow_1427_22275"}),r.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect3_dropShadow_1427_22275",result:"shape"}),r.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"}),r.jsx("feOffset",{dy:"1.50838"}),r.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),r.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"}),r.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect4_innerShadow_1427_22275"})]}),r.jsxs("linearGradient",{id:"strokeGradientOuter_1427_22275",x1:"89.5",y1:"19",x2:"89.5",y2:"154",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:e}),r.jsx("stop",{offset:"1",stopColor:n})]}),r.jsxs("linearGradient",{id:"strokeGradientInner_1427_22275",x1:"89.4991",y1:"38.2849",x2:"89.4991",y2:"134.713",gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:t}),r.jsx("stop",{offset:"1",stopColor:o})]})]})]})})}),L=p.memo(T),N=p.createContext({}),y=()=>p.useContext(N);function I({children:e,props:n}){const[t,o]=p.useState(!1),s=a=>{o(a)},i=()=>{o(!1)};return r.jsx(N.Provider,{value:{...n,onLoadingHandler:s,loading:t,onLoaded:i},children:e})}const U="https://connect-mw.dev.tap.company/middleware/v3/connect",G="https://connect-mw.dev.tap.company/middleware/v3/connect",B="https://connect-mw.dev.tap.company/middleware/v3/connect",D="tap-connect-sdk-iframe",x="https://connect.alpha.tap.company",F=({src:e})=>{const{loading:n}=y();return r.jsxs(r.Fragment,{children:[n&&r.jsx(L,{toggleAnimation:!0}),e&&r.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,t;return((t=(n=e==null?void 0:e.response)===null||n===void 0?void 0:n.data)===null||t===void 0?void 0:t.errors)!==void 0},$=function(e){return e instanceof Error},H=function(e){return typeof e=="string"},W=function(e){try{var n=e.response.data.errors,t=n[0],o=t.description,s=t.code;return{message:o,code:s}}catch(i){return{message:i.message,code:"UNKNOWN"}}},K=function(e){try{var n=e.message,t=n.split("::"),o=t[0],s=t[1];return{message:s,code:o}}catch(i){return{message:i.message,code:"UNKNOWN"}}},P=function(e){try{var n=e.split("::"),t=n[0],o=n[1];return{message:o,code:t}}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 t=W(n);this.code=t.code,this.message=t.message}else if($(n)){var t=K(n);this.code=t.code,this.message=t.message}else if(H(n)){var t=P(n);this.code=t.code,this.message=t.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 z=(e="tap-connect-sdk-element")=>{const n=document.getElementById(e);if(n)return n;const t=document.createElement("div");return t.setAttribute("id",e),document.body.prepend(t),t},Y=e=>e?["sa","sau"].includes(e.toLowerCase()):!1,J=e=>e==="dr",V=(e="")=>{const[n,t]=e.split("-");return Y(n)?J(t)?B:G:U},Q=({features:e,notification:n,paymentProvider:t,...o})=>{var s;return{open:o.open,operator:{public_key:o.publicKey},domain:o.merchantDomain,app_info:o.appInfo,country:o.businessCountryCode,scope:o.scope,board:{display:o.showBoard,editable:o.boardEditable},...o.leadId&&{lead:{id:o.leadId}},...((s=o.platforms)==null?void 0:s.length)&&{platforms:o.platforms},...((t==null?void 0:t.technologyId)||(t==null?void 0:t.settlementBy))&&{payment_provider:{...t.technologyId&&{technology:{id:t.technologyId}},...t.settlementBy&&{institution:{id:t.settlementBy}}}},features:e&&{poweredby:e.poweredBy,close_button:e.closeButton},...o.postUrl&&{post:{url:o.postUrl}},...o.redirectUrl&&{redirect:{url:o.redirectUrl}},data:o.data,mode:o.mode,notification:n&&{sms:n.mobile,email:n.email},interface:{...(e==null?void 0:e.dialogEdgeFormat)&&{edges:e.dialogEdgeFormat},locale:o.language,theme:o.theme,partner_logo:e==null?void 0:e.merchantLogo,...(e==null?void 0:e.dialogEndTransition)&&(e==null?void 0:e.dialogStartTransition)&&{dialog_transition:{start:e.dialogStartTransition,end:e.dialogEndTransition}}}}},X=()=>{const[e,n]=u.useState(""),{onError:t,onLoadingHandler:o,loginMode:s,region:i,...a}=y(),m=async()=>{o(!0);try{const l=await fetch(V(i),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a.publicKey}`,mdn:a.merchantDomain||x},body:JSON.stringify(Q(a))});if(!l.ok)throw new Error(`${l.status}::${l.statusText}`);const c=await l.json(),h=new URLSearchParams;a!=null&&a.theme&&h.append(f.THEME,a.theme),a!=null&&a.language&&h.append(f.LANGUAGE,a.language);const k=s?`${x}/auth`:x;if(h.append(f.CONFIG_TOKEN,c.token),c.connect.url=`${k}?${h.toString()}`,a.mode!==g.PAGE)return n(c.connect.url);window.location.href=c.connect.url}catch(l){const c=new q(l);t==null||t(c.getClientError()),o(!1)}};return u.useEffect(()=>{m()},[]),{connectLink:e}},Z=()=>{const{onSuccess:e,onClose:n,onError:t,onReady:o,onLoaded:s}=y(),i=u.useCallback(async a=>{if(a.origin!==x)return;const{data:m,event:l}=a.data;switch(l){case d.ON_CLOSE:n==null||n();break;case d.ON_ERROR:t==null||t(m);break;case d.ON_SUCCESS:e(m);break;case d.ON_LOADED:s();break;case d.ON_READY:o==null||o();break}},[n,t,s,o,e]);u.useEffect(()=>(window.addEventListener("message",i,!1),()=>{window.removeEventListener("message",i)}),[i])},ee=()=>{const{connectLink:e}=X();return Z(),r.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:r.jsx(F,{src:e})})},te=e=>r.jsx(I,{props:e,children:e.open&&r.jsx(ee,{})}),w=u.memo(te);var S,_=A;S=_.createRoot,_.hydrateRoot;const re=(e,n)=>{const t=z(e),o=S(t);return o.render(r.jsx(w,{...n})),{unmount:()=>o.unmount()}};exports.ConnectDialogEdgeFormat=E;exports.ConnectDialogTransition=O;exports.ConnectElement=w;exports.ConnectLanguage=b;exports.ConnectMode=g;exports.ConnectPasswordOperationType=C;exports.ConnectScope=j;exports.ConnectTheme=v;exports.renderConnectElement=re;
|
package/build/index.esm.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, jsxs as l, Fragment as y } from "react/jsx-runtime";
|
|
2
2
|
import * as p from "react";
|
|
3
|
-
import
|
|
3
|
+
import _ from "react";
|
|
4
4
|
import w from "react-dom";
|
|
5
|
-
var C = /* @__PURE__ */ ((e) => (e.PAGE = "page", e.POPUP = "popup", e.CONTENT = "content", e))(C || {}), 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 || {}),
|
|
6
|
-
const
|
|
5
|
+
var C = /* @__PURE__ */ ((e) => (e.PAGE = "page", e.POPUP = "popup", e.CONTENT = "content", e))(C || {}), 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 || {}), f = /* @__PURE__ */ ((e) => (e.PROFILE_TOKEN = "profile_token", e.CONFIG_TOKEN = "config_token", e.THEME = "theme", e.LANGUAGE = "lang", e))(f || {});
|
|
6
|
+
const I = ({
|
|
7
7
|
outerStartColor: e = "rgba(244, 244, 244, 1)",
|
|
8
|
-
outerEndColor:
|
|
9
|
-
innerStartColor:
|
|
10
|
-
innerEndColor:
|
|
8
|
+
outerEndColor: o = "rgba(238, 238, 238, 1)",
|
|
9
|
+
innerStartColor: t = "rgba(244, 244, 244, 1)",
|
|
10
|
+
innerEndColor: n = "rgba(238, 238, 238, 1)",
|
|
11
11
|
duration: a = 3,
|
|
12
12
|
toggleAnimation: i = !1
|
|
13
|
-
}) => /* @__PURE__ */
|
|
13
|
+
}) => /* @__PURE__ */ r(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
16
16
|
style: {
|
|
@@ -18,7 +18,7 @@ const U = ({
|
|
|
18
18
|
width: "135px",
|
|
19
19
|
height: "135px"
|
|
20
20
|
},
|
|
21
|
-
children: /* @__PURE__ */
|
|
21
|
+
children: /* @__PURE__ */ r(
|
|
22
22
|
"div",
|
|
23
23
|
{
|
|
24
24
|
style: {
|
|
@@ -30,9 +30,9 @@ const U = ({
|
|
|
30
30
|
height: "100%",
|
|
31
31
|
opacity: 0.9
|
|
32
32
|
},
|
|
33
|
-
children: /* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
33
|
+
children: /* @__PURE__ */ l("svg", { width: "199", height: "197", viewBox: "0 0 199 197", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
34
|
+
/* @__PURE__ */ l("g", { children: [
|
|
35
|
+
/* @__PURE__ */ r(
|
|
36
36
|
"circle",
|
|
37
37
|
{
|
|
38
38
|
cx: "89.5",
|
|
@@ -43,8 +43,8 @@ const U = ({
|
|
|
43
43
|
strokeWidth: "9.6",
|
|
44
44
|
strokeLinecap: "round",
|
|
45
45
|
strokeDasharray: "425 125",
|
|
46
|
-
children: i && /* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
46
|
+
children: i && /* @__PURE__ */ l(y, { children: [
|
|
47
|
+
/* @__PURE__ */ r(
|
|
48
48
|
"animateTransform",
|
|
49
49
|
{
|
|
50
50
|
attributeName: "transform",
|
|
@@ -55,7 +55,7 @@ const U = ({
|
|
|
55
55
|
repeatCount: "indefinite"
|
|
56
56
|
}
|
|
57
57
|
),
|
|
58
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ r(
|
|
59
59
|
"animate",
|
|
60
60
|
{
|
|
61
61
|
attributeName: "stroke-dashoffset",
|
|
@@ -68,7 +68,7 @@ const U = ({
|
|
|
68
68
|
] })
|
|
69
69
|
}
|
|
70
70
|
),
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ r(
|
|
72
72
|
"circle",
|
|
73
73
|
{
|
|
74
74
|
cx: "89.5",
|
|
@@ -79,8 +79,8 @@ const U = ({
|
|
|
79
79
|
strokeWidth: "9.6",
|
|
80
80
|
strokeLinecap: "round",
|
|
81
81
|
strokeDasharray: "300 100",
|
|
82
|
-
children: i && /* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
82
|
+
children: i && /* @__PURE__ */ l(y, { children: [
|
|
83
|
+
/* @__PURE__ */ r(
|
|
84
84
|
"animateTransform",
|
|
85
85
|
{
|
|
86
86
|
attributeName: "transform",
|
|
@@ -91,7 +91,7 @@ const U = ({
|
|
|
91
91
|
repeatCount: "indefinite"
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ r(
|
|
95
95
|
"animate",
|
|
96
96
|
{
|
|
97
97
|
attributeName: "stroke-dashoffset",
|
|
@@ -105,8 +105,8 @@ const U = ({
|
|
|
105
105
|
}
|
|
106
106
|
)
|
|
107
107
|
] }),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ l("defs", { children: [
|
|
109
|
+
/* @__PURE__ */ l(
|
|
110
110
|
"filter",
|
|
111
111
|
{
|
|
112
112
|
id: "filter0_dddi_1427_22275",
|
|
@@ -117,8 +117,8 @@ const U = ({
|
|
|
117
117
|
filterUnits: "userSpaceOnUse",
|
|
118
118
|
colorInterpolationFilters: "sRGB",
|
|
119
119
|
children: [
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ r("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
121
|
+
/* @__PURE__ */ r(
|
|
122
122
|
"feColorMatrix",
|
|
123
123
|
{
|
|
124
124
|
in: "SourceAlpha",
|
|
@@ -127,12 +127,12 @@ const U = ({
|
|
|
127
127
|
result: "hardAlpha"
|
|
128
128
|
}
|
|
129
129
|
),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */
|
|
135
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ r("feOffset", { dy: "1.68224" }),
|
|
131
|
+
/* @__PURE__ */ r("feGaussianBlur", { stdDeviation: "4.20656" }),
|
|
132
|
+
/* @__PURE__ */ r("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
133
|
+
/* @__PURE__ */ r("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__ */ r("feBlend", { mode: "normal", in2: "BackgroundImageFix", result: "effect1_dropShadow_1427_22275" }),
|
|
135
|
+
/* @__PURE__ */ r(
|
|
136
136
|
"feColorMatrix",
|
|
137
137
|
{
|
|
138
138
|
in: "SourceAlpha",
|
|
@@ -141,12 +141,12 @@ const U = ({
|
|
|
141
141
|
result: "hardAlpha"
|
|
142
142
|
}
|
|
143
143
|
),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ r("feOffset", { dx: "22.3542", dy: "22.6047" }),
|
|
145
|
+
/* @__PURE__ */ r("feGaussianBlur", { stdDeviation: "9.80447" }),
|
|
146
|
+
/* @__PURE__ */ r("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
147
|
+
/* @__PURE__ */ r("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__ */ r("feBlend", { mode: "normal", in2: "effect1_dropShadow_1427_22275", result: "effect2_dropShadow_1427_22275" }),
|
|
149
|
+
/* @__PURE__ */ r(
|
|
150
150
|
"feColorMatrix",
|
|
151
151
|
{
|
|
152
152
|
in: "SourceAlpha",
|
|
@@ -155,13 +155,13 @@ const U = ({
|
|
|
155
155
|
result: "hardAlpha"
|
|
156
156
|
}
|
|
157
157
|
),
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ r("feOffset", { dx: "-6.03352", dy: "-3.01676" }),
|
|
159
|
+
/* @__PURE__ */ r("feGaussianBlur", { stdDeviation: "7.5419" }),
|
|
160
|
+
/* @__PURE__ */ r("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
161
|
+
/* @__PURE__ */ r("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__ */ r("feBlend", { mode: "normal", in2: "effect2_dropShadow_1427_22275", result: "effect3_dropShadow_1427_22275" }),
|
|
163
|
+
/* @__PURE__ */ r("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect3_dropShadow_1427_22275", result: "shape" }),
|
|
164
|
+
/* @__PURE__ */ r(
|
|
165
165
|
"feColorMatrix",
|
|
166
166
|
{
|
|
167
167
|
in: "SourceAlpha",
|
|
@@ -170,14 +170,14 @@ const U = ({
|
|
|
170
170
|
result: "hardAlpha"
|
|
171
171
|
}
|
|
172
172
|
),
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ r("feOffset", { dy: "1.50838" }),
|
|
174
|
+
/* @__PURE__ */ r("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
175
|
+
/* @__PURE__ */ r("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__ */ r("feBlend", { mode: "normal", in2: "shape", result: "effect4_innerShadow_1427_22275" })
|
|
177
177
|
]
|
|
178
178
|
}
|
|
179
179
|
),
|
|
180
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ l(
|
|
181
181
|
"linearGradient",
|
|
182
182
|
{
|
|
183
183
|
id: "strokeGradientOuter_1427_22275",
|
|
@@ -187,12 +187,12 @@ const U = ({
|
|
|
187
187
|
y2: "154",
|
|
188
188
|
gradientUnits: "userSpaceOnUse",
|
|
189
189
|
children: [
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ r("stop", { stopColor: e }),
|
|
191
|
+
/* @__PURE__ */ r("stop", { offset: "1", stopColor: o })
|
|
192
192
|
]
|
|
193
193
|
}
|
|
194
194
|
),
|
|
195
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ l(
|
|
196
196
|
"linearGradient",
|
|
197
197
|
{
|
|
198
198
|
id: "strokeGradientInner_1427_22275",
|
|
@@ -202,8 +202,8 @@ const U = ({
|
|
|
202
202
|
y2: "134.713",
|
|
203
203
|
gradientUnits: "userSpaceOnUse",
|
|
204
204
|
children: [
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ r("stop", { stopColor: t }),
|
|
206
|
+
/* @__PURE__ */ r("stop", { offset: "1", stopColor: n })
|
|
207
207
|
]
|
|
208
208
|
}
|
|
209
209
|
)
|
|
@@ -212,20 +212,20 @@ const U = ({
|
|
|
212
212
|
}
|
|
213
213
|
)
|
|
214
214
|
}
|
|
215
|
-
),
|
|
216
|
-
function
|
|
217
|
-
const [
|
|
218
|
-
|
|
215
|
+
), U = _.memo(I), b = _.createContext({}), v = () => _.useContext(b);
|
|
216
|
+
function T({ children: e, props: o }) {
|
|
217
|
+
const [t, n] = _.useState(!1), a = (s) => {
|
|
218
|
+
n(s);
|
|
219
219
|
}, i = () => {
|
|
220
|
-
|
|
220
|
+
n(!1);
|
|
221
221
|
};
|
|
222
|
-
return /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ r(b.Provider, { value: { ...o, onLoadingHandler: a, loading: t, onLoaded: i }, children: e });
|
|
223
223
|
}
|
|
224
|
-
const
|
|
225
|
-
const { loading:
|
|
226
|
-
return /* @__PURE__ */
|
|
227
|
-
|
|
228
|
-
e && /* @__PURE__ */
|
|
224
|
+
const G = "https://connect-mw.dev.tap.company/middleware/v3/connect", B = "https://connect-mw.dev.tap.company/middleware/v3/connect", D = "https://connect-mw.dev.tap.company/middleware/v3/connect", F = "tap-connect-sdk-iframe", g = "https://connect.alpha.tap.company", $ = ({ src: e }) => {
|
|
225
|
+
const { loading: o } = v();
|
|
226
|
+
return /* @__PURE__ */ l(y, { children: [
|
|
227
|
+
o && /* @__PURE__ */ r(U, { toggleAnimation: !0 }),
|
|
228
|
+
e && /* @__PURE__ */ r(
|
|
229
229
|
"iframe",
|
|
230
230
|
{
|
|
231
231
|
id: F,
|
|
@@ -243,18 +243,18 @@ const T = "https://connect-mw.dev.tap.company/middleware/v3/connect", D = "https
|
|
|
243
243
|
)
|
|
244
244
|
] });
|
|
245
245
|
};
|
|
246
|
-
var
|
|
247
|
-
var
|
|
248
|
-
return ((
|
|
249
|
-
}, j = function(e) {
|
|
250
|
-
return e instanceof Error;
|
|
246
|
+
var j = function(e) {
|
|
247
|
+
var o, t;
|
|
248
|
+
return ((t = (o = e == null ? void 0 : e.response) === null || o === void 0 ? void 0 : o.data) === null || t === void 0 ? void 0 : t.errors) !== void 0;
|
|
251
249
|
}, M = function(e) {
|
|
252
|
-
return
|
|
250
|
+
return e instanceof Error;
|
|
253
251
|
}, H = function(e) {
|
|
252
|
+
return typeof e == "string";
|
|
253
|
+
}, W = function(e) {
|
|
254
254
|
try {
|
|
255
|
-
var
|
|
255
|
+
var o = e.response.data.errors, t = o[0], n = t.description, a = t.code;
|
|
256
256
|
return {
|
|
257
|
-
message:
|
|
257
|
+
message: n,
|
|
258
258
|
code: a
|
|
259
259
|
};
|
|
260
260
|
} catch (i) {
|
|
@@ -263,12 +263,12 @@ var $ = function(e) {
|
|
|
263
263
|
code: "UNKNOWN"
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
|
-
},
|
|
266
|
+
}, K = function(e) {
|
|
267
267
|
try {
|
|
268
|
-
var
|
|
268
|
+
var o = e.message, t = o.split("::"), n = t[0], a = t[1];
|
|
269
269
|
return {
|
|
270
270
|
message: a,
|
|
271
|
-
code:
|
|
271
|
+
code: n
|
|
272
272
|
};
|
|
273
273
|
} catch (i) {
|
|
274
274
|
return {
|
|
@@ -276,12 +276,12 @@ var $ = function(e) {
|
|
|
276
276
|
code: "UNKNOWN"
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
|
-
},
|
|
279
|
+
}, P = function(e) {
|
|
280
280
|
try {
|
|
281
|
-
var
|
|
281
|
+
var o = e.split("::"), t = o[0], n = o[1];
|
|
282
282
|
return {
|
|
283
|
-
message:
|
|
284
|
-
code:
|
|
283
|
+
message: n,
|
|
284
|
+
code: t
|
|
285
285
|
};
|
|
286
286
|
} catch (a) {
|
|
287
287
|
return {
|
|
@@ -290,7 +290,7 @@ var $ = function(e) {
|
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
}, Y = function() {
|
|
293
|
-
function e(
|
|
293
|
+
function e(o) {
|
|
294
294
|
if (Object.defineProperty(this, "code", {
|
|
295
295
|
enumerable: !0,
|
|
296
296
|
configurable: !0,
|
|
@@ -301,15 +301,15 @@ var $ = function(e) {
|
|
|
301
301
|
configurable: !0,
|
|
302
302
|
writable: !0,
|
|
303
303
|
value: void 0
|
|
304
|
-
}),
|
|
305
|
-
var
|
|
306
|
-
this.code =
|
|
307
|
-
} else if (
|
|
308
|
-
var
|
|
309
|
-
this.code =
|
|
310
|
-
} else if (
|
|
311
|
-
var
|
|
312
|
-
this.code =
|
|
304
|
+
}), j(o)) {
|
|
305
|
+
var t = W(o);
|
|
306
|
+
this.code = t.code, this.message = t.message;
|
|
307
|
+
} else if (M(o)) {
|
|
308
|
+
var t = K(o);
|
|
309
|
+
this.code = t.code, this.message = t.message;
|
|
310
|
+
} else if (H(o)) {
|
|
311
|
+
var t = P(o);
|
|
312
|
+
this.code = t.code, this.message = t.message;
|
|
313
313
|
} else
|
|
314
314
|
this.code = "UNKNOWN", this.message = "Unknown error";
|
|
315
315
|
}
|
|
@@ -340,84 +340,105 @@ var $ = function(e) {
|
|
|
340
340
|
}), e;
|
|
341
341
|
}();
|
|
342
342
|
const q = (e = "tap-connect-sdk-element") => {
|
|
343
|
-
const
|
|
344
|
-
if (
|
|
345
|
-
const
|
|
346
|
-
return
|
|
343
|
+
const o = document.getElementById(e);
|
|
344
|
+
if (o) return o;
|
|
345
|
+
const t = document.createElement("div");
|
|
346
|
+
return t.setAttribute("id", e), document.body.prepend(t), t;
|
|
347
347
|
}, z = (e) => e ? ["sa", "sau"].includes(e.toLowerCase()) : !1, J = (e) => e === "dr", V = (e = "") => {
|
|
348
|
-
const [
|
|
349
|
-
return z(
|
|
350
|
-
}, Q = (
|
|
351
|
-
|
|
348
|
+
const [o, t] = e.split("-");
|
|
349
|
+
return z(o) ? J(t) ? D : B : G;
|
|
350
|
+
}, Q = ({
|
|
351
|
+
features: e,
|
|
352
|
+
notification: o,
|
|
353
|
+
paymentProvider: t,
|
|
354
|
+
...n
|
|
355
|
+
}) => {
|
|
356
|
+
var a;
|
|
352
357
|
return {
|
|
353
|
-
open:
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
358
|
+
open: n.open,
|
|
359
|
+
operator: { public_key: n.publicKey },
|
|
360
|
+
domain: n.merchantDomain,
|
|
361
|
+
app_info: n.appInfo,
|
|
362
|
+
country: n.businessCountryCode,
|
|
363
|
+
scope: n.scope,
|
|
364
|
+
board: { display: n.showBoard, editable: n.boardEditable },
|
|
365
|
+
...n.leadId && { lead: { id: n.leadId } },
|
|
366
|
+
...((a = n.platforms) == null ? void 0 : a.length) && { platforms: n.platforms },
|
|
367
|
+
...((t == null ? void 0 : t.technologyId) || (t == null ? void 0 : t.settlementBy)) && {
|
|
368
|
+
payment_provider: {
|
|
369
|
+
...t.technologyId && {
|
|
370
|
+
technology: {
|
|
371
|
+
id: t.technologyId
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
...t.settlementBy && {
|
|
375
|
+
institution: {
|
|
376
|
+
id: t.settlementBy
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
features: e && {
|
|
382
|
+
poweredby: e.poweredBy,
|
|
383
|
+
close_button: e.closeButton
|
|
384
|
+
},
|
|
385
|
+
...n.postUrl && { post: { url: n.postUrl } },
|
|
386
|
+
...n.redirectUrl && { redirect: { url: n.redirectUrl } },
|
|
387
|
+
data: n.data,
|
|
388
|
+
mode: n.mode,
|
|
389
|
+
notification: o && {
|
|
390
|
+
sms: o.mobile,
|
|
391
|
+
email: o.email
|
|
392
|
+
},
|
|
393
|
+
interface: {
|
|
394
|
+
...(e == null ? void 0 : e.dialogEdgeFormat) && { edges: e.dialogEdgeFormat },
|
|
395
|
+
locale: n.language,
|
|
396
|
+
theme: n.theme,
|
|
397
|
+
partner_logo: e == null ? void 0 : e.merchantLogo,
|
|
398
|
+
...(e == null ? void 0 : e.dialogEndTransition) && (e == null ? void 0 : e.dialogStartTransition) && {
|
|
399
|
+
dialog_transition: { start: e.dialogStartTransition, end: e.dialogEndTransition }
|
|
379
400
|
}
|
|
380
401
|
}
|
|
381
402
|
};
|
|
382
403
|
}, X = () => {
|
|
383
|
-
const [e,
|
|
384
|
-
|
|
404
|
+
const [e, o] = p.useState(""), { onError: t, onLoadingHandler: n, loginMode: a, region: i, ...s } = v(), m = async () => {
|
|
405
|
+
n(!0);
|
|
385
406
|
try {
|
|
386
|
-
const
|
|
407
|
+
const d = await fetch(V(i), {
|
|
387
408
|
method: "POST",
|
|
388
409
|
headers: {
|
|
389
410
|
"Content-Type": "application/json",
|
|
390
411
|
Authorization: `Bearer ${s.publicKey}`,
|
|
391
|
-
mdn: s.merchantDomain ||
|
|
412
|
+
mdn: s.merchantDomain || g
|
|
392
413
|
},
|
|
393
414
|
body: JSON.stringify(Q(s))
|
|
394
415
|
});
|
|
395
|
-
if (!
|
|
396
|
-
throw new Error(`${
|
|
397
|
-
const c = await
|
|
398
|
-
s != null && s.theme &&
|
|
399
|
-
const
|
|
400
|
-
if (
|
|
416
|
+
if (!d.ok)
|
|
417
|
+
throw new Error(`${d.status}::${d.statusText}`);
|
|
418
|
+
const c = await d.json(), h = new URLSearchParams();
|
|
419
|
+
s != null && s.theme && h.append(f.THEME, s.theme), s != null && s.language && h.append(f.LANGUAGE, s.language);
|
|
420
|
+
const O = a ? `${g}/auth` : g;
|
|
421
|
+
if (h.append(f.CONFIG_TOKEN, c.token), c.connect.url = `${O}?${h.toString()}`, s.mode !== C.PAGE) return o(c.connect.url);
|
|
401
422
|
window.location.href = c.connect.url;
|
|
402
|
-
} catch (
|
|
403
|
-
const c = new Y(
|
|
404
|
-
|
|
423
|
+
} catch (d) {
|
|
424
|
+
const c = new Y(d);
|
|
425
|
+
t == null || t(c.getClientError()), n(!1);
|
|
405
426
|
}
|
|
406
427
|
};
|
|
407
428
|
return p.useEffect(() => {
|
|
408
429
|
m();
|
|
409
430
|
}, []), { connectLink: e };
|
|
410
431
|
}, Z = () => {
|
|
411
|
-
const { onSuccess: e, onClose:
|
|
432
|
+
const { onSuccess: e, onClose: o, onError: t, onReady: n, onLoaded: a } = v(), i = p.useCallback(
|
|
412
433
|
async (s) => {
|
|
413
|
-
if (s.origin !==
|
|
414
|
-
const { data: m, event:
|
|
415
|
-
switch (
|
|
434
|
+
if (s.origin !== g) return;
|
|
435
|
+
const { data: m, event: d } = s.data;
|
|
436
|
+
switch (d) {
|
|
416
437
|
case u.ON_CLOSE:
|
|
417
|
-
|
|
438
|
+
o == null || o();
|
|
418
439
|
break;
|
|
419
440
|
case u.ON_ERROR:
|
|
420
|
-
|
|
441
|
+
t == null || t(m);
|
|
421
442
|
break;
|
|
422
443
|
case u.ON_SUCCESS:
|
|
423
444
|
e(m);
|
|
@@ -426,18 +447,18 @@ const q = (e = "tap-connect-sdk-element") => {
|
|
|
426
447
|
a();
|
|
427
448
|
break;
|
|
428
449
|
case u.ON_READY:
|
|
429
|
-
|
|
450
|
+
n == null || n();
|
|
430
451
|
break;
|
|
431
452
|
}
|
|
432
453
|
},
|
|
433
|
-
[
|
|
454
|
+
[o, t, a, n, e]
|
|
434
455
|
);
|
|
435
456
|
p.useEffect(() => (window.addEventListener("message", i, !1), () => {
|
|
436
457
|
window.removeEventListener("message", i);
|
|
437
458
|
}), [i]);
|
|
438
459
|
}, ee = () => {
|
|
439
460
|
const { connectLink: e } = X();
|
|
440
|
-
return Z(), /* @__PURE__ */
|
|
461
|
+
return Z(), /* @__PURE__ */ r(
|
|
441
462
|
"div",
|
|
442
463
|
{
|
|
443
464
|
id: "tap-connect-main-container",
|
|
@@ -452,15 +473,15 @@ const q = (e = "tap-connect-sdk-element") => {
|
|
|
452
473
|
width: "100%",
|
|
453
474
|
height: "100%"
|
|
454
475
|
},
|
|
455
|
-
children: /* @__PURE__ */
|
|
476
|
+
children: /* @__PURE__ */ r($, { src: e })
|
|
456
477
|
}
|
|
457
478
|
);
|
|
458
|
-
}, te = (e) => /* @__PURE__ */
|
|
459
|
-
var
|
|
460
|
-
|
|
461
|
-
const se = (e,
|
|
462
|
-
const
|
|
463
|
-
return
|
|
479
|
+
}, te = (e) => /* @__PURE__ */ r(T, { props: e, children: e.open && /* @__PURE__ */ r(ee, {}) }), re = p.memo(te);
|
|
480
|
+
var N, E = w;
|
|
481
|
+
N = E.createRoot, E.hydrateRoot;
|
|
482
|
+
const se = (e, o) => {
|
|
483
|
+
const t = q(e), n = N(t);
|
|
484
|
+
return n.render(/* @__PURE__ */ r(re, { ...o })), { unmount: () => n.unmount() };
|
|
464
485
|
};
|
|
465
486
|
export {
|
|
466
487
|
R as ConnectDialogEdgeFormat,
|