@tap-payments/auth-jsconnect 2.11.11-development → 2.11.11-sandbox

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.
@@ -104,8 +104,8 @@ export interface IndividualPersonalInfoFormValues extends IndividualEmailMobileF
104
104
  gender: string | null;
105
105
  nid: string;
106
106
  issuedCountry: CountryCode | undefined;
107
- expiryDate: string;
108
- dob: string;
107
+ expiryDate: string | undefined;
108
+ dob: string | undefined;
109
109
  placeOfBirthCountry: CountryCode | undefined;
110
110
  placeOfBirthCity: City | undefined;
111
111
  nationality: CountryCode | undefined;
@@ -137,6 +137,7 @@
137
137
  "capital_paid_hint": "00000",
138
138
  "capital_paid_input_label": "رأس المال المدفوع",
139
139
  "capital_paid_label": "رأس المال المدفوع ({{currency}})",
140
+ "capital_paid_input_label": "رأس المال المدفوع",
140
141
  "capital_paid_required": "Please Enter paid amount",
141
142
  "capital_share_count_hint": "00000",
142
143
  "capital_share_count_label": "عدد اسهم رأس المال",
@@ -144,6 +145,7 @@
144
145
  "capital_share_value_hint": "00000",
145
146
  "capital_share_value_input_label": "قيمة السهم",
146
147
  "capital_share_value_label": "قيمة السهم ({{currency}})",
148
+ "capital_share_value_input_label": "قيمة السهم",
147
149
  "capital_share_value_required": "Please Enter share value",
148
150
  "category": "الفئة",
149
151
  "category_name": "اسم الفئة",
@@ -284,6 +286,7 @@
284
286
  "expected_customers_to_serve": "عدد العملاء شهريا",
285
287
  "expected_sale_per_month": "البيع المتوقع في الشهر؟",
286
288
  "expected_sales_monthly": "البيع المتوقع في الشهر؟ ({{currency}})",
289
+ "expected_sale_per_month": "البيع المتوقع في الشهر؟",
287
290
  "expected_sales_yearly": "ما هي المبيعات المتوقعة لعملك شهريًا؟",
288
291
  "expected_served_monthly": "عدد العملاء شهريا",
289
292
  "expiry_date": "تاريخ الإنتهاء",
@@ -493,6 +496,7 @@
493
496
  "please_choose_is_authorized": "الرجاء التأكيد إذا كنت أنت المستخدم المصرح له",
494
497
  "please_choose_relative_pep": "هل أنت أو أحد أقاربك شخص مكشوف علنًا (PEP)",
495
498
  "please_enter_actual_income": "ما هو دخلك الشهري ({{currency}}) ؟ ",
499
+ "monthly_income": "ما هو دخلك الشهري؟ ",
496
500
  "please_enter_employer_name": "يرجى إدخال اسم منشأه العمل الخاص بك",
497
501
  "please_try_again_after_few_minutes": "يمكنك محاولة تسجيل الدخول مرة أخرى بعد {{minutes}} دقيقة",
498
502
  "powered_by": "بواسطة",
@@ -136,6 +136,7 @@
136
136
  "capital_paid_hint": "00000",
137
137
  "capital_paid_input_label": "Capital Paid",
138
138
  "capital_paid_label": "Capital Paid ({{currency}})",
139
+ "capital_paid_input_label": "Capital Paid",
139
140
  "capital_paid_required": "Please Enter paid amount",
140
141
  "capital_share_count_hint": "00000",
141
142
  "capital_share_count_label": "Capital Share Count",
@@ -143,6 +144,7 @@
143
144
  "capital_share_value_hint": "00000",
144
145
  "capital_share_value_input_label": "Capital Share Value",
145
146
  "capital_share_value_label": "Capital Share Value ({{currency}})",
147
+ "capital_share_value_input_label": "Capital Share Value",
146
148
  "capital_share_value_required": "Please Enter share value",
147
149
  "category": "Category",
148
150
  "category_name": "Category name",
@@ -292,6 +294,7 @@
292
294
  "expected_customers_to_serve": "Customers served per month",
293
295
  "expected_sale_per_month": "Expected sale per month?",
294
296
  "expected_sales_monthly": "Expected sale per month? ({{currency}})",
297
+ "expected_sale_per_month": "Expected sale per month?",
295
298
  "expected_sales_yearly": "What is the expected sales for your business per month?",
296
299
  "expected_served_monthly": "Customers served per month",
297
300
  "expiry_date": "Date of expiry",
@@ -509,6 +512,7 @@
509
512
  "please_choose_is_authorized": "Please tell us if you are the authorized user",
510
513
  "please_choose_relative_pep": "Are you or one of your relatives a Publicly Exposed Person (PEP)",
511
514
  "please_enter_actual_income": "Monthly income ({{currency}})",
515
+ "monthly_income": "Monthly income",
512
516
  "please_enter_employer_name": "Please enter the name of your employer",
513
517
  "please_try_again_after_few_minutes": "You can try to login again after {{minutes}} mins",
514
518
  "powered_by": "Powered by",
@@ -33,7 +33,7 @@ var StyledTooltip = styled(function (_a) {
33
33
  var _b;
34
34
  var theme = _a.theme;
35
35
  return (_b = {},
36
- _b["& .".concat(tooltipClasses.tooltip)] = __assign(__assign({ color: alpha(theme.palette.text.primary, 0.5), width: 'fit-content', maxHeight: 'fit-content' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight, backgroundColor: theme.palette.secondary.light, border: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) }),
36
+ _b["& .".concat(tooltipClasses.tooltip)] = __assign(__assign({ color: alpha(theme.palette.text.primary, 0.5), width: 'fit-content', maxHeight: 'fit-content' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight, backgroundColor: theme.palette.secondary.light, border: "1px solid ".concat(alpha(theme.palette.divider, 0.8)), zIndex: 2147483647 }),
37
37
  _b);
38
38
  });
39
39
  var TextStyled = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
@@ -1,7 +1,7 @@
1
1
  var SANDBOX_BASE_URL = 'https://connect-mw.sandbox.tap.company/middleware';
2
2
  var PRODUCTION_BASE_URL = 'https://connect-mw.tap.company/middleware';
3
3
  var PRODUCTION_BASE_URL_SA = 'https://connect-mw.tap.com.sa/middleware';
4
- var PRODUCTION_BASE_URL_SA_DR = 'https://connect-mw-test.tap.com.sa/middleware';
4
+ var PRODUCTION_BASE_URL_SA_DR = 'https://connect-mw.tap.com.sa/middleware';
5
5
  var DEV_BASE_URL = 'https://connect-mw.dev.tap.company/middleware';
6
6
  var API_BUSINESS_COUNTRIES = 'https://godata.sandbox.tap.company/api/v1/business/country/list';
7
7
  var API_COUNTRIES = 'https://utilities.tap.company/api/v1/country/list';
@@ -1,5 +1,6 @@
1
1
  import { ScreenStepNavigation, BusinessType, POSInfo, TerminalInfo } from '../@types';
2
2
  export declare const CONNECT_DEV_URL = "https://connect.dev.tap.company";
3
+ export declare const CONNECT_SANDBOX_URL = "https://connect.sandbox.tap.company";
3
4
  export declare const CONNECT_PROD_URL = "https://connect.tap.company";
4
5
  export declare const CLIENT_ORIGIN: string;
5
6
  export declare const TAP_WEBSITE = "https://www.tap.company/";
@@ -1,6 +1,7 @@
1
1
  import { BusinessType } from '../@types';
2
2
  import { CONNECT_FLOWS } from './flows';
3
3
  export var CONNECT_DEV_URL = 'https://connect.dev.tap.company';
4
+ export var CONNECT_SANDBOX_URL = 'https://connect.sandbox.tap.company';
4
5
  export var CONNECT_PROD_URL = 'https://connect.tap.company';
5
6
  export var CLIENT_ORIGIN = window.location.origin;
6
7
  export var TAP_WEBSITE = 'https://www.tap.company/';
@@ -993,7 +994,7 @@ export var TERMINAL_SCREENS_NAVIGATION = [
993
994
  },
994
995
  {
995
996
  name: CONNECT_FLOWS.terminal.noTerminalLinked,
996
- next: CONNECT_FLOWS.terminal.terminalLinkNew,
997
+ next: CONNECT_FLOWS.terminal.posDeviceList,
997
998
  prev: CONNECT_FLOWS.terminal.board,
998
999
  order: 2
999
1000
  },
@@ -1006,13 +1007,13 @@ export var TERMINAL_SCREENS_NAVIGATION = [
1006
1007
  {
1007
1008
  name: CONNECT_FLOWS.terminal.posDeviceList,
1008
1009
  next: CONNECT_FLOWS.terminal.terminalLinkNew,
1009
- prev: CONNECT_FLOWS.terminal.terminalDeviceList,
1010
+ prev: [CONNECT_FLOWS.terminal.terminalDeviceList, CONNECT_FLOWS.terminal.noTerminalLinked],
1010
1011
  order: 3
1011
1012
  },
1012
1013
  {
1013
1014
  name: CONNECT_FLOWS.terminal.terminalLinkNew,
1014
1015
  next: CONNECT_FLOWS.terminal.terminalLinkedSuccess,
1015
- prev: [CONNECT_FLOWS.terminal.noTerminalLinked, CONNECT_FLOWS.terminal.posDeviceList],
1016
+ prev: CONNECT_FLOWS.terminal.posDeviceList,
1016
1017
  order: 3
1017
1018
  },
1018
1019
  {
@@ -82,14 +82,15 @@ export declare const updateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
82
82
  export declare const skipUpdateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
83
83
  leadResponse: any;
84
84
  }, void, {}>;
85
+ interface EmailCheckProps {
86
+ email: string;
87
+ cancelToken: CancelToken;
88
+ onSuccess?: () => void;
89
+ }
85
90
  export declare const checkEmailAvailability: import("@reduxjs/toolkit").AsyncThunk<{
86
91
  response: any;
87
92
  formData: string;
88
- } | undefined, {
89
- email: string;
90
- cancelToken: CancelToken;
91
- onSuccess?: (() => void) | undefined;
92
- }, {}>;
93
+ } | undefined, EmailCheckProps, {}>;
93
94
  export declare const checkBrandNameAvailability: import("@reduxjs/toolkit").AsyncThunk<{
94
95
  response: any;
95
96
  formData: {
@@ -71,7 +71,7 @@ import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2
71
71
  import { COLLECT_DOB_INFO_NAFATH, CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_BRAND } from '../../../constants';
72
72
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
73
73
  import { AuthForType, FlowsTypes } from '../../../@types';
74
- import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData, isNetworkError, isTimeoutError } from '../../../utils';
74
+ import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData, isNetworkError, isTimeoutError, isInternalServerError } from '../../../utils';
75
75
  export var updateBusinessCountry = createAsyncThunk('connect/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
76
76
  var connect, payload, data;
77
77
  return __generator(this, function (_a) {
@@ -763,23 +763,36 @@ export var skipUpdateLeadMobile = createAsyncThunk('connect/skipUpdateLeadMobile
763
763
  export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', function (_a, thunkApi) {
764
764
  var email = _a.email, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
765
765
  return __awaiter(void 0, void 0, void 0, function () {
766
- var connect, requestBody, data;
767
- var _b, _c;
768
- return __generator(this, function (_d) {
769
- switch (_d.label) {
766
+ var responseBody, requestBody, data, retryData;
767
+ var _b, _c, _d, _e;
768
+ return __generator(this, function (_f) {
769
+ switch (_f.label) {
770
770
  case 0:
771
- connect = thunkApi.getState().connect;
771
+ responseBody = thunkApi.getState().connect.data.otpData.responseBody;
772
772
  requestBody = {
773
773
  email: email,
774
- country: (_c = (_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.leadData) === null || _c === void 0 ? void 0 : _c.country_code,
774
+ country: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.leadData) === null || _b === void 0 ? void 0 : _b.country_code,
775
775
  encryption_contract: ['email']
776
776
  };
777
777
  return [4, API.availabilityServices.checkEmail(requestBody, { cancelToken: cancelToken })];
778
778
  case 1:
779
- data = (_d.sent()).data;
780
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
781
- if (!data.errors)
779
+ data = (_f.sent()).data;
780
+ if (!data.errors) {
781
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
782
782
  return [2, { response: data, formData: email }];
783
+ }
784
+ if (!isInternalServerError((_d = (_c = data.errors) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.error)) {
785
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
786
+ return [2];
787
+ }
788
+ return [4, API.availabilityServices.checkEmail(requestBody, { cancelToken: cancelToken })];
789
+ case 2:
790
+ retryData = (_f.sent()).data;
791
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
792
+ if (!retryData.errors)
793
+ return [2, { response: retryData, formData: email }];
794
+ if (isInternalServerError((_e = retryData.errors) === null || _e === void 0 ? void 0 : _e[0].error))
795
+ return [2, { response: { is_available: true }, formData: email }];
783
796
  return [2];
784
797
  }
785
798
  });
@@ -82,14 +82,15 @@ export declare const verifyNafathIdentityAsync: import("@reduxjs/toolkit").Async
82
82
  isNextScreenIsDob: boolean;
83
83
  }, verifyPACIAsyncParams, {}>;
84
84
  export declare const verifyPaciLeadIdentityAsync: import("@reduxjs/toolkit").AsyncThunk<any, verifyPACIAsyncParams, {}>;
85
+ interface EmailCheckProps {
86
+ email: string;
87
+ cancelToken: CancelToken;
88
+ onSuccess?: () => void;
89
+ }
85
90
  export declare const checkEmailAvailabilityAsync: import("@reduxjs/toolkit").AsyncThunk<{
86
91
  response: any;
87
92
  formData: string;
88
- } | undefined, {
89
- email: string;
90
- cancelToken: CancelToken;
91
- onSuccess?: (() => void) | undefined;
92
- }, {}>;
93
+ } | undefined, EmailCheckProps, {}>;
93
94
  export declare const checkBrandNameAvailabilityAsync: import("@reduxjs/toolkit").AsyncThunk<{
94
95
  response: any;
95
96
  formData: {
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType, LicenseType, AuthForScreen } fro
61
61
  import API from '../../../api';
62
62
  import { ADD_NEW_ENTITY, COLLECT_DOB_INFO_NAFATH, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH, SCOPE_MERCHANT } from '../../../constants';
63
63
  import { defaultCountry } from '../../../constants';
64
- import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError } from '../../../utils';
64
+ import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError, isInternalServerError } from '../../../utils';
65
65
  export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateBusinessCountryAsync', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var connectExpress, payload, data;
67
67
  return __generator(this, function (_a) {
@@ -838,23 +838,36 @@ export var verifyPaciLeadIdentityAsync = createAsyncThunk('connectExpress/verify
838
838
  export var checkEmailAvailabilityAsync = createAsyncThunk('connectExpress/CheckEmailAvailabilityAsync', function (_a, thunkApi) {
839
839
  var email = _a.email, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
840
840
  return __awaiter(void 0, void 0, void 0, function () {
841
- var connectExpress, requestBody, data;
842
- var _b, _c;
843
- return __generator(this, function (_d) {
844
- switch (_d.label) {
841
+ var responseData, requestBody, data, retryData;
842
+ var _b, _c, _d, _e, _f;
843
+ return __generator(this, function (_g) {
844
+ switch (_g.label) {
845
845
  case 0:
846
- connectExpress = thunkApi.getState().connectExpress;
846
+ responseData = thunkApi.getState().connectExpress.data.responseData;
847
847
  requestBody = {
848
848
  email: email,
849
- country: (_c = (_b = connectExpress.data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) === null || _c === void 0 ? void 0 : _c.country_code,
849
+ country: (_b = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _b === void 0 ? void 0 : _b.country_code,
850
850
  encryption_contract: ['email']
851
851
  };
852
852
  return [4, API.availabilityServices.checkEmail(requestBody, { cancelToken: cancelToken })];
853
853
  case 1:
854
- data = (_d.sent()).data;
855
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
856
- if (!data.errors)
854
+ data = (_g.sent()).data;
855
+ if (!data.errors) {
856
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
857
857
  return [2, { response: data, formData: email }];
858
+ }
859
+ if (!isInternalServerError((_d = (_c = data.errors) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.error)) {
860
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
861
+ return [2];
862
+ }
863
+ return [4, API.availabilityServices.checkEmail(requestBody, { cancelToken: cancelToken })];
864
+ case 2:
865
+ retryData = (_g.sent()).data;
866
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
867
+ if (!retryData.errors)
868
+ return [2, { response: retryData, formData: email }];
869
+ if (isInternalServerError((_f = (_e = retryData.errors) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.error))
870
+ return [2, { response: { is_available: true }, formData: email }];
858
871
  return [2];
859
872
  }
860
873
  });
@@ -1929,6 +1942,7 @@ export var connectSlice = createSlice({
1929
1942
  state.loading = false;
1930
1943
  state.error = null;
1931
1944
  state.data.individualData.mobile = action.payload.formData.mobile;
1945
+ state.data.individualData.countryCode = action.payload.formData.countryCode;
1932
1946
  state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.leadResponse, verifyAuthMobile: action.payload.leadResponse });
1933
1947
  state.data.verifyAuthOtpData.authFor = AuthForScreen.MOBILE_OWNERSHIP;
1934
1948
  })
@@ -621,7 +621,8 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
621
621
  expiry: isExpiryNonEditable || !expiryDate ? undefined : new Date(expiryDate).getTime(),
622
622
  type: isIdTypeNonEditable || !identification_id_type ? undefined : identification_id_type
623
623
  }
624
- })), (!isDOBNonEditable && {
624
+ })), (!isDOBNonEditable &&
625
+ dob && {
625
626
  date_of_birth: dob
626
627
  })), (hasBirth &&
627
628
  !(isBirthCityNonEditable && isBirthCountryNonEditable) && {
@@ -911,8 +912,8 @@ var initialState = {
911
912
  gender: IndividualGender.MALE,
912
913
  nid: '',
913
914
  issuedCountry: undefined,
914
- expiryDate: '',
915
- dob: '',
915
+ expiryDate: undefined,
916
+ dob: undefined,
916
917
  placeOfBirthCountry: undefined,
917
918
  placeOfBirthCity: undefined,
918
919
  nationality: undefined
@@ -30,7 +30,7 @@ var LinkedTerminalInfo = function () {
30
30
  var isAr = useLanguage().isAr;
31
31
  var _c = useAppSelector(terminalSelector), error = _c.error, selectedTerminal = _c.data.terminalInfo.selectedTerminal, loading = _c.loading;
32
32
  var terminal_device = selectedTerminal.terminal_device, linked = selectedTerminal.linked, device = selectedTerminal.device;
33
- var _d = (terminal_device.model || {}).image_url, image_url = _d === void 0 ? ICONS_NAMES.device_image : _d;
33
+ var _d = ((terminal_device === null || terminal_device === void 0 ? void 0 : terminal_device.model) || {}).image_url, image_url = _d === void 0 ? ICONS_NAMES.device_image : _d;
34
34
  var deviceName = (device === null || device === void 0 ? void 0 : device.display_name) || '';
35
35
  var deviceImage = (device === null || device === void 0 ? void 0 : device.logo) || ICONS_NAMES.platform_image;
36
36
  var deviceId = (device === null || device === void 0 ? void 0 : device.reference) || (device === null || device === void 0 ? void 0 : device.id) || '';
@@ -9,32 +9,77 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
12
48
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
49
  import * as React from 'react';
14
50
  import { useTranslation } from 'react-i18next';
15
51
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
16
52
  import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
17
- import Button from '../../../../components/Button';
18
- import Loader from '../../../../components/Loader';
19
53
  import { ICONS_NAMES } from '../../../../constants';
20
54
  import { ScreenContainer } from '../../../shared/Containers';
21
- import { linkNewTerminal, retrieveBoardDetails, retrieveBoardStatus, terminalSelector } from '../../../app/terminal/terminalStore';
55
+ import { retrieveBoardDetails, retrieveBoardStatus, retrievePOSDevices, terminalSelector } from '../../../app/terminal/terminalStore';
22
56
  import { DescriptionTypography, DeviceImage, NoTerminalDeviceLinkedContainer, TitleTypography } from './styles';
57
+ import Button from '../../../../features/shared/Button';
23
58
  var NoTerminalDeviceLinked = function () {
24
59
  var t = useTranslation().t;
25
60
  var isAr = useLanguage().isAr;
26
61
  var dispatch = useAppDispatch();
27
- var _a = useAppSelector(terminalSelector), loading = _a.loading, data = _a.data;
62
+ var _a = useAppSelector(terminalSelector), posDevicesLoading = _a.posDevicesLoading, data = _a.data;
28
63
  var _b = data.responseData || {}, boardFlows = _b.boardFlows, authData = _b.authData, boardData = _b.boardData;
29
- var handleOnClickNewTerminalLink = function () {
30
- dispatch(linkNewTerminal())
31
- .unwrap()
32
- .then(function (_a) {
33
- var nextScreen = _a.nextScreen;
34
- dispatch(handleNextScreenStep(nextScreen));
35
- })
36
- .catch(function () { });
37
- };
64
+ var handleOnClickNewTerminalLink = function () { return __awaiter(void 0, void 0, void 0, function () {
65
+ var err_1;
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0:
69
+ _a.trys.push([0, 2, , 3]);
70
+ return [4, dispatch(retrievePOSDevices()).unwrap()];
71
+ case 1:
72
+ _a.sent();
73
+ dispatch(handleNextScreenStep());
74
+ return [3, 3];
75
+ case 2:
76
+ err_1 = _a.sent();
77
+ console.log('Error while retrieving pos devices list error', err_1);
78
+ return [3, 3];
79
+ case 3: return [2];
80
+ }
81
+ });
82
+ }); };
38
83
  var handleOnBack = function () {
39
84
  if ((boardFlows === null || boardFlows === void 0 ? void 0 : boardFlows.length) > 0) {
40
85
  dispatch(handlePrevScreenStep());
@@ -53,6 +98,6 @@ var NoTerminalDeviceLinked = function () {
53
98
  })
54
99
  .catch(function () { });
55
100
  };
56
- return (_jsxs(ScreenContainer, __assign({ sx: { ml: 2.5, mr: 2.5 }, minHeight: 280, justifyContent: 'space-between' }, { children: [_jsxs(NoTerminalDeviceLinkedContainer, { children: [_jsx(DeviceImage, { src: ICONS_NAMES.terminal_device }), _jsx(TitleTypography, { children: t('terminal_no_terminal_linked') }), _jsx(DescriptionTypography, { children: t('terminal_no_terminal_linked_description') })] }), _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: loading ? _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 15, toggleAnimation: !!loading }) : t('back') }))] })));
101
+ return (_jsxs(ScreenContainer, __assign({ sx: { ml: 2.5, mr: 2.5 }, minHeight: 280, justifyContent: 'space-between' }, { children: [_jsxs(NoTerminalDeviceLinkedContainer, { children: [_jsx(DeviceImage, { src: ICONS_NAMES.terminal_device }), _jsx(TitleTypography, { children: t('terminal_no_terminal_linked') }), _jsx(DescriptionTypography, { children: t('terminal_no_terminal_linked_description') })] }), _jsx(Button, __assign({ sx: { mt: 0, ml: 0, mr: 0 }, loading: posDevicesLoading, onBackClicked: handleOnBack, onClick: handleOnClickNewTerminalLink, isAr: isAr }, { children: t('terminal_link_terminal') }))] })));
57
102
  };
58
103
  export default React.memo(NoTerminalDeviceLinked);
@@ -18,13 +18,14 @@ import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/sett
18
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
19
  import Button from '../../../../components/Button';
20
20
  import Warning from '../../../../components/Warning';
21
+ import { CONNECT_FLOWS } from '../../../../constants';
21
22
  import { clearError, linkNewTerminal, storeSelectedPOS, terminalSelector } from '../../../app/terminal/terminalStore';
22
23
  import { Header, Container, POSDeviceList } from '../shared';
23
24
  var POSDeviceListPage = function () {
24
25
  var t = useTranslation().t;
25
26
  var dispatch = useAppDispatch();
26
27
  var _a = useAppSelector(terminalSelector), _b = _a.data, selectedPOS = _b.terminalInfo.selectedPOS, responseData = _b.responseData, loading = _a.loading, error = _a.error;
27
- var posDevices = (responseData || {}).posDevices;
28
+ var _c = responseData || {}, posDevices = _c.posDevices, terminalData = _c.terminalData;
28
29
  React.useEffect(function () {
29
30
  if (error)
30
31
  dispatch(clearError());
@@ -40,7 +41,9 @@ var POSDeviceListPage = function () {
40
41
  .catch(function () { });
41
42
  };
42
43
  var handleOnBack = function () {
43
- dispatch(handlePrevScreenStep());
44
+ var _a;
45
+ var screen = ((_a = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _a === void 0 ? void 0 : _a.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked;
46
+ dispatch(handlePrevScreenStep(screen));
44
47
  };
45
48
  return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(Header, { title: 'terminal_select_device', sx: { pb: 0 } }), _jsx(POSDeviceList, { select: false, loading: loading, selectedPOS: selectedPOS, posDevices: posDevices, onClick: handleOnSelectPOS })] })), error && _jsx(Warning, __assign({ sx: { mt: 2 } }, { children: t(error) })), _jsx(Box, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: t('back') })) }))] })));
46
49
  };
@@ -13,8 +13,8 @@ var DeviceList = function (_a) {
13
13
  onClick(device);
14
14
  };
15
15
  return (_jsx(DeviceListContainer, { children: devices.map(function (device, index) {
16
- var _a;
17
- return (_jsx(DeviceCard, { onClick: function () { return handleOnClick(device); }, loading: device.id === (selected === null || selected === void 0 ? void 0 : selected.id) && loading, image: (_a = device.terminal_device.model.image_url) !== null && _a !== void 0 ? _a : defaultImage, name: device.terminal_device.display_name, deviceId: getId(device), pairedWith: getPairedWith(device), deviceIdLabel: getIdLabel(device), isLinked: device.linked, arrow: true, badge: true }, index));
16
+ var _a, _b, _c, _d, _e;
17
+ return (_jsx(DeviceCard, { onClick: function () { return handleOnClick(device); }, loading: device.id === (selected === null || selected === void 0 ? void 0 : selected.id) && loading, image: (_c = (_b = (_a = device.terminal_device) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.image_url) !== null && _c !== void 0 ? _c : defaultImage, name: (_e = (_d = device.terminal_device) === null || _d === void 0 ? void 0 : _d.display_name) !== null && _e !== void 0 ? _e : '', deviceId: getId(device), pairedWith: getPairedWith(device), deviceIdLabel: getIdLabel(device), isLinked: device.linked, arrow: true, badge: true }, index));
18
18
  }) }));
19
19
  };
20
20
  export default memo(DeviceList);
@@ -3,7 +3,8 @@ export var getPairedWith = function (terminal) {
3
3
  return (_a = terminal === null || terminal === void 0 ? void 0 : terminal.device) === null || _a === void 0 ? void 0 : _a.display_name;
4
4
  };
5
5
  export var getId = function (terminal) {
6
- return ((terminal === null || terminal === void 0 ? void 0 : terminal.device) ? terminal.device.reference || terminal.device.id : terminal === null || terminal === void 0 ? void 0 : terminal.terminal_device.serial_number) || '';
6
+ var _a;
7
+ return ((terminal === null || terminal === void 0 ? void 0 : terminal.device) ? terminal.device.reference || terminal.device.id : (_a = terminal === null || terminal === void 0 ? void 0 : terminal.terminal_device) === null || _a === void 0 ? void 0 : _a.serial_number) || '';
7
8
  };
8
9
  export var getIdLabel = function (terminal) {
9
10
  var _a;
@@ -1,5 +1,5 @@
1
1
  import { axiosInstance } from '../api';
2
- import { ENDPOINT_PATHS, CONNECT_DEV_URL, CONNECT_PROD_URL } from '../constants';
2
+ import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
3
3
  import { objectHasValues } from './object';
4
4
  import { isDisasterRecoveryEnv, isSA } from './string';
5
5
  export var sleep = function (milliseconds) {
@@ -17,7 +17,7 @@ export var setBaseUrl = function (publicKey, region) {
17
17
  var isProd = publicKey.includes('pk_live');
18
18
  var _a = region.split('-'), country = _a[0], envType = _a[1];
19
19
  if (!isProd) {
20
- axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
20
+ axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
21
21
  return;
22
22
  }
23
23
  if (isSA(country)) {
@@ -44,7 +44,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
44
44
  window.history.replaceState({}, '', newUrl);
45
45
  };
46
46
  export var openConnect = function (pk, countryCode) {
47
- var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_DEV_URL);
47
+ var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_SANDBOX_URL);
48
48
  if (countryCode) {
49
49
  newUrl.pathname = "/".concat(countryCode.toLowerCase());
50
50
  }
@@ -1,3 +1,4 @@
1
1
  export declare const isNetworkError: (error: string | null) => boolean;
2
2
  export declare const isTokenExpired: (error: string | null) => boolean;
3
3
  export declare const isTimeoutError: (error: string | null) => boolean;
4
+ export declare const isInternalServerError: (error: string | null) => boolean;
@@ -7,3 +7,6 @@ export var isTokenExpired = function (error) {
7
7
  export var isTimeoutError = function (error) {
8
8
  return (error || '').trim().toLowerCase().includes('timeout');
9
9
  };
10
+ export var isInternalServerError = function (error) {
11
+ return ['internal_server_error'].includes((error || '').trim().toLowerCase());
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.11.11-development",
3
+ "version": "2.11.11-sandbox",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -21,7 +21,7 @@
21
21
  "copy:files": "copyfiles -u 1 src/**/*.css build/",
22
22
  "tsc:alias": "tsc-alias -p tsconfig.json",
23
23
  "ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
24
- "push": "npm publish --access public --tag development"
24
+ "push": "npm publish --access public --tag sandbox"
25
25
  },
26
26
  "keywords": [],
27
27
  "author": {