@tap-payments/auth-jsconnect 2.1.21-test → 2.1.23-test

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.
@@ -149,7 +149,7 @@ export interface LibConfig extends LibCallbacks {
149
149
  language: LanguageMode;
150
150
  appInfo: AppInfo;
151
151
  businessCountryCode: string;
152
- scope?: string[];
152
+ scope: string;
153
153
  }
154
154
  export interface OSDetails {
155
155
  name: string;
@@ -18,6 +18,8 @@ export declare type CivilID = {
18
18
  country_code: string;
19
19
  };
20
20
  export declare type CreateAuthBody = {
21
+ country: string;
22
+ scope: string;
21
23
  user_credentail: MobileCredential | EmailCredential | IDCredential | CivilID;
22
24
  auth_type?: number;
23
25
  email_url?: string;
@@ -39,7 +41,6 @@ export declare type VerifyAuthBody = {
39
41
  sign_in: boolean;
40
42
  encryption_contract: Array<string>;
41
43
  remember_me?: boolean;
42
- scopes?: Array<string>;
43
44
  };
44
45
  export declare type VerifyOperationAuthBody = {
45
46
  auth_token: string;
@@ -205,7 +205,7 @@ export var settingsSlice = createSlice({
205
205
  state.data.activeScreen = action.payload[0];
206
206
  },
207
207
  handleSetAppConfig: function (state, action) {
208
- var _a = action.payload, appInfo = _a.appInfo, businessCountryCode = _a.businessCountryCode, language = _a.language, onError = _a.onError, onFlowCompleted = _a.onFlowCompleted, publicKey = _a.publicKey, merchantDomain = _a.merchantDomain, open = _a.open;
208
+ var _a = action.payload, appInfo = _a.appInfo, businessCountryCode = _a.businessCountryCode, language = _a.language, onError = _a.onError, onFlowCompleted = _a.onFlowCompleted, publicKey = _a.publicKey, merchantDomain = _a.merchantDomain, open = _a.open, scope = _a.scope;
209
209
  if (!appInfo.name)
210
210
  throw new Error('App name is required');
211
211
  if (!businessCountryCode)
@@ -214,14 +214,16 @@ export var settingsSlice = createSlice({
214
214
  throw new Error('Language is required');
215
215
  if (!publicKey)
216
216
  throw new Error('Public key is required');
217
- if (!onError)
217
+ if (typeof onError !== 'function')
218
218
  throw new Error('On error function is required');
219
- if (!onFlowCompleted)
219
+ if (typeof onFlowCompleted !== 'function')
220
220
  throw new Error('On flow completed function is required');
221
221
  if (!merchantDomain)
222
222
  throw new Error('Merchant domain is required');
223
223
  if (typeof open !== 'boolean')
224
224
  throw new Error('Open is required');
225
+ if (!scope)
226
+ throw new Error('Scope is required');
225
227
  state.data.appConfig = action.payload;
226
228
  },
227
229
  handleSetCountryByIso2: function (state, action) {
@@ -68,7 +68,6 @@ export var verifyAuthOTP = createAsyncThunk('verifyAuthOTPKit', function (params
68
68
  device_token: device_token || '',
69
69
  service_name: service_name || 'ABSHER',
70
70
  sign_in: false,
71
- scopes: settings.data.appConfig.scope || [],
72
71
  terms: auth.data.termAndConditionChecked ? ['general'] : [],
73
72
  encryption_contract: ['data']
74
73
  };
@@ -97,6 +96,8 @@ export var createAuth = createAsyncThunk('authCreateAuth', function (params, thu
97
96
  ? IDENTIFICATION_TYPE.NID
98
97
  : IDENTIFICATION_TYPE.IQAMA;
99
98
  requestBody = {
99
+ country: settings.data.businessCountry.iso2,
100
+ scope: settings.data.appConfig.scope,
100
101
  lang: settings.data.language,
101
102
  lead_id: leadId,
102
103
  user_credentail: {
@@ -134,6 +135,8 @@ export var resendOTP = createAsyncThunk('authResendOTP', function (_, thunkApi)
134
135
  ? IDENTIFICATION_TYPE.NID
135
136
  : IDENTIFICATION_TYPE.IQAMA;
136
137
  requestBody = {
138
+ country: settings.data.businessCountry.iso2,
139
+ scope: settings.data.appConfig.scope,
137
140
  lang: settings.data.language,
138
141
  lead_id: leadId,
139
142
  user_credentail: {
@@ -81,6 +81,8 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
81
81
  case 0:
82
82
  settings = thunkApi.getState().settings;
83
83
  requestBody = {
84
+ country: settings.data.businessCountry.iso2,
85
+ scope: settings.data.appConfig.scope,
84
86
  lang: settings.data.language,
85
87
  user_credentail: {
86
88
  phone: params.mobile || '',
@@ -110,6 +112,8 @@ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (p
110
112
  case 0:
111
113
  settings = thunkApi.getState().settings;
112
114
  requestBody = {
115
+ country: settings.data.businessCountry.iso2,
116
+ scope: settings.data.appConfig.scope,
113
117
  lang: settings.data.language,
114
118
  user_credentail: {
115
119
  identification_id: params.civilId,
@@ -140,6 +144,8 @@ export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (param
140
144
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
141
145
  _b = connect.data.mobileData, mobile = _b.mobile, countryCode = _b.countryCode;
142
146
  requestBody = {
147
+ country: settings.data.businessCountry.iso2,
148
+ scope: settings.data.appConfig.scope,
143
149
  lang: settings.data.language,
144
150
  user_credentail: {
145
151
  phone: mobile || '',
@@ -168,6 +174,8 @@ export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thu
168
174
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
169
175
  _b = connect.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
170
176
  requestBody = {
177
+ country: settings.data.businessCountry.iso2,
178
+ scope: settings.data.appConfig.scope,
171
179
  lang: settings.data.language,
172
180
  user_credentail: {
173
181
  identification_id: nid,
@@ -203,6 +211,8 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
203
211
  settings = thunkApi.getState().settings;
204
212
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
205
213
  requestBody = {
214
+ country: settings.data.businessCountry.iso2,
215
+ scope: settings.data.appConfig.scope,
206
216
  lang: settings.data.language,
207
217
  user_credentail: {
208
218
  identification_id: params.nid,
@@ -250,7 +260,6 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
250
260
  service_name: responseBody === null || responseBody === void 0 ? void 0 : responseBody.service_name,
251
261
  sign_in: responseBody === null || responseBody === void 0 ? void 0 : responseBody.sign_in,
252
262
  remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
253
- scopes: responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes,
254
263
  step_name: stepName,
255
264
  encryption_contract: ['data']
256
265
  };
@@ -64,6 +64,8 @@ export var createMobileAuth = createAsyncThunk('signIn/createMobileAuth', functi
64
64
  case 0:
65
65
  settings = thunkApi.getState().settings;
66
66
  requestBody = {
67
+ country: settings.data.businessCountry.iso2,
68
+ scope: settings.data.appConfig.scope,
67
69
  lang: settings.data.language,
68
70
  user_credentail: {
69
71
  phone: params.mobile || '',
@@ -93,6 +95,8 @@ export var resendOTPMobile = createAsyncThunk('signIn/resendOTPMobile', function
93
95
  _a = thunkApi.getState(), settings = _a.settings, signIn = _a.signIn;
94
96
  authData = signIn.data.auth;
95
97
  requestBody = {
98
+ country: settings.data.businessCountry.iso2,
99
+ scope: settings.data.appConfig.scope,
96
100
  lang: settings.data.language,
97
101
  user_credentail: {
98
102
  phone: authData.mobile || '',
@@ -117,6 +121,8 @@ export var createEmailAuth = createAsyncThunk('signIn/createEmailAuth', function
117
121
  case 0:
118
122
  settings = thunkApi.getState().settings;
119
123
  requestBody = {
124
+ country: settings.data.businessCountry.iso2,
125
+ scope: settings.data.appConfig.scope,
120
126
  lang: settings.data.language,
121
127
  user_credentail: {
122
128
  email: params.email || ''
@@ -144,6 +150,8 @@ export var resendOTPEmail = createAsyncThunk('signIn/resendOTPEmail', function (
144
150
  _a = thunkApi.getState(), settings = _a.settings, signIn = _a.signIn;
145
151
  authData = signIn.data.auth;
146
152
  requestBody = {
153
+ country: settings.data.businessCountry.iso2,
154
+ scope: settings.data.appConfig.scope,
147
155
  lang: settings.data.language,
148
156
  user_credentail: {
149
157
  email: authData.email || ''
@@ -177,7 +185,6 @@ export var verifyAuthOTP = createAsyncThunk('signIn/verifyAuthOTP', function (pa
177
185
  new_user: responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user,
178
186
  sign_in: responseBody === null || responseBody === void 0 ? void 0 : responseBody.sign_in,
179
187
  remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
180
- scopes: responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes,
181
188
  step_name: mobile ? SignIn_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP : SignIn_STEP_NAMES.VERIFY_AUTH_EMAIL_OTP,
182
189
  encryption_contract: ['data']
183
190
  };
@@ -210,7 +217,6 @@ export var verifyAuthPassword = createAsyncThunk('signIn/verifyAuthPassword', fu
210
217
  new_user: responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user,
211
218
  sign_in: responseBody === null || responseBody === void 0 ? void 0 : responseBody.sign_in,
212
219
  remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
213
- scopes: responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes,
214
220
  step_name: mobile ? SignIn_STEP_NAMES.VERIFY_AUTH_MOBILE : SignIn_STEP_NAMES.VERIFY_AUTH_EMAIL,
215
221
  encryption_contract: ['data']
216
222
  };
@@ -53,8 +53,8 @@ import Box from '@mui/material/Box';
53
53
  import Link from '@mui/material/Link';
54
54
  import { ICONS_NAMES } from '../../../constants';
55
55
  import CheckIcon from '@mui/icons-material/Check';
56
- import { useAppDispatch, useLanguage } from '../../../hooks';
57
- import { handleOpen, handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
56
+ import { useAppDispatch, useAppSelector, useLanguage } from '../../../hooks';
57
+ import { handleOpen, handleCurrentActiveScreen, handleNextScreenStep, settingsSelector } from '../../../app/settings';
58
58
  import { getScreenNameBasedOnFlow } from '../../../utils';
59
59
  import API from '../../../api';
60
60
  import Text from '../../../components/Text';
@@ -148,6 +148,7 @@ export default function FlowsButtons(_a) {
148
148
  var _this = this;
149
149
  var buttons = _a.buttons, data = _a.data;
150
150
  var dispatch = useAppDispatch();
151
+ var settingsData = useAppSelector(settingsSelector).data;
151
152
  var flowName = data.flowName, email = data.email, emailUrl = data.emailUrl, brandName = data.brandName;
152
153
  var _b = useState(false), loading = _b[0], setLoading = _b[1];
153
154
  var isAr = useLanguage().isAr;
@@ -176,6 +177,8 @@ export default function FlowsButtons(_a) {
176
177
  case 0:
177
178
  setLoading(true);
178
179
  payload = {
180
+ country: settingsData.businessCountry.iso2,
181
+ scope: settingsData.appConfig.scope,
179
182
  user_credentail: {
180
183
  email: email
181
184
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.21-test",
3
+ "version": "2.1.23-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",