Compare commits
9 Commits
feature/IO
...
feature/IO
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a68d2791d | ||
|
|
3691d32aaa | ||
|
|
7e741e4af9 | ||
|
|
f556d59ad7 | ||
|
|
7843ca9b1a | ||
|
|
c8701aba63 | ||
|
|
f6e65f82e5 | ||
|
|
663d91b648 | ||
|
|
2a7686ec75 |
@@ -10,6 +10,7 @@ import client from "../utils/GraphQLClient";
|
|||||||
import App from "./App";
|
import App from "./App";
|
||||||
import * as Sentry from "@sentry/react";
|
import * as Sentry from "@sentry/react";
|
||||||
import themeProvider from "./themeProvider";
|
import themeProvider from "./themeProvider";
|
||||||
|
import { CookiesProvider } from "react-cookie";
|
||||||
|
|
||||||
// Base Split configuration
|
// Base Split configuration
|
||||||
const config = {
|
const config = {
|
||||||
@@ -38,26 +39,28 @@ function AppContainer() {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ApolloProvider client={client}>
|
<CookiesProvider>
|
||||||
<ConfigProvider
|
<ApolloProvider client={client}>
|
||||||
input={{ autoComplete: "new-password" }}
|
<ConfigProvider
|
||||||
locale={enLocale}
|
input={{ autoComplete: "new-password" }}
|
||||||
theme={themeProvider}
|
locale={enLocale}
|
||||||
form={{
|
theme={themeProvider}
|
||||||
validateMessages: {
|
form={{
|
||||||
// eslint-disable-next-line no-template-curly-in-string
|
validateMessages: {
|
||||||
required: t("general.validation.required", { label: "${label}" })
|
// eslint-disable-next-line no-template-curly-in-string
|
||||||
}
|
required: t("general.validation.required", { label: "${label}" })
|
||||||
}}
|
}
|
||||||
>
|
}}
|
||||||
<GlobalLoadingBar />
|
>
|
||||||
<SplitFactoryProvider config={config}>
|
<GlobalLoadingBar />
|
||||||
<SplitClientProvider>
|
<SplitFactoryProvider config={config}>
|
||||||
<App />
|
<SplitClientProvider>
|
||||||
</SplitClientProvider>
|
<App />
|
||||||
</SplitFactoryProvider>
|
</SplitClientProvider>
|
||||||
</ConfigProvider>
|
</SplitFactoryProvider>
|
||||||
</ApolloProvider>
|
</ConfigProvider>
|
||||||
|
</ApolloProvider>
|
||||||
|
</CookiesProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ function FeatureWrapper({
|
|||||||
children,
|
children,
|
||||||
upsellComponent,
|
upsellComponent,
|
||||||
bypass,
|
bypass,
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
...restProps
|
...restProps
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -78,7 +79,11 @@ export function HasFeatureAccess({ featureName, bodyshop, bypass, debug = false
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return bodyshop?.features?.allAccess || dayjs(bodyshop?.features[featureName]).isAfter(dayjs());
|
return (
|
||||||
|
bodyshop?.features?.allAccess ||
|
||||||
|
bodyshop?.features?.[featureName] ||
|
||||||
|
dayjs(bodyshop?.features[featureName]).isAfter(dayjs())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(FeatureWrapper);
|
export default connect(mapStateToProps, null)(FeatureWrapper);
|
||||||
|
|||||||
@@ -340,6 +340,7 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
|
|||||||
args: [],
|
args: [],
|
||||||
imex: () => {
|
imex: () => {
|
||||||
window.$crisp.push(["set", "user:company", [payload.shopname]]);
|
window.$crisp.push(["set", "user:company", [payload.shopname]]);
|
||||||
|
window.$crisp.push(["set", "session:segments", [[`region:${payload.region_config}`]]]);
|
||||||
if (authRecord[0] && authRecord[0].user.validemail) {
|
if (authRecord[0] && authRecord[0].user.validemail) {
|
||||||
window.$crisp.push(["set", "user:email", [authRecord[0].user.email]]);
|
window.$crisp.push(["set", "user:email", [authRecord[0].user.email]]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,12 +39,14 @@ exports.createShop = async (req, res) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await client.request(
|
const result = await client.request(
|
||||||
`mutation INSERT_BODYSHOPS($bs: bodyshops_insert_input!){
|
`mutation INSERT_BODYSHOPS($bs: bodyshops_insert_input!) {
|
||||||
insert_bodyshops_one(object:$bs){
|
insert_bodyshops_one(object: $bs) {
|
||||||
id
|
id
|
||||||
|
vendors {
|
||||||
}
|
id
|
||||||
}`,
|
}
|
||||||
|
}
|
||||||
|
}`,
|
||||||
{
|
{
|
||||||
bs: {
|
bs: {
|
||||||
...bodyshop,
|
...bodyshop,
|
||||||
@@ -54,12 +56,39 @@ exports.createShop = async (req, res) => {
|
|||||||
{ countertype: "ihbnum", count: 1 },
|
{ countertype: "ihbnum", count: 1 },
|
||||||
{ countertype: "paymentnum", count: 1 }
|
{ countertype: "paymentnum", count: 1 }
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
vendors: {
|
||||||
|
data: [{ name: "In-House" }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
res.json(result);
|
const bodyshopId = result.insert_bodyshops_one.id;
|
||||||
|
const vendorId = result.insert_bodyshops_one.vendors[0].id;
|
||||||
|
|
||||||
|
if (!bodyshopId || !vendorId) {
|
||||||
|
throw new Error("Failed to create bodyshop or vendor");
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateBodyshop = await client.request(
|
||||||
|
`mutation UPDATE_BODYSHOP($id: uuid!, $inhousevendorid: uuid!) {
|
||||||
|
update_bodyshops_by_pk(pk_columns: { id: $id }, _set: { inhousevendorid: $inhousevendorid }) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
{
|
||||||
|
id: bodyshopId,
|
||||||
|
inhousevendorid: vendorId
|
||||||
|
}
|
||||||
|
);
|
||||||
|
res.status(200).json(updateBodyshop);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
logger.log("admin-create-shop-error", "error", req.user.email, null, {
|
||||||
|
message: error.message,
|
||||||
|
stack: error.stack,
|
||||||
|
request: req.body,
|
||||||
|
ioadmin: true
|
||||||
|
});
|
||||||
res.status(500).json(error);
|
res.status(500).json(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user