@tap-payments/auth-jsconnect 2.12.0 → 2.12.1

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.
@@ -27,7 +27,7 @@ export declare const verifyTokenOTP: import("@reduxjs/toolkit").AsyncThunk<{
27
27
  export declare const verifyTokenSessionExpired: import("@reduxjs/toolkit").AsyncThunk<{
28
28
  data: any;
29
29
  nextScreen: string;
30
- }, void, {}>;
30
+ }, boolean, {}>;
31
31
  export declare const verifyTokenOTPSessionExpired: import("@reduxjs/toolkit").AsyncThunk<{
32
32
  data: any;
33
33
  formData: OTPFormValues;
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
- import { handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
50
+ import { handleCurrentActiveScreen, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
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';
@@ -171,7 +171,7 @@ export var verifyTokenOTP = createAsyncThunk('terminal/verifyOtp', function (par
171
171
  }
172
172
  });
173
173
  }); });
174
- export var verifyTokenSessionExpired = createAsyncThunk('terminal/verifyTokenSessionExpired', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
174
+ export var verifyTokenSessionExpired = createAsyncThunk('terminal/verifyTokenSessionExpired', function (redirect, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
175
175
  var terminal, payload, data;
176
176
  return __generator(this, function (_a) {
177
177
  switch (_a.label) {
@@ -185,6 +185,8 @@ export var verifyTokenSessionExpired = createAsyncThunk('terminal/verifyTokenSes
185
185
  case 1:
186
186
  data = _a.sent();
187
187
  setAuthSessionToGlobalHeaders(data === null || data === void 0 ? void 0 : data.auth_session);
188
+ if (redirect)
189
+ thunkApi.dispatch(handleCurrentActiveScreen(CONNECT_FLOWS.terminal.otpSessionExpired));
188
190
  return [2, {
189
191
  data: data,
190
192
  nextScreen: CONNECT_FLOWS.terminal.otpSessionExpired
@@ -600,7 +602,7 @@ export var terminalSlice = createSlice({
600
602
  state.error = null;
601
603
  state.loading = false;
602
604
  var data = (action.payload || {}).data;
603
- state.data.responseData = { authData: data };
605
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: data });
604
606
  })
605
607
  .addCase(verifyTokenSessionExpired.rejected, function (state, action) {
606
608
  state.error = action.error.message;
@@ -615,7 +617,7 @@ export var terminalSlice = createSlice({
615
617
  state.error = null;
616
618
  var _a = action.payload, data = _a.data, formData = _a.formData;
617
619
  state.data.otpData = formData;
618
- state.data.responseData = { authData: data };
620
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: data });
619
621
  })
620
622
  .addCase(verifyTokenOTPSessionExpired.rejected, function (state, _a) {
621
623
  var message = _a.error.message;
@@ -43,7 +43,7 @@ var OTPInput = function (_a) {
43
43
  var handleOnResendOTP = function () {
44
44
  if (otpControl.field.value)
45
45
  setValue('otp', '', { shouldValidate: true });
46
- dispatch(verifyTokenSessionExpired());
46
+ dispatch(verifyTokenSessionExpired(false));
47
47
  };
48
48
  var otpValue = otpControl.field.value;
49
49
  return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",