@tap-payments/auth-jsconnect 2.6.8-test → 2.6.10-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.
@@ -220,7 +220,6 @@ export interface LibConfig extends LibCallbacks {
220
220
  redirectUrl?: string;
221
221
  data?: Array<string>;
222
222
  mode?: 'popup' | 'page';
223
- authId?: string;
224
223
  boardMaturity?: boolean;
225
224
  }
226
225
  export interface OSDetails {
@@ -26,6 +26,7 @@ export interface SettingsData {
26
26
  merchant?: MerchantInfo;
27
27
  isMaturityExpress: boolean;
28
28
  isHijri: boolean;
29
+ authId?: string;
29
30
  }
30
31
  export interface SettingsState extends SharedState<SettingsData> {
31
32
  internalLoading: boolean;
@@ -146,13 +146,14 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
146
146
  });
147
147
  }); });
148
148
  export var onCloseComplete = createAsyncThunk('settings/onCloseComplete', function (merchantId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
149
- var settings, _a, postURL, redirectUrl, authId, bi, list, id, body, data, urlQueryStart;
149
+ var settings, _a, appConfig, authId, postURL, redirectUrl, bi, list, id, body, data, urlQueryStart;
150
150
  var _b, _c, _d, _e;
151
151
  return __generator(this, function (_f) {
152
152
  switch (_f.label) {
153
153
  case 0:
154
154
  settings = thunkApi.getState().settings;
155
- _a = settings.data.appConfig, postURL = _a.postURL, redirectUrl = _a.redirectUrl, authId = _a.authId;
155
+ _a = settings.data, appConfig = _a.appConfig, authId = _a.authId;
156
+ postURL = appConfig.postURL, redirectUrl = appConfig.redirectUrl;
156
157
  bi = settings.data.deviceInfo.browser.browser_id;
157
158
  return [4, API.entityService.getTerminalListUsingMerchantId(merchantId)];
158
159
  case 1:
@@ -189,6 +190,7 @@ var initialState = {
189
190
  internalLoading: true,
190
191
  data: {
191
192
  boardMaturity: true,
193
+ authId: '',
192
194
  open: true,
193
195
  isTapOrigin: true,
194
196
  isMaturityExpress: false,
@@ -209,7 +211,7 @@ export var settingsSlice = createSlice({
209
211
  initialState: initialState,
210
212
  reducers: {
211
213
  storeAuthId: function (state, action) {
212
- state.data.appConfig.authId = action.payload;
214
+ state.data.authId = action.payload;
213
215
  },
214
216
  updateInternalLoading: function (state, action) {
215
217
  state.internalLoading = action.payload;
@@ -64,16 +64,16 @@ import { defaultCountry } from '../../../constants';
64
64
  import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA } from '../../../utils';
65
65
  export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retrieveLeadIdentityByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var _a, settings, connectExpress, countryCode, showBoard, data, _b, country_code, contact, phone, status, board_id, board_info_id, isRegistered, _c, boardInfo, boardData, error_1;
67
- var _d, _e;
68
- return __generator(this, function (_f) {
69
- switch (_f.label) {
67
+ var _d, _e, _f, _g;
68
+ return __generator(this, function (_h) {
69
+ switch (_h.label) {
70
70
  case 0:
71
71
  _a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
72
72
  countryCode = settings.data.businessCountry;
73
73
  showBoard = connectExpress.data.showBoard;
74
74
  return [4, API.leadService.retrieveLeadIdentity(leadId)];
75
75
  case 1:
76
- data = _f.sent();
76
+ data = _h.sent();
77
77
  _b = data || {}, country_code = _b.country_code, contact = _b.contact;
78
78
  if (country_code)
79
79
  thunkApi.dispatch(handleSetCountryByIso2(country_code));
@@ -86,8 +86,11 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
86
86
  thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_MOBILE_STEP'));
87
87
  return [2, { data: data, countryCode: countryCode }];
88
88
  }
89
+ if ((_d = data === null || data === void 0 ? void 0 : data.identification) === null || _d === void 0 ? void 0 : _d.authentication_id) {
90
+ thunkApi.dispatch(storeAuthId((_e = data === null || data === void 0 ? void 0 : data.identification) === null || _e === void 0 ? void 0 : _e.authentication_id));
91
+ }
89
92
  if (isRegistered && !showBoard) {
90
- (_e = (_d = settings.data.appConfig).onFlowCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, data);
93
+ (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, data);
91
94
  thunkApi.dispatch(handleOpen(false));
92
95
  return [2, { data: data, countryCode: countryCode }];
93
96
  }
@@ -96,19 +99,19 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
96
99
  return [2, { data: data, countryCode: countryCode }];
97
100
  }
98
101
  if (!(isRegistered && board_id && board_info_id)) return [3, 5];
99
- _f.label = 2;
102
+ _h.label = 2;
100
103
  case 2:
101
- _f.trys.push([2, 4, , 5]);
104
+ _h.trys.push([2, 4, , 5]);
102
105
  return [4, Promise.all([
103
106
  API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id }),
104
107
  API.boardService.retrieveBoardDetails(board_id)
105
108
  ])];
106
109
  case 3:
107
- _c = _f.sent(), boardInfo = _c[0], boardData = _c[1];
110
+ _c = _h.sent(), boardInfo = _c[0], boardData = _c[1];
108
111
  thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP'));
109
112
  return [2, { data: data, countryCode: countryCode, boardInfo: boardInfo, boardData: boardData }];
110
113
  case 4:
111
- error_1 = _f.sent();
114
+ error_1 = _h.sent();
112
115
  thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP'));
113
116
  return [2, { data: data, countryCode: countryCode }];
114
117
  case 5: return [2, { data: data, countryCode: countryCode }];
@@ -720,23 +723,24 @@ export var checkBrandNameAvailabilityAsync = createAsyncThunk('connectExpress/ch
720
723
  });
721
724
  });
722
725
  export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAsync', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
723
- var _a, connectExpress, settings, _b, responseData, showBoard, body, data, _c, boardInfo, boardData;
724
- var _d, _e, _f, _g, _h, _j;
725
- return __generator(this, function (_k) {
726
- switch (_k.label) {
726
+ var _a, connectExpress, settings, _b, responseData, showBoard, _c, postURL, scope, body, data, _d, boardInfo, boardData;
727
+ var _e, _f, _g, _h, _j, _k;
728
+ return __generator(this, function (_l) {
729
+ switch (_l.label) {
727
730
  case 0:
728
731
  _a = thunkApi.getState(), connectExpress = _a.connectExpress, settings = _a.settings;
729
732
  _b = connectExpress.data, responseData = _b.responseData, showBoard = _b.showBoard;
733
+ _c = settings.data.appConfig, postURL = _c.postURL, scope = _c.scope;
730
734
  body = {
731
735
  lead_id: responseData === null || responseData === void 0 ? void 0 : responseData.leadData.id,
732
- post_url: settings.data.appConfig.postURL || ''
736
+ post_url: scope === SCOPE_AUTH ? '' : postURL || ''
733
737
  };
734
738
  return [4, API.accountService.expressCreateAccount(body)];
735
739
  case 1:
736
- data = _k.sent();
737
- (_e = (_d = settings.data.appConfig).onCreated) === null || _e === void 0 ? void 0 : _e.call(_d, data);
738
- (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, data);
739
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, data);
740
+ data = _l.sent();
741
+ (_f = (_e = settings.data.appConfig).onCreated) === null || _f === void 0 ? void 0 : _f.call(_e, data);
742
+ (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, data);
743
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, data);
740
744
  if (!showBoard) return [3, 3];
741
745
  return [4, Promise.all([
742
746
  API.boardService.retrieveBoardInfo({ id: data.board_id, infoId: data.board_info_id }),
@@ -744,7 +748,7 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
744
748
  thunkApi.dispatch(getLeadByIdAsync(data.lead.id)).unwrap()
745
749
  ])];
746
750
  case 2:
747
- _c = _k.sent(), boardInfo = _c[0], boardData = _c[1];
751
+ _d = _l.sent(), boardInfo = _d[0], boardData = _d[1];
748
752
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
749
753
  return [2, { boardInfo: boardInfo, boardData: boardData, account: data }];
750
754
  case 3:
@@ -21,11 +21,10 @@ var SuccessWithFlowButtons = function () {
21
21
  var _a = useAppSelector(bankSelector), data = _a.data, loading = _a.loading;
22
22
  var settingsData = useAppSelector(settingsSelector).data;
23
23
  var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
24
- var redirectUrl = settingsData.appConfig.redirectUrl;
25
24
  var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals;
26
25
  var onClose = function () {
27
26
  dispatch(onCloseCompleteBank());
28
27
  };
29
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication && redirectUrl ? onClose : undefined }));
28
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication ? onClose : undefined }));
30
29
  };
31
30
  export default memo(SuccessWithFlowButtons);
@@ -21,11 +21,10 @@ var SuccessWithFlowButtons = function () {
21
21
  var _a = useAppSelector(brandSelector), data = _a.data, loading = _a.loading;
22
22
  var settingsData = useAppSelector(settingsSelector).data;
23
23
  var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
24
- var redirectUrl = settingsData.appConfig.redirectUrl;
25
24
  var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals;
26
25
  var onClose = function () {
27
26
  dispatch(onCloseCompleteBrand());
28
27
  };
29
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication && redirectUrl ? onClose : undefined }));
28
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication ? onClose : undefined }));
30
29
  };
31
30
  export default memo(SuccessWithFlowButtons);
@@ -22,7 +22,6 @@ var SuccessWithFlowButtons = function () {
22
22
  var settingsData = useAppSelector(settingsSelector).data;
23
23
  var _a = useAppSelector(connectExpressSelector), data = _a.data, loading = _a.loading;
24
24
  var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
25
- var redirectUrl = settingsData.appConfig.redirectUrl;
26
25
  var onClose = function () {
27
26
  dispatch(onCloseCompleteAsync());
28
27
  };
@@ -37,6 +36,6 @@ var SuccessWithFlowButtons = function () {
37
36
  var name = _a.name;
38
37
  return name !== FlowsTypes.PASSWORD;
39
38
  }); }, [flows]);
40
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, bank: bank, loading: loading, boardId: boardId, boardInfoId: boardInfoId, brand: brand, business: business, entity: entity, flows: filteredFlows || [], merchant: merchant, individuals: individualsInfo, user: __assign({ names: { en: name } }, user), onClose: isScopeAuthentication && redirectUrl ? onClose : undefined }));
39
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, bank: bank, loading: loading, boardId: boardId, boardInfoId: boardInfoId, brand: brand, business: business, entity: entity, flows: filteredFlows || [], merchant: merchant, individuals: individualsInfo, user: __assign({ names: { en: name } }, user), onClose: isScopeAuthentication ? onClose : undefined }));
41
40
  };
42
41
  export default memo(SuccessWithFlowButtons);
@@ -21,11 +21,10 @@ var SuccessWithFlowButtons = function () {
21
21
  var _a = useAppSelector(entitySelector), data = _a.data, loading = _a.loading;
22
22
  var settingsData = useAppSelector(settingsSelector).data;
23
23
  var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
24
- var redirectUrl = settingsData.appConfig.redirectUrl;
25
24
  var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals;
26
25
  var onClose = function () {
27
26
  dispatch(onCloseCompleteEntity());
28
27
  };
29
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, individuals: individuals, boardInfoId: board_info_id, flows: flows || [], onClose: isScopeAuthentication && redirectUrl ? onClose : undefined }));
28
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, individuals: individuals, boardInfoId: board_info_id, flows: flows || [], onClose: isScopeAuthentication ? onClose : undefined }));
30
29
  };
31
30
  export default memo(SuccessWithFlowButtons);
@@ -21,11 +21,10 @@ var SuccessWithFlowButtons = function () {
21
21
  var _a = useAppSelector(individualSelector), data = _a.data, loading = _a.loading;
22
22
  var settingsData = useAppSelector(settingsSelector).data;
23
23
  var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
24
- var redirectUrl = settingsData.appConfig.redirectUrl;
25
24
  var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals;
26
25
  var onClose = function () {
27
26
  dispatch(onCloseCompleteIndividual());
28
27
  };
29
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication && redirectUrl ? onClose : undefined }));
28
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication ? onClose : undefined }));
30
29
  };
31
30
  export default memo(SuccessWithFlowButtons);
@@ -21,11 +21,10 @@ var SuccessWithFlowButtons = function () {
21
21
  var _a = useAppSelector(passwordSelector), data = _a.data, loading = _a.loading;
22
22
  var settingsData = useAppSelector(settingsSelector).data;
23
23
  var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
24
- var redirectUrl = settingsData.appConfig.redirectUrl;
25
24
  var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals;
26
25
  var onClose = function () {
27
26
  dispatch(onCloseCompletePassword());
28
27
  };
29
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication && redirectUrl ? onClose : undefined }));
28
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication ? onClose : undefined }));
30
29
  };
31
30
  export default memo(SuccessWithFlowButtons);
@@ -21,11 +21,10 @@ var SuccessWithFlowButtons = function () {
21
21
  var _a = useAppSelector(taxSelector), data = _a.data, loading = _a.loading;
22
22
  var settingsData = useAppSelector(settingsSelector).data;
23
23
  var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
24
- var redirectUrl = settingsData.appConfig.redirectUrl;
25
24
  var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals;
26
25
  var onClose = function () {
27
26
  dispatch(onCloseCompleteTax());
28
27
  };
29
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication && redirectUrl ? onClose : undefined }));
28
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication ? onClose : undefined }));
30
29
  };
31
30
  export default memo(SuccessWithFlowButtons);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.6.8-test",
3
+ "version": "2.6.10-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",