@tap-payments/auth-jsconnect 2.0.35-test → 2.0.37-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.
- package/build/@types/app.d.ts +2 -1
- package/build/@types/app.js +1 -0
- package/build/@types/form.d.ts +3 -3
- package/build/api/entity.d.ts +2 -0
- package/build/app/rootReducer.d.ts +1 -0
- package/build/app/rootReducer.js +3 -1
- package/build/app/store.d.ts +2 -0
- package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
- package/build/components/AnimationFlow/AnimationFlow.js +3 -3
- package/build/components/AnimationFlow/Dialog.d.ts +2 -1
- package/build/components/AnimationFlow/Dialog.js +6 -2
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +8 -0
- package/build/features/app/auth/authStore.d.ts +20 -0
- package/build/features/app/auth/authStore.js +101 -0
- package/build/features/app/entity/entityStore.d.ts +5 -0
- package/build/features/app/entity/entityStore.js +149 -14
- package/build/features/auth/Auth.d.ts +8 -0
- package/build/features/auth/Auth.js +53 -0
- package/build/features/auth/index.d.ts +1 -0
- package/build/features/auth/index.js +1 -0
- package/build/features/auth/screens/OTP/OTP.d.ts +5 -0
- package/build/features/auth/screens/OTP/OTP.js +72 -0
- package/build/features/auth/screens/OTP/OTPInput.d.ts +5 -0
- package/build/features/auth/screens/OTP/OTPInput.js +44 -0
- package/build/features/auth/screens/OTP/index.d.ts +3 -0
- package/build/features/auth/screens/OTP/index.js +2 -0
- package/build/features/auth/screens/OTP/validation.d.ts +8 -0
- package/build/features/auth/screens/OTP/validation.js +4 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +54 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +139 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +52 -2
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +17 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +28 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +38 -0
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +112 -0
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +107 -0
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -0
- package/build/features/featuresScreens.d.ts +1 -0
- package/build/features/featuresScreens.js +9 -2
- package/build/features/shared/Background/Background.d.ts +3 -1
- package/build/features/shared/Background/Background.js +2 -2
- package/build/hooks/useAppDispatch.d.ts +1 -0
- package/build/index.d.ts +3 -2
- package/build/index.js +5 -2
- package/package.json +1 -1
package/build/@types/app.d.ts
CHANGED
package/build/@types/app.js
CHANGED
package/build/@types/form.d.ts
CHANGED
|
@@ -76,9 +76,9 @@ export declare type PasswordCreateFormValues = {
|
|
|
76
76
|
confirmPassword: string;
|
|
77
77
|
};
|
|
78
78
|
export declare type EntityFormValues = {
|
|
79
|
-
licenseNumber
|
|
80
|
-
licenseName
|
|
79
|
+
licenseNumber?: string;
|
|
80
|
+
licenseName?: string;
|
|
81
81
|
activities?: Array<Activity>;
|
|
82
|
-
salesChannels
|
|
82
|
+
salesChannels?: Array<SalesChannel>;
|
|
83
83
|
operationStartDate: string;
|
|
84
84
|
};
|
package/build/api/entity.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export declare type EntityInfoBody = {
|
|
|
3
3
|
id: string;
|
|
4
4
|
lead_id?: string;
|
|
5
5
|
activities?: Array<string>;
|
|
6
|
+
license_name?: string;
|
|
7
|
+
license_number?: string;
|
|
6
8
|
business_operation_start_at?: string;
|
|
7
9
|
channel_services?: Array<string>;
|
|
8
10
|
physical_store_available?: boolean;
|
|
@@ -9,5 +9,6 @@ declare const rootReducer: {
|
|
|
9
9
|
signIn: import("redux").Reducer<import("../features/app/signIn/signInStore").SignInState, import("redux").AnyAction>;
|
|
10
10
|
entity: import("redux").Reducer<import("../features/app/entity/entityStore").EntityState, import("redux").AnyAction>;
|
|
11
11
|
otp: import("redux").Reducer<import("../features/app/otp/otpStore").OtpState, import("redux").AnyAction>;
|
|
12
|
+
auth: import("redux").Reducer<import("../features/app/auth/authStore").AuthState, import("redux").AnyAction>;
|
|
12
13
|
};
|
|
13
14
|
export default rootReducer;
|
package/build/app/rootReducer.js
CHANGED
|
@@ -8,6 +8,7 @@ import password from '../features/app/password/passwordStore';
|
|
|
8
8
|
import signIn from '../features/app/signIn/signInStore';
|
|
9
9
|
import entity from '../features/app/entity/entityStore';
|
|
10
10
|
import otp from '../features/app/otp/otpStore';
|
|
11
|
+
import auth from '../features/app/auth/authStore';
|
|
11
12
|
var rootReducer = {
|
|
12
13
|
settings: settings,
|
|
13
14
|
connect: connect,
|
|
@@ -18,6 +19,7 @@ var rootReducer = {
|
|
|
18
19
|
password: password,
|
|
19
20
|
signIn: signIn,
|
|
20
21
|
entity: entity,
|
|
21
|
-
otp: otp
|
|
22
|
+
otp: otp,
|
|
23
|
+
auth: auth
|
|
22
24
|
};
|
|
23
25
|
export default rootReducer;
|
package/build/app/store.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
10
10
|
signIn: import("../features/app/signIn/signInStore").SignInState;
|
|
11
11
|
entity: import("../features/app/entity/entityStore").EntityState;
|
|
12
12
|
otp: import("../features/app/otp/otpStore").OtpState;
|
|
13
|
+
auth: import("../features/app/auth/authStore").AuthState;
|
|
13
14
|
}, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<{
|
|
14
15
|
settings: import("./settings").SettingsState;
|
|
15
16
|
connect: import("../features/app/connect/connectStore").ConnectState;
|
|
@@ -21,6 +22,7 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
21
22
|
signIn: import("../features/app/signIn/signInStore").SignInState;
|
|
22
23
|
entity: import("../features/app/entity/entityStore").EntityState;
|
|
23
24
|
otp: import("../features/app/otp/otpStore").OtpState;
|
|
25
|
+
auth: import("../features/app/auth/authStore").AuthState;
|
|
24
26
|
}, import("redux").AnyAction, undefined>]>>;
|
|
25
27
|
export declare type AppDispatch = typeof store.dispatch;
|
|
26
28
|
export declare type RootState = ReturnType<typeof store.getState>;
|
|
@@ -9,5 +9,6 @@ export interface AnimationFlowProps {
|
|
|
9
9
|
loading?: boolean;
|
|
10
10
|
error?: string | null;
|
|
11
11
|
screenId?: string;
|
|
12
|
+
animationType?: 'slide' | 'fade' | 'collapse';
|
|
12
13
|
}
|
|
13
|
-
export default function AnimationFlow({ open, children, breakpoint, type, footer, loading, error, isTapOrigin, screenId }: AnimationFlowProps): JSX.Element;
|
|
14
|
+
export default function AnimationFlow({ open, children, breakpoint, type, footer, loading, error, isTapOrigin, screenId, animationType }: AnimationFlowProps): JSX.Element;
|
|
@@ -17,7 +17,7 @@ import BottomSheet from './BottomSheet';
|
|
|
17
17
|
import Loader from './Loader';
|
|
18
18
|
import Error from './Error';
|
|
19
19
|
export default function AnimationFlow(_a) {
|
|
20
|
-
var open = _a.open, children = _a.children, breakpoint = _a.breakpoint, type = _a.type, footer = _a.footer, loading = _a.loading, error = _a.error, isTapOrigin = _a.isTapOrigin, screenId = _a.screenId;
|
|
20
|
+
var open = _a.open, children = _a.children, breakpoint = _a.breakpoint, type = _a.type, footer = _a.footer, loading = _a.loading, error = _a.error, isTapOrigin = _a.isTapOrigin, screenId = _a.screenId, animationType = _a.animationType;
|
|
21
21
|
var theme = useTheme();
|
|
22
22
|
var matches = useMediaQuery(theme.breakpoints.down(breakpoint || 'sm'));
|
|
23
23
|
if (loading) {
|
|
@@ -27,10 +27,10 @@ export default function AnimationFlow(_a) {
|
|
|
27
27
|
return _jsx(Error, { error: error });
|
|
28
28
|
}
|
|
29
29
|
if (type === 'PUPOP') {
|
|
30
|
-
return (_jsx(Dialog, __assign({ footer: footer, open: open, isTapOrigin: isTapOrigin }, { children: children })));
|
|
30
|
+
return (_jsx(Dialog, __assign({ footer: footer, open: open, isTapOrigin: isTapOrigin, animationType: animationType }, { children: children })));
|
|
31
31
|
}
|
|
32
32
|
if (type === 'BOTTOMSHEET') {
|
|
33
33
|
return _jsx(BottomSheet, __assign({ open: open }, { children: children }));
|
|
34
34
|
}
|
|
35
|
-
return matches ? (_jsx(BottomSheet, __assign({ open: open, screenId: screenId }, { children: children }))) : (_jsx(Dialog, __assign({ open: open, footer: footer, isTapOrigin: isTapOrigin }, { children: children })));
|
|
35
|
+
return matches ? (_jsx(BottomSheet, __assign({ open: open, screenId: screenId }, { children: children }))) : (_jsx(Dialog, __assign({ open: open, footer: footer, isTapOrigin: isTapOrigin, animationType: animationType }, { children: children })));
|
|
36
36
|
}
|
|
@@ -6,6 +6,7 @@ export interface DialogProps extends MUIDialogProps {
|
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
footer?: React.ReactNode;
|
|
8
8
|
transitionDuration?: number;
|
|
9
|
+
animationType?: 'slide' | 'fade' | 'collapse';
|
|
9
10
|
}
|
|
10
|
-
declare const _default: React.MemoExoticComponent<({ open, children, footer, transitionDuration, isTapOrigin, ...rest }: DialogProps) => JSX.Element>;
|
|
11
|
+
declare const _default: React.MemoExoticComponent<({ open, children, footer, transitionDuration, isTapOrigin, animationType, ...rest }: DialogProps) => JSX.Element>;
|
|
11
12
|
export default _default;
|
|
@@ -92,14 +92,18 @@ var LogoIconStyled = styled(Icon)(function (_a) {
|
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
94
|
var Dialog = function (_a) {
|
|
95
|
-
var open = _a.open, children = _a.children, footer = _a.footer, transitionDuration = _a.transitionDuration, isTapOrigin = _a.isTapOrigin, rest = __rest(_a, ["open", "children", "footer", "transitionDuration", "isTapOrigin"]);
|
|
95
|
+
var open = _a.open, children = _a.children, footer = _a.footer, transitionDuration = _a.transitionDuration, isTapOrigin = _a.isTapOrigin, _b = _a.animationType, animationType = _b === void 0 ? 'slide' : _b, rest = __rest(_a, ["open", "children", "footer", "transitionDuration", "isTapOrigin", "animationType"]);
|
|
96
96
|
var isAr = useLanguage().isAr;
|
|
97
|
+
var animation = {};
|
|
98
|
+
if (animationType === 'slide') {
|
|
99
|
+
Object.assign(animation, { TransitionComponent: Transition });
|
|
100
|
+
}
|
|
97
101
|
return (_jsxs(MuiDialog, __assign({ PaperProps: {
|
|
98
102
|
elevation: 0
|
|
99
103
|
}, sx: {
|
|
100
104
|
'& .MuiDialog-paper': {
|
|
101
105
|
overflowY: 'visible'
|
|
102
106
|
}
|
|
103
|
-
}, hideBackdrop: true, PaperComponent: PaperStyled, open: open,
|
|
107
|
+
}, hideBackdrop: true, PaperComponent: PaperStyled, open: open, transitionDuration: transitionDuration || 500, keepMounted: true, "aria-describedby": 'dialog-slide-description' }, rest, animation, { children: [_jsxs(DialogContentStyled, { children: [_jsxs(Collapse, __assign({ in: !isTapOrigin }, { children: [_jsx(LogoBadge, { src: ICONS_NAMES.LOGO_ICON }), _jsx(LogoIconBoxStyled, { children: _jsx(LogoIconStyled, { src: isAr ? ICONS_NAMES.TAP_AR : ICONS_NAMES.TAP_EN, alt: 'tap logo' }) })] })), children] }), footer] })));
|
|
104
108
|
};
|
|
105
109
|
export default React.memo(Dialog);
|
package/build/constants/app.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare const TAX_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
|
|
|
21
21
|
export declare const SigIn_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
|
|
22
22
|
export declare const ENTITY_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
|
|
23
23
|
export declare const OTP_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
|
|
24
|
+
export declare const AUTH_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
|
|
24
25
|
export declare const DefaultDeviceInfo: {
|
|
25
26
|
source: string;
|
|
26
27
|
device: {
|
package/build/constants/app.js
CHANGED
|
@@ -319,6 +319,14 @@ export var OTP_SCREENS_NAVIGATION = [
|
|
|
319
319
|
order: 1
|
|
320
320
|
}
|
|
321
321
|
];
|
|
322
|
+
export var AUTH_SCREENS_NAVIGATION = [
|
|
323
|
+
{
|
|
324
|
+
name: 'AUTH_VERIFY_STEP',
|
|
325
|
+
next: '',
|
|
326
|
+
prev: '',
|
|
327
|
+
order: 1
|
|
328
|
+
}
|
|
329
|
+
];
|
|
322
330
|
export var DefaultDeviceInfo = {
|
|
323
331
|
source: 'browser',
|
|
324
332
|
device: {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RootState } from '../../../app/store';
|
|
2
|
+
import { ResponseData, OTPFormValues, SharedState } from '../../../@types';
|
|
3
|
+
export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
+
formData: OTPFormValues;
|
|
5
|
+
}, OTPFormValues, {}>;
|
|
6
|
+
export interface AuthData extends ResponseData {
|
|
7
|
+
otp: string;
|
|
8
|
+
mobileNumber: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AuthState extends SharedState<AuthData> {
|
|
11
|
+
}
|
|
12
|
+
export declare const authSlice: import("@reduxjs/toolkit").Slice<AuthState, {
|
|
13
|
+
clearError: (state: AuthState) => void;
|
|
14
|
+
stopLoader: (state: AuthState) => void;
|
|
15
|
+
resetOTPScreen: (state: AuthState) => void;
|
|
16
|
+
}, "auth/store">;
|
|
17
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
18
|
+
declare const _default: import("redux").Reducer<AuthState, import("redux").AnyAction>;
|
|
19
|
+
export default _default;
|
|
20
|
+
export declare const authSelector: (state: RootState) => AuthState;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var _a;
|
|
38
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
39
|
+
import { handleOpen } from '../../../app/settings';
|
|
40
|
+
export var verifyAuth = createAsyncThunk('verifyAuthOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
41
|
+
var settings;
|
|
42
|
+
var _a, _b, _c, _d;
|
|
43
|
+
return __generator(this, function (_e) {
|
|
44
|
+
switch (_e.label) {
|
|
45
|
+
case 0:
|
|
46
|
+
settings = thunkApi.getState().settings;
|
|
47
|
+
return [4, new Promise(function (resolve) {
|
|
48
|
+
setTimeout(function () {
|
|
49
|
+
resolve(params);
|
|
50
|
+
}, 5000);
|
|
51
|
+
})];
|
|
52
|
+
case 1:
|
|
53
|
+
_e.sent();
|
|
54
|
+
(_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, params);
|
|
55
|
+
(_d = (_c = settings.data.appConfig).onFlowCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, { id: '' });
|
|
56
|
+
thunkApi.dispatch(handleOpen(false));
|
|
57
|
+
return [2, { formData: params }];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}); });
|
|
61
|
+
var initialState = {
|
|
62
|
+
error: null,
|
|
63
|
+
loading: false,
|
|
64
|
+
data: {
|
|
65
|
+
otp: '',
|
|
66
|
+
mobileNumber: ''
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
export var authSlice = createSlice({
|
|
70
|
+
name: 'auth/store',
|
|
71
|
+
initialState: initialState,
|
|
72
|
+
reducers: {
|
|
73
|
+
clearError: function (state) {
|
|
74
|
+
state.error = null;
|
|
75
|
+
},
|
|
76
|
+
stopLoader: function (state) {
|
|
77
|
+
state.loading = false;
|
|
78
|
+
},
|
|
79
|
+
resetOTPScreen: function (state) {
|
|
80
|
+
state.data.otp = '';
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
extraReducers: function (builder) {
|
|
84
|
+
builder
|
|
85
|
+
.addCase(verifyAuth.pending, function (state) {
|
|
86
|
+
state.loading = true;
|
|
87
|
+
state.error = null;
|
|
88
|
+
})
|
|
89
|
+
.addCase(verifyAuth.fulfilled, function (state) {
|
|
90
|
+
state.loading = false;
|
|
91
|
+
state.error = null;
|
|
92
|
+
})
|
|
93
|
+
.addCase(verifyAuth.rejected, function (state, action) {
|
|
94
|
+
state.loading = false;
|
|
95
|
+
state.error = action.error.message;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
export var clearError = (_a = authSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
|
|
100
|
+
export default authSlice.reducer;
|
|
101
|
+
export var authSelector = function (state) { return state.auth; };
|
|
@@ -21,10 +21,15 @@ export declare const verifyEntityLeadOTP: import("@reduxjs/toolkit").AsyncThunk<
|
|
|
21
21
|
export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
|
|
22
22
|
data: any;
|
|
23
23
|
}, string, {}>;
|
|
24
|
+
export declare const updateEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
25
|
+
data: any;
|
|
26
|
+
formData: EntityFormValues;
|
|
27
|
+
}, EntityFormValues, {}>;
|
|
24
28
|
export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
25
29
|
response: any;
|
|
26
30
|
formData: void;
|
|
27
31
|
} | undefined, void, {}>;
|
|
32
|
+
export declare const retrieveChannels: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
|
|
28
33
|
declare type VerifyData = {
|
|
29
34
|
token: string;
|
|
30
35
|
};
|
|
@@ -51,6 +51,8 @@ import API from '../../../api';
|
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
52
|
import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
|
|
53
53
|
import { ENTITY_STEP_NAMES, BUSINESS_FLOW_SUCCESS } from '../../../constants';
|
|
54
|
+
import moment from 'moment';
|
|
55
|
+
import { convertNumbers2English } from '../../../utils';
|
|
54
56
|
export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
57
|
var payload, data, boardInfoData, board_id, board_info_id, info, hasEntityCompleted;
|
|
56
58
|
var _a;
|
|
@@ -64,22 +66,26 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
64
66
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
65
67
|
case 1:
|
|
66
68
|
data = (_b.sent()).data;
|
|
69
|
+
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
70
|
+
case 2:
|
|
71
|
+
_b.sent();
|
|
67
72
|
boardInfoData = undefined;
|
|
68
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
73
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 6];
|
|
69
74
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
70
75
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
71
|
-
if (!(!!board_id && !!board_info_id)) return [3,
|
|
76
|
+
if (!(!!board_id && !!board_info_id)) return [3, 4];
|
|
72
77
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
73
|
-
case
|
|
78
|
+
case 3:
|
|
74
79
|
boardInfoData = _b.sent();
|
|
75
|
-
_b.label =
|
|
76
|
-
case
|
|
77
|
-
case
|
|
80
|
+
_b.label = 4;
|
|
81
|
+
case 4: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
82
|
+
case 5:
|
|
78
83
|
_b.sent();
|
|
79
84
|
info = boardInfoData.info;
|
|
80
85
|
hasEntityCompleted = ((_a = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _a === void 0 ? void 0 : _a.status) === 'completed';
|
|
86
|
+
thunkApi.dispatch(handleCurrentActiveScreen('ENTITY_INFO_STEP'));
|
|
81
87
|
if (data.step_name === ENTITY_STEP_NAMES.PHONE_AUTH) {
|
|
82
|
-
thunkApi.dispatch(handleCurrentActiveScreen('
|
|
88
|
+
thunkApi.dispatch(handleCurrentActiveScreen('ENTITY_INFO_STEP'));
|
|
83
89
|
}
|
|
84
90
|
else if (hasEntityCompleted) {
|
|
85
91
|
thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
@@ -87,8 +93,8 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
87
93
|
else if (data.step_name === ENTITY_STEP_NAMES.ENTITY_INFO) {
|
|
88
94
|
thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
|
|
89
95
|
}
|
|
90
|
-
_b.label =
|
|
91
|
-
case
|
|
96
|
+
_b.label = 6;
|
|
97
|
+
case 6: return [2, { data: data, boardResponse: { flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) }, token: token }];
|
|
92
98
|
}
|
|
93
99
|
});
|
|
94
100
|
}); });
|
|
@@ -156,6 +162,35 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
|
|
|
156
162
|
}
|
|
157
163
|
});
|
|
158
164
|
}); });
|
|
165
|
+
export var updateEntityInfo = createAsyncThunk('updateEntityInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
166
|
+
var _a, settings, entity, requestBody, data;
|
|
167
|
+
var _b, _c, _d, _e, _f;
|
|
168
|
+
return __generator(this, function (_g) {
|
|
169
|
+
switch (_g.label) {
|
|
170
|
+
case 0:
|
|
171
|
+
_a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
|
|
172
|
+
requestBody = {
|
|
173
|
+
id: (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id,
|
|
174
|
+
activities: (_d = (params.activities || [])) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
|
|
175
|
+
var en = _a.en;
|
|
176
|
+
return en;
|
|
177
|
+
}),
|
|
178
|
+
license_name: params.licenseName,
|
|
179
|
+
license_number: params.licenseNumber,
|
|
180
|
+
business_operation_start_at: params.operationStartDate,
|
|
181
|
+
step_name: ENTITY_STEP_NAMES.ENTITY_INFO
|
|
182
|
+
};
|
|
183
|
+
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
184
|
+
case 1:
|
|
185
|
+
data = (_g.sent()).data;
|
|
186
|
+
if (!data.errors) {
|
|
187
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
188
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
|
|
189
|
+
}
|
|
190
|
+
return [2, { data: data, formData: params }];
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}); });
|
|
159
194
|
export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
160
195
|
var _a, settings, entity, _b, id, infoId, payload, data;
|
|
161
196
|
var _c, _d, _e, _f;
|
|
@@ -184,6 +219,17 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', fun
|
|
|
184
219
|
}
|
|
185
220
|
});
|
|
186
221
|
}); });
|
|
222
|
+
export var retrieveChannels = createAsyncThunk('retrieveChannelsEntity', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
+
var data;
|
|
224
|
+
return __generator(this, function (_a) {
|
|
225
|
+
switch (_a.label) {
|
|
226
|
+
case 0: return [4, API.dataService.getChannelsOfServices()];
|
|
227
|
+
case 1:
|
|
228
|
+
data = (_a.sent()).data;
|
|
229
|
+
return [2, data];
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}); });
|
|
187
233
|
var initialState = {
|
|
188
234
|
error: null,
|
|
189
235
|
loading: false,
|
|
@@ -197,11 +243,9 @@ var initialState = {
|
|
|
197
243
|
otp: ''
|
|
198
244
|
},
|
|
199
245
|
entityData: {
|
|
200
|
-
licenseNumber: '',
|
|
201
|
-
licenseName: '',
|
|
202
246
|
activities: [],
|
|
203
247
|
salesChannels: [],
|
|
204
|
-
operationStartDate: ''
|
|
248
|
+
operationStartDate: '1998-08-22'
|
|
205
249
|
}
|
|
206
250
|
}
|
|
207
251
|
};
|
|
@@ -226,15 +270,49 @@ export var entitySlice = createSlice({
|
|
|
226
270
|
state.customLoading = true;
|
|
227
271
|
})
|
|
228
272
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
229
|
-
var _a;
|
|
273
|
+
var _a, _b, _c;
|
|
230
274
|
state.error = null;
|
|
231
275
|
state.customLoading = false;
|
|
232
|
-
var
|
|
276
|
+
var _d = action.payload, data = _d.data, token = _d.token, boardResponse = _d.boardResponse;
|
|
233
277
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
234
278
|
if (description) {
|
|
235
279
|
state.error = description;
|
|
236
280
|
return;
|
|
237
281
|
}
|
|
282
|
+
var _e = state.data.verify.responseBody || {}, brand = _e.brand, entity = _e.entity;
|
|
283
|
+
var issuingDate = brand === null || brand === void 0 ? void 0 : brand.business_operation_start_at;
|
|
284
|
+
if (!!issuingDate) {
|
|
285
|
+
var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
|
|
286
|
+
state.data.entityData.operationStartDate = convertNumbers2English(formattedDate);
|
|
287
|
+
}
|
|
288
|
+
var channels = (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.channelList;
|
|
289
|
+
var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
|
|
290
|
+
var _f = brand || {}, website = _f.website, social = _f.social;
|
|
291
|
+
var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
|
|
292
|
+
var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
|
|
293
|
+
var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
|
|
294
|
+
var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
|
|
295
|
+
var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
|
|
296
|
+
if (isHasWebsite && (isHasTwitter || isHasInstagram))
|
|
297
|
+
selectedChannels = [websiteData, socialData];
|
|
298
|
+
else if (isHasTwitter || isHasInstagram)
|
|
299
|
+
selectedChannels = [socialData];
|
|
300
|
+
else if (isHasWebsite)
|
|
301
|
+
selectedChannels = [websiteData];
|
|
302
|
+
if (((_c = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
303
|
+
selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
|
|
304
|
+
var _a;
|
|
305
|
+
return (_a = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name_en.toLowerCase() === storedChannel.toLowerCase(); });
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
state.data.entityData.salesChannels = selectedChannels;
|
|
309
|
+
var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || [];
|
|
310
|
+
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
311
|
+
var _a;
|
|
312
|
+
return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { var _a; return ((_a = activity.en) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === value.toLowerCase(); });
|
|
313
|
+
});
|
|
314
|
+
state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
|
|
315
|
+
state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]] });
|
|
238
316
|
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
|
|
239
317
|
state.data.verify.token = token;
|
|
240
318
|
})
|
|
@@ -279,6 +357,27 @@ export var entitySlice = createSlice({
|
|
|
279
357
|
.addCase(verifyEntityLeadOTP.rejected, function (state, action) {
|
|
280
358
|
state.loading = false;
|
|
281
359
|
state.error = action.error.message;
|
|
360
|
+
})
|
|
361
|
+
.addCase(updateEntityInfo.pending, function (state) {
|
|
362
|
+
state.loading = true;
|
|
363
|
+
state.error = null;
|
|
364
|
+
})
|
|
365
|
+
.addCase(updateEntityInfo.fulfilled, function (state, action) {
|
|
366
|
+
var _a;
|
|
367
|
+
state.loading = false;
|
|
368
|
+
state.error = null;
|
|
369
|
+
var _b = action.payload, data = _b.data, formData = _b.formData;
|
|
370
|
+
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
371
|
+
if (description) {
|
|
372
|
+
state.error = description;
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
state.data.entityData = formData;
|
|
376
|
+
state.data.entityData.responseBody = data;
|
|
377
|
+
})
|
|
378
|
+
.addCase(updateEntityInfo.rejected, function (state, action) {
|
|
379
|
+
state.loading = false;
|
|
380
|
+
state.error = action.error.message;
|
|
282
381
|
})
|
|
283
382
|
.addCase(retrieveBoardDetails.pending, function (state) {
|
|
284
383
|
state.error = null;
|
|
@@ -314,6 +413,42 @@ export var entitySlice = createSlice({
|
|
|
314
413
|
.addCase(updateBoardSuccess.rejected, function (state, action) {
|
|
315
414
|
state.loading = false;
|
|
316
415
|
state.error = action.error.message;
|
|
416
|
+
})
|
|
417
|
+
.addCase(retrieveChannels.pending, function (state) {
|
|
418
|
+
state.error = null;
|
|
419
|
+
state.loading = true;
|
|
420
|
+
})
|
|
421
|
+
.addCase(retrieveChannels.fulfilled, function (state, action) {
|
|
422
|
+
var _a;
|
|
423
|
+
state.error = null;
|
|
424
|
+
state.loading = false;
|
|
425
|
+
var data = action.payload || {};
|
|
426
|
+
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
427
|
+
if (description) {
|
|
428
|
+
state.error = description;
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
var channels = data || [];
|
|
432
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { channelList: channels });
|
|
433
|
+
var brand = (state.data.verify.responseBody || {}).brand;
|
|
434
|
+
var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
|
|
435
|
+
var _b = brand || {}, website = _b.website, social = _b.social;
|
|
436
|
+
var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
|
|
437
|
+
var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
|
|
438
|
+
var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
|
|
439
|
+
var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
|
|
440
|
+
var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
|
|
441
|
+
if (isHasWebsite && (isHasTwitter || isHasInstagram))
|
|
442
|
+
selectedChannels = [websiteData, socialData];
|
|
443
|
+
else if (isHasTwitter || isHasInstagram)
|
|
444
|
+
selectedChannels = [socialData];
|
|
445
|
+
else if (isHasWebsite)
|
|
446
|
+
selectedChannels = [websiteData];
|
|
447
|
+
state.data.entityData.salesChannels = selectedChannels;
|
|
448
|
+
})
|
|
449
|
+
.addCase(retrieveChannels.rejected, function (state, action) {
|
|
450
|
+
state.error = action.error.message;
|
|
451
|
+
state.loading = false;
|
|
317
452
|
});
|
|
318
453
|
}
|
|
319
454
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LibConfig } from '../../@types';
|
|
3
|
+
export interface AuthLibProps extends LibConfig {
|
|
4
|
+
leadId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function AuthLib(props: AuthLibProps): JSX.Element;
|
|
7
|
+
export declare function renderAuthLib(config: AuthLibProps, elementId: string): void;
|
|
8
|
+
export declare function unmountAuthLib(elementId: string): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { memo, useEffect } from 'react';
|
|
14
|
+
import { FeatureContainer } from '../shared/Containers';
|
|
15
|
+
import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
|
|
16
|
+
import { settingsSelector } from '../../app/settings';
|
|
17
|
+
import AnimationFlow from '../../components/AnimationFlow';
|
|
18
|
+
import { store } from '../../app/store';
|
|
19
|
+
import { authSelector } from '../app/auth/authStore';
|
|
20
|
+
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
21
|
+
import Collapse from '../../components/Collapse';
|
|
22
|
+
import { reactElement } from '../../utils';
|
|
23
|
+
import { AUTH_SCREENS_NAVIGATION } from '../../constants';
|
|
24
|
+
import { authFeatureScreens } from '../featuresScreens';
|
|
25
|
+
import Background from '../shared/Background';
|
|
26
|
+
import CustomFooter from '../shared/Footer';
|
|
27
|
+
var Auth = memo(function (props) {
|
|
28
|
+
var theme = useAppTheme().theme;
|
|
29
|
+
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
|
|
30
|
+
var authError = useAppSelector(authSelector).error;
|
|
31
|
+
useAppConfig(__assign({ navigation: AUTH_SCREENS_NAVIGATION }, props));
|
|
32
|
+
useErrorListener(authError || error);
|
|
33
|
+
useStepStartedListener();
|
|
34
|
+
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
35
|
+
useEffect(function () {
|
|
36
|
+
if (!props.leadId)
|
|
37
|
+
throw new Error('leadId is required');
|
|
38
|
+
}, []);
|
|
39
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, sx: { position: 'absolute' } }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}), screenId: activeScreen.name, animationType: 'collapse' }, { children: _jsx(FeatureContainer, { children: authFeatureScreens.map(function (_a, index) {
|
|
40
|
+
var Element = _a.element, name = _a.name;
|
|
41
|
+
var isActive = activeScreen.name === name;
|
|
42
|
+
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
43
|
+
}) }) })) })) })));
|
|
44
|
+
});
|
|
45
|
+
export function AuthLib(props) {
|
|
46
|
+
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Auth, __assign({}, props)) })));
|
|
47
|
+
}
|
|
48
|
+
export function renderAuthLib(config, elementId) {
|
|
49
|
+
reactElement(elementId).render(_jsx(AuthLib, __assign({}, config)));
|
|
50
|
+
}
|
|
51
|
+
export function unmountAuthLib(elementId) {
|
|
52
|
+
reactElement(elementId).unmount();
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Auth';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Auth';
|