@tap-payments/auth-jsconnect 2.8.63-development → 2.8.63-sandbox

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.
@@ -57,7 +57,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
57
57
  var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString, dangerousMessage, getParameterByName, setBaseUrl, getUserLanguage } from '../utils';
60
- import { BUSINESS_COUNTRIES, DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
60
+ import { BUSINESS_COUNTRIES, DEFAULT_COUNTRY_ISO2, DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
61
61
  import i18n from '../i18n';
62
62
  import { updateLocale } from '../utils/locale';
63
63
  import API, { getAxiosHeaders, setAxiosGlobalHeaders } from '../api';
@@ -161,8 +161,7 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
161
161
  ipCountry = undefined;
162
162
  if (countryCode)
163
163
  businessCountry = findCountryByIso2(countries, countryCode);
164
- if (country_code)
165
- ipCountry = findCountryByIso2(countries, country_code);
164
+ ipCountry = findCountryByIso2(countries, country_code !== null && country_code !== void 0 ? country_code : DEFAULT_COUNTRY_ISO2);
166
165
  if (appConfig.onSettingFetched)
167
166
  appConfig.onSettingFetched({
168
167
  config: config,
@@ -33,7 +33,7 @@ var StyledTooltip = styled(function (_a) {
33
33
  var _b;
34
34
  var theme = _a.theme;
35
35
  return (_b = {},
36
- _b["& .".concat(tooltipClasses.tooltip)] = __assign(__assign({ color: alpha(theme.palette.text.primary, 0.5), width: 'fit-content', maxHeight: 'fit-content' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight, backgroundColor: theme.palette.secondary.light, border: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) }),
36
+ _b["& .".concat(tooltipClasses.tooltip)] = __assign(__assign({ color: alpha(theme.palette.text.primary, 0.5), width: 'fit-content', maxHeight: 'fit-content' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight, backgroundColor: theme.palette.secondary.light, border: "1px solid ".concat(alpha(theme.palette.divider, 0.8)), zIndex: 2147483647 }),
37
37
  _b);
38
38
  });
39
39
  var TextStyled = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
@@ -1,5 +1,6 @@
1
1
  import { ScreenStepNavigation, BusinessType } from '../@types';
2
2
  export declare const CONNECT_DEV_URL = "https://connect.dev.tap.company";
3
+ export declare const CONNECT_SANDBOX_URL = "https://connect.sandbox.tap.company";
3
4
  export declare const CONNECT_PROD_URL = "https://connect.tap.company";
4
5
  export declare const CLIENT_ORIGIN: string;
5
6
  export declare const TAP_WEBSITE = "https://www.tap.company/";
@@ -9,6 +10,7 @@ export declare const LOCAL_STORAGE_KEYS: {
9
10
  languageMode: string;
10
11
  };
11
12
  export declare const SCOPE_AUTH = "auth";
13
+ export declare const DEFAULT_COUNTRY_ISO2 = "KW";
12
14
  export declare const EXTERNAL_LINKS: {
13
15
  TOS_EN: string;
14
16
  TOS_AR: string;
@@ -1,5 +1,6 @@
1
1
  import { BusinessType } from '../@types';
2
2
  export var CONNECT_DEV_URL = 'https://connect.dev.tap.company';
3
+ export var CONNECT_SANDBOX_URL = 'https://connect.sandbox.tap.company';
3
4
  export var CONNECT_PROD_URL = 'https://connect.tap.company';
4
5
  export var CLIENT_ORIGIN = window.location.origin;
5
6
  export var TAP_WEBSITE = 'https://www.tap.company/';
@@ -9,6 +10,7 @@ export var LOCAL_STORAGE_KEYS = {
9
10
  languageMode: 'languageMode'
10
11
  };
11
12
  export var SCOPE_AUTH = 'auth';
13
+ export var DEFAULT_COUNTRY_ISO2 = 'KW';
12
14
  export var EXTERNAL_LINKS = {
13
15
  TOS_EN: '/en/terms-conditions',
14
16
  TOS_AR: '/ar/terms-conditions',
@@ -7,7 +7,6 @@ interface verifyLeadTokenProps {
7
7
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
8
8
  data: any;
9
9
  token: string;
10
- flows: any;
11
10
  }, verifyLeadTokenProps, {
12
11
  state?: unknown;
13
12
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
@@ -50,7 +49,6 @@ export declare const verifyPasswordLeadOTP: import("@reduxjs/toolkit").AsyncThun
50
49
  formData: {
51
50
  otp: string;
52
51
  };
53
- flows: any;
54
52
  }, OTPFormValues, {
55
53
  state?: unknown;
56
54
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
@@ -55,7 +55,7 @@ import { retrieveIndividualData, sleep } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
58
- var payload, data, _b, config, board_info_password_status, country_code, board_id, recipient, countryIso2, publicKey, data_1, flows, data_2;
58
+ var payload, data, _b, config, board_info_password_status, country_code, board_id, countryIso2, publicKey, data_1;
59
59
  var _c, _d;
60
60
  return __generator(this, function (_e) {
61
61
  switch (_e.label) {
@@ -72,7 +72,7 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
72
72
  throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
73
73
  if (isInternally)
74
74
  data.step_name = PASSWORD_STEP_NAMES.PASSWORD_INFO;
75
- _b = data || {}, config = _b.config, board_info_password_status = _b.board_info_password_status, country_code = _b.country_code, board_id = _b.id, recipient = _b.recipient;
75
+ _b = data || {}, config = _b.config, board_info_password_status = _b.board_info_password_status, country_code = _b.country_code, board_id = _b.board_id;
76
76
  countryIso2 = country_code;
77
77
  if (countryIso2)
78
78
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
@@ -87,27 +87,16 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
87
87
  thunkApi.dispatch(handleSetCountryByIso2(data_1.entity.country));
88
88
  _e.label = 3;
89
89
  case 3:
90
- flows = [];
91
- if (!(data.step_name === PASSWORD_STEP_NAMES.PHONE_AUTH)) return [3, 4];
92
- thunkApi.dispatch(handleCurrentActiveScreen('PASSWORD_VERIFY_STEP'));
93
- return [3, 7];
94
- case 4:
95
- if (!(board_info_password_status === 'completed')) return [3, 6];
96
- return [4, Promise.all([
97
- API.boardService.retrieveBoardInfoStatus(board_id),
98
- thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: recipient === null || recipient === void 0 ? void 0 : recipient.id, individualType: recipient === null || recipient === void 0 ? void 0 : recipient.type })).unwrap()
99
- ])];
100
- case 5:
101
- data_2 = (_e.sent())[0];
102
- flows = (data_2 === null || data_2 === void 0 ? void 0 : data_2.info) || [];
103
- thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
104
- return [3, 7];
105
- case 6:
106
- if (data.step_name === PASSWORD_STEP_NAMES.PASSWORD_INFO) {
90
+ if (data.step_name === PASSWORD_STEP_NAMES.PHONE_AUTH) {
91
+ thunkApi.dispatch(handleCurrentActiveScreen('PASSWORD_VERIFY_STEP'));
92
+ }
93
+ else if (board_info_password_status === 'completed') {
94
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
95
+ }
96
+ else if (data.step_name === PASSWORD_STEP_NAMES.PASSWORD_INFO) {
107
97
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
108
98
  }
109
- _e.label = 7;
110
- case 7: return [2, { data: data, token: token, flows: flows }];
99
+ return [2, { data: data, token: token }];
111
100
  }
112
101
  });
113
102
  });
@@ -155,7 +144,7 @@ export var retrieveBoardDetails = createAsyncThunk('retrievePasswordBoardDetails
155
144
  });
156
145
  });
157
146
  export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
158
- var _a, password, settings, responseBody, payload, data, _b, config, board_info_password_status, country_code, board_id, recipient, countryIso2, publicKey, flows, data_3, data_4;
147
+ var _a, password, settings, responseBody, payload, data, _b, config, board_info_password_status, country_code, board_id, countryIso2, publicKey, data_2;
159
148
  var _c, _d, _e, _f, _g;
160
149
  return __generator(this, function (_h) {
161
150
  switch (_h.label) {
@@ -174,7 +163,7 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
174
163
  data = (_h.sent()).data;
175
164
  if ((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length)
176
165
  throw new Error(data.errors[0].description);
177
- _b = data || {}, config = _b.config, board_info_password_status = _b.board_info_password_status, country_code = _b.country_code, board_id = _b.id, recipient = _b.recipient;
166
+ _b = data || {}, config = _b.config, board_info_password_status = _b.board_info_password_status, country_code = _b.country_code, board_id = _b.board_id;
178
167
  countryIso2 = country_code;
179
168
  if (countryIso2)
180
169
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
@@ -182,29 +171,21 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
182
171
  if (publicKey)
183
172
  thunkApi.dispatch(handlePublicKey(publicKey));
184
173
  (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
185
- flows = [];
186
- if (!(board_info_password_status === 'completed')) return [3, 3];
187
- return [4, Promise.all([
188
- API.boardService.retrieveBoardInfoStatus(board_id),
189
- thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: recipient === null || recipient === void 0 ? void 0 : recipient.id, individualType: recipient === null || recipient === void 0 ? void 0 : recipient.type })).unwrap()
190
- ])];
191
- case 2:
192
- data_3 = (_h.sent())[0];
193
- flows = (data_3 === null || data_3 === void 0 ? void 0 : data_3.info) || [];
174
+ if (!(board_info_password_status === 'completed')) return [3, 2];
194
175
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
195
- return [3, 6];
196
- case 3:
197
- if (!!country_code) return [3, 5];
176
+ return [3, 5];
177
+ case 2:
178
+ if (!!country_code) return [3, 4];
198
179
  return [4, API.boardService.retrieveBoardDetails(board_id)];
180
+ case 3:
181
+ data_2 = _h.sent();
182
+ if ((_g = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _g === void 0 ? void 0 : _g.country)
183
+ thunkApi.dispatch(handleSetCountryByIso2(data_2.entity.country));
184
+ _h.label = 4;
199
185
  case 4:
200
- data_4 = _h.sent();
201
- if ((_g = data_4 === null || data_4 === void 0 ? void 0 : data_4.entity) === null || _g === void 0 ? void 0 : _g.country)
202
- thunkApi.dispatch(handleSetCountryByIso2(data_4.entity.country));
203
- _h.label = 5;
204
- case 5:
205
186
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
206
- _h.label = 6;
207
- case 6: return [2, { data: data, formData: __assign({}, params), flows: flows }];
187
+ _h.label = 5;
188
+ case 5: return [2, { data: data, formData: __assign({}, params) }];
208
189
  }
209
190
  });
210
191
  }); });
@@ -289,7 +270,7 @@ export var retrieveBoardStatus = createAsyncThunk('password/retrieveBoardStatus'
289
270
  });
290
271
  }); });
291
272
  export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
292
- var token, boardId, boardInfoId, userId, userType, payload, data, countryIso2, publicKey, data_5;
273
+ var token, boardId, boardInfoId, userId, userType, payload, data, countryIso2, publicKey, data_3;
293
274
  var _a, _b, _c;
294
275
  return __generator(this, function (_d) {
295
276
  switch (_d.label) {
@@ -313,9 +294,9 @@ export var verifyOperationToken = createAsyncThunk('verifyOperationToken', funct
313
294
  if (!!(data === null || data === void 0 ? void 0 : data.country)) return [3, 3];
314
295
  return [4, API.boardService.retrieveBoardDetails(boardId)];
315
296
  case 2:
316
- data_5 = _d.sent();
317
- if ((_c = data_5 === null || data_5 === void 0 ? void 0 : data_5.entity) === null || _c === void 0 ? void 0 : _c.country)
318
- thunkApi.dispatch(handleSetCountryByIso2(data_5.entity.country));
297
+ data_3 = _d.sent();
298
+ if ((_c = data_3 === null || data_3 === void 0 ? void 0 : data_3.entity) === null || _c === void 0 ? void 0 : _c.country)
299
+ thunkApi.dispatch(handleSetCountryByIso2(data_3.entity.country));
319
300
  _d.label = 3;
320
301
  case 3:
321
302
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
@@ -460,10 +441,8 @@ export var passwordSlice = createSlice({
460
441
  state.data.verify.operationType = PASSWORD_OPERATION_TYPE.SET_PASSWORD;
461
442
  state.error = null;
462
443
  state.customLoading = false;
463
- var _a = action.payload, data = _a.data, token = _a.token, flows = _a.flows;
464
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), { board_id: data.id }), ((flows === null || flows === void 0 ? void 0 : flows.length) && {
465
- flows: flows
466
- }));
444
+ var _a = action.payload, data = _a.data, token = _a.token;
445
+ state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { board_id: data.id });
467
446
  state.data.verify.token = token;
468
447
  })
469
448
  .addCase(verifyLeadToken.pending, function (state) {
@@ -498,12 +477,10 @@ export var passwordSlice = createSlice({
498
477
  .addCase(verifyPasswordLeadOTP.fulfilled, function (state, action) {
499
478
  state.loading = false;
500
479
  state.error = null;
501
- var _a = action.payload, data = _a.data, formData = _a.formData, flows = _a.flows;
480
+ var _a = action.payload, data = _a.data, formData = _a.formData;
502
481
  state.data.otpData = formData;
503
482
  state.data.otpData.responseBody = data;
504
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), { board_id: data.id }), ((flows === null || flows === void 0 ? void 0 : flows.length) && {
505
- flows: flows
506
- }));
483
+ state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { board_id: data.id });
507
484
  })
508
485
  .addCase(verifyPasswordLeadOTP.rejected, function (state, action) {
509
486
  state.loading = false;
@@ -1,5 +1,5 @@
1
1
  import { axiosInstance } from '../api';
2
- import { ENDPOINT_PATHS, CONNECT_DEV_URL, CONNECT_PROD_URL } from '../constants';
2
+ import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
3
3
  export var sleep = function (milliseconds) {
4
4
  if (milliseconds === void 0) { milliseconds = 1000; }
5
5
  return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
@@ -16,7 +16,7 @@ export var setBaseUrl = function (publicKey) {
16
16
  axiosInstance.defaults.baseURL = ENDPOINT_PATHS.PRODUCTION_BASE_URL;
17
17
  return;
18
18
  }
19
- axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
19
+ axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
20
20
  };
21
21
  export var updateLocationUrlWithCountry = function (countryIso2) {
22
22
  var country = countryIso2.toLowerCase();
@@ -35,7 +35,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
35
35
  window.history.replaceState({}, '', newUrl);
36
36
  };
37
37
  export var openConnect = function (pk, countryCode) {
38
- var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_DEV_URL);
38
+ var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_SANDBOX_URL);
39
39
  if (countryCode) {
40
40
  newUrl.pathname = "/".concat(countryCode.toLowerCase());
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.63-development",
3
+ "version": "2.8.63-sandbox",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -21,7 +21,7 @@
21
21
  "copy:files": "copyfiles -u 1 src/**/*.css build/",
22
22
  "tsc:alias": "tsc-alias -p tsconfig.json",
23
23
  "ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
24
- "push": "npm publish --access public --tag development"
24
+ "push": "npm publish --access public --tag sandbox"
25
25
  },
26
26
  "keywords": [],
27
27
  "author": {