@syzy/apphost 1.0.16 → 1.0.17
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/dist/api/mapping-api.js +2 -2
- package/dist/components/Login/Login.js +2 -5
- package/dist/config/EnvConfig.d.ts +1 -1
- package/dist/config/EnvConfig.js +1 -1
- package/package.json +1 -1
- package/dist/components/api/settings-api.d.ts +0 -26
- package/dist/components/api/settings-api.js +0 -129
- package/dist/services/Storage-service.d.ts +0 -2
- package/dist/services/Storage-service.js +0 -26
package/dist/api/mapping-api.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
2
|
-
import { EnvConfig } from "../config/EnvConfig";
|
|
3
|
-
import { Client } from "../services/Client.Service";
|
|
4
2
|
import { initUserMappingDto, transformtoUserMappingDto } from "../domain/model/UserMappingDto";
|
|
5
3
|
import { initRoleMappingDto, transformtoRoleMappingDto } from "../domain/model/RoleMappingDto";
|
|
6
4
|
import { initComponentMappingDto, transformtoComponentMappingDto } from "../domain/model/ComponentMappingDto";
|
|
@@ -11,6 +9,8 @@ import { logger } from "../util/Logger";
|
|
|
11
9
|
import { createBranchMutationGQL, createMapping, updateMapping } from "../customGraphQL/customMutations";
|
|
12
10
|
import { listBranchesQuery, ListBranchUserMappings, ListComponentRoleMappings, listMapping, ListUserRoleMapping, updateBranchMutationQuery } from "../customGraphQL/customQueries";
|
|
13
11
|
import { Status } from "../domain/type/StatusEnum";
|
|
12
|
+
import { Client } from "../services/Client.Service";
|
|
13
|
+
import { EnvConfig } from "../config/EnvConfig";
|
|
14
14
|
export const MAPPING_RESOURCE = "mapping";
|
|
15
15
|
export const GET_MAPPING_BY_USERID_QUERYKEY = "mappingbyuserid";
|
|
16
16
|
export const LIST_BRANCHES_RESOURCE = "branches";
|
|
@@ -9,14 +9,12 @@ import { FaEye, FaEyeSlash } from "react-icons/fa";
|
|
|
9
9
|
// import logo from "../../../src/assets/images/Hotel-Logo.jpg"
|
|
10
10
|
import { signIn, signUp, confirmSignUp, confirmResetPassword, getCurrentUser, confirmSignIn, resetPassword } from "aws-amplify/auth";
|
|
11
11
|
import { signInSchema, registerSchema, confirmSignUpSchema, resetPasswordSchema, forceResetSchema, forgotPasswordSchema, } from "./loginSchema";
|
|
12
|
-
import { ALL, HIDE_SIGN_UP, HIDE_SIGN_UP_IS_NO } from "../../static/constants";
|
|
13
|
-
import { useGetSettingsByPkAndSk } from "../api/settings-api";
|
|
14
12
|
const LoginForm = ({ login }) => {
|
|
15
13
|
const [authMode, setAuthMode] = useState("signin");
|
|
16
14
|
const navigate = useNavigate();
|
|
17
15
|
const [tempUsername, setTempUsername] = useState("");
|
|
18
16
|
const [showPassword, setShowPassword] = useState(false);
|
|
19
|
-
const { settingsByPkAndSk } = useGetSettingsByPkAndSk(ALL, HIDE_SIGN_UP);
|
|
17
|
+
// const { settingsByPkAndSk } = useGetSettingsByPkAndSk(ALL, HIDE_SIGN_UP);
|
|
20
18
|
const getSchema = () => {
|
|
21
19
|
switch (authMode) {
|
|
22
20
|
case "signin":
|
|
@@ -143,7 +141,6 @@ const LoginForm = ({ login }) => {
|
|
|
143
141
|
const isPassword = type === "password";
|
|
144
142
|
return (_jsxs("div", { className: "mb-3 position-relative", children: [_jsxs("div", { className: "input-group", children: [_jsx("input", { type: isPassword ? (showPassword ? "text" : "password") : type, placeholder: label, ...register(name), className: `form-control ${errors[name] ? "is-invalid" : ""}` }), isPassword && (_jsx("span", { className: "input-group-text bg-white", style: { cursor: "pointer" }, onClick: () => setShowPassword((prev) => !prev), children: showPassword ? _jsx(FaEye, { size: 18 }) : _jsx(FaEyeSlash, { size: 18 }) }))] }), errors[name] && (_jsx("div", { className: "invalid-feedback d-block", children: errors[name]?.message }))] }));
|
|
145
143
|
};
|
|
146
|
-
return (_jsx("div", { className: "d-flex justify-content-center align-items-center vh-100 bg-light", children: _jsx("div", { className: "card shadow-sm p-4 p-md-5 w-100", style: { maxWidth: "420px" }, children: _jsxs("form", { onSubmit: handleSubmit(onSubmit), children: [_jsx("div", { className: "d-flex justify-content-center", children: _jsx("img", { className: "w-75 mx-auto mb-4", src: "logo" }) }), _jsxs("h4", { className: "text-center mb-4 fw-bold", children: [authMode === "signin" && "Sign in to your account", authMode === "register" && "Create a new account", authMode === "confirm" && "Verify your email", authMode === "forgot" && "Forgot Password?", authMode === "reset" && "Reset Password", authMode === "forceReset" && "Set New Password"] }), authMode === "signin" && (_jsxs(_Fragment, { children: [renderInput("Username", "text", "username"), renderInput("Password", "password", "password"), _jsx("button", { type: "submit", className: "btn btn-primary w-100 mb-2", children: "Sign In" }),
|
|
147
|
-
_jsx("button", { type: "button", className: "btn btn-link p-0", onClick: () => setAuthMode("register"), children: "Create Account" }), _jsx("button", { type: "button", className: "btn btn-link p-0", onClick: () => setAuthMode("forgot"), children: "Forgot Password?" })] })] })), authMode === "register" && (_jsxs(_Fragment, { children: [renderInput("Username", "text", "username"), renderInput("Email", "email", "email"), renderInput("Password", "password", "password"), renderInput("Confirm Password", "password", "confirmPassword"), _jsx("button", { type: "submit", className: "btn btn-success w-100 mb-2", children: "Register" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "confirm" && (_jsxs(_Fragment, { children: [renderInput("Verification Code", "text", "confirmationCode"), _jsx("button", { type: "submit", className: "btn btn-primary w-100 mb-2", children: "Confirm" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "forgot" && (_jsxs(_Fragment, { children: [renderInput("Username", "text", "username"), _jsx("button", { type: "submit", className: "btn btn-warning w-100 mb-2", children: "Send Reset Code" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "reset" && (_jsxs(_Fragment, { children: [renderInput("Verification Code", "text", "confirmationCode"), renderInput("New Password", "password", "password"), renderInput("Confirm New Password", "password", "confirmPassword"), _jsx("button", { type: "submit", className: "btn btn-success w-100 mb-2", children: "Reset Password" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "forceReset" && (_jsxs(_Fragment, { children: [renderInput("New Password", "password", "password"), renderInput("Confirm New Password", "password", "confirmPassword"), _jsx("button", { type: "submit", className: "btn btn-success w-100 mb-2", children: "Update Password" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] }))] }) }) }));
|
|
144
|
+
return (_jsx("div", { className: "d-flex justify-content-center align-items-center vh-100 bg-light", children: _jsx("div", { className: "card shadow-sm p-4 p-md-5 w-100", style: { maxWidth: "420px" }, children: _jsxs("form", { onSubmit: handleSubmit(onSubmit), children: [_jsx("div", { className: "d-flex justify-content-center", children: _jsx("img", { className: "w-75 mx-auto mb-4", src: "logo" }) }), _jsxs("h4", { className: "text-center mb-4 fw-bold", children: [authMode === "signin" && "Sign in to your account", authMode === "register" && "Create a new account", authMode === "confirm" && "Verify your email", authMode === "forgot" && "Forgot Password?", authMode === "reset" && "Reset Password", authMode === "forceReset" && "Set New Password"] }), authMode === "signin" && (_jsxs(_Fragment, { children: [renderInput("Username", "text", "username"), renderInput("Password", "password", "password"), _jsx("button", { type: "submit", className: "btn btn-primary w-100 mb-2", children: "Sign In" }), _jsx("div", { className: "d-flex justify-content-between", children: _jsx("button", { type: "button", className: "btn btn-link p-0", onClick: () => setAuthMode("forgot"), children: "Forgot Password?" }) })] })), authMode === "register" && (_jsxs(_Fragment, { children: [renderInput("Username", "text", "username"), renderInput("Email", "email", "email"), renderInput("Password", "password", "password"), renderInput("Confirm Password", "password", "confirmPassword"), _jsx("button", { type: "submit", className: "btn btn-success w-100 mb-2", children: "Register" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "confirm" && (_jsxs(_Fragment, { children: [renderInput("Verification Code", "text", "confirmationCode"), _jsx("button", { type: "submit", className: "btn btn-primary w-100 mb-2", children: "Confirm" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "forgot" && (_jsxs(_Fragment, { children: [renderInput("Username", "text", "username"), _jsx("button", { type: "submit", className: "btn btn-warning w-100 mb-2", children: "Send Reset Code" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "reset" && (_jsxs(_Fragment, { children: [renderInput("Verification Code", "text", "confirmationCode"), renderInput("New Password", "password", "password"), renderInput("Confirm New Password", "password", "confirmPassword"), _jsx("button", { type: "submit", className: "btn btn-success w-100 mb-2", children: "Reset Password" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] })), authMode === "forceReset" && (_jsxs(_Fragment, { children: [renderInput("New Password", "password", "password"), renderInput("Confirm New Password", "password", "confirmPassword"), _jsx("button", { type: "submit", className: "btn btn-success w-100 mb-2", children: "Update Password" }), _jsx("button", { type: "button", className: "btn btn-link w-100", onClick: () => setAuthMode("signin"), children: "Back to Sign In" })] }))] }) }) }));
|
|
148
145
|
};
|
|
149
146
|
export default LoginForm;
|
package/dist/config/EnvConfig.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const EnvConfig = {
|
|
2
2
|
env: import.meta.env.VITE_SERVER_ENV || "local",
|
|
3
3
|
bookingAPi: import.meta.env.VITE_BOOKING_SERVICE_SERVER_URL || "",
|
|
4
|
-
|
|
4
|
+
hmsapi: import.meta.env.VITE_HMS_SERVICE_SERVER_URL || "",
|
|
5
5
|
region: import.meta.env.VITE_AWS_REGION || "",
|
|
6
6
|
userPoolId: import.meta.env.VITE_USERPOOL_ID || "",
|
|
7
7
|
userPoolClientId: import.meta.env.VITE_USERPOOL_CLIENT_ID || "",
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SettingsDto } from "../../domain/model/SettingsDto";
|
|
2
|
-
import { UndefinedString } from "../../domain/type/Nullable";
|
|
3
|
-
import { PrefixDescription } from "../../domain/model/PrefixDescriptionDto";
|
|
4
|
-
export declare const GET_SETTINGS_BY_PK: string;
|
|
5
|
-
export declare const GET_SETTINGS_BY_PK_AND_SK: string;
|
|
6
|
-
export declare const listSettings = "query listSettings(\n $pk: ID\n $sk: ModelStringKeyConditionInput\n $filter: ModelSettingsFilterInput\n) {\n listSettings(pk: $pk, sk: $sk, filter: $filter) {\n pk\n sk\n value\n description\n createdDt\n __typename\n }\n}";
|
|
7
|
-
export declare const updateSettings = "mutation updateSettings($input: SettingsInput!) {\n updateSettings(input: $input) {\n pk\n sk\n value\n description\n createdDt\n __typename\n }\n}";
|
|
8
|
-
export declare const transformtoSettingsDto: (interviewProspectData: any) => SettingsDto;
|
|
9
|
-
export declare const transformdToPrefixDescription: (description: string) => PrefixDescription;
|
|
10
|
-
export declare const getSettingsByPkFun: (pk: UndefinedString) => Promise<SettingsDto[]>;
|
|
11
|
-
export declare const useGetSettingsByPk: (pk: string) => {
|
|
12
|
-
settingsByPK: SettingsDto[] | undefined;
|
|
13
|
-
settingsByPKError: Error | null;
|
|
14
|
-
settingsByPKLoading: boolean;
|
|
15
|
-
settingsByPKFetching: boolean;
|
|
16
|
-
settingsByPKSuccess: boolean;
|
|
17
|
-
};
|
|
18
|
-
export declare const getSettingsByPkAndSKFun: (pk: UndefinedString, sk: UndefinedString) => Promise<SettingsDto>;
|
|
19
|
-
export declare const useGetSettingsByPkAndSk: (pk: string, sk: string) => {
|
|
20
|
-
settingsByPkAndSk: SettingsDto | undefined;
|
|
21
|
-
settingsByPkAndSkError: Error | null;
|
|
22
|
-
settingsByPkAndSkLoading: boolean;
|
|
23
|
-
settingsByPkAndSkFetching: boolean;
|
|
24
|
-
settingsByPkAndSkSuccess: boolean;
|
|
25
|
-
};
|
|
26
|
-
export declare const useUpdateSettingsMutation: () => import("@tanstack/react-query").UseMutationResult<any, Error, SettingsDto, unknown>;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
2
|
-
import { initSettings } from "../../domain/model/SettingsDto";
|
|
3
|
-
import { transformToData } from "../../util/transformToData";
|
|
4
|
-
import { logger } from "../../util/Logger";
|
|
5
|
-
import { ALL } from "../../static/constants";
|
|
6
|
-
export const GET_SETTINGS_BY_PK = "settingsbypk";
|
|
7
|
-
export const GET_SETTINGS_BY_PK_AND_SK = "settingsbypkandsk";
|
|
8
|
-
const endpoint = EnvConfig.appHostAPi;
|
|
9
|
-
export const listSettings = `query listSettings(
|
|
10
|
-
$pk: ID
|
|
11
|
-
$sk: ModelStringKeyConditionInput
|
|
12
|
-
$filter: ModelSettingsFilterInput
|
|
13
|
-
) {
|
|
14
|
-
listSettings(pk: $pk, sk: $sk, filter: $filter) {
|
|
15
|
-
pk
|
|
16
|
-
sk
|
|
17
|
-
value
|
|
18
|
-
description
|
|
19
|
-
createdDt
|
|
20
|
-
__typename
|
|
21
|
-
}
|
|
22
|
-
}`;
|
|
23
|
-
export const updateSettings = `mutation updateSettings($input: SettingsInput!) {
|
|
24
|
-
updateSettings(input: $input) {
|
|
25
|
-
pk
|
|
26
|
-
sk
|
|
27
|
-
value
|
|
28
|
-
description
|
|
29
|
-
createdDt
|
|
30
|
-
__typename
|
|
31
|
-
}
|
|
32
|
-
}`;
|
|
33
|
-
export const transformtoSettingsDto = (interviewProspectData) => transformToData(interviewProspectData);
|
|
34
|
-
export const transformdToPrefixDescription = (description) => {
|
|
35
|
-
return JSON.parse(description);
|
|
36
|
-
};
|
|
37
|
-
export const getSettingsByPkFun = async (pk) => {
|
|
38
|
-
try {
|
|
39
|
-
const client = await Client.getCustomGraphqlClient(endpoint);
|
|
40
|
-
const variables = {
|
|
41
|
-
filter: {
|
|
42
|
-
or: [
|
|
43
|
-
{ pk: { eq: pk } },
|
|
44
|
-
{ pk: { eq: ALL } }
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const response = await client.request(listSettings, variables);
|
|
49
|
-
const settingsData = response.listSettings;
|
|
50
|
-
return (settingsData && settingsData.length > 0) ? settingsData.map((eventSchedule) => transformtoSettingsDto(eventSchedule)) : [];
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
return [];
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
export const useGetSettingsByPk = (pk) => {
|
|
57
|
-
const { data, isLoading, error, isFetching, isSuccess } = useQuery({
|
|
58
|
-
queryKey: [GET_SETTINGS_BY_PK, pk],
|
|
59
|
-
queryFn: () => getSettingsByPkFun(pk),
|
|
60
|
-
placeholderData: keepPreviousData,
|
|
61
|
-
staleTime: 1000 * 5 * 60,
|
|
62
|
-
enabled: pk !== "" && pk !== undefined,
|
|
63
|
-
});
|
|
64
|
-
return {
|
|
65
|
-
settingsByPK: data,
|
|
66
|
-
settingsByPKError: error,
|
|
67
|
-
settingsByPKLoading: isLoading,
|
|
68
|
-
settingsByPKFetching: isFetching,
|
|
69
|
-
settingsByPKSuccess: isSuccess,
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
export const getSettingsByPkAndSKFun = async (pk, sk) => {
|
|
73
|
-
try {
|
|
74
|
-
const client = await Client.getCustomGraphqlClient(endpoint);
|
|
75
|
-
const variables = {
|
|
76
|
-
pk: pk,
|
|
77
|
-
sk: {
|
|
78
|
-
eq: sk
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
const response = await client.request(listSettings, variables);
|
|
82
|
-
const settingsData = response.listSettings;
|
|
83
|
-
return (settingsData && settingsData.length > 0) ? transformtoSettingsDto(settingsData[0]) : initSettings;
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
return initSettings;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
export const useGetSettingsByPkAndSk = (pk, sk) => {
|
|
90
|
-
const { data, isLoading, error, isFetching, isSuccess } = useQuery({
|
|
91
|
-
queryKey: [GET_SETTINGS_BY_PK_AND_SK, pk, sk],
|
|
92
|
-
queryFn: () => getSettingsByPkAndSKFun(pk, sk),
|
|
93
|
-
placeholderData: keepPreviousData,
|
|
94
|
-
staleTime: 1000 * 5 * 60,
|
|
95
|
-
enabled: pk !== "" && pk !== undefined && sk !== "" && sk !== undefined,
|
|
96
|
-
});
|
|
97
|
-
return {
|
|
98
|
-
settingsByPkAndSk: data,
|
|
99
|
-
settingsByPkAndSkError: error,
|
|
100
|
-
settingsByPkAndSkLoading: isLoading,
|
|
101
|
-
settingsByPkAndSkFetching: isFetching,
|
|
102
|
-
settingsByPkAndSkSuccess: isSuccess,
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
export const useUpdateSettingsMutation = () => {
|
|
106
|
-
async function createVersionFn(settingsData) {
|
|
107
|
-
const client = await Client.getClient();
|
|
108
|
-
const response = await client.graphql({
|
|
109
|
-
query: updateSettings,
|
|
110
|
-
variables: {
|
|
111
|
-
input: settingsData
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
return response;
|
|
115
|
-
}
|
|
116
|
-
const queryClient = useQueryClient();
|
|
117
|
-
return useMutation({
|
|
118
|
-
mutationFn: createVersionFn,
|
|
119
|
-
onSuccess: (_data, variables) => {
|
|
120
|
-
const settingsByPKQueryKey = [GET_SETTINGS_BY_PK, variables.pk];
|
|
121
|
-
queryClient.invalidateQueries({ queryKey: settingsByPKQueryKey });
|
|
122
|
-
const settingsByPKAndSKQueryKey = [GET_SETTINGS_BY_PK_AND_SK, variables.pk, variables.sk];
|
|
123
|
-
queryClient.invalidateQueries({ queryKey: settingsByPKAndSKQueryKey });
|
|
124
|
-
},
|
|
125
|
-
onError: (err) => {
|
|
126
|
-
logger.error("Error while settings updating", err);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { uploadData } from 'aws-amplify/storage';
|
|
2
|
-
import { LogCategoryEnum } from '../util/LogEnum';
|
|
3
|
-
import { logger } from '../util/Logger';
|
|
4
|
-
import { EnvConfig } from '../config/EnvConfig';
|
|
5
|
-
export const getImageUrl = async (imageKey) => {
|
|
6
|
-
logger.debug(LogCategoryEnum.Info, "imageKey passed", imageKey);
|
|
7
|
-
let returnString = undefined;
|
|
8
|
-
if (imageKey) {
|
|
9
|
-
//Below for hms-ck-dev env image bucket url -------------
|
|
10
|
-
returnString = `${EnvConfig.imageStorageBucketUrl}/${imageKey}`;
|
|
11
|
-
}
|
|
12
|
-
return returnString;
|
|
13
|
-
};
|
|
14
|
-
export const uploadImage = async (imageKey, image) => {
|
|
15
|
-
logger.debug(LogCategoryEnum.Info, "inside upload image function", imageKey);
|
|
16
|
-
logger.debug(LogCategoryEnum.Info, "inside upload image function", image);
|
|
17
|
-
await uploadData({
|
|
18
|
-
key: imageKey,
|
|
19
|
-
data: image,
|
|
20
|
-
options: {
|
|
21
|
-
accessLevel: 'guest',
|
|
22
|
-
contentType: image.type,
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
logger.debug(LogCategoryEnum.Info, "image key", imageKey);
|
|
26
|
-
};
|