@tap-payments/connect 2.6.5-test → 2.6.8-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 CHANGED
@@ -40,8 +40,8 @@ const ConnectComponent = () => {
40
40
  country={'SA'}
41
41
  // required (the scope of the merchant)
42
42
  scope={'merchant'}
43
- // merchant data array `ex: [operator]`
44
- data= {[]},
43
+ // merchant data array `ex: [operator]`
44
+ data={[]}
45
45
  // optional (Lead Id can be passed in case of you already created a lead using our API )
46
46
  lead={'led_xxxxxxxxxxxxxxxxxxxxxx'}
47
47
  // required (Decide the mode of connect `normal` or `express`)
@@ -56,8 +56,8 @@ const ConnectComponent = () => {
56
56
  open={true}
57
57
  // optional (The POST Method URL used to push te data from our server to the merchant server)
58
58
  postURL={'https://api.example.com/post'}
59
- // This redirect url after verify authentication go to merchant website
60
- redirectUrl={''}
59
+ // This redirect url after verify authentication go to merchant website
60
+ redirectUrl={''}
61
61
  //optional (Callback function to handle the ready state of the TapConnect )
62
62
  onReady={() => console.log('onReady')}
63
63
  // optional (Callback function runs after creating an account)
@@ -85,7 +85,7 @@ const ConnectComponent = () => {
85
85
  content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,shrink-to-fit=no"
86
86
  />
87
87
  <title>Auth-JsConnect</title>
88
- <script src="https://tap-sdks.b-cdn.net/connect/build-2.6.5-test/main.js"></script>
88
+ <script src="https://tap-sdks.b-cdn.net/connect/build-2.6.8-test/main.js"></script>
89
89
  </head>
90
90
  <body>
91
91
  <div id="root"></div>
@@ -154,7 +154,7 @@ const ConnectComponent = () => {
154
154
  | postURL `optional` | `string` | The POST Method URL used to push te data from our server to the merchant server and |
155
155
  | | | it's required only if `mature` is `false` |
156
156
  | redirectUrl `optional` | `string` | This redirect url after verify authentication go to merchant website |
157
- | | | It is `required` if scope is `auth` |
157
+ | | | It is `required` if scope is `auth` and mode is `page` |
158
158
  | onReady `optional` | `function` | Callback function to handle the ready state of the `TapConnect` |
159
159
  | onCreated `optional` | `function` | Callback function to called the the account created successfully |
160
160
  | | | it calls only if `mature` is `false` |
@@ -24,6 +24,7 @@ export interface ConnectProps {
24
24
  }
25
25
  export interface OriginalConnectProps {
26
26
  publicKey: string;
27
+ mode: 'popup' | 'page';
27
28
  open: boolean;
28
29
  merchantDomain: string;
29
30
  language: string;
@@ -1,4 +1,4 @@
1
- export declare const CDN_LIBRARY_BASE_URL = "https://auth-jsconnect.b-cdn.net/build-2.6.5-test/";
1
+ export declare const CDN_LIBRARY_BASE_URL = "https://auth-jsconnect.b-cdn.net/build-2.6.8-test/";
2
2
  export declare const Maturity: {
3
3
  readonly FULL: "full";
4
4
  readonly EXPRESS: "express";
@@ -1,4 +1,4 @@
1
- export var CDN_LIBRARY_BASE_URL = 'https://auth-jsconnect.b-cdn.net/build-2.6.5-test/';
1
+ export var CDN_LIBRARY_BASE_URL = 'https://auth-jsconnect.b-cdn.net/build-2.6.8-test/';
2
2
  export var Maturity = {
3
3
  FULL: 'full',
4
4
  EXPRESS: 'express'
@@ -9,17 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
12
  import * as React from 'react';
24
13
  import { wrapLibConfig } from '../../utils';
25
14
  var ConnectExpress = function (props) {
@@ -64,8 +53,7 @@ var ConnectExpress = function (props) {
64
53
  break;
65
54
  default:
66
55
  unmountComponent();
67
- var onSuccess = props.onSuccess, rest = __rest(props, ["onSuccess"]);
68
- var configAttrs = wrapLibConfig(__assign(__assign({}, rest), { verifyToken: token, onBoardButtonClick: onButtonClick }));
56
+ var configAttrs = wrapLibConfig(__assign(__assign({}, props), { verifyToken: token, onBoardButtonClick: onButtonClick }));
69
57
  var unmountExpress = renderConnectExpressLib(configAttrs, elementId).unmount;
70
58
  unmountComponent = unmountExpress;
71
59
  break;
@@ -3,5 +3,5 @@ type ExtraProps = {
3
3
  verifyToken?: string;
4
4
  onBoardButtonClick?: (data: Record<string, string>) => void;
5
5
  };
6
- export declare const wrapLibConfig: ({ publicKey, open, language, country, scope, lead, postURL, onError, onReady, onSuccess, board, verifyToken, domain, onBoardButtonClick, onClose, onCreated, onBoardCompleted, boardMaturity, data, redirectUrl }: ConnectProps & ExtraProps) => OriginalConnectProps;
6
+ export declare const wrapLibConfig: ({ publicKey, open, mode, language, country, scope, lead, postURL, onError, onReady, onSuccess, board, verifyToken, domain, onBoardButtonClick, onClose, onCreated, onBoardCompleted, boardMaturity, data, redirectUrl }: ConnectProps & ExtraProps) => OriginalConnectProps;
7
7
  export {};
@@ -1,5 +1,5 @@
1
1
  export var wrapLibConfig = function (_a) {
2
- var publicKey = _a.publicKey, open = _a.open, language = _a.language, country = _a.country, scope = _a.scope, lead = _a.lead, postURL = _a.postURL, onError = _a.onError, onReady = _a.onReady, onSuccess = _a.onSuccess, board = _a.board, verifyToken = _a.verifyToken, domain = _a.domain, onBoardButtonClick = _a.onBoardButtonClick, onClose = _a.onClose, onCreated = _a.onCreated, onBoardCompleted = _a.onBoardCompleted, boardMaturity = _a.boardMaturity, data = _a.data, redirectUrl = _a.redirectUrl;
2
+ var publicKey = _a.publicKey, open = _a.open, mode = _a.mode, language = _a.language, country = _a.country, scope = _a.scope, lead = _a.lead, postURL = _a.postURL, onError = _a.onError, onReady = _a.onReady, onSuccess = _a.onSuccess, board = _a.board, verifyToken = _a.verifyToken, domain = _a.domain, onBoardButtonClick = _a.onBoardButtonClick, onClose = _a.onClose, onCreated = _a.onCreated, onBoardCompleted = _a.onBoardCompleted, boardMaturity = _a.boardMaturity, data = _a.data, redirectUrl = _a.redirectUrl;
3
3
  return {
4
4
  appInfo: {
5
5
  name: window.location.hostname || window.location.origin
@@ -8,6 +8,7 @@ export var wrapLibConfig = function (_a) {
8
8
  language: language,
9
9
  merchantDomain: domain,
10
10
  open: open,
11
+ mode: mode,
11
12
  postURL: postURL,
12
13
  publicKey: publicKey,
13
14
  scope: scope,
@@ -1,6 +1,12 @@
1
1
  import { Language } from '../constants';
2
2
  export var validateConnectProps = function (props) {
3
- var publicKey = props.publicKey, mature = props.mature, country = props.country, language = props.language, scope = props.scope, open = props.open, domain = props.domain, board = props.board, lead = props.lead, onClose = props.onClose, onCreated = props.onCreated, onError = props.onError, onReady = props.onReady, onSuccess = props.onSuccess, postURL = props.postURL, redirectUrl = props.redirectUrl;
3
+ var mode = props.mode, publicKey = props.publicKey, mature = props.mature, country = props.country, language = props.language, scope = props.scope, open = props.open, domain = props.domain, board = props.board, lead = props.lead, onClose = props.onClose, onCreated = props.onCreated, onError = props.onError, onReady = props.onReady, onSuccess = props.onSuccess, postURL = props.postURL, redirectUrl = props.redirectUrl;
4
+ if (!mode) {
5
+ throw new Error('mode is required');
6
+ }
7
+ if (!['page', 'popup'].includes(mode)) {
8
+ throw new Error('you can only use page or popup for mode');
9
+ }
4
10
  if (!publicKey) {
5
11
  throw new Error('publicKey is required');
6
12
  }
@@ -11,14 +17,13 @@ export var validateConnectProps = function (props) {
11
17
  throw new Error('language is required');
12
18
  }
13
19
  if (![Language.AR, Language.EN].includes(language)) {
14
- throw new Error('You can only use AR or EN for language');
20
+ throw new Error('you can only use AR or EN for language');
15
21
  }
16
22
  if (!scope) {
17
23
  throw new Error('scope is required');
18
24
  }
19
- if (scope === 'auth') {
20
- if (!redirectUrl)
21
- throw new Error('redirectUrl is required');
25
+ if (scope === 'auth' && mode === 'page' && !redirectUrl) {
26
+ throw new Error('redirectUrl is required');
22
27
  }
23
28
  if (!domain) {
24
29
  throw new Error('domain is required');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/connect",
3
- "version": "2.6.5-test",
3
+ "version": "2.6.8-test",
4
4
  "description": "Tap Connect",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",