@tap-payments/auth-jsconnect 2.11.18-development → 2.11.19-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.
@@ -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
+ };
@@ -21,7 +21,7 @@ declare const API: {
21
21
  };
22
22
  operatorService: {
23
23
  validateOperator: (body: ValidateOperatorBody) => Promise<any>;
24
- confirm: (data: ConfirmBody) => Promise<any>;
24
+ confirm: (data: ConfirmBody, authSession?: string) => Promise<any>;
25
25
  };
26
26
  countryService: {
27
27
  getCountries: (disableCountries?: boolean | undefined) => Promise<any> | {
@@ -91,8 +91,8 @@ declare const API: {
91
91
  accountService: {
92
92
  createAccount: (data: CreateAccountBody) => Promise<any>;
93
93
  expressCreateAccount: (data: ExpressCreateAccountBody) => Promise<any>;
94
- checkAccountAvailability: (individualId: string) => Promise<any>;
95
- checkAccountAvailabilityStatus: (individualId: string) => Promise<any>;
94
+ checkAccountAvailability: (individualId: string, authSession?: string | undefined) => Promise<any>;
95
+ checkAccountAvailabilityStatus: (individualId: string, authSession?: string | undefined) => Promise<any>;
96
96
  checkMigrationStatus: (jobId: string) => Promise<any>;
97
97
  };
98
98
  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 = {
@@ -681,36 +681,36 @@ export var checkMigrationStatus = createAsyncThunk('auth/checkMigrationStatus',
681
681
  });
682
682
  }); });
683
683
  export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailability', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
684
- var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, authId, accountData, _b, step_name, brands, entities, brandList, entityList, isExistingUser;
685
- var _c;
686
- return __generator(this, function (_d) {
687
- switch (_d.label) {
684
+ var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, _b, authId, auth_session, accountData, _c, step_name, brands, entities, brandList, entityList, isExistingUser;
685
+ var _d;
686
+ return __generator(this, function (_e) {
687
+ switch (_e.label) {
688
688
  case 0:
689
689
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
690
690
  authConfigData = settings.data.appConfig.data;
691
691
  authDataHasValue = authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length;
692
692
  isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
693
- data = (_c = auth.data.responseData) === null || _c === void 0 ? void 0 : _c.authResponse;
694
- authId = (data || {}).id;
693
+ data = (_d = auth.data.responseData) === null || _d === void 0 ? void 0 : _d.authResponse;
694
+ _b = data || {}, authId = _b.id, auth_session = _b.auth_session;
695
695
  accountData = undefined;
696
696
  if (!isDataHasIndividualOnly) return [3, 2];
697
- return [4, API.accountService.checkAccountAvailabilityStatus(data === null || data === void 0 ? void 0 : data.individual_id)];
697
+ return [4, API.accountService.checkAccountAvailabilityStatus(data === null || data === void 0 ? void 0 : data.individual_id, auth_session)];
698
698
  case 1:
699
- accountData = _d.sent();
699
+ accountData = _e.sent();
700
700
  return [3, 4];
701
- case 2: return [4, API.accountService.checkAccountAvailability(data === null || data === void 0 ? void 0 : data.individual_id)];
701
+ case 2: return [4, API.accountService.checkAccountAvailability(data === null || data === void 0 ? void 0 : data.individual_id, auth_session)];
702
702
  case 3:
703
- accountData = _d.sent();
704
- _d.label = 4;
703
+ accountData = _e.sent();
704
+ _e.label = 4;
705
705
  case 4:
706
- _b = accountData || {}, step_name = _b.step_name, brands = _b.brands, entities = _b.entities;
706
+ _c = accountData || {}, step_name = _c.step_name, brands = _c.brands, entities = _c.entities;
707
707
  brandList = brands || [];
708
708
  entityList = entities || [];
709
709
  isExistingUser = step_name === 'select_account';
710
710
  if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3, 6];
711
711
  return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
712
712
  case 5:
713
- _d.sent();
713
+ _e.sent();
714
714
  return [2, { brandList: brandList, entityList: entityList }];
715
715
  case 6:
716
716
  if (isExistingUser && authDataHasValue && brandList.length && entityList.length) {
@@ -807,7 +807,7 @@ export var confirmInfo = createAsyncThunk('auth/confirmInfo', function (_a, thun
807
807
  entity_id: (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) || '',
808
808
  data: settings.data.appConfig.data || []
809
809
  };
810
- return [4, API.operatorService.confirm(body)];
810
+ return [4, API.operatorService.confirm(body, authResponse === null || authResponse === void 0 ? void 0 : authResponse.auth_session)];
811
811
  case 1:
812
812
  data = _k.sent();
813
813
  (_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.11.18-development",
3
+ "version": "2.11.19-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",