@tap-payments/auth-jsconnect 2.6.84-test → 2.6.86-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.
@@ -11,6 +11,7 @@ export declare type CreateAccountBody = {
11
11
  export declare type ExpressCreateAccountBody = {
12
12
  post_url: string;
13
13
  lead_id: string;
14
+ platforms?: string[];
14
15
  };
15
16
  declare const accountService: {
16
17
  createAccount: (data: CreateAccountBody) => Promise<any>;
@@ -116,6 +116,7 @@ export declare type RemoveEntityActivity = {
116
116
  };
117
117
  export declare type MerchantListBody = {
118
118
  business_entity_id: string;
119
+ brand_id: string;
119
120
  create_if_not_present: boolean;
120
121
  platforms?: Array<string>;
121
122
  };
@@ -53,7 +53,7 @@ import i18n from '../i18n';
53
53
  import { updateLocale } from '../utils/locale';
54
54
  import API, { getAxiosHeaders, setAxiosGlobalHeaders } from '../api';
55
55
  export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var settings, _a, appConfig, language, _b, client, device, os, disableLocale, maturity, disableCountries, configToken, onVerifyConfigTokenSuccess, _c, visitorId, locale, configInfo, matureData, lang, initPayload, _d, country_list, ip_info, merchant, operator, config, list, _e, ip, latitude, longitude, country_code, domain, language_1, country, scope, public_key, maturity_1, board_maturity, post, platform_redirect_url, data, lead_id, platforms, deviceInfo, isValidOperator, countries, countryCode, businessCountry, ipCountry;
56
+ var settings, _a, appConfig, language, _b, client, device, os, disableLocale, maturity, disableCountries, configToken, onVerifyConfigTokenSuccess, _c, visitorId, locale, configInfo, matureData, lang, initPayload, _d, country_list, ip_info, merchant, operator, config, list, _e, ip, latitude, longitude, country_code, domain, language_1, country, scope, public_key, mature, board_maturity, post, platform_redirect_url, data, lead_id, platforms, deviceInfo, isValidOperator, countries, countryCode, businessCountry, ipCountry;
57
57
  return __generator(this, function (_f) {
58
58
  switch (_f.label) {
59
59
  case 0:
@@ -81,10 +81,10 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
81
81
  list = (country_list || { list: [] }).list;
82
82
  _e = ip_info || {}, ip = _e.ip, latitude = _e.latitude, longitude = _e.longitude, country_code = _e.country_code;
83
83
  if (config) {
84
- domain = config.domain, language_1 = config.language, country = config.country, scope = config.scope, public_key = config.public_key, maturity_1 = config.maturity, board_maturity = config.board_maturity, post = config.post, platform_redirect_url = config.platform_redirect_url, data = config.data, lead_id = config.lead_id, platforms = config.platforms;
84
+ domain = config.domain, language_1 = config.language, country = config.country, scope = config.scope, public_key = config.public_key, mature = config.maturity, board_maturity = config.board_maturity, post = config.post, platform_redirect_url = config.platform_redirect_url, data = config.data, lead_id = config.lead_id, platforms = config.platforms;
85
85
  configInfo = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, configInfo), (domain && { merchantDomain: domain })), (language_1 && { language: language_1 })), (country && { businessCountryCode: country })), (scope && { scope: scope })), (public_key && { publicKey: public_key })), ((post === null || post === void 0 ? void 0 : post.url) && { postURL: post === null || post === void 0 ? void 0 : post.url })), (platform_redirect_url && { redirectUrl: platform_redirect_url })), (data && { data: data })), (lead_id && { leadId: lead_id })), (platforms && { platforms: platforms }));
86
- if (typeof maturity_1 === 'boolean')
87
- matureData = maturity_1 ? 'full' : 'express';
86
+ if (typeof mature === 'boolean')
87
+ matureData = mature ? 'full' : 'express';
88
88
  thunkApi.dispatch(handleSetAppConfig(configInfo));
89
89
  thunkApi.dispatch(handleLanguage(language_1 || lang));
90
90
  if (public_key) {
@@ -96,7 +96,7 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
96
96
  if (typeof board_maturity === 'boolean')
97
97
  thunkApi.dispatch(handelBoardMaturity(board_maturity));
98
98
  onVerifyConfigTokenSuccess === null || onVerifyConfigTokenSuccess === void 0 ? void 0 : onVerifyConfigTokenSuccess(config);
99
- if (matureData === 'express' && maturity_1 !== matureData && typeof configInfo.onMaturityChanged === 'function') {
99
+ if (matureData === 'express' && maturity !== matureData && typeof configInfo.onMaturityChanged === 'function') {
100
100
  configInfo.onMaturityChanged(matureData);
101
101
  }
102
102
  }
@@ -35,7 +35,10 @@ export declare const checkAccountAvailability: import("@reduxjs/toolkit").AsyncT
35
35
  brandList: any;
36
36
  entityList: any;
37
37
  }, void, {}>;
38
- export declare const getMerchantList: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
38
+ export declare const getMerchantList: import("@reduxjs/toolkit").AsyncThunk<any, {
39
+ entityId: string;
40
+ brandId: string;
41
+ }, {}>;
39
42
  export declare const confirmInfo: import("@reduxjs/toolkit").AsyncThunk<void, AuthenticationListFormValues & {
40
43
  authId?: string | undefined;
41
44
  }, {}>;
@@ -437,14 +437,15 @@ export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailab
437
437
  }
438
438
  });
439
439
  }); });
440
- export var getMerchantList = createAsyncThunk('auth/getMerchantList', function (entityId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
440
+ export var getMerchantList = createAsyncThunk('auth/getMerchantList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
441
441
  var settings, payload, merchants;
442
442
  return __generator(this, function (_a) {
443
443
  switch (_a.label) {
444
444
  case 0:
445
445
  settings = thunkApi.getState().settings;
446
446
  payload = {
447
- business_entity_id: entityId,
447
+ business_entity_id: params.entityId,
448
+ brand_id: params.brandId,
448
449
  create_if_not_present: true,
449
450
  platforms: settings.data.appConfig.platforms
450
451
  };
@@ -24,7 +24,10 @@ export declare const retrieveAuthenticationListAsync: import("@reduxjs/toolkit")
24
24
  }, {
25
25
  individualId: string;
26
26
  }, {}>;
27
- export declare const getMerchantListAsync: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
27
+ export declare const getMerchantListAsync: import("@reduxjs/toolkit").AsyncThunk<any, {
28
+ entityId: string;
29
+ brandId: string;
30
+ }, {}>;
28
31
  export declare const createMobileAuthAsync: import("@reduxjs/toolkit").AsyncThunk<{
29
32
  response: any;
30
33
  formData: MobileFormValues;
@@ -213,14 +213,15 @@ export var retrieveAuthenticationListAsync = createAsyncThunk('connectExpress/re
213
213
  });
214
214
  });
215
215
  });
216
- export var getMerchantListAsync = createAsyncThunk('connectExpress/getMerchantListAsync', function (entityId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
216
+ export var getMerchantListAsync = createAsyncThunk('connectExpress/getMerchantListAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
217
217
  var settings, payload, merchants;
218
218
  return __generator(this, function (_a) {
219
219
  switch (_a.label) {
220
220
  case 0:
221
221
  settings = thunkApi.getState().settings;
222
222
  payload = {
223
- business_entity_id: entityId,
223
+ business_entity_id: params.entityId,
224
+ brand_id: params.brandId,
224
225
  create_if_not_present: true,
225
226
  platforms: settings.data.appConfig.platforms
226
227
  };
@@ -859,7 +860,8 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
859
860
  _c = settings.data.appConfig, postURL = _c.postURL, scope = _c.scope;
860
861
  body = {
861
862
  lead_id: responseData === null || responseData === void 0 ? void 0 : responseData.leadData.id,
862
- post_url: scope === SCOPE_AUTH ? '' : postURL || ''
863
+ post_url: scope === SCOPE_AUTH ? '' : postURL || '',
864
+ platforms: settings.data.appConfig.platforms
863
865
  };
864
866
  return [4, API.accountService.expressCreateAccount(body)];
865
867
  case 1:
@@ -53,6 +53,7 @@ var MerchantList = React.forwardRef(function (_a, ref) {
53
53
  var merchantList = (data.responseData || {}).merchantList;
54
54
  var merchantInfoControl = useController({ control: control, name: 'merchantInfo' });
55
55
  var entityInfo = watch('entityInfo');
56
+ var brandInfo = watch('brandInfo');
56
57
  var merchantValue = merchantInfoControl.field.value;
57
58
  var error = (_b = merchantInfoControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
58
59
  React.useEffect(function () {
@@ -62,24 +63,26 @@ var MerchantList = React.forwardRef(function (_a, ref) {
62
63
  }
63
64
  }, [merchantList]);
64
65
  React.useEffect(function () {
65
- var _a;
66
+ var _a, _b;
66
67
  if (!entityInfo)
67
68
  return;
68
69
  if (merchantLoading)
69
70
  return;
71
+ var brandInfoId = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.id;
70
72
  var entityId = (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 0 ? (_a = merchantList[0]) === null || _a === void 0 ? void 0 : _a.business_entity_id : '';
73
+ var brandId = (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 0 ? (_b = merchantList[0]) === null || _b === void 0 ? void 0 : _b.brand_id : '';
71
74
  var id = (entityInfo || {}).id;
72
75
  if (!id)
73
76
  return;
74
- if (entityId && id && entityId !== id) {
77
+ if ((entityId && id && entityId !== id) || (brandId && brandInfoId && brandId !== brandInfoId)) {
75
78
  setValue('merchantInfo', undefined);
76
- dispatch(getMerchantList(id));
79
+ dispatch(getMerchantList({ entityId: id, brandId: brandInfoId }));
77
80
  return;
78
81
  }
79
82
  if (!(merchantList === null || merchantList === void 0 ? void 0 : merchantList.length)) {
80
- dispatch(getMerchantList(id));
83
+ dispatch(getMerchantList({ entityId: id, brandId: brandInfoId }));
81
84
  }
82
- }, [entityInfo, merchantList]);
85
+ }, [entityInfo, merchantList, brandInfo]);
83
86
  var onOpenMerchantSelect = function (event) {
84
87
  if (readOnly)
85
88
  return;
@@ -53,6 +53,7 @@ var MerchantList = React.forwardRef(function (_a, ref) {
53
53
  var merchantList = (((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}).merchantList;
54
54
  var merchantInfoControl = useController({ control: control, name: 'merchantInfo' });
55
55
  var entityInfo = watch('entityInfo');
56
+ var brandInfo = watch('brandInfo');
56
57
  var merchantValue = merchantInfoControl.field.value;
57
58
  var error = (_c = merchantInfoControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
58
59
  React.useEffect(function () {
@@ -62,24 +63,26 @@ var MerchantList = React.forwardRef(function (_a, ref) {
62
63
  }
63
64
  }, [merchantList]);
64
65
  React.useEffect(function () {
65
- var _a;
66
+ var _a, _b;
66
67
  if (!entityInfo)
67
68
  return;
68
69
  if (merchantLoading)
69
70
  return;
71
+ var brandInfoId = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.id;
70
72
  var entityId = (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 0 ? (_a = merchantList[0]) === null || _a === void 0 ? void 0 : _a.business_entity_id : '';
73
+ var brandId = (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 0 ? (_b = merchantList[0]) === null || _b === void 0 ? void 0 : _b.brand_id : '';
71
74
  var id = (entityInfo || {}).id;
72
75
  if (!id)
73
76
  return;
74
- if (entityId && id && entityId !== id) {
77
+ if ((entityId && id && entityId !== id) || (brandId && brandInfoId && brandId !== brandInfoId)) {
75
78
  setValue('merchantInfo', undefined);
76
- dispatch(getMerchantListAsync(id));
79
+ dispatch(getMerchantListAsync({ entityId: id, brandId: brandInfoId }));
77
80
  return;
78
81
  }
79
82
  if (!(merchantList === null || merchantList === void 0 ? void 0 : merchantList.length)) {
80
- dispatch(getMerchantListAsync(id));
83
+ dispatch(getMerchantListAsync({ entityId: id, brandId: brandInfoId }));
81
84
  }
82
- }, [entityInfo, merchantList]);
85
+ }, [entityInfo, merchantList, brandInfo]);
83
86
  var onOpenMerchantSelect = function (event) {
84
87
  if (readOnly)
85
88
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.6.84-test",
3
+ "version": "2.6.86-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",