@tap-payments/connect-v2 0.0.27-test β 0.0.28-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/README.md +147 -40
- package/build/index.d.ts +12 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,50 +1,157 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Connect SDK V2
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A React SDK that allows merchants to easily integrate with Tap Connect in their applications, handling identification and authentication seamlessly.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package provides:
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
7
|
+
- **_ConnectElement_**: a React component that can be embedded directly in your app to enable secure, localized, and customizable connections.
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
- **_renderTapConnect_**: a UMD helper function (available on the global TapConnectSDK object) that lets you render the widget in plain JavaScript environments without a React build setup.
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
---
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
## π¦ Installation
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
- Using `npm`:
|
|
16
|
+
```bash
|
|
17
|
+
npm install @tap-payments/connect-v2
|
|
18
|
+
```
|
|
19
|
+
- Using `yarn`:
|
|
20
|
+
```bash
|
|
21
|
+
yarn add @tap-payments/connect-v2
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## β‘ Quick Start
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import React, { useState } from 'react';
|
|
30
|
+
import { ConnectElement, ConnectScope, ConnectTheme, ConnectMode } from '@tap-payments/connect-v2';
|
|
31
|
+
|
|
32
|
+
const App = () => {
|
|
33
|
+
const [open, setOpen] = useState(false);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div>
|
|
37
|
+
<button onClick={() => setOpen(true)}>Open Connect Element</button>
|
|
38
|
+
|
|
39
|
+
<ConnectElement
|
|
40
|
+
open={open}
|
|
41
|
+
publicKey="pk_test_XXXXXXXXXXXXXXXXXXXXXXX"
|
|
42
|
+
merchantDomain="https://example.com"
|
|
43
|
+
theme={ConnectTheme.DARK}
|
|
44
|
+
scope={ConnectScope.MERCHANT}
|
|
45
|
+
appInfo={{
|
|
46
|
+
name: 'My App',
|
|
47
|
+
version: '1.0.0',
|
|
48
|
+
}}
|
|
49
|
+
onClose={() => setOpen(false)}
|
|
50
|
+
features={{ poweredBy: true, closeButton: true }}
|
|
51
|
+
mode={ConnectMode.POPUP}
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default App;
|
|
26
58
|
```
|
|
27
59
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
## π Vanilla JS Demo
|
|
61
|
+
|
|
62
|
+
You can also use the SDK without a React build setup by including the UMD bundle directly in your HTML file. The global TapConnectSDK object provides a helper method to render the widget into any container element.
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<!doctype html>
|
|
66
|
+
<html>
|
|
67
|
+
<head>
|
|
68
|
+
<title>Tap Connect SDK Demo</title>
|
|
69
|
+
</head>
|
|
70
|
+
<body>
|
|
71
|
+
<div id="connect-container"></div>
|
|
72
|
+
|
|
73
|
+
<button onclick="openConnect()">Open Connect</button>
|
|
74
|
+
|
|
75
|
+
<!-- React and ReactDOM (required for the widget to work) -->
|
|
76
|
+
<script src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
|
|
77
|
+
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
|
|
78
|
+
|
|
79
|
+
<!-- Tap Connect SDK UMD bundle -->
|
|
80
|
+
<script src="https://cdn.tap.company/tap-sdks/connect-v2/build-0.0.28-test/index.js"></script>
|
|
81
|
+
|
|
82
|
+
<script>
|
|
83
|
+
function openConnect() {
|
|
84
|
+
TapConnectSDK.renderConnectElement('connect-container', {
|
|
85
|
+
open: true,
|
|
86
|
+
publicKey: 'pk_test_lat64TEDSvHrUOYAxVRe28PQ',
|
|
87
|
+
merchantDomain: 'https://connect.dev.tap.company',
|
|
88
|
+
language: TapConnectSDK.ConnectLanguage.EN,
|
|
89
|
+
appInfo: {
|
|
90
|
+
name: 'My App',
|
|
91
|
+
},
|
|
92
|
+
theme: TapConnectSDK.ConnectTheme.DARK,
|
|
93
|
+
scope: TapConnectSDK.ConnectScope.MERCHANT,
|
|
94
|
+
data: ['brand', 'entity'],
|
|
95
|
+
showBoard: true,
|
|
96
|
+
mode: TapConnectSDK.ConnectMode.PAGE,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
</script>
|
|
100
|
+
</body>
|
|
101
|
+
</html>
|
|
50
102
|
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## π§ Props
|
|
107
|
+
|
|
108
|
+
| Prop | Type | Required | Description |
|
|
109
|
+
| ----------------------- | ------------------------------------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
110
|
+
| **open** | `boolean` | β
| Controls whether Connect element is open or closed. |
|
|
111
|
+
| **publicKey** | `string` | β
| Your public API key provided by Tap Payments. |
|
|
112
|
+
| **merchantDomain** | `string` | β
| Merchant's domain (e.g. `https://expamle.com`). |
|
|
113
|
+
| **scope** | `ConnectScope` | β
| Defines the integration scope [**auth**, **merchant**]. |
|
|
114
|
+
| **appInfo** | `ConnectAppInfo` | β
| Information about the merchantβs host application. |
|
|
115
|
+
| β name | `string` | β
| The display name of your application. |
|
|
116
|
+
| β identifier | `string` | β | A unique identifier for your application (e.g., bundle ID or package name). |
|
|
117
|
+
| β version | `string` | β | The current version of your application (e.g., `1.0.0`). |
|
|
118
|
+
| **onReady** | `() => void` | β | Called when the app configurations are loaded successfully initializing. |
|
|
119
|
+
| **onClose** | `() => void` | β | Triggered when the Connect element is closed by the user. |
|
|
120
|
+
| **onError** | `(eror: CustomError) => void` | β | Triggered on any error. |
|
|
121
|
+
| **onSuccess** | `(response: Record<string, string \| number>) => void` | β | Callback triggered when the flow completes successfully. |
|
|
122
|
+
| **theme** | `ConnectTheme` | β | Customize the app theme [**light**, **dark**]. |
|
|
123
|
+
| **language** | `ConnectLanguage` | β | Language code for localization [**en**, **ar**]. |
|
|
124
|
+
| **businessCountryCode** | `string` | β | Country ISO2 code of the merchant country. |
|
|
125
|
+
| **showBoard** | `boolean` | β | Show the merchant board UI. |
|
|
126
|
+
| **leadId** | `string` | β | Optional lead ID for loading lead data. |
|
|
127
|
+
| **platforms** | `string` | β | - |
|
|
128
|
+
| **paymentProvider** | `ConnectPaymentProvider` | β | Information about the payment provider configuration. |
|
|
129
|
+
| β technologyId | `string` | β
| - |
|
|
130
|
+
| β settlementBy | `string` | β
| - |
|
|
131
|
+
| **features** | `ConnectAppFeatures` | β | Additional configuration options for appearance and UI. |
|
|
132
|
+
| β poweredBy | `boolean` | β | Show or hide the βPowered by Tapβ logo. |
|
|
133
|
+
| β merchantLogo | `boolean` | β | Show or hide the merchantβs logo in the widget. |
|
|
134
|
+
| β closeButton | `boolean` | β | Display a close button on the widget. |
|
|
135
|
+
| β dialogStartTransition | `ConnectDialogTransition` | β | Transition animation when the dialog opens [**left**,**right**,**up**,**down**]. |
|
|
136
|
+
| β dialogEndTransition | `ConnectDialogTransition` | β | Transition animation when the dialog closes [**left**,**right**,**up**,**down**]. |
|
|
137
|
+
| β dialogEdgeFormat | `ConnectDialogEdgeFormat` | β | Controls the shape/format of the dialog edges [**curved**, **straight**]. |
|
|
138
|
+
| **postUrl** | `string` | β | Endpoint to post our data to merchant's server. |
|
|
139
|
+
| **redirectUrl** | `string` | β | Redirect URL after success. |
|
|
140
|
+
| **data** | `string[]` | β | Merchant data array (e.g. **operator**, **brand**, **entity**, etc.). |
|
|
141
|
+
| **mode** | `ConnectMode` | β | Controls the display behavior of the Connect Element, using the ConnectMode enum to specify whether it appears as a full page, popup, or display content only. |
|
|
142
|
+
| **notification** | `ConnectNotification` | β | Notification configuration to notify the user after account creation. |
|
|
143
|
+
| β email | `boolean` | β
| Enable or disable email notifications. |
|
|
144
|
+
| β mobile | `boolean` | β | Enable or disable mobile (SMS) notifications. |
|
|
145
|
+
| **boardEditable** | `boolean` | β | Allow merchant board to be editable. |
|
|
146
|
+
| **boardId** | `string` | β | Specify existing board ID. |
|
|
147
|
+
| **boardInfoId** | `string` | β | Specify board info ID for password kit. |
|
|
148
|
+
| **userId** | `string` | β | User ID for password kit. |
|
|
149
|
+
| **userType** | `string` | β | Type of the user for password kit. |
|
|
150
|
+
| **operationType** | `ConnectPasswordOperationType` | β | Operation type for password kit. |
|
|
151
|
+
| **loginMode** | `boolean` | β | Opens Connect in login/auth mode. |
|
|
152
|
+
| **region** | `string` | β | Region code that changes the target middlware (e.g., **sa** for Saudi). |
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
Developed by **Tap Payments**
|
|
157
|
+
π [Website](https://www.tap.company) Β· π¬ [Support](https://www.tap.company/support) Β· πΌ [LinkedIn](https://www.linkedin.com/company/tappayments)
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
2
2
|
import * as React_2 from 'react';
|
|
3
3
|
|
|
4
|
+
declare type ConnectAppFeatures = {
|
|
5
|
+
poweredBy?: boolean;
|
|
6
|
+
merchantLogo?: boolean;
|
|
7
|
+
closeButton?: boolean;
|
|
8
|
+
dialogStartTransition?: ConnectDialogTransition;
|
|
9
|
+
dialogEndTransition?: ConnectDialogTransition;
|
|
10
|
+
dialogEdgeFormat?: ConnectDialogEdgeFormat;
|
|
11
|
+
};
|
|
12
|
+
|
|
4
13
|
export declare type ConnectAppInfo = {
|
|
5
14
|
name: string;
|
|
6
15
|
identifier?: string;
|
|
@@ -43,8 +52,8 @@ export declare enum ConnectPasswordOperationType {
|
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
export declare type ConnectPaymentProvider = {
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
technologyId: string;
|
|
56
|
+
settlementBy: string;
|
|
48
57
|
};
|
|
49
58
|
|
|
50
59
|
export declare type ConnectProps = {
|
|
@@ -64,14 +73,7 @@ export declare type ConnectProps = {
|
|
|
64
73
|
leadId?: string;
|
|
65
74
|
platforms?: Array<string>;
|
|
66
75
|
paymentProvider?: ConnectPaymentProvider;
|
|
67
|
-
features?:
|
|
68
|
-
poweredBy?: boolean;
|
|
69
|
-
merchantLogo?: boolean;
|
|
70
|
-
closeButton?: boolean;
|
|
71
|
-
dialogStartTransition?: ConnectDialogTransition;
|
|
72
|
-
dialogEndTransition?: ConnectDialogTransition;
|
|
73
|
-
dialogEdgeFormat?: ConnectDialogEdgeFormat;
|
|
74
|
-
};
|
|
76
|
+
features?: ConnectAppFeatures;
|
|
75
77
|
postUrl?: string;
|
|
76
78
|
redirectUrl?: string;
|
|
77
79
|
data?: Array<string>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/connect-v2",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.28-test",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.cjs.js",
|
|
7
7
|
"module": "build/index.esm.js",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"vite-tsconfig-paths": "^5.1.4"
|
|
68
68
|
},
|
|
69
69
|
"lint-staged": {
|
|
70
|
-
"*.{js,ts,tsx,json,css,yml}": [
|
|
70
|
+
"*.{js,ts,tsx,json,css,yml,md,html}": [
|
|
71
71
|
"prettier --write",
|
|
72
72
|
"eslint"
|
|
73
73
|
]
|