@tap-payments/auth-jsconnect 2.10.1-development → 2.10.2-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.
@@ -168,7 +168,7 @@ declare const API: {
168
168
  terminalService: {
169
169
  retrieveTerminalDeviceList: (merchants: string[]) => Promise<any>;
170
170
  generateAuthenticationToLinkNewTerminal: (payload: GenerateAuthLinkNewTerminalProps) => Promise<any>;
171
- unlinkTerminalDevice: (payload: UnlinkTerminalDeviceProps) => Promise<any>;
171
+ unlinkTerminalDevice: ({ deviceId, ...payload }: UnlinkTerminalDeviceProps) => Promise<any>;
172
172
  retrieveTerminalList: (merchantIds: string[]) => Promise<any>;
173
173
  };
174
174
  };
@@ -7,7 +7,10 @@ export interface GenerateAuthLinkNewTerminalProps {
7
7
  };
8
8
  }
9
9
  export interface UnlinkTerminalDeviceProps {
10
- id: string;
10
+ deviceId: string;
11
+ terminal: {
12
+ id: string;
13
+ };
11
14
  action: string;
12
15
  }
13
16
  export interface LinkTerminalDeviceProps {
@@ -17,7 +20,7 @@ export interface LinkTerminalDeviceProps {
17
20
  declare const terminalService: {
18
21
  retrieveTerminalDeviceList: (merchants: string[]) => Promise<any>;
19
22
  generateAuthenticationToLinkNewTerminal: (payload: GenerateAuthLinkNewTerminalProps) => Promise<any>;
20
- unlinkTerminalDevice: (payload: UnlinkTerminalDeviceProps) => Promise<any>;
23
+ unlinkTerminalDevice: ({ deviceId, ...payload }: UnlinkTerminalDeviceProps) => Promise<any>;
21
24
  retrieveTerminalList: (merchantIds: string[]) => Promise<any>;
22
25
  };
23
26
  export { terminalService };
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { ENDPOINT_PATHS } from '../constants';
2
13
  import { httpClient } from './axios';
3
14
  var retrieveTerminalDeviceList = function (merchants) {
@@ -29,25 +40,11 @@ var generateAuthenticationToLinkNewTerminal = function (payload) {
29
40
  data: payload
30
41
  });
31
42
  };
32
- var unlinkTerminalDevice = function (payload) {
33
- return httpClient({
34
- method: 'get',
35
- url: 'https://dummyjson.com/c/15d1-eae7-43ad-9734'
36
- });
43
+ var unlinkTerminalDevice = function (_a) {
44
+ var deviceId = _a.deviceId, payload = __rest(_a, ["deviceId"]);
37
45
  return httpClient({
38
- method: 'post',
39
- url: "".concat(ENDPOINT_PATHS.TERMINAL, "/link"),
40
- data: payload
41
- });
42
- };
43
- var linkTerminalDevice = function (payload) {
44
- return httpClient({
45
- method: 'get',
46
- url: 'https://dummyjson.com/c/7544-fa91-4a47-9612'
47
- });
48
- return httpClient({
49
- method: 'post',
50
- url: "".concat(ENDPOINT_PATHS.TERMINAL, "/link"),
46
+ method: 'put',
47
+ url: "".concat(ENDPOINT_PATHS.TERMINAL, "/device/").concat(deviceId),
51
48
  data: payload
52
49
  });
53
50
  };
@@ -154,6 +154,18 @@ export declare const retrieveBoardStatus: import("@reduxjs/toolkit").AsyncThunk<
154
154
  fulfilledMeta?: unknown;
155
155
  rejectedMeta?: unknown;
156
156
  }>;
157
+ export declare const retrieveTerminalDeviceList: import("@reduxjs/toolkit").AsyncThunk<{
158
+ data: any;
159
+ }, void, {
160
+ state?: unknown;
161
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
162
+ extra?: unknown;
163
+ rejectValue?: unknown;
164
+ serializedErrorType?: unknown;
165
+ pendingMeta?: unknown;
166
+ fulfilledMeta?: unknown;
167
+ rejectedMeta?: unknown;
168
+ }>;
157
169
  export declare const updateDeviceLinkedSuccess: import("@reduxjs/toolkit").AsyncThunk<{
158
170
  data: any;
159
171
  nextScreen: string;
@@ -245,19 +245,22 @@ export var pushNotificationLinkNewTerminal = createAsyncThunk('terminal/pushNoti
245
245
  });
246
246
  });
247
247
  export var unlinkTerminalDevice = createAsyncThunk('terminal/unlinkTerminalDevice', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
248
- var terminal, id, payload, data;
249
- return __generator(this, function (_a) {
250
- switch (_a.label) {
248
+ var terminal, _a, id, terminalInfo, payload, data;
249
+ return __generator(this, function (_b) {
250
+ switch (_b.label) {
251
251
  case 0:
252
252
  terminal = thunkApi.getState().terminal;
253
- id = terminal.data.terminalInfo.selectedTerminalDevice.id;
253
+ _a = terminal.data.terminalInfo.selectedTerminalDevice, id = _a.id, terminalInfo = _a.terminal;
254
254
  payload = {
255
- id: id,
256
- action: 'unlink'
255
+ deviceId: id,
256
+ action: 'unlink',
257
+ terminal: {
258
+ id: (terminalInfo === null || terminalInfo === void 0 ? void 0 : terminalInfo.id) || ''
259
+ }
257
260
  };
258
261
  return [4, API.terminalService.unlinkTerminalDevice(payload)];
259
262
  case 1:
260
- data = _a.sent();
263
+ data = _b.sent();
261
264
  return [2, { data: data, nextScreen: CONNECT_FLOWS.terminal.terminalUnlinkedSuccess }];
262
265
  }
263
266
  });
@@ -336,6 +339,21 @@ export var retrieveBoardStatus = createAsyncThunk('terminal/retrieveBoardStatus'
336
339
  });
337
340
  });
338
341
  });
342
+ export var retrieveTerminalDeviceList = createAsyncThunk('terminal/retrieveTerminalDeviceList', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
343
+ var terminal, merchant_id, data;
344
+ var _a;
345
+ return __generator(this, function (_b) {
346
+ switch (_b.label) {
347
+ case 0:
348
+ terminal = thunkApi.getState().terminal;
349
+ merchant_id = (((_a = terminal.data.responseData) === null || _a === void 0 ? void 0 : _a.authData) || {}).merchant_id;
350
+ return [4, API.terminalService.retrieveTerminalDeviceList([merchant_id])];
351
+ case 1:
352
+ data = _b.sent();
353
+ return [2, { data: data }];
354
+ }
355
+ });
356
+ }); });
339
357
  export var updateDeviceLinkedSuccess = createAsyncThunk('terminal/updateDeviceLinkedSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
340
358
  var _a, settings, terminal, _b, showBoard, mode, _c, id, board_info_id, payload, data;
341
359
  var _d, _e, _f, _g, _h, _j, _k, _l, _m;
@@ -415,7 +433,7 @@ var initialState = {
415
433
  customLoading: false,
416
434
  terminalListLoading: false,
417
435
  data: {
418
- flowName: FlowsTypes.CONNECT,
436
+ flowName: FlowsTypes.TERMINAL,
419
437
  verify: {
420
438
  token: ''
421
439
  },
@@ -521,6 +539,17 @@ export var terminalSlice = createSlice({
521
539
  .addCase(retrieveTerminalList.pending, function (state) {
522
540
  state.terminalListLoading = true;
523
541
  state.error = null;
542
+ })
543
+ .addCase(retrieveTerminalDeviceList.pending, function (state) {
544
+ state.error = null;
545
+ })
546
+ .addCase(retrieveTerminalDeviceList.fulfilled, function (state, action) {
547
+ state.error = null;
548
+ var data = action.payload.data;
549
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { terminalData: data });
550
+ })
551
+ .addCase(retrieveTerminalDeviceList.rejected, function (state, action) {
552
+ state.error = action.error.message;
524
553
  })
525
554
  .addCase(pushNotificationLinkNewTerminal.pending, function (state) {
526
555
  state.error = null;
@@ -242,6 +242,6 @@ export default function FlowsButtons(_a) {
242
242
  onResetPassword();
243
243
  else
244
244
  onRedirect({ title: title, href: href, src: src, hoverSrc: hoverSrc, isCompleted: isCompleted, name: name, status: status, token: token });
245
- } }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, hasUrl: !!href, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [name !== 'password' && _jsx(Dot, { completed: ['complete', 'completed', 'reviewed'].includes(status === null || status === void 0 ? void 0 : status.toLowerCase()) }), _jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)', marginInlineStart: 0 }, src: ICONS_NAMES.Arrow_filled_right_icon })] }))), startIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isBrand(name) ? (_jsx(_Fragment, { children: _jsx(BrandImage, { children: _jsx(BrandNameStyled, { children: brandName }) }) })) : (_jsx(Image, { src: src, alt: title })), type: 'button' }, { children: title })) }), idx));
245
+ } }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, hasUrl: !!href, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [name !== 'password' && name !== 'terminal' && (_jsx(Dot, { completed: ['complete', 'completed', 'reviewed'].includes(status === null || status === void 0 ? void 0 : status.toLowerCase()) })), _jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)', marginInlineStart: 0 }, src: ICONS_NAMES.Arrow_filled_right_icon })] }))), startIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isBrand(name) ? (_jsx(_Fragment, { children: _jsx(BrandImage, { children: _jsx(BrandNameStyled, { children: brandName }) }) })) : (_jsx(Image, { src: src, alt: title })), type: 'button' }, { children: title })) }), idx));
246
246
  }), onClose && (_jsx(SharedButton, __assign({ sx: { mt: 2.5, ml: 0, mr: 0 }, isAr: isAr, disableBack: true, loading: storeLoading, onClick: onClose }, { children: t('close_and_complete_later') })))] }));
247
247
  }
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
15
15
  import Box from '@mui/material/Box';
16
16
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
17
17
  import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
18
- import { retrieveBoardDetails, retrieveBoardStatus, terminalSelector } from '../../../app/terminal/terminalStore';
18
+ import { retrieveBoardDetails, retrieveBoardStatus, retrieveTerminalDeviceList, terminalSelector } from '../../../app/terminal/terminalStore';
19
19
  import SuccessScreen from '../../../shared/SuccessScreen';
20
20
  import Button from '../../../shared/Button';
21
21
  import { getTerminalName, SuccessContainerStyled } from '../shared';
@@ -30,6 +30,7 @@ var LinkedSuccess = function () {
30
30
  var handleGoToBoard = function () {
31
31
  var board_id = (boardData || {}).id;
32
32
  var _a = (authData === null || authData === void 0 ? void 0 : authData.recipient) || {}, id = _a.id, type = _a.type;
33
+ dispatch(retrieveTerminalDeviceList());
33
34
  dispatch(retrieveBoardStatus({ boardId: board_id }))
34
35
  .unwrap()
35
36
  .then(function () {
@@ -4,7 +4,7 @@ export declare const Container: import("@emotion/styled").StyledComponent<import
4
4
  }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
5
5
  export declare const LinkButton: import("@emotion/styled").StyledComponent<import("@mui/material/Button").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
6
6
  ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
7
- }, "className" | "style" | "classes" | "color" | "children" | "sx" | "tabIndex" | "size" | "action" | "disabled" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "href" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
7
+ }, "className" | "style" | "classes" | "color" | "children" | "sx" | "tabIndex" | "action" | "size" | "disabled" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "href" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
8
8
  export declare const AddIconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
9
9
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
10
10
  }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -16,7 +16,7 @@ import Box from '@mui/material/Box';
16
16
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
17
17
  import { CONNECT_FLOWS } from '../../../../constants';
18
18
  import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
19
- import { retrieveBoardDetails, retrieveBoardStatus, terminalSelector } from '../../../app/terminal/terminalStore';
19
+ import { retrieveBoardDetails, retrieveBoardStatus, retrieveTerminalDeviceList, terminalSelector } from '../../../app/terminal/terminalStore';
20
20
  import SuccessScreen from '../../../shared/SuccessScreen';
21
21
  import Button from '../../../shared/Button';
22
22
  import { SuccessContainerStyled } from '../shared';
@@ -32,6 +32,7 @@ var UnlinkedSuccess = function () {
32
32
  var handleGoToBoard = function () {
33
33
  var board_id = (boardData || {}).id;
34
34
  var _a = (authData === null || authData === void 0 ? void 0 : authData.recipient) || {}, id = _a.id, type = _a.type;
35
+ dispatch(retrieveTerminalDeviceList());
35
36
  dispatch(retrieveBoardStatus({ boardId: board_id }))
36
37
  .unwrap()
37
38
  .then(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.10.1-development",
3
+ "version": "2.10.2-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",