@tap-payments/auth-jsconnect 2.12.8-development → 2.12.10-development

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.
@@ -10,5 +10,6 @@ declare const fileService: {
10
10
  uploadFile: (data: UploadFileBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any, {}>>;
11
11
  uploadFileInfo: (data: UploadFileBody, config?: AxiosRequestConfig) => Promise<any>;
12
12
  downloadFile: (id: string, name: string, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any, {}>>;
13
+ retrieveFileInfo: (fileId: string) => Promise<any>;
13
14
  };
14
15
  export { fileService };
package/build/api/file.js CHANGED
@@ -29,9 +29,17 @@ var downloadFile = function (id, name, config) {
29
29
  return response;
30
30
  });
31
31
  };
32
+ var retrieveFileInfo = function (fileId) {
33
+ return httpClient({
34
+ method: 'get',
35
+ url: "".concat(ENDPOINT_PATHS.FILES_PATH, "/content?fileId=").concat(fileId),
36
+ responseType: 'blob'
37
+ });
38
+ };
32
39
  var fileService = {
33
40
  uploadFile: uploadFile,
34
41
  uploadFileInfo: uploadFileInfo,
35
- downloadFile: downloadFile
42
+ downloadFile: downloadFile,
43
+ retrieveFileInfo: retrieveFileInfo
36
44
  };
37
45
  export { fileService };
@@ -157,6 +157,7 @@ declare const API: {
157
157
  uploadFile: (data: UploadFileBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
158
158
  uploadFileInfo: (data: UploadFileBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<any>;
159
159
  downloadFile: (id: string, name: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>;
160
+ retrieveFileInfo: (fileId: string) => Promise<any>;
160
161
  };
161
162
  documentService: {
162
163
  updateDocumentInfo: (data: DocumentUpdateBody) => Promise<any>;
@@ -1,7 +1,7 @@
1
1
  var SANDBOX_BASE_URL = 'https://connect-mw.sandbox.tap.company/middleware';
2
2
  var PRODUCTION_BASE_URL = 'https://connect-mw.tap.company/middleware';
3
3
  var PRODUCTION_BASE_URL_SA = 'https://connect-mw.tap.com.sa/middleware';
4
- var PRODUCTION_BASE_URL_SA_DR = 'https://connect-mw.tap.com.sa/middleware';
4
+ var PRODUCTION_BASE_URL_SA_DR = 'https://connect-mw-tmp.tap.com.sa/middleware';
5
5
  var DEV_BASE_URL = 'https://connect-mw.dev.tap.company/middleware';
6
6
  var API_BUSINESS_COUNTRIES = 'https://godata.sandbox.tap.company/api/v1/business/country/list';
7
7
  var API_COUNTRIES = 'https://utilities.tap.company/api/v1/country/list';
@@ -818,7 +818,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
818
818
  documentsList.push({ type: DocumentPurpose.CUSTOMER_SIGNATURE, images: signatureFileId });
819
819
  if (!(documentsList.length > 0)) return [3, 6];
820
820
  documentBody = {
821
- individual_type_id: ((ids === null || ids === void 0 ? void 0 : ids.length) ? ids.find(function (i) { return i.includes('usr_'); }) : id) || '',
821
+ individual_type_id: ((ids === null || ids === void 0 ? void 0 : ids.length) ? ids[0] : id) || '',
822
822
  country: businessCountry.iso2,
823
823
  documents: documentsList
824
824
  };
@@ -40,6 +40,9 @@ export declare const linkNewTerminal: import("@reduxjs/toolkit").AsyncThunk<{
40
40
  export declare const retrievePOSDevices: import("@reduxjs/toolkit").AsyncThunk<{
41
41
  data: any;
42
42
  }, void, {}>;
43
+ export declare const retrieveTerminalPlatformBrandLogo: import("@reduxjs/toolkit").AsyncThunk<{
44
+ logo: string;
45
+ }, void, {}>;
43
46
  interface pushNotificationLinkNewTerminalParams {
44
47
  newTerminal: boolean;
45
48
  onSuccess: () => void;
@@ -51,7 +51,7 @@ import { handleCurrentActiveScreen, handlePublicKey, handleSetCountryByIso2, onC
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { CONNECT_FLOWS, NAFATH_PACI_TIMEOUT_DURATION, SELECTED_POS_DEFAULT_INFO, SELECTED_TERMINAL_DEFAULT_INFO, TERMINAL_PUSH_NOTIFICATION_DURATION, TERMINAL_PUSH_NOTIFICATION_FAILED, TERMINAL_STEP_NAMES } from '../../../constants';
53
53
  import API, { setAuthSessionToGlobalHeaders } from '../../../api';
54
- import { isAuthenticationVerificationFailed, isNetworkError, isNoDataFoundError, isTimeoutError, retrieveIndividualData, sleep } from '../../../utils';
54
+ import { createImageObjectURL, isAuthenticationVerificationFailed, isNetworkError, isNoDataFoundError, isTimeoutError, retrieveIndividualData, sleep } from '../../../utils';
55
55
  export var verifyToken = createAsyncThunk('terminal/verifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
@@ -262,6 +262,25 @@ export var retrievePOSDevices = createAsyncThunk('terminal/retrievePOSDevices',
262
262
  }
263
263
  });
264
264
  }); });
265
+ export var retrieveTerminalPlatformBrandLogo = createAsyncThunk('terminal/retrieveTerminalPlatformBrandLogo', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
266
+ var terminal, list, logoFileId, data, logo;
267
+ var _a, _b, _c, _d, _e, _f;
268
+ return __generator(this, function (_g) {
269
+ switch (_g.label) {
270
+ case 0:
271
+ terminal = thunkApi.getState().terminal;
272
+ list = (_c = (_b = (_a = terminal.data.responseData) === null || _a === void 0 ? void 0 : _a.terminalData) === null || _b === void 0 ? void 0 : _b.list) !== null && _c !== void 0 ? _c : [];
273
+ logoFileId = (_f = (_e = (_d = list === null || list === void 0 ? void 0 : list[0]) === null || _d === void 0 ? void 0 : _d.platform) === null || _e === void 0 ? void 0 : _e.brand) === null || _f === void 0 ? void 0 : _f.logo;
274
+ if (!logoFileId)
275
+ return [2, { logo: '' }];
276
+ return [4, API.fileService.retrieveFileInfo(logoFileId)];
277
+ case 1:
278
+ data = _g.sent();
279
+ logo = createImageObjectURL(data);
280
+ return [2, { logo: logo }];
281
+ }
282
+ });
283
+ }); });
265
284
  export var pushNotificationLinkNewTerminal = createAsyncThunk('terminal/pushNotificationLinkNewTerminal', function (_a, thunkApi) {
266
285
  var newTerminal = _a.newTerminal, onSuccess = _a.onSuccess, onFailure = _a.onFailure;
267
286
  return __awaiter(void 0, void 0, void 0, function () {
@@ -655,6 +674,20 @@ export var terminalSlice = createSlice({
655
674
  .addCase(retrievePOSDevices.pending, function (state) {
656
675
  state.posDevicesLoading = true;
657
676
  state.error = null;
677
+ })
678
+ .addCase(retrieveTerminalPlatformBrandLogo.pending, function (state) {
679
+ state.error = null;
680
+ })
681
+ .addCase(retrieveTerminalPlatformBrandLogo.fulfilled, function (state, action) {
682
+ var _a;
683
+ state.error = null;
684
+ var prevLogo = (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.terminalPlatformBrandLogo;
685
+ if (prevLogo)
686
+ URL.revokeObjectURL(prevLogo);
687
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { terminalPlatformBrandLogo: action.payload.logo });
688
+ })
689
+ .addCase(retrieveTerminalPlatformBrandLogo.rejected, function (state) {
690
+ state.error = null;
658
691
  })
659
692
  .addCase(retrieveTerminalList.pending, function (state) {
660
693
  state.error = null;
@@ -56,7 +56,7 @@ import Button from '../../../../components/Button';
56
56
  import Loader from '../../../../components/Loader';
57
57
  import Warning from '../../../../components/Warning';
58
58
  import Box from '@mui/material/Box';
59
- import { clearError, resetTerminalLinkResponse, retrieveBoardDetails, retrieveBoardStatus, retrievePOSDevices, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
59
+ import { clearError, resetTerminalLinkResponse, retrieveBoardDetails, retrieveBoardStatus, retrievePOSDevices, retrieveTerminalPlatformBrandLogo, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
60
60
  import { Header, Container, TextTypography } from '../shared';
61
61
  import DeviceList from './DeviceList';
62
62
  var TerminalDeviceList = function () {
@@ -100,6 +100,7 @@ var TerminalDeviceList = function () {
100
100
  _a.label = 1;
101
101
  case 1:
102
102
  _a.trys.push([1, 3, , 4]);
103
+ dispatch(retrieveTerminalPlatformBrandLogo());
103
104
  return [4, dispatch(retrievePOSDevices()).unwrap()];
104
105
  case 2:
105
106
  _a.sent();
@@ -9,14 +9,14 @@ import { useAppSelector } from '../../../../hooks';
9
9
  import { terminalSelector } from '../../../../features/app/terminal/terminalStore';
10
10
  import { useTheme } from '@mui/material/styles';
11
11
  var POSDeviceList = function (_a) {
12
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
13
- var posDevices = _a.posDevices, onClick = _a.onClick, selectedPOS = _a.selectedPOS, _m = _a.select, select = _m === void 0 ? true : _m, loading = _a.loading;
12
+ var _b, _c, _d, _e, _f, _g;
13
+ var posDevices = _a.posDevices, onClick = _a.onClick, selectedPOS = _a.selectedPOS, _h = _a.select, select = _h === void 0 ? true : _h, loading = _a.loading;
14
14
  var t = useTranslation().t;
15
15
  var typography = useTheme().typography;
16
16
  var responseData = useAppSelector(terminalSelector).data.responseData;
17
- var terminalData = (responseData || {}).terminalData;
18
- var platformImage = ((_e = (_d = (_c = (_b = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.platform) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.logo) || ICONS_NAMES.platform_image;
19
- var platformName = (_l = (_k = (_j = (_h = (_g = (_f = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.platform) === null || _h === void 0 ? void 0 : _h.brand) === null || _j === void 0 ? void 0 : _j.name) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.text;
17
+ var _j = responseData || {}, terminalData = _j.terminalData, terminalPlatformBrandLogo = _j.terminalPlatformBrandLogo;
18
+ var platformImage = terminalPlatformBrandLogo || ICONS_NAMES.platform_image;
19
+ var platformName = (_g = (_f = (_e = (_d = (_c = (_b = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.platform) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.name) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.text;
20
20
  var getEndComponent = function (pos) {
21
21
  if (loading && (selectedPOS === null || selectedPOS === void 0 ? void 0 : selectedPOS.id) === (pos === null || pos === void 0 ? void 0 : pos.id))
22
22
  return _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 10, style: { height: 24, width: 24 }, toggleAnimation: !!loading });
@@ -0,0 +1 @@
1
+ export declare const createImageObjectURL: (blob: Blob) => string;
@@ -0,0 +1,6 @@
1
+ export var createImageObjectURL = function (blob) {
2
+ var _a;
3
+ if (!(blob === null || blob === void 0 ? void 0 : blob.size) || !((_a = blob === null || blob === void 0 ? void 0 : blob.type) === null || _a === void 0 ? void 0 : _a.startsWith('image/')))
4
+ return '';
5
+ return URL.createObjectURL(blob);
6
+ };
@@ -8,6 +8,7 @@ export * from './string';
8
8
  export * from './device';
9
9
  export * from './rsa';
10
10
  export * from './common';
11
+ export * from './file';
11
12
  export * from './date';
12
13
  export * from './error';
13
14
  export * from './gtm';
@@ -8,6 +8,7 @@ export * from './string';
8
8
  export * from './device';
9
9
  export * from './rsa';
10
10
  export * from './common';
11
+ export * from './file';
11
12
  export * from './date';
12
13
  export * from './error';
13
14
  export * from './gtm';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.12.8-development",
3
+ "version": "2.12.10-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",