@tap-payments/auth-jsconnect 2.13.7-beta → 2.13.8-beta

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.
@@ -19,8 +19,8 @@ export declare type ExpressCreateAccountBody = {
19
19
  declare const accountService: {
20
20
  createAccount: (data: CreateAccountBody) => Promise<any>;
21
21
  expressCreateAccount: (data: ExpressCreateAccountBody) => Promise<any>;
22
- checkAccountAvailability: (individualId: string) => Promise<any>;
23
- checkAccountAvailabilityStatus: (individualId: string) => Promise<any>;
22
+ checkAccountAvailability: (individualId: string, authSession?: string) => Promise<any>;
23
+ checkAccountAvailabilityStatus: (individualId: string, authSession?: string) => Promise<any>;
24
24
  checkMigrationStatus: (jobId: string) => Promise<any>;
25
25
  };
26
26
  export { accountService };
@@ -1,5 +1,6 @@
1
1
  import { ENDPOINT_PATHS } from '../constants';
2
2
  import { httpClient } from './axios';
3
+ import { getAuthHeaders } from './headers';
3
4
  var createAccount = function (data) {
4
5
  return httpClient({
5
6
  method: 'post',
@@ -14,16 +15,18 @@ var expressCreateAccount = function (data) {
14
15
  data: data
15
16
  });
16
17
  };
17
- var checkAccountAvailability = function (individualId) {
18
+ var checkAccountAvailability = function (individualId, authSession) {
18
19
  return httpClient({
19
20
  method: 'get',
20
- url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(individualId, "/accounts")
21
+ url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(individualId, "/accounts"),
22
+ headers: getAuthHeaders(authSession)
21
23
  });
22
24
  };
23
- var checkAccountAvailabilityStatus = function (individualId) {
25
+ var checkAccountAvailabilityStatus = function (individualId, authSession) {
24
26
  return httpClient({
25
27
  method: 'get',
26
- url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(individualId, "/accounts?data=status")
28
+ url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(individualId, "/accounts?data=status"),
29
+ headers: getAuthHeaders(authSession)
27
30
  });
28
31
  };
29
32
  var checkMigrationStatus = function (jobId) {
@@ -0,0 +1,5 @@
1
+ export declare const getAuthHeaders: (authSession?: string) => {
2
+ st: string;
3
+ } | {
4
+ st?: undefined;
5
+ };
@@ -0,0 +1,3 @@
1
+ export var getAuthHeaders = function (authSession) {
2
+ return authSession ? { st: authSession } : {};
3
+ };
@@ -20,7 +20,7 @@ declare const API: {
20
20
  };
21
21
  operatorService: {
22
22
  validateOperator: (body: ValidateOperatorBody) => Promise<any>;
23
- confirm: (data: ConfirmBody) => Promise<any>;
23
+ confirm: (data: ConfirmBody, authSession?: string) => Promise<any>;
24
24
  };
25
25
  countryService: {
26
26
  getCountries: (disableCountries?: boolean | undefined) => Promise<any> | {
@@ -90,8 +90,8 @@ declare const API: {
90
90
  accountService: {
91
91
  createAccount: (data: CreateAccountBody) => Promise<any>;
92
92
  expressCreateAccount: (data: ExpressCreateAccountBody) => Promise<any>;
93
- checkAccountAvailability: (individualId: string) => Promise<any>;
94
- checkAccountAvailabilityStatus: (individualId: string) => Promise<any>;
93
+ checkAccountAvailability: (individualId: string, authSession?: string | undefined) => Promise<any>;
94
+ checkAccountAvailabilityStatus: (individualId: string, authSession?: string | undefined) => Promise<any>;
95
95
  checkMigrationStatus: (jobId: string) => Promise<any>;
96
96
  };
97
97
  dataService: {
@@ -17,6 +17,6 @@ export declare type ConfirmBody = {
17
17
  };
18
18
  declare const operatorService: {
19
19
  validateOperator: (body: ValidateOperatorBody) => Promise<any>;
20
- confirm: (data: ConfirmBody) => Promise<any>;
20
+ confirm: (data: ConfirmBody, authSession?: string) => Promise<any>;
21
21
  };
22
22
  export { operatorService };
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  };
37
37
  import { ENDPOINT_PATHS } from '../constants';
38
38
  import { httpClient } from './axios';
39
+ import { getAuthHeaders } from './headers';
39
40
  var validateOperator = function (body) { return __awaiter(void 0, void 0, void 0, function () {
40
41
  var data, error_1;
41
42
  return __generator(this, function (_a) {
@@ -59,11 +60,13 @@ var validateOperator = function (body) { return __awaiter(void 0, void 0, void 0
59
60
  }
60
61
  });
61
62
  }); };
62
- var confirm = function (data) {
63
+ var confirm = function (data, authSession) {
64
+ if (authSession === void 0) { authSession = ''; }
63
65
  return httpClient({
64
66
  method: 'post',
65
67
  url: "".concat(ENDPOINT_PATHS.CONNECT, "/confirm"),
66
- data: data
68
+ data: data,
69
+ headers: getAuthHeaders(authSession)
67
70
  });
68
71
  };
69
72
  var operatorService = {
@@ -677,36 +677,36 @@ export var checkMigrationStatus = createAsyncThunk('auth/checkMigrationStatus',
677
677
  });
678
678
  }); });
679
679
  export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailability', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
680
- var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, authId, accountData, _b, step_name, brands, entities, brandList, entityList, isExistingUser;
681
- var _c;
682
- return __generator(this, function (_d) {
683
- switch (_d.label) {
680
+ var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, _b, authId, auth_session, accountData, _c, step_name, brands, entities, brandList, entityList, isExistingUser;
681
+ var _d;
682
+ return __generator(this, function (_e) {
683
+ switch (_e.label) {
684
684
  case 0:
685
685
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
686
686
  authConfigData = settings.data.appConfig.data;
687
687
  authDataHasValue = authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length;
688
688
  isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
689
- data = (_c = auth.data.responseData) === null || _c === void 0 ? void 0 : _c.authResponse;
690
- authId = (data || {}).id;
689
+ data = (_d = auth.data.responseData) === null || _d === void 0 ? void 0 : _d.authResponse;
690
+ _b = data || {}, authId = _b.id, auth_session = _b.auth_session;
691
691
  accountData = undefined;
692
692
  if (!isDataHasIndividualOnly) return [3, 2];
693
- return [4, API.accountService.checkAccountAvailabilityStatus(data === null || data === void 0 ? void 0 : data.individual_id)];
693
+ return [4, API.accountService.checkAccountAvailabilityStatus(data === null || data === void 0 ? void 0 : data.individual_id, auth_session)];
694
694
  case 1:
695
- accountData = _d.sent();
695
+ accountData = _e.sent();
696
696
  return [3, 4];
697
- case 2: return [4, API.accountService.checkAccountAvailability(data === null || data === void 0 ? void 0 : data.individual_id)];
697
+ case 2: return [4, API.accountService.checkAccountAvailability(data === null || data === void 0 ? void 0 : data.individual_id, auth_session)];
698
698
  case 3:
699
- accountData = _d.sent();
700
- _d.label = 4;
699
+ accountData = _e.sent();
700
+ _e.label = 4;
701
701
  case 4:
702
- _b = accountData || {}, step_name = _b.step_name, brands = _b.brands, entities = _b.entities;
702
+ _c = accountData || {}, step_name = _c.step_name, brands = _c.brands, entities = _c.entities;
703
703
  brandList = brands || [];
704
704
  entityList = entities || [];
705
705
  isExistingUser = step_name === 'select_account';
706
706
  if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3, 6];
707
707
  return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
708
708
  case 5:
709
- _d.sent();
709
+ _e.sent();
710
710
  return [2, { brandList: brandList, entityList: entityList }];
711
711
  case 6:
712
712
  if (isExistingUser && authDataHasValue && brandList.length && entityList.length) {
@@ -803,7 +803,7 @@ export var confirmInfo = createAsyncThunk('auth/confirmInfo', function (_a, thun
803
803
  entity_id: (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) || '',
804
804
  data: settings.data.appConfig.data || []
805
805
  };
806
- return [4, API.operatorService.confirm(body)];
806
+ return [4, API.operatorService.confirm(body, authResponse === null || authResponse === void 0 ? void 0 : authResponse.auth_session)];
807
807
  case 1:
808
808
  data = _k.sent();
809
809
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.13.7-beta",
3
+ "version": "2.13.8-beta",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",