@tap-payments/connect 2.7.8-test → 2.8.0

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
@@ -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.7.8-test/main.js"></script>
88
+ <script src="https://tap-sdks.b-cdn.net/connect/build-2.8.0/main.js"></script>
89
89
  </head>
90
90
  <body>
91
91
  <div id="root"></div>
@@ -106,7 +106,7 @@ const ConnectComponent = () => {
106
106
  mature: false,
107
107
  board: true,
108
108
  boardMaturity: false,
109
- mode: "popup",
109
+ mode: "popup",
110
110
  open: true,
111
111
  postURL: 'https://api.example.com/post',
112
112
  redirectUrl: '',
@@ -137,36 +137,35 @@ const ConnectComponent = () => {
137
137
 
138
138
  ## Properties
139
139
 
140
- | name | type | description |
141
- | ---------------------------------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
142
- | publicKey `required` | `string` | Public key of the merchant account provided by Tap Payments |
143
- | domain `required` | `string` | Domain of the merchant |
144
- | language `required` | `Languages` | language flag to control the language of the connect element and only accept [ar,en] |
145
- | country `required` | `string` | Country ISO2 of the merchant |
146
- | scope `required` | `string` | the scope of the merchant available values [merchant, auth] |
147
- | data `optional` | `Array<string>` | Merchant data array `ex: [operator]` |
148
- | lead `optional` | `string` | Lead Id can be passed in case of you already created a lead using our API |
149
- | mode `required` | `string` | Decide to show connect as a `popup` or `page` or `content` to our connect domain. Default value is `popup`. `content` mode only used for board kit |
150
- | mature `required` | `boolean` | Decide the mode of connect `normal` or `express` |
151
- | board `optional` | `string` | Show/Hide board screens |
152
- | open `required` | `boolean` | Open/Close the connect library |
153
- | hideOverlay `optional` | `boolean` | Used to disable the **auth** background color and it can be used only for auth kit |
154
- | hideLoaderOverlay `optional` | `boolean` | Used to disable the **auth** loader background color and it can be used only for auth kit |
155
- | openAnimationDirection `optional` | `left or right or up or down` | Used to handle **auth** slide animation direction when open popup for auth kit |
156
- | closeAnimationDirection `optional` | `left or right or up or down` | Used to handle **auth** slide animation direction when close popup for auth kit |
157
- | hideMerchantLogo `optional` | `boolean` | Used to hide the **auth** merchant logo and it can be used only for auth kit |
158
- | loaderColor `optional` | `string` | Used to change loader color and it can be used only for board kit |
159
- | boardMaturity `optional` | `boolean` | Decide the board maturity |
160
- | settingData `optional` | `boolean` | This is to get settings information. It is used board kit and other kits open from board |
161
- | postURL `optional` | `string` | The POST Method URL used to push te data from our server to the merchant server and |
162
- | | | it's required only if `mature` is `false` |
163
- | redirectUrl `optional` | `string` | This redirect url after verify authentication go to merchant website |
164
- | | | It is `required` if scope is `auth` and mode is `page` |
165
- | onReady `optional` | `function` | Callback function to handle the ready state of the `TapConnect` |
166
- | onCreated `optional` | `function` | Callback function to called the the account created successfully |
167
- | | | it calls only if `mature` is `false` |
168
- | onSuccess `optional` | `function` | Callback function to handle the success response, it will run after the user finish the flow |
169
- | onError `optional` | `function` | Callback function to handle the error response, it will run if the user face any error |
170
- | onClose `optional` | `function` | Callback function to called when `TapConnect` get close |
171
- | onBoardCompleted `optional` | `function` | Callback function to called when you complete all flows |
172
- | onSettingFetched `optional` | `function` | Callback function to called after fetch settings information. It is used board kit and other kits open from board |
140
+ | name | type | description |
141
+ | ----------------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
142
+ | publicKey `required` | `string` | Public key of the merchant account provided by Tap Payments |
143
+ | domain `required` | `string` | Domain of the merchant |
144
+ | language `required` | `Languages` | language flag to control the language of the connect element and only accept [ar,en] |
145
+ | country `required` | `string` | Country ISO2 of the merchant |
146
+ | scope `required` | `string` | the scope of the merchant available values [merchant, auth] |
147
+ | data `optional` | `Array<string>` | Merchant data array `ex: [operator]` |
148
+ | lead `optional` | `string` | Lead Id can be passed in case of you already created a lead using our API |
149
+ | mode `required` | `string` | Decide to show connect as a `popup` or `page` or `content` to our connect domain. Default value is `popup`. `content` mode only used for board kit |
150
+ | mature `required` | `boolean` | Decide the mode of connect `normal` or `express` |
151
+ | board `optional` | `string` | Show/Hide board screens |
152
+ | open `required` | `boolean` | Open/Close the connect library |
153
+ | features.dialogStartTransition `optional` | `left or right or up or down` | Used to handle **auth** slide animation direction when open popup for auth kit |
154
+ | features.dialogEndTransition `optional` | `left or right or up or down` | Used to handle **auth** slide animation direction when close popup for auth kit |
155
+ | features `object` | `all values true` | Used to show or hide some fields (poweredBy, merchantLogo - Used to hide the merchant logo and it can be used only for auth kit, switchLanguage, overlay - Used to disable the background color and it can be used only for auth kit, loaderOverlay - Used to disable the loader background color and it can be used only for auth kit, tapTextLogo, closeButton - Used enable to close dialog, disableNafath - Used to hide nafath login button in **auth** kit, disablePaci - Used to hide paci login button in **auth** kit) |
156
+ | loaderColor `optional` | `string` | Used to change loader color and it can be used only for board kit |
157
+ | notification `optional` | `object: {email: boolean, mobile?: boolean}` | Express flow decide to send notification to email or mobile after finish create account |
158
+ | boardMaturity `optional` | `boolean` | Decide the board maturity |
159
+ | settingData `optional` | `boolean` | This is to get settings information. It is used board kit and other kits open from board |
160
+ | postURL `optional` | `string` | The POST Method URL used to push te data from our server to the merchant server and |
161
+ | | | it's required only if `mature` is `false` |
162
+ | redirectUrl `optional` | `string` | This redirect url after verify authentication go to merchant website |
163
+ | | | It is `required` if scope is `auth` and mode is `page` |
164
+ | onReady `optional` | `function` | Callback function to handle the ready state of the `TapConnect` |
165
+ | onCreated `optional` | `function` | Callback function to called the the account created successfully |
166
+ | | | it calls only if `mature` is `false` |
167
+ | onSuccess `optional` | `function` | Callback function to handle the success response, it will run after the user finish the flow |
168
+ | onError `optional` | `function` | Callback function to handle the error response, it will run if the user face any error |
169
+ | onClose `optional` | `function` | Callback function to called when `TapConnect` get close |
170
+ | onBoardCompleted `optional` | `function` | Callback function to called when you complete all flows |
171
+ | onSettingFetched `optional` | `function` | Callback function to called after fetch settings information. It is used board kit and other kits open from board |
@@ -10,6 +10,25 @@ export interface ConfigInfo {
10
10
  connect?: Redirect;
11
11
  platforms?: string[];
12
12
  payment_provider?: PaymentProvider;
13
+ notification?: Notification;
14
+ country?: string;
15
+ }
16
+ export interface ConnectFeatures {
17
+ poweredBy?: boolean;
18
+ merchantLogo?: boolean;
19
+ switchLanguage?: boolean;
20
+ overlay?: boolean;
21
+ loaderOverlay?: boolean;
22
+ tapTextLogo?: boolean;
23
+ closeButton?: boolean;
24
+ dialogStartTransition?: 'left' | 'right' | 'up' | 'down';
25
+ dialogEndTransition?: 'left' | 'right' | 'up' | 'down';
26
+ disableNafath?: boolean;
27
+ disablePaci?: boolean;
28
+ }
29
+ export interface Notification {
30
+ email: boolean;
31
+ mobile?: boolean;
13
32
  }
14
33
  export interface PaymentProvider {
15
34
  technology_id: string;
@@ -1,5 +1,5 @@
1
1
  import { Language } from '../constants';
2
- import { ConfigInfo, SettingAsyncData } from './config';
2
+ import { ConfigInfo, ConnectFeatures, Notification, SettingAsyncData } from './config';
3
3
  export interface ConnectProps {
4
4
  elementId: string;
5
5
  publicKey: string;
@@ -12,11 +12,6 @@ export interface ConnectProps {
12
12
  mode?: 'popup' | 'page' | 'content';
13
13
  board?: boolean;
14
14
  boardMaturity?: boolean;
15
- hideOverlay?: boolean;
16
- hideLoaderOverlay?: boolean;
17
- hideMerchantLogo?: boolean;
18
- openAnimationDirection?: 'left' | 'right' | 'up' | 'down';
19
- closeAnimationDirection?: 'left' | 'right' | 'up' | 'down';
20
15
  loaderColor?: string;
21
16
  boardId?: string;
22
17
  open: boolean;
@@ -24,6 +19,8 @@ export interface ConnectProps {
24
19
  redirectUrl?: string;
25
20
  data?: Array<string>;
26
21
  settingData?: SettingAsyncData;
22
+ features?: ConnectFeatures;
23
+ notification?: Notification;
27
24
  onError?: (err: Error) => void;
28
25
  onReady?: () => void;
29
26
  onClose?: () => void;
@@ -47,6 +44,8 @@ export interface OriginalConnectProps {
47
44
  data?: Array<string>;
48
45
  showBoard?: boolean;
49
46
  boardMaturity?: boolean;
47
+ features?: ConnectFeatures;
48
+ notification?: Notification;
50
49
  verifyToken?: string;
51
50
  onFlowCompleted: (res: object, headers?: Record<string, string>) => void;
52
51
  onError: (err: any) => void;
@@ -73,7 +73,7 @@ export var generateConfigToken = function (data) { return __awaiter(void 0, void
73
73
  publicKey = public_key;
74
74
  baseUrl = getBaseUrl(public_key);
75
75
  }
76
- return [4, axios.post("".concat(baseUrl, "v1/connect"), data, {
76
+ return [4, axios.post("".concat(baseUrl, "v3/connect"), data, {
77
77
  headers: {
78
78
  'Content-Type': 'application/json',
79
79
  'Access-Control-Allow-Headers': true,
@@ -1,4 +1,4 @@
1
- export declare const CDN_LIBRARY_BASE_URL = "https://auth-jsconnect.b-cdn.net/build-2.7.8-test/";
1
+ export declare const CDN_LIBRARY_BASE_URL = "https://auth-jsconnect.b-cdn.net/build-2.8.0";
2
2
  export declare const Maturity: {
3
3
  readonly FULL: "full";
4
4
  readonly EXPRESS: "express";
@@ -8,7 +8,10 @@ export declare const Language: {
8
8
  readonly AR: "ar";
9
9
  };
10
10
  export declare const CONNECT_URL = "https://connect.tap.company/";
11
+ export declare const CONNECT_BETA_URL = "https://connect.beta.tap.company/";
12
+ export declare const CONNECT_SANDBOX_URL = "https://connect.sandbox.tap.company/";
11
13
  export declare const CONNECT_DEV_URL = "https://connect.dev.tap.company/";
12
14
  export declare const CONNECT_MW_URL = "https://connect-mw.tap.company/middleware/";
13
- export declare const CONNECT_DEV_MW_URL = "https://connect-mw.dev.tap.company/middleware/";
15
+ export declare const CONNECT_MW_BETA_URL = "https://connect-mw.beta.tap.company/middleware/";
14
16
  export declare const CONNECT_SANDBOX_MW_URL = "https://connect-mw.sandbox.tap.company/middleware/";
17
+ export declare const CONNECT_DEV_MW_URL = "https://connect-mw.dev.tap.company/middleware/";
@@ -1,4 +1,4 @@
1
- export var CDN_LIBRARY_BASE_URL = 'https://auth-jsconnect.b-cdn.net/build-2.7.8-test/';
1
+ export var CDN_LIBRARY_BASE_URL = 'https://auth-jsconnect.b-cdn.net/build-2.8.0';
2
2
  export var Maturity = {
3
3
  FULL: 'full',
4
4
  EXPRESS: 'express'
@@ -8,7 +8,10 @@ export var Language = {
8
8
  AR: 'ar'
9
9
  };
10
10
  export var CONNECT_URL = 'https://connect.tap.company/';
11
+ export var CONNECT_BETA_URL = 'https://connect.beta.tap.company/';
12
+ export var CONNECT_SANDBOX_URL = 'https://connect.sandbox.tap.company/';
11
13
  export var CONNECT_DEV_URL = 'https://connect.dev.tap.company/';
12
14
  export var CONNECT_MW_URL = 'https://connect-mw.tap.company/middleware/';
13
- export var CONNECT_DEV_MW_URL = 'https://connect-mw.dev.tap.company/middleware/';
15
+ export var CONNECT_MW_BETA_URL = 'https://connect-mw.beta.tap.company/middleware/';
14
16
  export var CONNECT_SANDBOX_MW_URL = 'https://connect-mw.sandbox.tap.company/middleware/';
17
+ export var CONNECT_DEV_MW_URL = 'https://connect-mw.dev.tap.company/middleware/';
@@ -87,14 +87,14 @@ export var TapConnect = React.memo(function (props) {
87
87
  });
88
88
  var tapConnectInstance = null;
89
89
  export var renderTapConnect = function (props, elementId) { return __awaiter(void 0, void 0, void 0, function () {
90
- var mode, board, publicKey, boardMaturity, language, country, scope, lead, postURL, mature, onError, redirectUrl, AuthData, payload, _a, data, publicKeyValue, _b, token, connect, baseUrl, url_1, countryCode, url, el, root, unmount;
90
+ var mode, board, publicKey, boardMaturity, language, country, scope, lead, postURL, mature, onError, redirectUrl, AuthData, payload, _a, data, publicKeyValue, _b, token, connect, baseUrl, countryCode, fallbackURL_1, url_1, fallbackURL, url, el, root, unmount;
91
91
  return __generator(this, function (_c) {
92
92
  switch (_c.label) {
93
93
  case 0:
94
94
  props.mode = props.mode || 'popup';
95
95
  mode = props.mode, board = props.board, publicKey = props.publicKey, boardMaturity = props.boardMaturity, language = props.language, country = props.country, scope = props.scope, lead = props.lead, postURL = props.postURL, mature = props.mature, onError = props.onError, redirectUrl = props.redirectUrl, AuthData = props.data;
96
96
  if (!(mode === 'page')) return [3, 2];
97
- payload = __assign(__assign(__assign(__assign({ operator: {
97
+ payload = __assign(__assign(__assign(__assign(__assign({ operator: {
98
98
  public_key: publicKey
99
99
  }, scope: scope }, (AuthData && {
100
100
  data: AuthData
@@ -113,7 +113,7 @@ export var renderTapConnect = function (props, elementId) { return __awaiter(voi
113
113
  post: {
114
114
  url: postURL
115
115
  }
116
- }));
116
+ })), { country: country });
117
117
  return [4, generateConfigToken(payload)];
118
118
  case 1:
119
119
  _a = _c.sent(), data = _a.data, publicKeyValue = _a.publicKey;
@@ -123,13 +123,19 @@ export var renderTapConnect = function (props, elementId) { return __awaiter(voi
123
123
  }
124
124
  _b = data || {}, token = _b.token, connect = _b.connect;
125
125
  baseUrl = getRedirectBaseUrl(publicKeyValue || '');
126
+ countryCode = (country !== null && country !== void 0 ? country : '').toLowerCase();
126
127
  if (!mature || scope === 'auth') {
127
- url_1 = (connect === null || connect === void 0 ? void 0 : connect.url) || "".concat(baseUrl, "?config_token=").concat(token);
128
+ fallbackURL_1 = "".concat(baseUrl, "?config_token=").concat(token);
129
+ if (country)
130
+ fallbackURL_1 += "&country_code=".concat(country);
131
+ url_1 = (connect === null || connect === void 0 ? void 0 : connect.url) || fallbackURL_1;
128
132
  window.location.href = url_1;
129
133
  return [2];
130
134
  }
131
- countryCode = country.toLowerCase();
132
- url = (connect === null || connect === void 0 ? void 0 : connect.url) || "".concat(baseUrl).concat(countryCode, "?config_token=").concat(token);
135
+ fallbackURL = "".concat(baseUrl).concat(countryCode, "?config_token=").concat(token);
136
+ if (country)
137
+ fallbackURL += "&country_code=".concat(country);
138
+ url = (connect === null || connect === void 0 ? void 0 : connect.url) || fallbackURL;
133
139
  window.location.href = url;
134
140
  return [2];
135
141
  case 2:
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ConnectProps as ConnectAttrs } from '../../@types';
3
- export type ConnectAuthProps = Pick<ConnectAttrs, 'open' | 'domain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'lead' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'hideOverlay' | 'hideMerchantLogo' | 'hideLoaderOverlay' | 'openAnimationDirection' | 'closeAnimationDirection'>;
3
+ export type ConnectAuthProps = Pick<ConnectAttrs, 'open' | 'domain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'lead' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'features'>;
4
4
  export declare const TapConnectAuth: React.MemoExoticComponent<(props: ConnectAuthProps & {
5
5
  id?: string;
6
6
  }) => import("react/jsx-runtime").JSX.Element>;
@@ -84,11 +84,7 @@ var ConnectAuth = function (props) {
84
84
  onError: props.onError,
85
85
  onReady: props.onReady,
86
86
  onClose: props.onClose,
87
- hideOverlay: props.hideOverlay,
88
- hideLoaderOverlay: props.hideLoaderOverlay,
89
- hideMerchantLogo: props.hideMerchantLogo,
90
- openAnimationDirection: props.openAnimationDirection,
91
- closeAnimationDirection: props.closeAnimationDirection
87
+ features: props.features
92
88
  }, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-auth-lib-id').unmount;
93
89
  return function () {
94
90
  unmount();
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ConnectProps as ConnectAttrs } from '../../@types';
3
- type BankProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched'>;
3
+ type BankProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
4
4
  export type TapBankProps = BankProps & {
5
5
  verifyToken: string;
6
6
  onBoardButtonClick: (data: Record<string, string>) => void;
@@ -70,6 +70,7 @@ var Bank = function (props) {
70
70
  mode: props.mode,
71
71
  scope: props.scope,
72
72
  merchantDomain: props.domain,
73
+ showBoard: props.board,
73
74
  publicKey: props.publicKey,
74
75
  postURL: props.postURL,
75
76
  appInfo: {
@@ -85,7 +86,8 @@ var Bank = function (props) {
85
86
  verifyToken: props.verifyToken,
86
87
  onBoardButtonClick: props.onBoardButtonClick,
87
88
  settingData: props.settingData,
88
- onSettingFetched: props.onSettingFetched
89
+ onSettingFetched: props.onSettingFetched,
90
+ features: props.features
89
91
  }, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-bank-lib-id').unmount;
90
92
  return function () {
91
93
  unmount();
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ConnectProps as ConnectAttrs } from '../../@types';
3
- export type BoardProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'boardId' | 'settingData' | 'onSettingFetched'>;
3
+ export type BoardProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'boardId' | 'settingData' | 'onSettingFetched' | 'features'>;
4
4
  export type TapBoardProps = BoardProps & {
5
5
  onBoardButtonClick: (data: Record<string, string>) => void;
6
6
  };
@@ -85,7 +85,8 @@ var Board = function (props) {
85
85
  boardId: props.boardId,
86
86
  onBoardButtonClick: props.onBoardButtonClick,
87
87
  settingData: props.settingData,
88
- onSettingFetched: props.onSettingFetched
88
+ onSettingFetched: props.onSettingFetched,
89
+ features: props.features
89
90
  }, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-board-lib-id').unmount;
90
91
  return function () {
91
92
  unmount();
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ConnectProps as ConnectAttrs } from '../../@types';
3
- type BrandProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched'>;
3
+ type BrandProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
4
4
  export type TapBrandProps = BrandProps & {
5
5
  verifyToken: string;
6
6
  onBoardButtonClick: (data: Record<string, string>) => void;
@@ -70,6 +70,7 @@ var Brand = function (props) {
70
70
  mode: props.mode,
71
71
  scope: props.scope,
72
72
  merchantDomain: props.domain,
73
+ showBoard: props.board,
73
74
  publicKey: props.publicKey,
74
75
  postURL: props.postURL,
75
76
  appInfo: {
@@ -85,7 +86,8 @@ var Brand = function (props) {
85
86
  verifyToken: props.verifyToken,
86
87
  onBoardButtonClick: props.onBoardButtonClick,
87
88
  settingData: props.settingData,
88
- onSettingFetched: props.onSettingFetched
89
+ onSettingFetched: props.onSettingFetched,
90
+ features: props.features
89
91
  }, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-brand-lib-id').unmount;
90
92
  return function () {
91
93
  unmount();
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ConnectProps as ConnectAttrs } from '../../@types';
3
- type EntityProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched'>;
3
+ type EntityProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
4
4
  export type TapEntityProps = EntityProps & {
5
5
  verifyToken: string;
6
6
  onBoardButtonClick: (data: Record<string, string>) => void;
@@ -70,6 +70,7 @@ var Entity = function (props) {
70
70
  mode: props.mode,
71
71
  scope: props.scope,
72
72
  merchantDomain: props.domain,
73
+ showBoard: props.board,
73
74
  publicKey: props.publicKey,
74
75
  postURL: props.postURL,
75
76
  appInfo: {
@@ -85,7 +86,8 @@ var Entity = function (props) {
85
86
  verifyToken: props.verifyToken,
86
87
  onBoardButtonClick: props.onBoardButtonClick,
87
88
  settingData: props.settingData,
88
- onSettingFetched: props.onSettingFetched
89
+ onSettingFetched: props.onSettingFetched,
90
+ features: props.features
89
91
  }, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-entity-lib-id').unmount;
90
92
  return function () {
91
93
  unmount();
@@ -12,19 +12,23 @@ var __assign = (this && this.__assign) || function () {
12
12
  import * as React from 'react';
13
13
  import { wrapLibConfig } from '../../utils';
14
14
  var ConnectExpress = function (props) {
15
- var _a = React.useState(''), token = _a[0], setToken = _a[1];
16
- var _b = React.useState('express'), name = _b[0], setName = _b[1];
15
+ var _a;
16
+ var _b = React.useState(''), token = _b[0], setToken = _b[1];
17
+ var _c = React.useState('express'), name = _c[0], setName = _c[1];
18
+ var _d = React.useState((_a = props.country) !== null && _a !== void 0 ? _a : ''), busCountryCode = _d[0], setBusCountryCode = _d[1];
17
19
  var onButtonClick = function (_a) {
18
- var name = _a.name, token = _a.token;
20
+ var name = _a.name, token = _a.token, countryCode = _a.countryCode;
19
21
  setToken(token);
20
22
  setName(name);
23
+ if (countryCode)
24
+ setBusCountryCode(countryCode);
21
25
  };
22
- var _c = window['TapAuth'], renderConnectExpressLib = _c.renderConnectExpressLib, renderIndividualLib = _c.renderIndividualLib, renderBankLib = _c.renderBankLib, renderTaxLib = _c.renderTaxLib, renderEntityLib = _c.renderEntityLib, renderBrandLib = _c.renderBrandLib;
26
+ var _e = window['TapAuth'], renderConnectExpressLib = _e.renderConnectExpressLib, renderIndividualLib = _e.renderIndividualLib, renderBankLib = _e.renderBankLib, renderTaxLib = _e.renderTaxLib, renderEntityLib = _e.renderEntityLib, renderBrandLib = _e.renderBrandLib;
23
27
  var elementId = props.elementId;
24
28
  var unmountComponent = function () { };
25
29
  React.useEffect(function () {
26
30
  console.log('rendering: ', name);
27
- var config = wrapLibConfig(__assign(__assign({}, props), { verifyToken: token, onBoardButtonClick: onButtonClick }));
31
+ var config = wrapLibConfig(__assign(__assign({}, props), { country: busCountryCode, verifyToken: token, onBoardButtonClick: onButtonClick }));
28
32
  switch (name) {
29
33
  case 'brand':
30
34
  unmountComponent();
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ConnectProps as ConnectAttrs } from '../../@types';
3
- type IndividualProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched'>;
3
+ type IndividualProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
4
4
  export type TapIndividualProps = IndividualProps & {
5
5
  verifyToken: string;
6
6
  onBoardButtonClick: (data: Record<string, string>) => void;
@@ -70,6 +70,7 @@ var Individual = function (props) {
70
70
  mode: props.mode,
71
71
  scope: props.scope,
72
72
  merchantDomain: props.domain,
73
+ showBoard: props.board,
73
74
  publicKey: props.publicKey,
74
75
  postURL: props.postURL,
75
76
  appInfo: {
@@ -85,7 +86,8 @@ var Individual = function (props) {
85
86
  verifyToken: props.verifyToken,
86
87
  onBoardButtonClick: props.onBoardButtonClick,
87
88
  settingData: props.settingData,
88
- onSettingFetched: props.onSettingFetched
89
+ onSettingFetched: props.onSettingFetched,
90
+ features: props.features
89
91
  }, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-individual-lib-id').unmount;
90
92
  return function () {
91
93
  unmount();
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ConnectProps as ConnectAttrs } from '../../@types';
3
- type PasswordProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched'>;
3
+ type PasswordProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
4
4
  export type TapPasswordProps = PasswordProps & {
5
5
  verifyToken: string;
6
6
  onBoardButtonClick: (data: Record<string, string>) => void;
@@ -70,6 +70,7 @@ var Password = function (props) {
70
70
  mode: props.mode,
71
71
  scope: props.scope,
72
72
  merchantDomain: props.domain,
73
+ showBoard: props.board,
73
74
  publicKey: props.publicKey,
74
75
  postURL: props.postURL,
75
76
  appInfo: {
@@ -85,7 +86,8 @@ var Password = function (props) {
85
86
  verifyToken: props.verifyToken,
86
87
  onBoardButtonClick: props.onBoardButtonClick,
87
88
  settingData: props.settingData,
88
- onSettingFetched: props.onSettingFetched
89
+ onSettingFetched: props.onSettingFetched,
90
+ features: props.features
89
91
  }, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-password-lib-id').unmount;
90
92
  return function () {
91
93
  unmount();
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ConnectProps as ConnectAttrs } from '../../@types';
3
- type TaxProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched'>;
3
+ type TaxProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
4
4
  export type TapTaxProps = TaxProps & {
5
5
  verifyToken: string;
6
6
  onBoardButtonClick: (data: Record<string, string>) => void;
@@ -70,6 +70,7 @@ var Tax = function (props) {
70
70
  mode: props.mode,
71
71
  scope: props.scope,
72
72
  merchantDomain: props.domain,
73
+ showBoard: props.board,
73
74
  publicKey: props.publicKey,
74
75
  postURL: props.postURL,
75
76
  appInfo: {
@@ -85,7 +86,8 @@ var Tax = function (props) {
85
86
  verifyToken: props.verifyToken,
86
87
  onBoardButtonClick: props.onBoardButtonClick,
87
88
  settingData: props.settingData,
88
- onSettingFetched: props.onSettingFetched
89
+ onSettingFetched: props.onSettingFetched,
90
+ features: props.features
89
91
  }, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-tax-lib-id').unmount;
90
92
  return function () {
91
93
  unmount();
@@ -1,2 +1,2 @@
1
- export declare const getBaseUrl: (publicKey: string) => "https://connect-mw.tap.company/middleware/" | "https://connect-mw.dev.tap.company/middleware/";
2
- export declare const getRedirectBaseUrl: (publicKey: string) => "https://connect.tap.company/" | "https://connect.dev.tap.company/";
1
+ export declare const getBaseUrl: (publicKey: string) => "https://connect-mw.tap.company/middleware/" | "https://connect-mw.sandbox.tap.company/middleware/";
2
+ export declare const getRedirectBaseUrl: (publicKey: string) => "https://connect.tap.company/" | "https://connect.sandbox.tap.company/";
@@ -1,4 +1,4 @@
1
- import { CONNECT_MW_URL, CONNECT_DEV_MW_URL, CONNECT_DEV_URL, CONNECT_URL } from '../constants';
1
+ import { CONNECT_MW_URL, CONNECT_SANDBOX_MW_URL, CONNECT_SANDBOX_URL, CONNECT_URL } from '../constants';
2
2
  var isProd = function (publicKey) {
3
3
  return publicKey.includes('pk_live');
4
4
  };
@@ -6,11 +6,11 @@ export var getBaseUrl = function (publicKey) {
6
6
  if (isProd(publicKey)) {
7
7
  return CONNECT_MW_URL;
8
8
  }
9
- return CONNECT_DEV_MW_URL;
9
+ return CONNECT_SANDBOX_MW_URL;
10
10
  };
11
11
  export var getRedirectBaseUrl = function (publicKey) {
12
12
  if (isProd(publicKey)) {
13
13
  return CONNECT_URL;
14
14
  }
15
- return CONNECT_DEV_URL;
15
+ return CONNECT_SANDBOX_URL;
16
16
  };
@@ -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, mode, 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, features, notification }: 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, 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;
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, features = _a.features, notification = _a.notification;
3
3
  return {
4
4
  appInfo: {
5
5
  name: window.location.hostname || window.location.origin
@@ -18,6 +18,8 @@ export var wrapLibConfig = function (_a) {
18
18
  showBoard: board,
19
19
  boardMaturity: boardMaturity,
20
20
  verifyToken: verifyToken,
21
+ features: features,
22
+ notification: notification,
21
23
  onFlowCompleted: function (res) {
22
24
  onSuccess && onSuccess(res);
23
25
  },
@@ -1,6 +1,6 @@
1
1
  import { Language } from '../constants';
2
2
  export var validateConnectProps = function (props) {
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;
3
+ var mode = props.mode, publicKey = props.publicKey, mature = props.mature, 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
4
  if (!mode) {
5
5
  throw new Error('mode is required');
6
6
  }
@@ -10,9 +10,6 @@ export var validateConnectProps = function (props) {
10
10
  if (!publicKey) {
11
11
  throw new Error('publicKey is required');
12
12
  }
13
- if (!country) {
14
- throw new Error('country is required');
15
- }
16
13
  if (!language) {
17
14
  throw new Error('language is required');
18
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/connect",
3
- "version": "2.7.8-test",
3
+ "version": "2.8.0",
4
4
  "description": "Tap Connect",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",