@tap-payments/auth-jsconnect 2.9.4-development → 2.9.5-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.
@@ -114,19 +114,21 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('auth/retrieveLeadId
114
114
  });
115
115
  }); });
116
116
  export var createMobileAuth = createAsyncThunk('auth/createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
117
- var _a, settings, auth, requestBody, data;
118
- var _b, _c;
119
- return __generator(this, function (_d) {
120
- switch (_d.label) {
117
+ var _a, settings, auth, isStartWithZero, mobileNumber, requestBody, data;
118
+ var _b, _c, _d;
119
+ return __generator(this, function (_e) {
120
+ switch (_e.label) {
121
121
  case 0:
122
122
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
123
+ isStartWithZero = (_b = params.mobile) === null || _b === void 0 ? void 0 : _b.startsWith('0');
124
+ mobileNumber = isStartWithZero ? params.mobile.slice(1) : params.mobile;
123
125
  requestBody = {
124
126
  country: settings.data.businessCountry.iso2,
125
127
  scope: settings.data.appConfig.scope,
126
128
  lang: settings.data.language,
127
129
  lead_id: auth.data.leadId,
128
130
  user_credentail: {
129
- phone: params.mobile || '',
131
+ phone: mobileNumber || '',
130
132
  code: params.countryCode.idd_prefix.toString()
131
133
  },
132
134
  sign_in: false,
@@ -136,26 +138,29 @@ export var createMobileAuth = createAsyncThunk('auth/createMobileAuth', function
136
138
  };
137
139
  return [4, API.authService.createAuth(requestBody)];
138
140
  case 1:
139
- data = _d.sent();
141
+ data = _e.sent();
140
142
  thunkApi.dispatch(handleNextScreenStep());
141
- (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
143
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody.user_credentail);
142
144
  return [2, { response: data, formData: params }];
143
145
  }
144
146
  });
145
147
  }); });
146
148
  export var resendMobileAuthOTP = createAsyncThunk('auth/resendMobileAuthOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
147
- var _a, settings, auth, requestBody, data;
148
- return __generator(this, function (_b) {
149
- switch (_b.label) {
149
+ var _a, settings, auth, isStartWithZero, mobileNumber, requestBody, data;
150
+ var _b;
151
+ return __generator(this, function (_c) {
152
+ switch (_c.label) {
150
153
  case 0:
151
154
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
155
+ isStartWithZero = (_b = params.mobile) === null || _b === void 0 ? void 0 : _b.startsWith('0');
156
+ mobileNumber = isStartWithZero ? params.mobile.slice(1) : params.mobile;
152
157
  requestBody = {
153
158
  country: settings.data.businessCountry.iso2,
154
159
  scope: settings.data.appConfig.scope,
155
160
  lang: settings.data.language,
156
161
  lead_id: auth.data.leadId,
157
162
  user_credentail: {
158
- phone: params.mobile,
163
+ phone: mobileNumber,
159
164
  code: params.countryCode.idd_prefix.toString()
160
165
  },
161
166
  sign_in: false,
@@ -165,7 +170,7 @@ export var resendMobileAuthOTP = createAsyncThunk('auth/resendMobileAuthOTP', fu
165
170
  };
166
171
  return [4, API.authService.createAuth(requestBody)];
167
172
  case 1:
168
- data = _b.sent();
173
+ data = _c.sent();
169
174
  return [2, { response: data, formData: params }];
170
175
  }
171
176
  });
@@ -91,18 +91,20 @@ export var updateBusinessCountry = createAsyncThunk('connect/updateBusinessCount
91
91
  });
92
92
  }); });
93
93
  export var createMobileAuth = createAsyncThunk('createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
94
- var settings, requestBody, data;
95
- var _a, _b;
96
- return __generator(this, function (_c) {
97
- switch (_c.label) {
94
+ var settings, isStartWithZero, mobileNumber, requestBody, data;
95
+ var _a, _b, _c;
96
+ return __generator(this, function (_d) {
97
+ switch (_d.label) {
98
98
  case 0:
99
99
  settings = thunkApi.getState().settings;
100
+ isStartWithZero = (_a = params.mobile) === null || _a === void 0 ? void 0 : _a.startsWith('0');
101
+ mobileNumber = isStartWithZero ? params.mobile.slice(1) : params.mobile;
100
102
  requestBody = {
101
103
  country: settings.data.businessCountry.iso2,
102
104
  scope: settings.data.appConfig.scope,
103
105
  lang: settings.data.language,
104
106
  user_credentail: {
105
- phone: params.mobile || '',
107
+ phone: mobileNumber || '',
106
108
  code: params.countryCode.idd_prefix.toString()
107
109
  },
108
110
  sign_in: false,
@@ -112,9 +114,9 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
112
114
  };
113
115
  return [4, API.authService.createAuth(requestBody)];
114
116
  case 1:
115
- data = _c.sent();
117
+ data = _d.sent();
116
118
  thunkApi.dispatch(handleNextScreenStep());
117
- (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
119
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
118
120
  return [2, { response: data, formData: params }];
119
121
  }
120
122
  });
@@ -149,18 +151,20 @@ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (p
149
151
  });
150
152
  }); });
151
153
  export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
152
- var _a, settings, connect, _b, mobile, countryCode, requestBody;
154
+ var _a, settings, connect, _b, mobile, countryCode, isStartWithZero, mobileNumber, requestBody;
153
155
  return __generator(this, function (_c) {
154
156
  switch (_c.label) {
155
157
  case 0:
156
158
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
157
159
  _b = connect.data.mobileData, mobile = _b.mobile, countryCode = _b.countryCode;
160
+ isStartWithZero = mobile === null || mobile === void 0 ? void 0 : mobile.startsWith('0');
161
+ mobileNumber = isStartWithZero ? mobile.slice(1) : mobile;
158
162
  requestBody = {
159
163
  country: settings.data.businessCountry.iso2,
160
164
  scope: settings.data.appConfig.scope,
161
165
  lang: settings.data.language,
162
166
  user_credentail: {
163
- phone: mobile || '',
167
+ phone: mobileNumber || '',
164
168
  code: countryCode.idd_prefix.toString()
165
169
  },
166
170
  sign_in: false,
@@ -253,19 +253,21 @@ export var getMerchantListAsync = createAsyncThunk('connectExpress/getMerchantLi
253
253
  });
254
254
  });
255
255
  export var createMobileAuthAsync = createAsyncThunk('connectExpress/createMobileAuthAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
256
- var _a, settings, connectExpress, requestBody, data;
257
- var _b, _c;
258
- return __generator(this, function (_d) {
259
- switch (_d.label) {
256
+ var _a, settings, connectExpress, isStartWithZero, mobileNumber, requestBody, data;
257
+ var _b, _c, _d;
258
+ return __generator(this, function (_e) {
259
+ switch (_e.label) {
260
260
  case 0:
261
261
  _a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
262
+ isStartWithZero = (_b = params.mobile) === null || _b === void 0 ? void 0 : _b.startsWith('0');
263
+ mobileNumber = isStartWithZero ? params.mobile.slice(1) : params.mobile;
262
264
  requestBody = {
263
265
  country: settings.data.businessCountry.iso2,
264
266
  scope: settings.data.appConfig.scope,
265
267
  lang: settings.data.language,
266
268
  lead_id: connectExpress.data.leadId,
267
269
  user_credentail: {
268
- phone: params.mobile,
270
+ phone: mobileNumber,
269
271
  code: params.countryCode.idd_prefix.toString()
270
272
  },
271
273
  sign_in: false,
@@ -275,26 +277,29 @@ export var createMobileAuthAsync = createAsyncThunk('connectExpress/createMobile
275
277
  };
276
278
  return [4, API.authService.createExpressAuth(requestBody)];
277
279
  case 1:
278
- data = _d.sent();
280
+ data = _e.sent();
279
281
  thunkApi.dispatch(handleNextScreenStep());
280
- (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
282
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody.user_credentail);
281
283
  return [2, { response: data, formData: params }];
282
284
  }
283
285
  });
284
286
  }); });
285
287
  export var resendMobileAuthOTP = createAsyncThunk('connectExpress/resendMobileAuthOTPExpress', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
286
- var _a, settings, connectExpress, requestBody, data;
287
- return __generator(this, function (_b) {
288
- switch (_b.label) {
288
+ var _a, settings, connectExpress, isStartWithZero, mobileNumber, requestBody, data;
289
+ var _b;
290
+ return __generator(this, function (_c) {
291
+ switch (_c.label) {
289
292
  case 0:
290
293
  _a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
294
+ isStartWithZero = (_b = params.mobile) === null || _b === void 0 ? void 0 : _b.startsWith('0');
295
+ mobileNumber = isStartWithZero ? params.mobile.slice(1) : params.mobile;
291
296
  requestBody = {
292
297
  country: settings.data.businessCountry.iso2,
293
298
  scope: settings.data.appConfig.scope,
294
299
  lang: settings.data.language,
295
300
  lead_id: connectExpress.data.leadId,
296
301
  user_credentail: {
297
- phone: params.mobile,
302
+ phone: mobileNumber,
298
303
  code: params.countryCode.idd_prefix.toString()
299
304
  },
300
305
  sign_in: false,
@@ -304,7 +309,7 @@ export var resendMobileAuthOTP = createAsyncThunk('connectExpress/resendMobileAu
304
309
  };
305
310
  return [4, API.authService.createExpressAuth(requestBody)];
306
311
  case 1:
307
- data = _b.sent();
312
+ data = _c.sent();
308
313
  return [2, { response: data, formData: params }];
309
314
  }
310
315
  });
@@ -56,19 +56,21 @@ var redirection = function (type) {
56
56
  return handleNextScreenStep('SIGIN_OTP_STEP');
57
57
  };
58
58
  export var createMobileAuth = createAsyncThunk('signIn/createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
59
- var settings, requestBody, data;
60
- var _a, _b, _c, _d;
61
- return __generator(this, function (_e) {
62
- switch (_e.label) {
59
+ var settings, isStartWithZero, mobileNumber, requestBody, data;
60
+ var _a, _b, _c, _d, _e;
61
+ return __generator(this, function (_f) {
62
+ switch (_f.label) {
63
63
  case 0:
64
64
  settings = thunkApi.getState().settings;
65
+ isStartWithZero = (_a = params.mobile) === null || _a === void 0 ? void 0 : _a.startsWith('0');
66
+ mobileNumber = isStartWithZero ? params.mobile.slice(1) : params.mobile;
65
67
  requestBody = {
66
68
  country: settings.data.businessCountry.iso2,
67
69
  scope: settings.data.appConfig.scope,
68
70
  lang: settings.data.language,
69
71
  user_credentail: {
70
- phone: params.mobile || '',
71
- code: (_b = (_a = params.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) === null || _b === void 0 ? void 0 : _b.toString()
72
+ phone: mobileNumber || '',
73
+ code: (_c = (_b = params.countryCode) === null || _b === void 0 ? void 0 : _b.idd_prefix) === null || _c === void 0 ? void 0 : _c.toString()
72
74
  },
73
75
  sign_in: true,
74
76
  step_name: SignIn_STEP_NAMES.CREATE_AUTH_MOBILE,
@@ -76,28 +78,30 @@ export var createMobileAuth = createAsyncThunk('signIn/createMobileAuth', functi
76
78
  };
77
79
  return [4, API.authService.createAuth(requestBody)];
78
80
  case 1:
79
- data = _e.sent();
81
+ data = _f.sent();
80
82
  thunkApi.dispatch(redirection(data === null || data === void 0 ? void 0 : data.auth_type));
81
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody.user_credentail);
83
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody.user_credentail);
82
84
  return [2, { data: data, formData: params }];
83
85
  }
84
86
  });
85
87
  }); });
86
88
  export var resendOTPMobile = createAsyncThunk('signIn/resendOTPMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
87
- var _a, settings, signIn, authData, requestBody, data;
88
- var _b, _c;
89
- return __generator(this, function (_d) {
90
- switch (_d.label) {
89
+ var _a, settings, signIn, authData, isStartWithZero, mobileNumber, requestBody, data;
90
+ var _b, _c, _d, _e;
91
+ return __generator(this, function (_f) {
92
+ switch (_f.label) {
91
93
  case 0:
92
94
  _a = thunkApi.getState(), settings = _a.settings, signIn = _a.signIn;
93
95
  authData = signIn.data.auth;
96
+ isStartWithZero = (_b = authData.mobile) === null || _b === void 0 ? void 0 : _b.startsWith('0');
97
+ mobileNumber = isStartWithZero ? (_c = authData.mobile) === null || _c === void 0 ? void 0 : _c.slice(1) : authData.mobile;
94
98
  requestBody = {
95
99
  country: settings.data.businessCountry.iso2,
96
100
  scope: settings.data.appConfig.scope,
97
101
  lang: settings.data.language,
98
102
  user_credentail: {
99
- phone: authData.mobile || '',
100
- code: ((_c = (_b = authData.countryCode) === null || _b === void 0 ? void 0 : _b.idd_prefix) === null || _c === void 0 ? void 0 : _c.toString()) || ''
103
+ phone: mobileNumber || '',
104
+ code: ((_e = (_d = authData.countryCode) === null || _d === void 0 ? void 0 : _d.idd_prefix) === null || _e === void 0 ? void 0 : _e.toString()) || ''
101
105
  },
102
106
  sign_in: true,
103
107
  step_name: SignIn_STEP_NAMES.CREATE_AUTH_MOBILE,
@@ -105,7 +109,7 @@ export var resendOTPMobile = createAsyncThunk('signIn/resendOTPMobile', function
105
109
  };
106
110
  return [4, API.authService.createAuth(requestBody)];
107
111
  case 1:
108
- data = _d.sent();
112
+ data = _f.sent();
109
113
  return [2, data];
110
114
  }
111
115
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.9.4-development",
3
+ "version": "2.9.5-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",