Replace export default
with named exports (#352)
* Update eslint config to prevent default exports * exlucde vitest config from banned default exports * Remove default exports from Monitoring App * Replace default exports with named exports * Fix klaviyo import path * Replace default exports in CMS
This commit is contained in:
parent
f387a7b28b
commit
eca52ad058
83 changed files with 19628 additions and 8645 deletions
5
.changeset/hot-clouds-applaud.md
Normal file
5
.changeset/hot-clouds-applaud.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"saleor-app-search": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Removed search index preview page. It can be easily accessed at Algolia itself.
|
5
.changeset/new-mice-remember.md
Normal file
5
.changeset/new-mice-remember.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"saleor-app-search": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Update Next and Sentry
|
14
.changeset/thick-dots-live.md
Normal file
14
.changeset/thick-dots-live.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
"eslint-config-saleor": patch
|
||||||
|
"saleor-app-emails-and-messages": patch
|
||||||
|
"saleor-app-data-importer": patch
|
||||||
|
"saleor-app-products-feed": patch
|
||||||
|
"saleor-app-monitoring": patch
|
||||||
|
"saleor-app-klaviyo": patch
|
||||||
|
"saleor-app-search": patch
|
||||||
|
"saleor-app-slack": patch
|
||||||
|
"saleor-app-taxes": patch
|
||||||
|
"saleor-app-cms": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Replace "export default" with named exports
|
5
.changeset/twenty-crews-battle.md
Normal file
5
.changeset/twenty-crews-battle.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"eslint-config-saleor": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Added "no-default-export" eslint rule (except Next.js page)
|
|
@ -8,7 +8,7 @@ import {
|
||||||
getProductVariantProviderInstancesToAlter,
|
getProductVariantProviderInstancesToAlter,
|
||||||
} from "./settings";
|
} from "./settings";
|
||||||
import { providersSchemaSet } from "../config";
|
import { providersSchemaSet } from "../config";
|
||||||
import cmsProviders, { CMSProvider } from "../providers";
|
import { cmsProviders, CMSProvider } from "../providers";
|
||||||
import { CmsClientOperations } from "../types";
|
import { CmsClientOperations } from "../types";
|
||||||
import { logger as pinoLogger } from "../../logger";
|
import { logger as pinoLogger } from "../../logger";
|
||||||
import { getCmsIdFromSaleorItemKey } from "./metadata";
|
import { getCmsIdFromSaleorItemKey } from "./metadata";
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
export * from "./config";
|
export * from "./config";
|
||||||
export * from "./client";
|
export * from "./client";
|
||||||
export * from "./providers";
|
export * from "./providers";
|
||||||
export { default as cmsProviders } from "./providers";
|
|
||||||
|
|
|
@ -156,4 +156,4 @@ const contentfulOperations: CreateOperations<ContentfulConfig> = (config) => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default createProvider(contentfulOperations, contentfulConfigSchema);
|
export const contentfulProvider = createProvider(contentfulOperations, contentfulConfigSchema);
|
||||||
|
|
|
@ -90,4 +90,4 @@ const datocmsOperations: CreateOperations<DatocmsConfig> = (config) => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default createProvider(datocmsOperations, datocmsConfigSchema);
|
export const datoCmsProvider = createProvider(datocmsOperations, datocmsConfigSchema);
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import contentful from "./contentful";
|
import { contentfulProvider } from "./contentful";
|
||||||
import strapi from "./strapi";
|
import { strapiProvider } from "./strapi";
|
||||||
import datocms from "./datocms";
|
import { datoCmsProvider } from "./datocms";
|
||||||
|
|
||||||
const cmsProviders = {
|
export const cmsProviders = {
|
||||||
contentful,
|
contentful: contentfulProvider,
|
||||||
strapi,
|
strapi: strapiProvider,
|
||||||
datocms,
|
datocms: datoCmsProvider,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CMSProvider = keyof typeof cmsProviders;
|
export type CMSProvider = keyof typeof cmsProviders;
|
||||||
|
|
||||||
export default cmsProviders;
|
|
||||||
|
|
|
@ -111,4 +111,4 @@ export const strapiOperations: CreateStrapiOperations = (config): CmsOperations
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default createProvider(strapiOperations, strapiConfigSchema);
|
export const strapiProvider = createProvider(strapiOperations, strapiConfigSchema);
|
||||||
|
|
|
@ -20,7 +20,7 @@ import {
|
||||||
SingleChannelSchema,
|
SingleChannelSchema,
|
||||||
SingleProviderSchema,
|
SingleProviderSchema,
|
||||||
} from "../../../lib/cms/config";
|
} from "../../../lib/cms/config";
|
||||||
import ProviderIcon from "../../provider-instances/ui/provider-icon";
|
import { ProviderIcon } from "../../provider-instances/ui/provider-icon";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => {
|
const useStyles = makeStyles((theme) => {
|
||||||
return {
|
return {
|
||||||
|
@ -49,7 +49,7 @@ interface ChannelConfigurationFormProps {
|
||||||
onSubmit: (channel: SingleChannelSchema) => any;
|
onSubmit: (channel: SingleChannelSchema) => any;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ChannelConfigurationForm = ({
|
export const ChannelConfigurationForm = ({
|
||||||
channel,
|
channel,
|
||||||
providerInstances,
|
providerInstances,
|
||||||
loading,
|
loading,
|
||||||
|
@ -150,5 +150,3 @@ const ChannelConfigurationForm = ({
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ChannelConfigurationForm;
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { AppPaper } from "../../ui/app-paper";
|
import { AppPaper } from "../../ui/app-paper";
|
||||||
import { FormControlLabel, Grid, Paper, Radio, RadioGroup, Typography } from "@material-ui/core";
|
import { FormControlLabel, Grid, Paper, Radio, RadioGroup, Typography } from "@material-ui/core";
|
||||||
import { Skeleton } from "@material-ui/lab";
|
import { Skeleton } from "@material-ui/lab";
|
||||||
import ChannelConfigurationForm from "./channel-configuration-form";
|
import { ChannelConfigurationForm } from "./channel-configuration-form";
|
||||||
import {
|
import {
|
||||||
MergedChannelSchema,
|
MergedChannelSchema,
|
||||||
ProvidersSchema,
|
ProvidersSchema,
|
||||||
|
@ -60,7 +60,7 @@ interface ChannelConfigurationProps {
|
||||||
errors: ChannelsErrors;
|
errors: ChannelsErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ChannelConfiguration = ({
|
export const ChannelConfiguration = ({
|
||||||
activeChannel,
|
activeChannel,
|
||||||
providerInstances,
|
providerInstances,
|
||||||
saveChannel,
|
saveChannel,
|
||||||
|
@ -117,5 +117,3 @@ const ChannelConfiguration = ({
|
||||||
</Paper>
|
</Paper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ChannelConfiguration;
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { ChannelFragment } from "../../../../generated/graphql";
|
import { ChannelFragment } from "../../../../generated/graphql";
|
||||||
import { MergedChannelSchema, SingleChannelSchema } from "../../../lib/cms/config";
|
import { MergedChannelSchema, SingleChannelSchema } from "../../../lib/cms/config";
|
||||||
import ProviderIcon from "../../provider-instances/ui/provider-icon";
|
import { ProviderIcon } from "../../provider-instances/ui/provider-icon";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => {
|
const useStyles = makeStyles((theme) => {
|
||||||
return {
|
return {
|
||||||
|
@ -40,7 +40,7 @@ interface ChannelsListItemsProps {
|
||||||
setActiveChannel: (channel: MergedChannelSchema | null) => void;
|
setActiveChannel: (channel: MergedChannelSchema | null) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ChannelsListItems = ({
|
export const ChannelsListItems = ({
|
||||||
channels,
|
channels,
|
||||||
activeChannel,
|
activeChannel,
|
||||||
setActiveChannel,
|
setActiveChannel,
|
||||||
|
@ -72,5 +72,3 @@ const ChannelsListItems = ({
|
||||||
</OffsettedList>
|
</OffsettedList>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ChannelsListItems;
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Skeleton } from "@material-ui/lab";
|
||||||
import { ChannelFragment } from "../../../../generated/graphql";
|
import { ChannelFragment } from "../../../../generated/graphql";
|
||||||
import { MergedChannelSchema, SingleChannelSchema } from "../../../lib/cms";
|
import { MergedChannelSchema, SingleChannelSchema } from "../../../lib/cms";
|
||||||
import { AppPaper } from "../../ui/app-paper";
|
import { AppPaper } from "../../ui/app-paper";
|
||||||
import ChannelsListItems from "./channels-list-items";
|
import { ChannelsListItems } from "./channels-list-items";
|
||||||
import { ChannelsErrors, ChannelsLoading } from "./types";
|
import { ChannelsErrors, ChannelsLoading } from "./types";
|
||||||
|
|
||||||
const ChannelsListSkeleton = () => {
|
const ChannelsListSkeleton = () => {
|
||||||
|
@ -32,7 +32,7 @@ interface ChannelsListProps {
|
||||||
errors: ChannelsErrors;
|
errors: ChannelsErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ChannelsList = ({
|
export const ChannelsList = ({
|
||||||
channels,
|
channels,
|
||||||
activeChannel,
|
activeChannel,
|
||||||
setActiveChannel,
|
setActiveChannel,
|
||||||
|
@ -55,5 +55,3 @@ const ChannelsList = ({
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ChannelsList;
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
import { useEffect, useState } from "react";
|
import { useState } from "react";
|
||||||
import { MergedChannelSchema, SingleChannelSchema } from "../../../lib/cms/config";
|
import { MergedChannelSchema } from "../../../lib/cms/config";
|
||||||
import useProviderInstances from "../../provider-instances/ui/hooks/useProviderInstances";
|
import { useProviderInstances } from "../../provider-instances/ui/hooks/useProviderInstances";
|
||||||
import { Instructions } from "../../ui/instructions";
|
import { Instructions } from "../../ui/instructions";
|
||||||
import ChannelConfiguration from "./channel-configuration";
|
import { ChannelConfiguration } from "./channel-configuration";
|
||||||
import ChannelsList from "./channels-list";
|
import { ChannelsList } from "./channels-list";
|
||||||
import useChannels from "./hooks/useChannels";
|
import { useChannels } from "./hooks/useChannels";
|
||||||
import useSaveChannels from "./hooks/useChannelsFetch";
|
|
||||||
|
|
||||||
const Channels = () => {
|
export const Channels = () => {
|
||||||
const { channels, saveChannel, loading, errors } = useChannels();
|
const { channels, saveChannel, loading, errors } = useChannels();
|
||||||
const { providerInstances } = useProviderInstances();
|
const { providerInstances } = useProviderInstances();
|
||||||
|
|
||||||
|
@ -41,4 +40,3 @@ const Channels = () => {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Channels;
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import useChannelsFetch from "./useChannelsFetch";
|
import { useChannelsFetch } from "./useChannelsFetch";
|
||||||
import { MergedChannelSchema, SingleChannelSchema } from "../../../../lib/cms/config";
|
import { MergedChannelSchema, SingleChannelSchema } from "../../../../lib/cms/config";
|
||||||
import { ChannelsErrors, ChannelsLoading } from "../types";
|
import { ChannelsErrors, ChannelsLoading } from "../types";
|
||||||
import { useChannelsQuery } from "../../../../../generated/graphql";
|
import { useChannelsQuery } from "../../../../../generated/graphql";
|
||||||
import { useIsMounted } from "usehooks-ts";
|
import { useIsMounted } from "usehooks-ts";
|
||||||
|
|
||||||
const useChannels = () => {
|
export const useChannels = () => {
|
||||||
const isMounted = useIsMounted();
|
const isMounted = useIsMounted();
|
||||||
const [channelsQueryData, channelsQueryOpts] = useChannelsQuery({
|
const [channelsQueryData, channelsQueryOpts] = useChannelsQuery({
|
||||||
pause: !isMounted,
|
pause: !isMounted,
|
||||||
|
@ -47,5 +47,3 @@ const useChannels = () => {
|
||||||
|
|
||||||
return { channels, saveChannel, loading, errors };
|
return { channels, saveChannel, loading, errors };
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useChannels;
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
import { SALEOR_API_URL_HEADER, SALEOR_AUTHORIZATION_BEARER_HEADER } from "@saleor/app-sdk/const";
|
import { SALEOR_API_URL_HEADER, SALEOR_AUTHORIZATION_BEARER_HEADER } from "@saleor/app-sdk/const";
|
||||||
import { ChannelsApiResponse } from "../../../../pages/api/channels";
|
import { ChannelsApiResponse } from "../../../../pages/api/channels";
|
||||||
|
|
||||||
const useChannelsFetch = () => {
|
export const useChannelsFetch = () => {
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState } = useAppBridge();
|
||||||
const [isSaving, setIsSaving] = React.useState(false);
|
const [isSaving, setIsSaving] = React.useState(false);
|
||||||
const [isFetching, setIsFetching] = React.useState(false);
|
const [isFetching, setIsFetching] = React.useState(false);
|
||||||
|
@ -80,5 +80,3 @@ const useChannelsFetch = () => {
|
||||||
|
|
||||||
return { saveChannel, isSaving, data: config, isFetching, error: validationError };
|
return { saveChannel, isSaving, data: config, isFetching, error: validationError };
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useChannelsFetch;
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import useProviderInstancesFetch from "./useProviderInstancesFetch";
|
import { useProviderInstancesFetch } from "./useProviderInstancesFetch";
|
||||||
import { SingleProviderSchema } from "../../../../lib/cms/config";
|
import { SingleProviderSchema } from "../../../../lib/cms/config";
|
||||||
import { ProvidersErrors, ProvidersLoading } from "../types";
|
import { ProvidersErrors, ProvidersLoading } from "../types";
|
||||||
|
|
||||||
const useProviderInstances = () => {
|
export const useProviderInstances = () => {
|
||||||
const {
|
const {
|
||||||
saveProviderInstance: saveProviderInstanceFetch,
|
saveProviderInstance: saveProviderInstanceFetch,
|
||||||
deleteProviderInstance: deleteProviderInstanceFetch,
|
deleteProviderInstance: deleteProviderInstanceFetch,
|
||||||
|
@ -43,5 +43,3 @@ const useProviderInstances = () => {
|
||||||
|
|
||||||
return { providerInstances, saveProviderInstance, deleteProviderInstance, loading, errors };
|
return { providerInstances, saveProviderInstance, deleteProviderInstance, loading, errors };
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useProviderInstances;
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { CMSSchemaProviderInstances, SingleProviderSchema } from "../../../../li
|
||||||
import { SALEOR_API_URL_HEADER, SALEOR_AUTHORIZATION_BEARER_HEADER } from "@saleor/app-sdk/const";
|
import { SALEOR_API_URL_HEADER, SALEOR_AUTHORIZATION_BEARER_HEADER } from "@saleor/app-sdk/const";
|
||||||
import { ProviderInstancesApiResponse } from "../../../../pages/api/provider-instances";
|
import { ProviderInstancesApiResponse } from "../../../../pages/api/provider-instances";
|
||||||
|
|
||||||
const useProviderInstancesFetch = () => {
|
export const useProviderInstancesFetch = () => {
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState } = useAppBridge();
|
||||||
const [isSaving, setIsSaving] = React.useState(false);
|
const [isSaving, setIsSaving] = React.useState(false);
|
||||||
const [isFetching, setIsFetching] = React.useState(false);
|
const [isFetching, setIsFetching] = React.useState(false);
|
||||||
|
@ -130,5 +130,3 @@ const useProviderInstancesFetch = () => {
|
||||||
error: validationError,
|
error: validationError,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useProviderInstancesFetch;
|
|
||||||
|
|
|
@ -5,10 +5,8 @@ interface ProviderIconProps {
|
||||||
providerName: string;
|
providerName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProviderIcon = ({ providerName }: ProviderIconProps) => {
|
export const ProviderIcon = ({ providerName }: ProviderIconProps) => {
|
||||||
const provider = getProviderByName(providerName);
|
const provider = getProviderByName(providerName);
|
||||||
|
|
||||||
return provider ? <Image src={provider.iconSrc} alt={`${provider.label} icon`} /> : null;
|
return provider ? <Image src={provider.iconSrc} alt={`${provider.label} icon`} /> : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ProviderIcon;
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ interface ProviderInstanceConfigurationFormProps<TProvider extends CMSProviderSc
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProviderInstanceConfigurationForm = <TProvider extends CMSProviderSchema>({
|
export const ProviderInstanceConfigurationForm = <TProvider extends CMSProviderSchema>({
|
||||||
provider,
|
provider,
|
||||||
providerInstance,
|
providerInstance,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
|
@ -165,5 +165,3 @@ const ProviderInstanceConfigurationForm = <TProvider extends CMSProviderSchema>(
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ProviderInstanceConfigurationForm;
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import Image from "next/image";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { CMSProviderSchema, providersConfig, SingleProviderSchema } from "../../../lib/cms/config";
|
import { CMSProviderSchema, providersConfig, SingleProviderSchema } from "../../../lib/cms/config";
|
||||||
import { AppPaper } from "../../ui/app-paper";
|
import { AppPaper } from "../../ui/app-paper";
|
||||||
import ProviderInstanceConfigurationForm from "./provider-instance-configuration-form";
|
import { ProviderInstanceConfigurationForm } from "./provider-instance-configuration-form";
|
||||||
import { Skeleton } from "@material-ui/lab";
|
import { Skeleton } from "@material-ui/lab";
|
||||||
import { ProvidersErrors, ProvidersLoading } from "./types";
|
import { ProvidersErrors, ProvidersLoading } from "./types";
|
||||||
import { getProviderByName, Provider } from "../../providers/config";
|
import { getProviderByName, Provider } from "../../providers/config";
|
||||||
|
@ -84,7 +84,7 @@ interface ProviderInstanceConfigurationProps {
|
||||||
errors: ProvidersErrors;
|
errors: ProvidersErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProviderInstanceConfiguration = ({
|
export const ProviderInstanceConfiguration = ({
|
||||||
activeProviderInstance,
|
activeProviderInstance,
|
||||||
newProviderInstance,
|
newProviderInstance,
|
||||||
saveProviderInstance,
|
saveProviderInstance,
|
||||||
|
@ -187,5 +187,3 @@ const ProviderInstanceConfiguration = ({
|
||||||
</AppPaper>
|
</AppPaper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ProviderInstanceConfiguration;
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import clsx from "clsx";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { SingleProviderSchema } from "../../../lib/cms/config";
|
import { SingleProviderSchema } from "../../../lib/cms/config";
|
||||||
import { getProviderByName } from "../../providers/config";
|
import { getProviderByName } from "../../providers/config";
|
||||||
import ProviderIcon from "./provider-icon";
|
import { ProviderIcon } from "./provider-icon";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => {
|
const useStyles = makeStyles((theme) => {
|
||||||
return {
|
return {
|
||||||
|
@ -59,7 +59,7 @@ interface ProviderInstancesListItemsProps {
|
||||||
setActiveProviderInstance: (provider: SingleProviderSchema) => void;
|
setActiveProviderInstance: (provider: SingleProviderSchema) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProviderInstancesListItems = ({
|
export const ProviderInstancesListItems = ({
|
||||||
providerInstances,
|
providerInstances,
|
||||||
activeProviderInstance,
|
activeProviderInstance,
|
||||||
setActiveProviderInstance,
|
setActiveProviderInstance,
|
||||||
|
@ -92,5 +92,3 @@ const ProviderInstancesListItems = ({
|
||||||
</OffsettedList>
|
</OffsettedList>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ProviderInstancesListItems;
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Skeleton } from "@material-ui/lab";
|
||||||
import { Button, makeStyles } from "@saleor/macaw-ui";
|
import { Button, makeStyles } from "@saleor/macaw-ui";
|
||||||
import { SingleProviderSchema } from "../../../lib/cms/config";
|
import { SingleProviderSchema } from "../../../lib/cms/config";
|
||||||
import { AppPaper } from "../../ui/app-paper";
|
import { AppPaper } from "../../ui/app-paper";
|
||||||
import ProviderInstancesListItems, { ProviderItem } from "./provider-instances-list-items";
|
import { ProviderInstancesListItems, ProviderItem } from "./provider-instances-list-items";
|
||||||
import { ProvidersErrors, ProvidersLoading } from "./types";
|
import { ProvidersErrors, ProvidersLoading } from "./types";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => {
|
const useStyles = makeStyles((theme) => {
|
||||||
|
@ -44,7 +44,7 @@ interface ProviderInstancesListProps {
|
||||||
errors: ProvidersErrors;
|
errors: ProvidersErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProviderInstancesList = ({
|
export const ProviderInstancesList = ({
|
||||||
providerInstances,
|
providerInstances,
|
||||||
activeProviderInstance,
|
activeProviderInstance,
|
||||||
newProviderInstance,
|
newProviderInstance,
|
||||||
|
@ -91,5 +91,3 @@ const ProviderInstancesList = ({
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ProviderInstancesList;
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import ProviderInstancesList from "./provider-instances-list";
|
import { ProviderInstancesList } from "./provider-instances-list";
|
||||||
import { Instructions } from "../../ui/instructions";
|
import { Instructions } from "../../ui/instructions";
|
||||||
import ProviderInstanceConfiguration from "./provider-instance-configuration";
|
import { ProviderInstanceConfiguration } from "./provider-instance-configuration";
|
||||||
import { providersConfig, ProvidersSchema, SingleProviderSchema } from "../../../lib/cms/config";
|
import { providersConfig, ProvidersSchema, SingleProviderSchema } from "../../../lib/cms/config";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import useProviderInstances from "./hooks/useProviderInstances";
|
import { useProviderInstances } from "./hooks/useProviderInstances";
|
||||||
|
|
||||||
const ProviderInstances = () => {
|
export const ProviderInstances = () => {
|
||||||
const { providerInstances, saveProviderInstance, deleteProviderInstance, loading, errors } =
|
const { providerInstances, saveProviderInstance, deleteProviderInstance, loading, errors } =
|
||||||
useProviderInstances();
|
useProviderInstances();
|
||||||
|
|
||||||
|
@ -73,5 +73,3 @@ const ProviderInstances = () => {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ProviderInstances;
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ interface AppTabsProps {
|
||||||
activeTab: keyof typeof tabs;
|
activeTab: keyof typeof tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AppTabs = ({ activeTab }: AppTabsProps) => {
|
export const AppTabs = ({ activeTab }: AppTabsProps) => {
|
||||||
const styles = useStyles();
|
const styles = useStyles();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
@ -40,4 +40,3 @@ const AppTabs = ({ activeTab }: AppTabsProps) => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default AppTabs;
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
} from "@saleor/macaw-ui";
|
} from "@saleor/macaw-ui";
|
||||||
import React, { PropsWithChildren, ReactElement, ReactNode, useEffect } from "react";
|
import React, { PropsWithChildren, ReactElement, ReactNode, useEffect } from "react";
|
||||||
import { AppProps } from "next/app";
|
import { AppProps } from "next/app";
|
||||||
import GraphQLProvider from "../providers/GraphQLProvider";
|
import { GraphQLProvider } from "../providers/GraphQLProvider";
|
||||||
import { ThemeSynchronizer } from "../lib/theme-synchronizer";
|
import { ThemeSynchronizer } from "../lib/theme-synchronizer";
|
||||||
import { RoutePropagator } from "@saleor/app-sdk/app-bridge/next";
|
import { RoutePropagator } from "@saleor/app-sdk/app-bridge/next";
|
||||||
import { NoSSRWrapper } from "../lib/no-ssr-wrapper";
|
import { NoSSRWrapper } from "../lib/no-ssr-wrapper";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import AppTabs from "../modules/ui/app-tabs";
|
import { AppTabs } from "../modules/ui/app-tabs";
|
||||||
import Channels from "../modules/channels/ui/channels";
|
import { Channels } from "../modules/channels/ui/channels";
|
||||||
import { AppContainer } from "../modules/ui/app-container";
|
import { AppContainer } from "../modules/ui/app-container";
|
||||||
import { AppLayout } from "../modules/ui/app-layout";
|
import { AppLayout } from "../modules/ui/app-layout";
|
||||||
import { NextPageWithLayout } from "./_app";
|
import { NextPageWithLayout } from "./_app";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { AppContainer } from "../modules/ui/app-container";
|
import { AppContainer } from "../modules/ui/app-container";
|
||||||
import { AppLayout } from "../modules/ui/app-layout";
|
import { AppLayout } from "../modules/ui/app-layout";
|
||||||
import AppTabs from "../modules/ui/app-tabs";
|
import { AppTabs } from "../modules/ui/app-tabs";
|
||||||
import ProviderInstances from "../modules/provider-instances/ui/provider-instances";
|
import { ProviderInstances } from "../modules/provider-instances/ui/provider-instances";
|
||||||
import { NextPageWithLayout } from "./_app";
|
import { NextPageWithLayout } from "./_app";
|
||||||
import { ReactElement } from "react";
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Provider } from "urql";
|
||||||
|
|
||||||
import { createClient } from "../lib/graphql";
|
import { createClient } from "../lib/graphql";
|
||||||
|
|
||||||
function GraphQLProvider(props: PropsWithChildren<{}>) {
|
export function GraphQLProvider(props: PropsWithChildren<{}>) {
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState } = useAppBridge();
|
||||||
const saleorApiUrl = appBridgeState?.saleorApiUrl!;
|
const saleorApiUrl = appBridgeState?.saleorApiUrl!;
|
||||||
|
|
||||||
|
@ -14,5 +14,3 @@ function GraphQLProvider(props: PropsWithChildren<{}>) {
|
||||||
|
|
||||||
return <Provider value={client} {...props} />;
|
return <Provider value={client} {...props} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default GraphQLProvider;
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import React, { ComponentProps } from "react";
|
||||||
import { Container, Divider } from "@material-ui/core";
|
import { Container, Divider } from "@material-ui/core";
|
||||||
import { Button, makeStyles, PageTab, PageTabs, SaleorTheme } from "@saleor/macaw-ui";
|
import { Button, makeStyles, PageTab, PageTabs, SaleorTheme } from "@saleor/macaw-ui";
|
||||||
import { CustomersImporterView } from "../modules/customers/customers-importer-nuvo/customers-importer-view";
|
import { CustomersImporterView } from "../modules/customers/customers-importer-nuvo/customers-importer-view";
|
||||||
import GraphQLProvider from "../providers/GraphQLProvider";
|
import { GraphQLProvider } from "../providers/GraphQLProvider";
|
||||||
import { actions, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
import { actions, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
||||||
|
|
||||||
type Tab = "customers";
|
type Tab = "customers";
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Provider } from "urql";
|
||||||
|
|
||||||
import { createClient } from "../lib/graphql";
|
import { createClient } from "../lib/graphql";
|
||||||
|
|
||||||
function GraphQLProvider(props: PropsWithChildren<{}>) {
|
export function GraphQLProvider(props: PropsWithChildren<{}>) {
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState } = useAppBridge();
|
||||||
|
|
||||||
const client = createClient(appBridgeState?.saleorApiUrl!, async () =>
|
const client = createClient(appBridgeState?.saleorApiUrl!, async () =>
|
||||||
|
@ -13,5 +13,3 @@ function GraphQLProvider(props: PropsWithChildren<{}>) {
|
||||||
|
|
||||||
return <Provider value={client} {...props} />;
|
return <Provider value={client} {...props} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default GraphQLProvider;
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,7 @@ import { AppConfigurationForm } from "./app-configuration-form";
|
||||||
import { actions, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
import { actions, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
||||||
import { AppColumnsLayout } from "../../ui/app-columns-layout";
|
import { AppColumnsLayout } from "../../ui/app-columns-layout";
|
||||||
import { trpcClient } from "../../trpc/trpc-client";
|
import { trpcClient } from "../../trpc/trpc-client";
|
||||||
import SideMenu from "./side-menu";
|
import { SideMenu } from "./side-menu";
|
||||||
import { LoadingIndicator } from "../../ui/loading-indicator";
|
import { LoadingIndicator } from "../../ui/loading-indicator";
|
||||||
import { Instructions } from "./instructions";
|
import { Instructions } from "./instructions";
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@ export const Instructions = () => {
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography paragraph>
|
<Typography paragraph>
|
||||||
Start by creating a new configuration for provider of your choice. You can create multiple
|
Start by creating a new configuration for provider of your choice. You can create multiple
|
||||||
configurations and then assign them to channels. Navigate to the relevant tab to configure the provider.
|
configurations and then assign them to channels. Navigate to the relevant tab to configure
|
||||||
|
the provider.
|
||||||
</Typography>
|
</Typography>
|
||||||
</Paper>
|
</Paper>
|
||||||
);
|
);
|
||||||
|
|
|
@ -107,5 +107,3 @@ export const SideMenu: React.FC<SideMenuProps> = ({
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SideMenu;
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { getDefaultEmptyConfiguration } from "../mjml-config-container";
|
||||||
import { NextRouter, useRouter } from "next/router";
|
import { NextRouter, useRouter } from "next/router";
|
||||||
import { mjmlUrls } from "../../urls";
|
import { mjmlUrls } from "../../urls";
|
||||||
import { MjmlTemplatesCard } from "./mjml-templates-card";
|
import { MjmlTemplatesCard } from "./mjml-templates-card";
|
||||||
import SideMenu from "../../../app-configuration/ui/side-menu";
|
import { SideMenu } from "../../../app-configuration/ui/side-menu";
|
||||||
import { MjmlConfiguration } from "../mjml-config";
|
import { MjmlConfiguration } from "../mjml-config";
|
||||||
import { LoadingIndicator } from "../../../ui/loading-indicator";
|
import { LoadingIndicator } from "../../../ui/loading-indicator";
|
||||||
import { Add } from "@material-ui/icons";
|
import { Add } from "@material-ui/icons";
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { trpcClient } from "../../../trpc/trpc-client";
|
||||||
import { SendgridConfigurationForm } from "./sendgrid-configuration-form";
|
import { SendgridConfigurationForm } from "./sendgrid-configuration-form";
|
||||||
import { getDefaultEmptyConfiguration } from "../sendgrid-config-container";
|
import { getDefaultEmptyConfiguration } from "../sendgrid-config-container";
|
||||||
import { NextRouter, useRouter } from "next/router";
|
import { NextRouter, useRouter } from "next/router";
|
||||||
import SideMenu from "../../../app-configuration/ui/side-menu";
|
import { SideMenu } from "../../../app-configuration/ui/side-menu";
|
||||||
import { SendgridConfiguration } from "../sendgrid-config";
|
import { SendgridConfiguration } from "../sendgrid-config";
|
||||||
import { LoadingIndicator } from "../../../ui/loading-indicator";
|
import { LoadingIndicator } from "../../../ui/loading-indicator";
|
||||||
import { Add } from "@material-ui/icons";
|
import { Add } from "@material-ui/icons";
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Typography } from "@material-ui/core";
|
||||||
import { actions, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
import { actions, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
||||||
import { appName } from "./const";
|
import { appName } from "./const";
|
||||||
|
|
||||||
const NotReadyPage = () => {
|
export const NotReadyPage = () => {
|
||||||
const { appBridge } = useAppBridge();
|
const { appBridge } = useAppBridge();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -33,5 +33,3 @@ const NotReadyPage = () => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default NotReadyPage;
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ const warnings: Record<WarningCause, string> = {
|
||||||
unknown_cause: "Something went wrong.",
|
unknown_cause: "Something went wrong.",
|
||||||
};
|
};
|
||||||
|
|
||||||
function AccessWarning({ cause = "unknown_cause" }: AccessWarningProps) {
|
export function AccessWarning({ cause = "unknown_cause" }: AccessWarningProps) {
|
||||||
return (
|
return (
|
||||||
<div suppressHydrationWarning>
|
<div suppressHydrationWarning>
|
||||||
<Typography variant="subtitle1">
|
<Typography variant="subtitle1">
|
||||||
|
@ -30,5 +30,3 @@ function AccessWarning({ cause = "unknown_cause" }: AccessWarningProps) {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AccessWarning;
|
|
|
@ -3,7 +3,7 @@ import React from "react";
|
||||||
|
|
||||||
import { useStyles } from "./styles";
|
import { useStyles } from "./styles";
|
||||||
|
|
||||||
function LoadingPage() {
|
export function LoadingPage() {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -16,5 +16,3 @@ function LoadingPage() {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default LoadingPage;
|
|
|
@ -11,7 +11,7 @@ interface UseFetchProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This hook is meant to be used mainly for internal API calls
|
// This hook is meant to be used mainly for internal API calls
|
||||||
const useAppApi = ({ url, options, skip }: UseFetchProps) => {
|
export const useAppApi = ({ url, options, skip }: UseFetchProps) => {
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState } = useAppBridge();
|
||||||
|
|
||||||
const [data, setData] = useState<any>();
|
const [data, setData] = useState<any>();
|
||||||
|
@ -60,5 +60,3 @@ const useAppApi = ({ url, options, skip }: UseFetchProps) => {
|
||||||
|
|
||||||
return { data, error, loading };
|
return { data, error, loading };
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useAppApi;
|
|
|
@ -2,7 +2,7 @@ interface EmailServiceProvider {
|
||||||
send: (event: string, recipient: string, context: any) => Promise<Response>;
|
send: (event: string, recipient: string, context: any) => Promise<Response>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Klaviyo = (token: string): EmailServiceProvider => ({
|
export const Klaviyo = (token: string): EmailServiceProvider => ({
|
||||||
send: async (event, recipient, context) => {
|
send: async (event, recipient, context) => {
|
||||||
const formParams = new URLSearchParams();
|
const formParams = new URLSearchParams();
|
||||||
formParams.append(
|
formParams.append(
|
||||||
|
@ -27,5 +27,3 @@ const Klaviyo = (token: string): EmailServiceProvider => ({
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default Klaviyo;
|
|
|
@ -5,8 +5,8 @@ import {
|
||||||
FetchAppDetailsDocument,
|
FetchAppDetailsDocument,
|
||||||
FetchAppDetailsQuery,
|
FetchAppDetailsQuery,
|
||||||
UpdateAppMetadataDocument,
|
UpdateAppMetadataDocument,
|
||||||
} from "../generated/graphql";
|
} from "../../generated/graphql";
|
||||||
import { settingsManagerSecretKey } from "../saleor-app";
|
import { settingsManagerSecretKey } from "../../saleor-app";
|
||||||
|
|
||||||
// Function is using urql graphql client to fetch all available metadata.
|
// Function is using urql graphql client to fetch all available metadata.
|
||||||
// Before returning query result, we are transforming response to list of objects with key and value fields
|
// Before returning query result, we are transforming response to list of objects with key and value fields
|
|
@ -11,7 +11,7 @@ import {
|
||||||
import React, { PropsWithChildren, useEffect } from "react";
|
import React, { PropsWithChildren, useEffect } from "react";
|
||||||
|
|
||||||
import { ThemeSynchronizer } from "../hooks/theme-synchronizer";
|
import { ThemeSynchronizer } from "../hooks/theme-synchronizer";
|
||||||
import { AppLayoutProps } from "../types";
|
import { AppLayoutProps } from "../../types";
|
||||||
import { createGenerateClassName } from "@material-ui/core";
|
import { createGenerateClassName } from "@material-ui/core";
|
||||||
|
|
||||||
type PalettesOverride = Record<"light" | "dark", SaleorThemeColors>;
|
type PalettesOverride = Record<"light" | "dark", SaleorThemeColors>;
|
|
@ -3,7 +3,7 @@ import { EncryptedMetadataManager } from "@saleor/app-sdk/settings-manager";
|
||||||
|
|
||||||
import { createClient } from "../../lib/graphql";
|
import { createClient } from "../../lib/graphql";
|
||||||
import { createSettingsManager } from "../../lib/metadata";
|
import { createSettingsManager } from "../../lib/metadata";
|
||||||
import { saleorApp } from "../../saleor-app";
|
import { saleorApp } from "../../../saleor-app";
|
||||||
|
|
||||||
type ConfigurationKeysType =
|
type ConfigurationKeysType =
|
||||||
| "PUBLIC_TOKEN"
|
| "PUBLIC_TOKEN"
|
|
@ -1,7 +1,7 @@
|
||||||
import { createManifestHandler } from "@saleor/app-sdk/handlers/next";
|
import { createManifestHandler } from "@saleor/app-sdk/handlers/next";
|
||||||
import { AppManifest } from "@saleor/app-sdk/types";
|
import { AppManifest } from "@saleor/app-sdk/types";
|
||||||
|
|
||||||
import pkg from "../../package.json";
|
import pkg from "../../../package.json";
|
||||||
import { customerCreatedWebhook } from "./webhooks/customer-created";
|
import { customerCreatedWebhook } from "./webhooks/customer-created";
|
||||||
import { fulfillmentCreatedWebhook } from "./webhooks/fulfillment-created";
|
import { fulfillmentCreatedWebhook } from "./webhooks/fulfillment-created";
|
||||||
import { orderCreatedWebhook } from "./webhooks/order-created";
|
import { orderCreatedWebhook } from "./webhooks/order-created";
|
|
@ -1,6 +1,6 @@
|
||||||
import { createAppRegisterHandler } from "@saleor/app-sdk/handlers/next";
|
import { createAppRegisterHandler } from "@saleor/app-sdk/handlers/next";
|
||||||
|
|
||||||
import { saleorApp } from "../../saleor-app";
|
import { saleorApp } from "../../../saleor-app";
|
||||||
|
|
||||||
const allowedUrlsPattern = process.env.ALLOWED_DOMAIN_PATTERN;
|
const allowedUrlsPattern = process.env.ALLOWED_DOMAIN_PATTERN;
|
||||||
|
|
|
@ -4,11 +4,11 @@ import { gql } from "urql";
|
||||||
import {
|
import {
|
||||||
CustomerCreatedWebhookPayloadFragment,
|
CustomerCreatedWebhookPayloadFragment,
|
||||||
UntypedCustomerCreatedDocument,
|
UntypedCustomerCreatedDocument,
|
||||||
} from "../../../generated/graphql";
|
} from "../../../../generated/graphql";
|
||||||
import { createClient } from "../../../lib/graphql";
|
import { createClient } from "../../../lib/graphql";
|
||||||
import Klaviyo from "../../../lib/klaviyo";
|
import { Klaviyo } from "../../../lib/klaviyo";
|
||||||
import { createSettingsManager } from "../../../lib/metadata";
|
import { createSettingsManager } from "../../../lib/metadata";
|
||||||
import { saleorApp } from "../../../saleor-app";
|
import { saleorApp } from "../../../../saleor-app";
|
||||||
|
|
||||||
const CustomerCreatedWebhookPayload = gql`
|
const CustomerCreatedWebhookPayload = gql`
|
||||||
fragment CustomerCreatedWebhookPayload on CustomerCreated {
|
fragment CustomerCreatedWebhookPayload on CustomerCreated {
|
|
@ -4,11 +4,11 @@ import { gql } from "urql";
|
||||||
import {
|
import {
|
||||||
FulfillmentCreatedWebhookPayloadFragment,
|
FulfillmentCreatedWebhookPayloadFragment,
|
||||||
UntypedFulfillmentCreatedDocument,
|
UntypedFulfillmentCreatedDocument,
|
||||||
} from "../../../generated/graphql";
|
} from "../../../../generated/graphql";
|
||||||
import { createClient } from "../../../lib/graphql";
|
import { createClient } from "../../../lib/graphql";
|
||||||
import Klaviyo from "../../../lib/klaviyo";
|
import { Klaviyo } from "../../../lib/klaviyo";
|
||||||
import { createSettingsManager } from "../../../lib/metadata";
|
import { createSettingsManager } from "../../../lib/metadata";
|
||||||
import { saleorApp } from "../../../saleor-app";
|
import { saleorApp } from "../../../../saleor-app";
|
||||||
|
|
||||||
const FulfillmentCreatedWebhookPayload = gql`
|
const FulfillmentCreatedWebhookPayload = gql`
|
||||||
fragment FulfillmentCreatedWebhookPayload on FulfillmentCreated {
|
fragment FulfillmentCreatedWebhookPayload on FulfillmentCreated {
|
|
@ -4,11 +4,11 @@ import { gql } from "urql";
|
||||||
import {
|
import {
|
||||||
OrderCreatedWebhookPayloadFragment,
|
OrderCreatedWebhookPayloadFragment,
|
||||||
UntypedOrderCreatedDocument,
|
UntypedOrderCreatedDocument,
|
||||||
} from "../../../generated/graphql";
|
} from "../../../../generated/graphql";
|
||||||
import { createClient } from "../../../lib/graphql";
|
import { createClient } from "../../../lib/graphql";
|
||||||
import Klaviyo from "../../../lib/klaviyo";
|
import { Klaviyo } from "../../../lib/klaviyo";
|
||||||
import { createSettingsManager } from "../../../lib/metadata";
|
import { createSettingsManager } from "../../../lib/metadata";
|
||||||
import { saleorApp } from "../../../saleor-app";
|
import { saleorApp } from "../../../../saleor-app";
|
||||||
|
|
||||||
const OrderCreatedWebhookPayload = gql`
|
const OrderCreatedWebhookPayload = gql`
|
||||||
fragment OrderCreatedWebhookPayload on OrderCreated {
|
fragment OrderCreatedWebhookPayload on OrderCreated {
|
|
@ -4,11 +4,11 @@ import { gql } from "urql";
|
||||||
import {
|
import {
|
||||||
OrderFullyPaidWebhookPayloadFragment,
|
OrderFullyPaidWebhookPayloadFragment,
|
||||||
UntypedOrderFullyPaidDocument,
|
UntypedOrderFullyPaidDocument,
|
||||||
} from "../../../generated/graphql";
|
} from "../../../../generated/graphql";
|
||||||
import { createClient } from "../../../lib/graphql";
|
import { createClient } from "../../../lib/graphql";
|
||||||
import Klaviyo from "../../../lib/klaviyo";
|
import { Klaviyo } from "../../../lib/klaviyo";
|
||||||
import { createSettingsManager } from "../../../lib/metadata";
|
import { createSettingsManager } from "../../../lib/metadata";
|
||||||
import { saleorApp } from "../../../saleor-app";
|
import { saleorApp } from "../../../../saleor-app";
|
||||||
|
|
||||||
const OrderFullyPaidWebhookPayload = gql`
|
const OrderFullyPaidWebhookPayload = gql`
|
||||||
fragment OrderFullyPaidWebhookPayload on OrderFullyPaid {
|
fragment OrderFullyPaidWebhookPayload on OrderFullyPaid {
|
|
@ -6,11 +6,11 @@ import { SALEOR_API_URL_HEADER, SALEOR_AUTHORIZATION_BEARER_HEADER } from "@sale
|
||||||
import { ConfirmButton, ConfirmButtonTransitionState, makeStyles } from "@saleor/macaw-ui";
|
import { ConfirmButton, ConfirmButtonTransitionState, makeStyles } from "@saleor/macaw-ui";
|
||||||
import { ChangeEvent, SyntheticEvent, useEffect, useState } from "react";
|
import { ChangeEvent, SyntheticEvent, useEffect, useState } from "react";
|
||||||
|
|
||||||
import AccessWarning from "../components/AccessWarning/AccessWarning";
|
import { AccessWarning } from "../components/AccessWarning/AccessWarning";
|
||||||
import useAppApi from "../hooks/useAppApi";
|
import { useAppApi } from "../hooks/useAppApi";
|
||||||
import { AppColumnsLayout } from "../lib/ui/app-columns-layout";
|
import { AppColumnsLayout } from "../lib/ui/app-columns-layout";
|
||||||
|
|
||||||
import useDashboardNotifier from "../utils/useDashboardNotifier";
|
import { useDashboardNotifier } from "../utils/useDashboardNotifier";
|
||||||
|
|
||||||
interface ConfigurationField {
|
interface ConfigurationField {
|
||||||
key: string;
|
key: string;
|
|
@ -1,6 +1,6 @@
|
||||||
import { actions, NotificationPayload, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
import { actions, NotificationPayload, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
||||||
|
|
||||||
const useDashboardNotifier = () => {
|
export const useDashboardNotifier = () => {
|
||||||
const { appBridgeState, appBridge } = useAppBridge();
|
const { appBridgeState, appBridge } = useAppBridge();
|
||||||
|
|
||||||
const notify = (payload: NotificationPayload) =>
|
const notify = (payload: NotificationPayload) =>
|
||||||
|
@ -8,5 +8,3 @@ const useDashboardNotifier = () => {
|
||||||
|
|
||||||
return [notify];
|
return [notify];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useDashboardNotifier;
|
|
|
@ -3,7 +3,7 @@ import { PropsWithChildren } from "react";
|
||||||
import { Provider } from "urql";
|
import { Provider } from "urql";
|
||||||
import { createClient } from "./lib/create-graphq-client";
|
import { createClient } from "./lib/create-graphq-client";
|
||||||
|
|
||||||
function GraphQLProvider(props: PropsWithChildren<{}>) {
|
export function GraphQLProvider(props: PropsWithChildren<{}>) {
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState } = useAppBridge();
|
||||||
|
|
||||||
const client = createClient(
|
const client = createClient(
|
||||||
|
@ -14,5 +14,3 @@ function GraphQLProvider(props: PropsWithChildren<{}>) {
|
||||||
|
|
||||||
return <Provider value={client} {...props} />;
|
return <Provider value={client} {...props} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default GraphQLProvider;
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { AppProps } from "next/app";
|
||||||
|
|
||||||
import { ThemeSynchronizer } from "../lib/theme-synchronizer";
|
import { ThemeSynchronizer } from "../lib/theme-synchronizer";
|
||||||
import { NoSSRWrapper } from "../lib/no-ssr-wrapper";
|
import { NoSSRWrapper } from "../lib/no-ssr-wrapper";
|
||||||
import GraphQLProvider from "../graphql-provider";
|
import { GraphQLProvider } from "../graphql-provider";
|
||||||
|
|
||||||
const themeOverrides: Partial<Theme> = {
|
const themeOverrides: Partial<Theme> = {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,8 +8,7 @@ import { actions, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
||||||
import { AppColumnsLayout } from "../../ui/app-columns-layout";
|
import { AppColumnsLayout } from "../../ui/app-columns-layout";
|
||||||
import { FeedPreviewCard } from "./feed-preview-card";
|
import { FeedPreviewCard } from "./feed-preview-card";
|
||||||
import { Instructions } from "./instructions";
|
import { Instructions } from "./instructions";
|
||||||
import SideMenu from "./side-menu";
|
import { SideMenu } from "./side-menu";
|
||||||
import { CategoryMappingForm } from "../../category-mapping/ui/category-mapping-form";
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => {
|
const useStyles = makeStyles((theme) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -107,5 +107,3 @@ export const SideMenu: React.FC<SideMenuProps> = ({
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SideMenu;
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
"@saleor/app-sdk": "0.37.1",
|
"@saleor/app-sdk": "0.37.1",
|
||||||
"@saleor/apps-shared": "workspace:*",
|
"@saleor/apps-shared": "workspace:*",
|
||||||
"@saleor/macaw-ui": "0.7.2",
|
"@saleor/macaw-ui": "0.7.2",
|
||||||
"@sentry/nextjs": "^7.31.1",
|
"@sentry/nextjs": "^7.46.0",
|
||||||
"@types/debug": "^4.1.7",
|
"@types/debug": "^4.1.7",
|
||||||
"@urql/exchange-auth": "^1.0.0",
|
"@urql/exchange-auth": "^1.0.0",
|
||||||
"algoliasearch": "4.14.2",
|
"algoliasearch": "4.14.2",
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
"graphql": "^16.6.0",
|
"graphql": "^16.6.0",
|
||||||
"graphql-tag": "^2.12.6",
|
"graphql-tag": "^2.12.6",
|
||||||
"instantsearch.css": "^7.4.5",
|
"instantsearch.css": "^7.4.5",
|
||||||
"next": "13.1.6",
|
"next": "13.2.4",
|
||||||
"next-urql": "4.0.0",
|
"next-urql": "4.0.0",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
|
|
|
@ -164,4 +164,3 @@ export const AlgoliaConfigurationCard = () => {
|
||||||
/**
|
/**
|
||||||
* Export default for Next.dynamic
|
* Export default for Next.dynamic
|
||||||
*/
|
*/
|
||||||
export default AlgoliaConfigurationCard;
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Card, CardContent, CardHeader } from "@material-ui/core";
|
import { Card, CardContent, CardHeader } from "@material-ui/core";
|
||||||
import { ImportProductsToAlgolia } from "./ImportProductsToAlgolia";
|
import { ImportProductsToAlgolia } from "./ImportProductsToAlgolia";
|
||||||
import AlgoliaConfigurationCard from "./AlgoliaConfigurationCard";
|
import { AlgoliaConfigurationCard } from "./AlgoliaConfigurationCard";
|
||||||
import { makeStyles, PageTab, PageTabs } from "@saleor/macaw-ui";
|
import { makeStyles } from "@saleor/macaw-ui";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import Instructions from "./Instructions";
|
import { Instructions } from "./Instructions";
|
||||||
|
|
||||||
import { AppColumnsLayout } from "./AppColumnsLayout";
|
import { AppColumnsLayout } from "./AppColumnsLayout";
|
||||||
|
|
||||||
|
@ -24,15 +24,9 @@ const useStyles = makeStyles((theme) => ({
|
||||||
|
|
||||||
export const ConfigurationView = () => {
|
export const ConfigurationView = () => {
|
||||||
const styles = useStyles();
|
const styles = useStyles();
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const handleClick = (val: string) => router.push("/" + val);
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
<PageTabs className={styles.tabs} value="" onChange={handleClick}>
|
|
||||||
<PageTab label={"Configuration"} value="" />
|
|
||||||
<PageTab label={"Preview"} value="search" />
|
|
||||||
</PageTabs>
|
|
||||||
<AppColumnsLayout>
|
<AppColumnsLayout>
|
||||||
<div />
|
<div />
|
||||||
<div>
|
<div>
|
||||||
|
@ -49,8 +43,3 @@ export const ConfigurationView = () => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Export default for Next.dynamic
|
|
||||||
*/
|
|
||||||
export default ConfigurationView;
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Card, CardContent, CardHeader, List, ListItem, Typography, Link } from "@material-ui/core";
|
import { Card, CardContent, CardHeader, List, ListItem, Typography, Link } from "@material-ui/core";
|
||||||
import { useAppBridge } from "@saleor/app-sdk/app-bridge";
|
import { useAppBridge } from "@saleor/app-sdk/app-bridge";
|
||||||
|
|
||||||
function Instructions() {
|
export function Instructions() {
|
||||||
const { appBridge } = useAppBridge();
|
const { appBridge } = useAppBridge();
|
||||||
|
|
||||||
const algoliaDashboardUrl = "https://www.algolia.com/apps/dashboard";
|
const algoliaDashboardUrl = "https://www.algolia.com/apps/dashboard";
|
||||||
|
@ -70,5 +70,3 @@ function Instructions() {
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Instructions;
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
} from "@saleor/macaw-ui";
|
} from "@saleor/macaw-ui";
|
||||||
import React, { PropsWithChildren, useEffect } from "react";
|
import React, { PropsWithChildren, useEffect } from "react";
|
||||||
import { AppProps } from "next/app";
|
import { AppProps } from "next/app";
|
||||||
import GraphQLProvider from "../providers/GraphQLProvider";
|
import { GraphQLProvider } from "../providers/GraphQLProvider";
|
||||||
import { QueryClient, QueryClientProvider } from "react-query";
|
import { QueryClient, QueryClientProvider } from "react-query";
|
||||||
import { RoutePropagator } from "@saleor/app-sdk/app-bridge/next";
|
import { RoutePropagator } from "@saleor/app-sdk/app-bridge/next";
|
||||||
import { ThemeSynchronizer } from "../lib/theme-synchronizer";
|
import { ThemeSynchronizer } from "../lib/theme-synchronizer";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { useAppBridge, withAuthorization } from "@saleor/app-sdk/app-bridge";
|
import { useAppBridge, withAuthorization } from "@saleor/app-sdk/app-bridge";
|
||||||
import ConfigurationView from "../components/ConfigurationView";
|
import { ConfigurationView } from "../components/ConfigurationView";
|
||||||
import { isInIframe } from "@saleor/apps-shared";
|
import { isInIframe } from "@saleor/apps-shared";
|
||||||
import { LinearProgress } from "@material-ui/core";
|
import { LinearProgress } from "@material-ui/core";
|
||||||
|
|
||||||
|
|
|
@ -1,110 +0,0 @@
|
||||||
import algoliasearch from "algoliasearch";
|
|
||||||
import { InstantSearch, Pagination } from "react-instantsearch-hooks-web";
|
|
||||||
import { Card, CardContent, CardHeader, MenuItem, Select } from "@material-ui/core";
|
|
||||||
import "instantsearch.css/themes/reset.css";
|
|
||||||
import "instantsearch.css/themes/satellite.css";
|
|
||||||
import styles from "../../styles/search.module.css";
|
|
||||||
|
|
||||||
import { makeStyles, PageTab, PageTabs } from "@saleor/macaw-ui";
|
|
||||||
import { SearchBox } from "../../components/SearchBox";
|
|
||||||
import { Hits } from "../../components/Hits";
|
|
||||||
import { useRouter } from "next/router";
|
|
||||||
import { useAppBridge } from "@saleor/app-sdk/app-bridge";
|
|
||||||
import { useConfiguration } from "../../lib/configuration";
|
|
||||||
import { useMemo, useState } from "react";
|
|
||||||
import { useQuery } from "react-query";
|
|
||||||
|
|
||||||
import { AppColumnsLayout } from "../../components/AppColumnsLayout";
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
|
||||||
wrapper: {
|
|
||||||
paddingBottom: 50,
|
|
||||||
},
|
|
||||||
content: {
|
|
||||||
padding: "0 50px",
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
function Search() {
|
|
||||||
const classes = useStyles();
|
|
||||||
const { appBridgeState } = useAppBridge();
|
|
||||||
const [indexName, setIndexName] = useState<string>();
|
|
||||||
const algoliaConfiguration = useConfiguration(
|
|
||||||
appBridgeState?.saleorApiUrl,
|
|
||||||
appBridgeState?.token
|
|
||||||
);
|
|
||||||
|
|
||||||
const searchClient = useMemo(() => {
|
|
||||||
if (!algoliaConfiguration.data?.appId || !algoliaConfiguration.data.secretKey) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return algoliasearch(algoliaConfiguration.data.appId, algoliaConfiguration.data.secretKey);
|
|
||||||
}, [algoliaConfiguration?.data?.appId, algoliaConfiguration?.data?.secretKey]);
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const handleClick = (val: string) => router.push("/" + val);
|
|
||||||
|
|
||||||
const indicesQuery = useQuery({
|
|
||||||
queryKey: ["indices"],
|
|
||||||
queryFn: () => searchClient?.listIndices(),
|
|
||||||
onSuccess: (data) => {
|
|
||||||
// auto select the first fetched index to display its contents
|
|
||||||
if (data?.items?.length) {
|
|
||||||
setIndexName(data.items[0].name);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
enabled: !!searchClient,
|
|
||||||
});
|
|
||||||
|
|
||||||
const availableIndices = indicesQuery.data?.items.map((index) => index.name) || [];
|
|
||||||
|
|
||||||
const displayInterface = !!searchClient && indexName;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={classes.wrapper}>
|
|
||||||
<PageTabs className={styles.tabs} value="search" onChange={handleClick}>
|
|
||||||
<PageTab label={"Configuration"} value="" />
|
|
||||||
<PageTab label={"Preview"} value="search" />
|
|
||||||
</PageTabs>
|
|
||||||
|
|
||||||
<div className={classes.content}>
|
|
||||||
{displayInterface ? (
|
|
||||||
<InstantSearch searchClient={searchClient} indexName={indexName}>
|
|
||||||
<AppColumnsLayout variant="1:2">
|
|
||||||
<div className={styles.filterGrid}>
|
|
||||||
<Card>
|
|
||||||
<CardHeader title={"Index"} />
|
|
||||||
<CardContent>
|
|
||||||
<Select
|
|
||||||
labelId="index-select-label"
|
|
||||||
id="index-select"
|
|
||||||
value={indexName}
|
|
||||||
onChange={(event) => setIndexName(event.target.value as string)}
|
|
||||||
>
|
|
||||||
{availableIndices.map((name) => (
|
|
||||||
<MenuItem key={name} value={name}>
|
|
||||||
{name}
|
|
||||||
</MenuItem>
|
|
||||||
))}
|
|
||||||
</Select>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</div>
|
|
||||||
<div className={styles.contentWrapper}>
|
|
||||||
<SearchBox />
|
|
||||||
<Hits />
|
|
||||||
<Pagination />
|
|
||||||
</div>
|
|
||||||
</AppColumnsLayout>
|
|
||||||
</InstantSearch>
|
|
||||||
) : (
|
|
||||||
<Card>
|
|
||||||
<CardHeader title="To preview indexes, ensure the App is configured" />
|
|
||||||
</Card>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Search;
|
|
|
@ -4,7 +4,7 @@ import { Provider } from "urql";
|
||||||
|
|
||||||
import { createClient } from "../lib/graphql";
|
import { createClient } from "../lib/graphql";
|
||||||
|
|
||||||
function GraphQLProvider(props: PropsWithChildren<{}>) {
|
export function GraphQLProvider(props: PropsWithChildren<{}>) {
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState } = useAppBridge();
|
||||||
const saleorApiUrl = appBridgeState?.saleorApiUrl!;
|
const saleorApiUrl = appBridgeState?.saleorApiUrl!;
|
||||||
|
|
||||||
|
@ -18,5 +18,3 @@ function GraphQLProvider(props: PropsWithChildren<{}>) {
|
||||||
|
|
||||||
return <Provider value={client} {...props} />;
|
return <Provider value={client} {...props} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default GraphQLProvider;
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ const warnings: Record<WarningCause, string> = {
|
||||||
unknown_cause: "Something went wrong.",
|
unknown_cause: "Something went wrong.",
|
||||||
};
|
};
|
||||||
|
|
||||||
function AccessWarning({ cause = "unknown_cause" }: AccessWarningProps) {
|
export function AccessWarning({ cause = "unknown_cause" }: AccessWarningProps) {
|
||||||
return (
|
return (
|
||||||
<div suppressHydrationWarning>
|
<div suppressHydrationWarning>
|
||||||
<Typography variant="subtitle1">
|
<Typography variant="subtitle1">
|
||||||
|
@ -30,5 +30,3 @@ function AccessWarning({ cause = "unknown_cause" }: AccessWarningProps) {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AccessWarning;
|
|
||||||
|
|
|
@ -16,5 +16,3 @@ function LoadingPage() {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default LoadingPage;
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ interface UseFetchProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This hook is meant to be used mainly for internal API calls
|
// This hook is meant to be used mainly for internal API calls
|
||||||
const useAppApi = <D>({ url, options, skip }: UseFetchProps) => {
|
export const useAppApi = <D>({ url, options, skip }: UseFetchProps) => {
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState } = useAppBridge();
|
||||||
|
|
||||||
const [data, setData] = useState<D>();
|
const [data, setData] = useState<D>();
|
||||||
|
@ -60,5 +60,3 @@ const useAppApi = <D>({ url, options, skip }: UseFetchProps) => {
|
||||||
|
|
||||||
return { data, error, loading };
|
return { data, error, loading };
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useAppApi;
|
|
||||||
|
|
|
@ -14,10 +14,10 @@ import { SALEOR_API_URL_HEADER, SALEOR_AUTHORIZATION_BEARER_HEADER } from "@sale
|
||||||
import { ConfirmButton, ConfirmButtonTransitionState, makeStyles } from "@saleor/macaw-ui";
|
import { ConfirmButton, ConfirmButtonTransitionState, makeStyles } from "@saleor/macaw-ui";
|
||||||
import { ChangeEvent, ReactElement, SyntheticEvent, useEffect, useState } from "react";
|
import { ChangeEvent, ReactElement, SyntheticEvent, useEffect, useState } from "react";
|
||||||
|
|
||||||
import AccessWarning from "../components/AccessWarning/AccessWarning";
|
import { AccessWarning } from "../components/AccessWarning/AccessWarning";
|
||||||
import { ConfigurationError } from "../components/ConfigurationError/ConfigurationError";
|
import { ConfigurationError } from "../components/ConfigurationError/ConfigurationError";
|
||||||
import useAppApi from "../hooks/useAppApi";
|
import { useAppApi } from "../hooks/useAppApi";
|
||||||
import useDashboardNotifier from "../utils/useDashboardNotifier";
|
import { useDashboardNotifier } from "../utils/useDashboardNotifier";
|
||||||
import { AppColumnsLayout } from "../components/AppColumnsLayout/AppColumnsLayout";
|
import { AppColumnsLayout } from "../components/AppColumnsLayout/AppColumnsLayout";
|
||||||
|
|
||||||
interface ConfigurationField {
|
interface ConfigurationField {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { actions, NotificationPayload, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
import { actions, NotificationPayload, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
||||||
|
|
||||||
const useDashboardNotifier = () => {
|
export const useDashboardNotifier = () => {
|
||||||
const { appBridge, appBridgeState } = useAppBridge();
|
const { appBridge, appBridgeState } = useAppBridge();
|
||||||
|
|
||||||
const notify = (payload: NotificationPayload) =>
|
const notify = (payload: NotificationPayload) =>
|
||||||
|
@ -8,5 +8,3 @@ const useDashboardNotifier = () => {
|
||||||
|
|
||||||
return [notify];
|
return [notify];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useDashboardNotifier;
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
import React, { PropsWithChildren, useEffect } from "react";
|
import React, { PropsWithChildren, useEffect } from "react";
|
||||||
import { AppProps } from "next/app";
|
import { AppProps } from "next/app";
|
||||||
|
|
||||||
import GraphQLProvider from "../providers/GraphQLProvider";
|
import { GraphQLProvider } from "../providers/GraphQLProvider";
|
||||||
import { ThemeSynchronizer } from "../lib/theme-synchronizer";
|
import { ThemeSynchronizer } from "../lib/theme-synchronizer";
|
||||||
import { trpcClient } from "../modules/trpc/trpc-client";
|
import { trpcClient } from "../modules/trpc/trpc-client";
|
||||||
import { NoSSRWrapper } from "../lib/no-ssr-wrapper";
|
import { NoSSRWrapper } from "../lib/no-ssr-wrapper";
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Provider } from "urql";
|
||||||
|
|
||||||
import { createClient } from "../lib/graphql";
|
import { createClient } from "../lib/graphql";
|
||||||
|
|
||||||
function GraphQLProvider(props: PropsWithChildren<{}>) {
|
export function GraphQLProvider(props: PropsWithChildren<{}>) {
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState } = useAppBridge();
|
||||||
|
|
||||||
if (!appBridgeState?.saleorApiUrl) {
|
if (!appBridgeState?.saleorApiUrl) {
|
||||||
|
@ -17,5 +17,3 @@ function GraphQLProvider(props: PropsWithChildren<{}>) {
|
||||||
|
|
||||||
return <Provider value={client} {...props} />;
|
return <Provider value={client} {...props} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default GraphQLProvider;
|
|
||||||
|
|
|
@ -3,11 +3,19 @@ module.exports = {
|
||||||
rules: {
|
rules: {
|
||||||
"@next/next/no-html-link-for-pages": "off",
|
"@next/next/no-html-link-for-pages": "off",
|
||||||
"react/jsx-key": "off",
|
"react/jsx-key": "off",
|
||||||
|
"import/no-default-export": "error",
|
||||||
},
|
},
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
babelOptions: {
|
babelOptions: {
|
||||||
presets: [require.resolve("next/babel")],
|
presets: [require.resolve("next/babel")],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ["src/pages/**/*", "src/pages/api/**/*", "vitest.config.ts", "generated/graphql.ts"],
|
||||||
|
rules: {
|
||||||
|
"import/no-default-export": "off",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
133
pnpm-lock.yaml
133
pnpm-lock.yaml
|
@ -734,7 +734,7 @@ importers:
|
||||||
'@saleor/app-sdk': 0.37.1
|
'@saleor/app-sdk': 0.37.1
|
||||||
'@saleor/apps-shared': workspace:*
|
'@saleor/apps-shared': workspace:*
|
||||||
'@saleor/macaw-ui': 0.7.2
|
'@saleor/macaw-ui': 0.7.2
|
||||||
'@sentry/nextjs': ^7.31.1
|
'@sentry/nextjs': ^7.46.0
|
||||||
'@types/debug': ^4.1.7
|
'@types/debug': ^4.1.7
|
||||||
'@types/node': ^18.11.9
|
'@types/node': ^18.11.9
|
||||||
'@types/react': ^18.0.25
|
'@types/react': ^18.0.25
|
||||||
|
@ -750,7 +750,7 @@ importers:
|
||||||
graphql: ^16.6.0
|
graphql: ^16.6.0
|
||||||
graphql-tag: ^2.12.6
|
graphql-tag: ^2.12.6
|
||||||
instantsearch.css: ^7.4.5
|
instantsearch.css: ^7.4.5
|
||||||
next: 13.1.6
|
next: 13.2.4
|
||||||
next-urql: 4.0.0
|
next-urql: 4.0.0
|
||||||
prettier: ^2.7.1
|
prettier: ^2.7.1
|
||||||
react: 18.2.0
|
react: 18.2.0
|
||||||
|
@ -765,10 +765,10 @@ importers:
|
||||||
'@material-ui/core': 4.12.4_5ndqzdd6t4rivxsukjv3i3ak2q
|
'@material-ui/core': 4.12.4_5ndqzdd6t4rivxsukjv3i3ak2q
|
||||||
'@material-ui/icons': 4.11.3_x54wk6dsnsxe7g7vvfmytp77te
|
'@material-ui/icons': 4.11.3_x54wk6dsnsxe7g7vvfmytp77te
|
||||||
'@material-ui/lab': 4.0.0-alpha.61_x54wk6dsnsxe7g7vvfmytp77te
|
'@material-ui/lab': 4.0.0-alpha.61_x54wk6dsnsxe7g7vvfmytp77te
|
||||||
'@saleor/app-sdk': 0.37.1_3vryta7zmbcsw4rrqf4axjqggm
|
'@saleor/app-sdk': 0.37.1_ld2jel3hspngo3u5lti2kgl2sq
|
||||||
'@saleor/apps-shared': link:../../packages/shared
|
'@saleor/apps-shared': link:../../packages/shared
|
||||||
'@saleor/macaw-ui': 0.7.2_2dwar4pp5qoelfawvjffoi6dne
|
'@saleor/macaw-ui': 0.7.2_2dwar4pp5qoelfawvjffoi6dne
|
||||||
'@sentry/nextjs': 7.36.0_next@13.1.6+react@18.2.0
|
'@sentry/nextjs': 7.46.0_next@13.2.4+react@18.2.0
|
||||||
'@types/debug': 4.1.7
|
'@types/debug': 4.1.7
|
||||||
'@urql/exchange-auth': 1.0.0_graphql@16.6.0
|
'@urql/exchange-auth': 1.0.0_graphql@16.6.0
|
||||||
algoliasearch: 4.14.2
|
algoliasearch: 4.14.2
|
||||||
|
@ -777,7 +777,7 @@ importers:
|
||||||
graphql: 16.6.0
|
graphql: 16.6.0
|
||||||
graphql-tag: 2.12.6_graphql@16.6.0
|
graphql-tag: 2.12.6_graphql@16.6.0
|
||||||
instantsearch.css: 7.4.5
|
instantsearch.css: 7.4.5
|
||||||
next: 13.1.6_biqbaboplfbrettd7655fr4n2y
|
next: 13.2.4_biqbaboplfbrettd7655fr4n2y
|
||||||
next-urql: 4.0.0_react@18.2.0+urql@3.0.3
|
next-urql: 4.0.0_react@18.2.0+urql@3.0.3
|
||||||
react: 18.2.0
|
react: 18.2.0
|
||||||
react-dom: 18.2.0_react@18.2.0
|
react-dom: 18.2.0_react@18.2.0
|
||||||
|
@ -4901,6 +4901,16 @@ packages:
|
||||||
tslib: 1.14.1
|
tslib: 1.14.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@sentry-internal/tracing/7.46.0:
|
||||||
|
resolution: {integrity: sha512-KYoppa7PPL8Er7bdPoxTNUfIY804JL7hhOEomQHYD22rLynwQ4AaLm3YEY75QWwcGb0B7ZDMV+tSumW7Rxuwuw==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
dependencies:
|
||||||
|
'@sentry/core': 7.46.0
|
||||||
|
'@sentry/types': 7.46.0
|
||||||
|
'@sentry/utils': 7.46.0
|
||||||
|
tslib: 1.14.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@sentry/browser/7.36.0:
|
/@sentry/browser/7.36.0:
|
||||||
resolution: {integrity: sha512-Mu0OpisCZFICBGxVXdHWjUDgSvuQKjnO9acNcXR1+68IU08iX+cU6f2kq6VzI4mW/pNieI20FDFbx9KA0YZ4+A==}
|
resolution: {integrity: sha512-Mu0OpisCZFICBGxVXdHWjUDgSvuQKjnO9acNcXR1+68IU08iX+cU6f2kq6VzI4mW/pNieI20FDFbx9KA0YZ4+A==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -4946,6 +4956,18 @@ packages:
|
||||||
tslib: 1.14.1
|
tslib: 1.14.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@sentry/browser/7.46.0:
|
||||||
|
resolution: {integrity: sha512-4rX9hKPjxzfH5LhZzO5DlS5NXQ8qZg2ibepaqEgcDHrpYh5813mjjnE4OQA8wiZ6WuG3xKFgHBrGeliD5jXz9w==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
dependencies:
|
||||||
|
'@sentry-internal/tracing': 7.46.0
|
||||||
|
'@sentry/core': 7.46.0
|
||||||
|
'@sentry/replay': 7.46.0
|
||||||
|
'@sentry/types': 7.46.0
|
||||||
|
'@sentry/utils': 7.46.0
|
||||||
|
tslib: 1.14.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@sentry/cli/1.74.6:
|
/@sentry/cli/1.74.6:
|
||||||
resolution: {integrity: sha512-pJ7JJgozyjKZSTjOGi86chIngZMLUlYt2HOog+OJn+WGvqEkVymu8m462j1DiXAnex9NspB4zLLNuZ/R6rTQHg==}
|
resolution: {integrity: sha512-pJ7JJgozyjKZSTjOGi86chIngZMLUlYt2HOog+OJn+WGvqEkVymu8m462j1DiXAnex9NspB4zLLNuZ/R6rTQHg==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
|
@ -5000,6 +5022,15 @@ packages:
|
||||||
tslib: 1.14.1
|
tslib: 1.14.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@sentry/core/7.46.0:
|
||||||
|
resolution: {integrity: sha512-BnNHGh/ZTztqQedFko7vb2u6yLs/kWesOQNivav32ZbsEpVCjcmG1gOJXh2YmGIvj3jXOC9a4xfIuh+lYFcA6A==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
dependencies:
|
||||||
|
'@sentry/types': 7.46.0
|
||||||
|
'@sentry/utils': 7.46.0
|
||||||
|
tslib: 1.14.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@sentry/integrations/7.36.0:
|
/@sentry/integrations/7.36.0:
|
||||||
resolution: {integrity: sha512-wrRoUqdeGi64NNimGVk8U8DBiXamxTYPBux0/faFDyau8EJyQFcv8zOyB78Za4W2Ss3ZXNaE/WtFF8UxalHzBQ==}
|
resolution: {integrity: sha512-wrRoUqdeGi64NNimGVk8U8DBiXamxTYPBux0/faFDyau8EJyQFcv8zOyB78Za4W2Ss3ZXNaE/WtFF8UxalHzBQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -5040,6 +5071,16 @@ packages:
|
||||||
tslib: 1.14.1
|
tslib: 1.14.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@sentry/integrations/7.46.0:
|
||||||
|
resolution: {integrity: sha512-Y/KreRcROYJif0nM8+kQAkaCvuwGzpqMwLKkC5CfG1xLLDch+OI7HRU98HevyqXNk6YAzQdvBOYXSe7Ny6Zc0A==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
dependencies:
|
||||||
|
'@sentry/types': 7.46.0
|
||||||
|
'@sentry/utils': 7.46.0
|
||||||
|
localforage: 1.10.0
|
||||||
|
tslib: 1.14.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@sentry/nextjs/7.36.0_next@13.1.0+react@18.2.0:
|
/@sentry/nextjs/7.36.0_next@13.1.0+react@18.2.0:
|
||||||
resolution: {integrity: sha512-7IUwBjCjo3rWuvEG16D1wKb0D+aMyCU920VGCAQVZaqTZAgrgAKfpTa1Sk0fmDxYglW1EBI9QM+WEnOa9RleLw==}
|
resolution: {integrity: sha512-7IUwBjCjo3rWuvEG16D1wKb0D+aMyCU920VGCAQVZaqTZAgrgAKfpTa1Sk0fmDxYglW1EBI9QM+WEnOa9RleLw==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -5191,6 +5232,36 @@ packages:
|
||||||
- supports-color
|
- supports-color
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@sentry/nextjs/7.46.0_next@13.2.4+react@18.2.0:
|
||||||
|
resolution: {integrity: sha512-v6Eigug95d2BUkFNPSLJ3L5PX2SEObcR14H0B9KSoX8nbocIEpIN6joQ+V0YPv9NR35kI83RUBZI36V3RsMl4A==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
peerDependencies:
|
||||||
|
next: ^10.0.8 || ^11.0 || ^12.0 || ^13.0
|
||||||
|
react: 16.x || 17.x || 18.x
|
||||||
|
webpack: '>= 4.0.0'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
webpack:
|
||||||
|
optional: true
|
||||||
|
dependencies:
|
||||||
|
'@rollup/plugin-commonjs': 24.0.0_rollup@2.78.0
|
||||||
|
'@sentry/core': 7.46.0
|
||||||
|
'@sentry/integrations': 7.46.0
|
||||||
|
'@sentry/node': 7.46.0
|
||||||
|
'@sentry/react': 7.46.0_react@18.2.0
|
||||||
|
'@sentry/types': 7.46.0
|
||||||
|
'@sentry/utils': 7.46.0
|
||||||
|
'@sentry/webpack-plugin': 1.20.0
|
||||||
|
chalk: 3.0.0
|
||||||
|
next: 13.2.4_biqbaboplfbrettd7655fr4n2y
|
||||||
|
react: 18.2.0
|
||||||
|
rollup: 2.78.0
|
||||||
|
stacktrace-parser: 0.1.10
|
||||||
|
tslib: 1.14.1
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- encoding
|
||||||
|
- supports-color
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@sentry/node/7.36.0:
|
/@sentry/node/7.36.0:
|
||||||
resolution: {integrity: sha512-nAHAY+Rbn5OlTpNX/i6wYrmw3hT/BtwPZ/vNU52cKgw7CpeE1UrCeFjnPn18rQPB7lIh7x0vNvoaPrfemRzpSQ==}
|
resolution: {integrity: sha512-nAHAY+Rbn5OlTpNX/i6wYrmw3hT/BtwPZ/vNU52cKgw7CpeE1UrCeFjnPn18rQPB7lIh7x0vNvoaPrfemRzpSQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -5252,6 +5323,22 @@ packages:
|
||||||
- supports-color
|
- supports-color
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@sentry/node/7.46.0:
|
||||||
|
resolution: {integrity: sha512-+GrgJMCye2WXGarRiU5IJHCK27xg7xbPc2XjGojBKbBoZfqxVAWbXEK4bnBQgRGP1pCmrU/M6ZhVgR3dP580xA==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
dependencies:
|
||||||
|
'@sentry-internal/tracing': 7.46.0
|
||||||
|
'@sentry/core': 7.46.0
|
||||||
|
'@sentry/types': 7.46.0
|
||||||
|
'@sentry/utils': 7.46.0
|
||||||
|
cookie: 0.4.2
|
||||||
|
https-proxy-agent: 5.0.1
|
||||||
|
lru_map: 0.3.3
|
||||||
|
tslib: 1.14.1
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@sentry/react/7.36.0_react@18.2.0:
|
/@sentry/react/7.36.0_react@18.2.0:
|
||||||
resolution: {integrity: sha512-ttrRqbgeqvkV3DwkDRZC/V8OEnBKGpQf4dKpG8oMlfdVbMTINzrxYUgkhi9xAkxkH9O+vj3Md8L3Rdqw/SDwKQ==}
|
resolution: {integrity: sha512-ttrRqbgeqvkV3DwkDRZC/V8OEnBKGpQf4dKpG8oMlfdVbMTINzrxYUgkhi9xAkxkH9O+vj3Md8L3Rdqw/SDwKQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -5308,6 +5395,20 @@ packages:
|
||||||
tslib: 1.14.1
|
tslib: 1.14.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@sentry/react/7.46.0_react@18.2.0:
|
||||||
|
resolution: {integrity: sha512-4U7gZ5XwzCgIAH00SJe2MEjJfZq1vB4M7/YYFTjfo5geVux/c+54xgVCxZiQpCaLJBJ5NoB9Fi47RrHbxauTGA==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
peerDependencies:
|
||||||
|
react: 15.x || 16.x || 17.x || 18.x
|
||||||
|
dependencies:
|
||||||
|
'@sentry/browser': 7.46.0
|
||||||
|
'@sentry/types': 7.46.0
|
||||||
|
'@sentry/utils': 7.46.0
|
||||||
|
hoist-non-react-statics: 3.3.2
|
||||||
|
react: 18.2.0
|
||||||
|
tslib: 1.14.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@sentry/replay/7.36.0:
|
/@sentry/replay/7.36.0:
|
||||||
resolution: {integrity: sha512-wNbME74/2GtkqdDXz7NaStyfPWVLjYmN9TFWvu6E9sNl9pkDDvii/Qc8F6ps1wa7bozkKcWRHgNvYiGCxUBHcg==}
|
resolution: {integrity: sha512-wNbME74/2GtkqdDXz7NaStyfPWVLjYmN9TFWvu6E9sNl9pkDDvii/Qc8F6ps1wa7bozkKcWRHgNvYiGCxUBHcg==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
@ -5344,6 +5445,15 @@ packages:
|
||||||
'@sentry/utils': 7.45.0
|
'@sentry/utils': 7.45.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@sentry/replay/7.46.0:
|
||||||
|
resolution: {integrity: sha512-rHsAFdeEu47JRy6mEwwN+M+zTTWlOFWw9sR/eDCvik2lxAXBN2mXvf/N/MN9zQB3+QnS13ke+SvwVW7CshLOXg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
'@sentry/core': 7.46.0
|
||||||
|
'@sentry/types': 7.46.0
|
||||||
|
'@sentry/utils': 7.46.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@sentry/tracing/7.36.0:
|
/@sentry/tracing/7.36.0:
|
||||||
resolution: {integrity: sha512-5R5mfWMDncOcTMmmyYMjgus1vZJzIFw4LHaSbrX7e1IRNT/6vFyNeVxATa2ePXb9mI3XHo5f2p7YrnreAtaSXw==}
|
resolution: {integrity: sha512-5R5mfWMDncOcTMmmyYMjgus1vZJzIFw4LHaSbrX7e1IRNT/6vFyNeVxATa2ePXb9mI3XHo5f2p7YrnreAtaSXw==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -5394,6 +5504,11 @@ packages:
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@sentry/types/7.46.0:
|
||||||
|
resolution: {integrity: sha512-2FMEMgt2h6u7AoELhNhu9L54GAh67KKfK2pJ1kEXJHmWxM9FSCkizjLs/t+49xtY7jEXr8qYq8bV967VfDPQ9g==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@sentry/utils/7.36.0:
|
/@sentry/utils/7.36.0:
|
||||||
resolution: {integrity: sha512-mgDi5X5Bm0sydCzXpnyKD/sD98yc2qnKXyRdNX4HRRwruhC/P53LT0hGhZXsyqsB/l8OAMl0zWXJLg0xONQsEw==}
|
resolution: {integrity: sha512-mgDi5X5Bm0sydCzXpnyKD/sD98yc2qnKXyRdNX4HRRwruhC/P53LT0hGhZXsyqsB/l8OAMl0zWXJLg0xONQsEw==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -5426,6 +5541,14 @@ packages:
|
||||||
tslib: 1.14.1
|
tslib: 1.14.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@sentry/utils/7.46.0:
|
||||||
|
resolution: {integrity: sha512-elRezDAF84guMG0OVIIZEWm6wUpgbda4HGks98CFnPsrnMm3N1bdBI9XdlxYLtf+ir5KsGR5YlEIf/a0kRUwAQ==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
dependencies:
|
||||||
|
'@sentry/types': 7.46.0
|
||||||
|
tslib: 1.14.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@sentry/webpack-plugin/1.20.0:
|
/@sentry/webpack-plugin/1.20.0:
|
||||||
resolution: {integrity: sha512-Ssj1mJVFsfU6vMCOM2d+h+KQR7QHSfeIP16t4l20Uq/neqWXZUQ2yvQfe4S3BjdbJXz/X4Rw8Hfy1Sd0ocunYw==}
|
resolution: {integrity: sha512-Ssj1mJVFsfU6vMCOM2d+h+KQR7QHSfeIP16t4l20Uq/neqWXZUQ2yvQfe4S3BjdbJXz/X4Rw8Hfy1Sd0ocunYw==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
|
|
Loading…
Reference in a new issue