@tap-payments/auth-jsconnect 2.10.11-beta → 2.10.13-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.
@@ -14,6 +14,7 @@ export declare const onCloseComplete: import("@reduxjs/toolkit").AsyncThunk<void
14
14
  merchantId: string;
15
15
  brandId: string;
16
16
  entityId: string;
17
+ nextScreen?: string | undefined;
17
18
  }, {}>;
18
19
  export interface SettingsData {
19
20
  skin: ThemeMode;
@@ -56,7 +56,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
56
56
  };
57
57
  var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
- import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString, dangerousMessage, getParameterByName, setBaseUrl, getUserLanguage } from '../utils';
59
+ import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString, dangerousMessage, getParameterByName, setBaseUrl, getUserLanguage, sleep } from '../utils';
60
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';
@@ -179,7 +179,7 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
179
179
  });
180
180
  }); });
181
181
  export var onCloseComplete = createAsyncThunk('settings/onCloseComplete', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
182
- var settings, _a, appConfig, authId, postURL, redirectUrl, bi, merchantId, brandId, entityId, body, data, urlQueryStart, newUrl;
182
+ var settings, _a, appConfig, authId, postURL, redirectUrl, bi, merchantId, brandId, entityId, nextScreen, body, data, urlQueryStart, newUrl;
183
183
  var _b, _c;
184
184
  return __generator(this, function (_d) {
185
185
  switch (_d.label) {
@@ -188,7 +188,7 @@ export var onCloseComplete = createAsyncThunk('settings/onCloseComplete', functi
188
188
  _a = settings.data, appConfig = _a.appConfig, authId = _a.authId;
189
189
  postURL = appConfig.postURL, redirectUrl = appConfig.redirectUrl;
190
190
  bi = settings.data.deviceInfo.browser.browser_id;
191
- merchantId = params.merchantId, brandId = params.brandId, entityId = params.entityId;
191
+ merchantId = params.merchantId, brandId = params.brandId, entityId = params.entityId, nextScreen = params.nextScreen;
192
192
  if (!authId) return [3, 2];
193
193
  body = {
194
194
  post_url: postURL || '',
@@ -203,6 +203,10 @@ export var onCloseComplete = createAsyncThunk('settings/onCloseComplete', functi
203
203
  case 1:
204
204
  data = _d.sent();
205
205
  (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, data);
206
+ if (nextScreen) {
207
+ sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen(nextScreen)); });
208
+ return [2];
209
+ }
206
210
  if (settings.data.appConfig.mode === 'popup') {
207
211
  settings.data.appConfig.onFlowCompleted({ auth_id: authId, bi: bi });
208
212
  thunkApi.dispatch(handleOpen(false));
@@ -11,6 +11,7 @@ export declare const LOCAL_STORAGE_KEYS: {
11
11
  languageMode: string;
12
12
  };
13
13
  export declare const SCOPE_AUTH = "auth";
14
+ export declare const SCOPE_MERCHANT = "merchant";
14
15
  export declare const DEFAULT_COUNTRY_ISO2 = "KW";
15
16
  export declare const NAFATH_VERIFICATION_FAILED = "nafath_verification_failed";
16
17
  export declare const COLLECT_DOB_INFO_NAFATH = "collect_date_of_birth";
@@ -12,6 +12,7 @@ export var LOCAL_STORAGE_KEYS = {
12
12
  languageMode: 'languageMode'
13
13
  };
14
14
  export var SCOPE_AUTH = 'auth';
15
+ export var SCOPE_MERCHANT = 'merchant';
15
16
  export var DEFAULT_COUNTRY_ISO2 = 'KW';
16
17
  export var NAFATH_VERIFICATION_FAILED = 'nafath_verification_failed';
17
18
  export var COLLECT_DOB_INFO_NAFATH = 'collect_date_of_birth';
@@ -1,7 +1,10 @@
1
1
  export declare const ICONS_BASE_URL = "https://dash.b-cdn.net";
2
2
  export declare const ICONS_PATH = "/icons/menu";
3
+ export declare const ASSETS_BASE_URL = "https://tap-assets.b-cdn.net";
4
+ export declare const ASSETS_PATH = "/icons/connect";
3
5
  export declare const ICONS_EXTENSION = ".svg";
4
6
  export declare const ICONS_FULL_PATH: string;
7
+ export declare const ASSETS_FULL_PATH: string;
5
8
  export declare const ICONS_NAMES: {
6
9
  SIDE_MENU_CLOSE_ICON: string;
7
10
  SIDE_MENU_CLOSE_ICON_DARK: string;
@@ -44,6 +47,7 @@ export declare const ICONS_NAMES: {
44
47
  NAFATH_LOGO: string;
45
48
  NAFATH_VERIFY_ICON: string;
46
49
  EXPRESS_ERROR_ICON: string;
50
+ TAP_LOGO: string;
47
51
  TAP_EN: string;
48
52
  TAP_AR: string;
49
53
  ID_IMAGE: string;
@@ -1,7 +1,13 @@
1
+ import { ThemeMode } from '../@types';
1
2
  export var ICONS_BASE_URL = 'https://dash.b-cdn.net';
2
3
  export var ICONS_PATH = '/icons/menu';
4
+ export var ASSETS_BASE_URL = 'https://tap-assets.b-cdn.net';
5
+ export var ASSETS_PATH = '/icons/connect';
3
6
  export var ICONS_EXTENSION = '.svg';
4
7
  export var ICONS_FULL_PATH = ICONS_BASE_URL + ICONS_PATH;
8
+ export var ASSETS_FULL_PATH = ASSETS_BASE_URL + ASSETS_PATH;
9
+ var generateAssetPath = function (name, theme) { return "".concat(ASSETS_BASE_URL).concat(ASSETS_PATH, "/").concat(theme, "/").concat(name).concat(ICONS_EXTENSION); };
10
+ var generateLightAssetPath = function (name) { return generateAssetPath(name, ThemeMode.LIGHT); };
5
11
  export var ICONS_NAMES = {
6
12
  SIDE_MENU_CLOSE_ICON: ICONS_FULL_PATH + '/side-menu-close' + ICONS_EXTENSION,
7
13
  SIDE_MENU_CLOSE_ICON_DARK: ICONS_FULL_PATH + '/side-menu-close-dark' + ICONS_EXTENSION,
@@ -41,9 +47,10 @@ export var ICONS_NAMES = {
41
47
  TAP_LOGO_TEXT_AR: ICONS_FULL_PATH + '/tap-white-text-ar' + ICONS_EXTENSION,
42
48
  TAP_LOGO_TEXT_EN: ICONS_FULL_PATH + '/tap-white-text-en' + ICONS_EXTENSION,
43
49
  PACI_VERIFY_ICON: ICONS_FULL_PATH + '/PACI_verify_icon' + '.png',
44
- NAFATH_LOGO: 'https://tap-assets.b-cdn.net/icons/connect/light/nafath_button_logo.svg',
45
- NAFATH_VERIFY_ICON: 'https://tap-assets.b-cdn.net/icons/connect/light/nafath_logo.svg',
50
+ NAFATH_LOGO: generateLightAssetPath('nafath_button_logo'),
51
+ NAFATH_VERIFY_ICON: generateLightAssetPath('nafath_logo'),
46
52
  EXPRESS_ERROR_ICON: ICONS_FULL_PATH + '/EXPRESS_error_icon' + '.svg',
53
+ TAP_LOGO: generateLightAssetPath('tap-logo'),
47
54
  TAP_EN: 'https://tap-connecet.b-cdn.net/imgs/tapEN' + ICONS_EXTENSION,
48
55
  TAP_AR: 'https://tap-connecet.b-cdn.net/imgs/tapAR' + ICONS_EXTENSION,
49
56
  ID_IMAGE: 'https://villageofwarwick.org/wp-content/uploads/2020/02/ICON99-512-1.png',
@@ -59,7 +59,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import { handleNextScreenStep, handleCurrentActiveScreen, handleOpen, handleSetCountryByIso2, onCloseComplete, storeAuthId } from '../../../app/settings';
60
60
  import { FlowsTypes, AuthForType, BusinessType, LicenseType, AuthForScreen } from '../../../@types';
61
61
  import API from '../../../api';
62
- import { ADD_NEW_ENTITY, COLLECT_DOB_INFO_NAFATH, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH } from '../../../constants';
62
+ import { ADD_NEW_ENTITY, COLLECT_DOB_INFO_NAFATH, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH, SCOPE_MERCHANT } from '../../../constants';
63
63
  import { defaultCountry } from '../../../constants';
64
64
  import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError } from '../../../utils';
65
65
  export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateBusinessCountryAsync', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
@@ -888,10 +888,10 @@ export var checkBrandNameAvailabilityAsync = createAsyncThunk('connectExpress/ch
888
888
  export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAsync', function (_a, thunkApi) {
889
889
  var isRetry = _a.isRetry;
890
890
  return __awaiter(void 0, void 0, void 0, function () {
891
- var _b, connectExpress, settings, responseData, _c, postURL, scope, redirectUrl, mode, showBoard, notification, platforms, payment_provider, leadId, authId, bi, leadData, accountData, data, body, data, urlQueryStart;
892
- var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
893
- return __generator(this, function (_v) {
894
- switch (_v.label) {
891
+ var _b, connectExpress, settings, responseData, _c, postURL, scope, redirectUrl, mode, showBoard, notification, platforms, payment_provider, leadId, authId, bi, leadData, accountData, data, body, data, data, urlQueryStart;
892
+ var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
893
+ return __generator(this, function (_y) {
894
+ switch (_y.label) {
895
895
  case 0:
896
896
  _b = thunkApi.getState(), connectExpress = _b.connectExpress, settings = _b.settings;
897
897
  responseData = connectExpress.data.responseData;
@@ -905,12 +905,12 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
905
905
  if (!isRetry) return [3, 2];
906
906
  return [4, thunkApi.dispatch(getLeadByIdAsync(leadId)).unwrap()];
907
907
  case 1:
908
- data = (_v.sent()).data;
908
+ data = (_y.sent()).data;
909
909
  if (data === null || data === void 0 ? void 0 : data.board_id) {
910
910
  leadData = data;
911
911
  accountData = data;
912
912
  }
913
- _v.label = 2;
913
+ _y.label = 2;
914
914
  case 2:
915
915
  body = {
916
916
  lead_id: leadId,
@@ -922,8 +922,8 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
922
922
  if (!!(leadData === null || leadData === void 0 ? void 0 : leadData.board_id)) return [3, 4];
923
923
  return [4, API.accountService.expressCreateAccount(body)];
924
924
  case 3:
925
- accountData = _v.sent();
926
- _v.label = 4;
925
+ accountData = _y.sent();
926
+ _y.label = 4;
927
927
  case 4:
928
928
  sendCustomEventToGTM({
929
929
  event: 'Send Event',
@@ -939,22 +939,41 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
939
939
  (_m = (_l = settings.data.appConfig).onCreated) === null || _m === void 0 ? void 0 : _m.call(_l, accountData);
940
940
  (_p = (_o = settings.data.appConfig).onFlowCompleted) === null || _p === void 0 ? void 0 : _p.call(_o, accountData);
941
941
  (_r = (_q = settings.data.appConfig).onStepCompleted) === null || _r === void 0 ? void 0 : _r.call(_q, settings.data.activeScreen.name, accountData);
942
- if (showBoard) {
943
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
944
- return [2, { accountData: accountData }];
945
- }
946
- if (!(scope === SCOPE_AUTH)) return [3, 8];
942
+ if (!(scope === SCOPE_MERCHANT)) return [3, 8];
947
943
  if (!!(leadData === null || leadData === void 0 ? void 0 : leadData.board_id)) return [3, 6];
948
944
  return [4, thunkApi.dispatch(getLeadByIdAsync(leadId)).unwrap()];
949
945
  case 5:
950
- data = (_v.sent()).data;
946
+ data = (_y.sent()).data;
951
947
  leadData = data;
952
- _v.label = 6;
953
- case 6: return [4, thunkApi.dispatch(onCloseComplete({ merchantId: (_s = leadData === null || leadData === void 0 ? void 0 : leadData.merchant) === null || _s === void 0 ? void 0 : _s.id, brandId: (_t = leadData === null || leadData === void 0 ? void 0 : leadData.brand) === null || _t === void 0 ? void 0 : _t.id, entityId: (_u = leadData === null || leadData === void 0 ? void 0 : leadData.entity) === null || _u === void 0 ? void 0 : _u.id }))];
948
+ _y.label = 6;
949
+ case 6:
950
+ if (!postURL) return [3, 8];
951
+ return [4, thunkApi.dispatch(onCloseComplete({
952
+ merchantId: (_s = leadData === null || leadData === void 0 ? void 0 : leadData.merchant) === null || _s === void 0 ? void 0 : _s.id,
953
+ brandId: (_t = leadData === null || leadData === void 0 ? void 0 : leadData.brand) === null || _t === void 0 ? void 0 : _t.id,
954
+ entityId: (_u = leadData === null || leadData === void 0 ? void 0 : leadData.entity) === null || _u === void 0 ? void 0 : _u.id,
955
+ nextScreen: showBoard ? 'CONNECT_EXPRESS_PREPARING_DATA_STEP' : ''
956
+ }))];
954
957
  case 7:
955
- _v.sent();
958
+ _y.sent();
956
959
  return [2, { accountData: accountData }];
957
960
  case 8:
961
+ if (showBoard) {
962
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
963
+ return [2, { accountData: accountData }];
964
+ }
965
+ if (!(scope === SCOPE_AUTH)) return [3, 12];
966
+ if (!!(leadData === null || leadData === void 0 ? void 0 : leadData.board_id)) return [3, 10];
967
+ return [4, thunkApi.dispatch(getLeadByIdAsync(leadId)).unwrap()];
968
+ case 9:
969
+ data = (_y.sent()).data;
970
+ leadData = data;
971
+ _y.label = 10;
972
+ case 10: return [4, thunkApi.dispatch(onCloseComplete({ merchantId: (_v = leadData === null || leadData === void 0 ? void 0 : leadData.merchant) === null || _v === void 0 ? void 0 : _v.id, brandId: (_w = leadData === null || leadData === void 0 ? void 0 : leadData.brand) === null || _w === void 0 ? void 0 : _w.id, entityId: (_x = leadData === null || leadData === void 0 ? void 0 : leadData.entity) === null || _x === void 0 ? void 0 : _x.id }))];
973
+ case 11:
974
+ _y.sent();
975
+ return [2, { accountData: accountData }];
976
+ case 12:
958
977
  if (redirectUrl && mode === 'page') {
959
978
  urlQueryStart = redirectUrl.includes('?') ? '&' : '?';
960
979
  window.open("".concat(redirectUrl).concat(urlQueryStart, "authentication_id=").concat(authId, "&bi=").concat(bi), '_self');
@@ -1,19 +1,16 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import Box from '@mui/material/Box';
5
5
  import Icon from '../../../components/Icon';
6
6
  import { ICONS_NAMES } from '../../../constants';
7
- import { useLanguage } from '../../../hooks';
8
7
  var BoxStyled = styled(Box)(function (_a) {
9
8
  var _b;
10
9
  var theme = _a.theme;
11
10
  return (_b = {
12
11
  display: 'flex',
13
- flexDirection: 'column',
14
12
  justifyContent: 'center',
15
- alignItems: 'center',
16
- paddingTop: theme.spacing(5)
13
+ paddingTop: theme.spacing(10)
17
14
  },
18
15
  _b[theme.breakpoints.down('sm')] = {
19
16
  paddingTop: theme.spacing(11)
@@ -23,20 +20,11 @@ var BoxStyled = styled(Box)(function (_a) {
23
20
  var LogoBadgeStyled = styled(Icon)(function (_a) {
24
21
  var theme = _a.theme;
25
22
  return ({
26
- height: theme.spacing(8.875),
27
- width: theme.spacing(8.875)
28
- });
29
- });
30
- var LogoIconStyled = styled(Icon)(function (_a) {
31
- var theme = _a.theme;
32
- return ({
33
- width: theme.spacing(5.875),
34
- height: theme.spacing(3.625),
35
- marginTop: theme.spacing(2.5)
23
+ height: theme.spacing(9.5),
24
+ width: theme.spacing(19.322)
36
25
  });
37
26
  });
38
27
  var LogoBackground = function () {
39
- var isAr = useLanguage().isAr;
40
- return (_jsxs(BoxStyled, { children: [_jsx(LogoBadgeStyled, { src: ICONS_NAMES.TAP_LOGO_EN_ICON }), _jsx(LogoIconStyled, { src: isAr ? ICONS_NAMES.TAP_LOGO_TEXT_AR : ICONS_NAMES.TAP_LOGO_TEXT_EN, alt: 'tap logo' })] }));
28
+ return (_jsx(BoxStyled, { children: _jsx(LogoBadgeStyled, { src: ICONS_NAMES.TAP_LOGO, alt: 'tap logo' }) }));
41
29
  };
42
30
  export default memo(LogoBackground);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.10.11-beta",
3
+ "version": "2.10.13-beta",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",