@tap-payments/connect 2.10.7-beta → 2.10.9-beta

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.10.7-beta/main.js"></script>
88
+ <script src="https://tap-sdks.b-cdn.net/connect/build-2.10.9-beta/main.js"></script>
89
89
  </head>
90
90
  <body>
91
91
  <div id="root"></div>
@@ -11,6 +11,7 @@ export interface ConfigInfo {
11
11
  platforms?: string[];
12
12
  payment_provider?: PaymentProvider;
13
13
  notification?: Notification;
14
+ country?: string;
14
15
  }
15
16
  export interface ConnectFeatures {
16
17
  poweredBy?: boolean;
@@ -1,4 +1,4 @@
1
- export declare const CDN_LIBRARY_BASE_URL = "https://auth-jsconnect.b-cdn.net/build-2.10.7-beta";
1
+ export declare const CDN_LIBRARY_BASE_URL = "https://auth-jsconnect.b-cdn.net/build-2.10.9-beta";
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.10.7-beta';
1
+ export var CDN_LIBRARY_BASE_URL = 'https://auth-jsconnect.b-cdn.net/build-2.10.9-beta';
2
2
  export var Maturity = {
3
3
  FULL: 'full',
4
4
  EXPRESS: 'express'
@@ -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:
@@ -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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/connect",
3
- "version": "2.10.7-beta",
3
+ "version": "2.10.9-beta",
4
4
  "description": "Tap Connect",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",