@soppiya/app-bridge 1.2.1 → 1.2.2
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/components/articles-picker/model/useArticles.js +5 -2
- package/dist/components/blogs-picker/model/useBlogs.js +5 -2
- package/dist/components/collections-pciker/model/useCollections.js +5 -2
- package/dist/components/country-picker/model/{useContry.d.ts → useCountries.d.ts} +2 -2
- package/dist/components/country-picker/model/{useContry.js → useCountries.js} +8 -7
- package/dist/components/country-picker/ui/CountryPicker.d.ts +1 -1
- package/dist/components/country-picker/ui/CountryPicker.js +5 -5
- package/dist/components/country-picker/ui/CountryPicker.stories.d.ts +1 -1
- package/dist/components/customers-picker/model/useCustomers.d.ts +1 -1
- package/dist/components/customers-picker/model/useCustomers.js +6 -5
- package/dist/components/customers-picker/ui/CustomersPicker.d.ts +1 -1
- package/dist/components/customers-picker/ui/CustomersPicker.js +3 -3
- package/dist/components/customers-picker/ui/CustomersPicker.stories.d.ts +1 -1
- package/dist/components/link-list-picker/model/useLinkList.js +5 -2
- package/dist/components/link-list-picker/ui/LinkListPicker.d.ts +1 -1
- package/dist/components/link-list-picker/ui/LinkListPicker.js +2 -2
- package/dist/components/link-list-picker/ui/LinkListPicker.stories.d.ts +1 -1
- package/dist/components/meta-data/ui/VariantRefMetaField.d.ts +1 -1
- package/dist/components/metaobjects-entries-picker/model/useMetaobjectEntries.js +5 -2
- package/dist/components/metaobjects-entries-picker/ui/MetaobjectEntriesPicker.d.ts +1 -1
- package/dist/components/metaobjects-entries-picker/ui/MetaobjectEntriesPicker.js +2 -2
- package/dist/components/metaobjects-entries-picker/ui/MetaobjectEntriesPicker.stories.d.ts +1 -1
- package/dist/components/metaobjects-picker/model/useMetaobjects.js +5 -2
- package/dist/components/pages-picker/model/usePages.js +5 -2
- package/dist/components/pages-picker/ui/PagesPicker.js +2 -2
- package/dist/components/products-picker/model/useProducts.js +5 -2
- package/dist/components/products-picker/ui/ProductPicker.d.ts +1 -1
- package/dist/components/products-picker/ui/ProductPicker.js +2 -2
- package/dist/components/products-picker/ui/ProductsPicker.stories.d.ts +1 -1
- package/dist/components/region-picker/model/useRegion.d.ts +1 -1
- package/dist/components/region-picker/model/useRegion.js +7 -5
- package/dist/components/region-picker/ui/RegionPicker.js +4 -4
- package/dist/components/segments-picker/api/query.js +29 -13
- package/dist/components/segments-picker/model/useSegments.d.ts +1 -1
- package/dist/components/segments-picker/model/useSegments.js +6 -5
- package/dist/components/segments-picker/ui/SegmentsPicker.d.ts +1 -1
- package/dist/components/segments-picker/ui/SegmentsPicker.js +3 -3
- package/dist/components/segments-picker/ui/SegmentsPicker.stories.d.ts +1 -1
- package/dist/components/variants-picker/model/useVariants.d.ts +1 -1
- package/dist/components/variants-picker/model/useVariants.js +6 -5
- package/dist/components/variants-picker/ui/VariantsPicker.js +1 -1
- package/dist/shared/graphql/gql.d.ts +2 -2
- package/dist/shared/graphql/gql.js +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
3
|
import { articlesQuery } from "../api/query.js";
|
|
3
4
|
const userArticles = (props = {})=>{
|
|
4
5
|
const { first, query, filterKeys, skip } = props;
|
|
5
|
-
const { data,
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(articlesQuery, {
|
|
6
7
|
skip,
|
|
7
8
|
variables: {
|
|
8
9
|
first,
|
|
9
10
|
query,
|
|
10
11
|
filterKeys
|
|
11
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
12
14
|
});
|
|
13
15
|
const articles = data?.articles?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
14
16
|
const pageInfo = data?.articles?.pageInfo;
|
|
17
|
+
const isLoadingArticles = networkStatus === NetworkStatus.loading;
|
|
15
18
|
const fetchMoreArticles = ()=>{
|
|
16
19
|
if (!pageInfo?.hasNextPage) return;
|
|
17
20
|
fetchMore({
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
3
|
import { blogsQuery } from "../api/query.js";
|
|
3
4
|
const useBlogs = (props = {})=>{
|
|
4
5
|
const { first, skip, query, filterKeys } = props;
|
|
5
|
-
const { data,
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(blogsQuery, {
|
|
6
7
|
skip,
|
|
7
8
|
variables: {
|
|
8
9
|
first,
|
|
9
10
|
query,
|
|
10
11
|
filterKeys
|
|
11
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
12
14
|
});
|
|
13
15
|
const blogs = data?.blogs?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
14
16
|
const pageInfo = data?.blogs?.pageInfo;
|
|
17
|
+
const isLoadingBlogs = networkStatus === NetworkStatus.loading;
|
|
15
18
|
const fetchMoreBlogs = ()=>{
|
|
16
19
|
if (!pageInfo?.hasNextPage) return;
|
|
17
20
|
fetchMore({
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
3
|
import { collectionQuery } from "../api/query.js";
|
|
3
4
|
const useCollections = (props = {})=>{
|
|
4
5
|
const { skip, query, filterKeys } = props;
|
|
5
|
-
const { data,
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(collectionQuery, {
|
|
6
7
|
skip,
|
|
7
8
|
variables: {
|
|
8
9
|
filterKeys,
|
|
9
10
|
query
|
|
10
|
-
}
|
|
11
|
+
},
|
|
12
|
+
notifyOnNetworkStatusChange: true
|
|
11
13
|
});
|
|
12
14
|
const collections = data?.collections?.edges?.map((edge)=>edge?.node)?.filter((node)=>null != node);
|
|
13
15
|
const pageInfo = data?.collections?.pageInfo;
|
|
16
|
+
const isLoadingCollections = networkStatus === NetworkStatus.loading;
|
|
14
17
|
const fetchMoreCollections = ()=>{
|
|
15
18
|
if (!pageInfo?.hasNextPage) return;
|
|
16
19
|
fetchMore({
|
|
@@ -5,13 +5,13 @@ type Props = {
|
|
|
5
5
|
query?: string | null;
|
|
6
6
|
filterKeys?: _CountryFilterKeys | null;
|
|
7
7
|
};
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const useCountries: (props?: Props) => {
|
|
9
9
|
countries: {
|
|
10
10
|
__typename: "_Country";
|
|
11
11
|
_id?: string | null;
|
|
12
12
|
name?: string | null;
|
|
13
13
|
flag?: string | null;
|
|
14
|
-
}[];
|
|
14
|
+
}[] | undefined;
|
|
15
15
|
pageInfo: {
|
|
16
16
|
__typename: "PageInfo";
|
|
17
17
|
endCursor?: string | null;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
|
-
import { useRef } from "react";
|
|
3
3
|
import { countryQuery } from "../api/query.js";
|
|
4
|
-
const
|
|
4
|
+
const useCountries = (props = {})=>{
|
|
5
5
|
const { skip, first, query, filterKeys } = props;
|
|
6
|
-
const
|
|
7
|
-
const { data, loading: isLoadingCountry, error, fetchMore } = useQuery(countryQuery, {
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(countryQuery, {
|
|
8
7
|
skip,
|
|
9
8
|
variables: {
|
|
10
9
|
first,
|
|
11
10
|
query,
|
|
12
11
|
filterKeys
|
|
13
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
14
14
|
});
|
|
15
|
-
const countries = data?._countries?.edges?.map((edge)=>edge?.node).filter((node)=>null != node)
|
|
15
|
+
const countries = data?._countries?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
16
16
|
const pageInfo = data?._countries?.pageInfo;
|
|
17
|
+
const isLoadingCountry = networkStatus === NetworkStatus.loading;
|
|
17
18
|
const fetchMoreCountries = ()=>{
|
|
18
19
|
if (!pageInfo?.hasNextPage) return;
|
|
19
20
|
fetchMore({
|
|
@@ -45,4 +46,4 @@ const useCountry = (props = {})=>{
|
|
|
45
46
|
fetchMoreCountries
|
|
46
47
|
};
|
|
47
48
|
};
|
|
48
|
-
export {
|
|
49
|
+
export { useCountries };
|
|
@@ -6,5 +6,5 @@ type Props = {
|
|
|
6
6
|
onClose?: () => void;
|
|
7
7
|
onOk?: (countries: string[]) => void;
|
|
8
8
|
};
|
|
9
|
-
declare const CountryPicker: ({ title, initialIds, limit, okButtonLoading, onClose, onOk }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const CountryPicker: ({ title, initialIds, limit, okButtonLoading, onClose, onOk, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default CountryPicker;
|
|
@@ -5,11 +5,11 @@ import { BlockStack, Box, Button, Checkbox, Image, InlineStack, Input, Modal, Sp
|
|
|
5
5
|
import classnames from "classnames";
|
|
6
6
|
import lodash from "lodash";
|
|
7
7
|
import { useState } from "react";
|
|
8
|
-
import {
|
|
8
|
+
import { useCountries } from "../model/useCountries.js";
|
|
9
9
|
const CountryPicker = ({ title = "Countries", initialIds = [], limit = 1 / 0, okButtonLoading, onClose, onOk })=>{
|
|
10
10
|
const [selectedCustomer, setSelectedCustomer] = useState(initialIds);
|
|
11
11
|
const { query, debounceQuery, onChangeQuery } = useFilterQuery();
|
|
12
|
-
const { countries, pageInfo, isLoadingCountry, fetchMoreCountries } =
|
|
12
|
+
const { countries, pageInfo, isLoadingCountry, fetchMoreCountries } = useCountries({
|
|
13
13
|
first: 20,
|
|
14
14
|
query: debounceQuery
|
|
15
15
|
});
|
|
@@ -61,10 +61,10 @@ const CountryPicker = ({ title = "Countries", initialIds = [], limit = 1 / 0, ok
|
|
|
61
61
|
})
|
|
62
62
|
}) : /*#__PURE__*/ jsxs(BlockStack, {
|
|
63
63
|
children: [
|
|
64
|
-
countries
|
|
64
|
+
countries?.map((country)=>/*#__PURE__*/ jsx(InlineStack, {
|
|
65
65
|
stack: "full",
|
|
66
|
-
className: classnames(
|
|
67
|
-
|
|
66
|
+
className: classnames("lg:cursor-pointer border-t border-t-[#ebebeb]!", {
|
|
67
|
+
"bg-[#f1f1f1ab] cursor-default!": !selectedCustomer.includes(country._id) && isReached
|
|
68
68
|
}),
|
|
69
69
|
gapX: 60,
|
|
70
70
|
padding: 60,
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
|
-
import { useRef } from "react";
|
|
3
3
|
import { customersQuery } from "../api/query.js";
|
|
4
4
|
const useCustomers = (props = {})=>{
|
|
5
5
|
const { skip, first, query, filterKeys } = props;
|
|
6
|
-
const
|
|
7
|
-
const { data, loading: isLoadingCustomers, error, fetchMore } = useQuery(customersQuery, {
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(customersQuery, {
|
|
8
7
|
skip,
|
|
9
8
|
variables: {
|
|
10
9
|
first,
|
|
11
10
|
query,
|
|
12
11
|
filterKeys
|
|
13
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
14
14
|
});
|
|
15
15
|
const pageInfo = data?.customers?.pageInfo;
|
|
16
|
-
const
|
|
16
|
+
const isLoadingCustomers = networkStatus === NetworkStatus.loading;
|
|
17
|
+
const customers = data?.customers?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
17
18
|
const fetchMoreCustomers = ()=>{
|
|
18
19
|
if (!pageInfo?.hasNextPage) return;
|
|
19
20
|
fetchMore({
|
|
@@ -6,5 +6,5 @@ type Props = {
|
|
|
6
6
|
onClose?: () => void;
|
|
7
7
|
onOk?: (customers: string[]) => void;
|
|
8
8
|
};
|
|
9
|
-
declare const CustomersPicker: ({ title, initialIds, limit, okButtonLoading, onClose, onOk }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const CustomersPicker: ({ title, initialIds, limit, okButtonLoading, onClose, onOk, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default CustomersPicker;
|
|
@@ -61,10 +61,10 @@ const CustomersPicker = ({ title = "Customers", initialIds = [], limit = 1 / 0,
|
|
|
61
61
|
})
|
|
62
62
|
}) : /*#__PURE__*/ jsxs(BlockStack, {
|
|
63
63
|
children: [
|
|
64
|
-
customers
|
|
64
|
+
customers?.map((customer)=>/*#__PURE__*/ jsx(InlineStack, {
|
|
65
65
|
stack: "full",
|
|
66
|
-
className: classnames(
|
|
67
|
-
|
|
66
|
+
className: classnames("lg:cursor-pointer border-t border-t-[#ebebeb]!", {
|
|
67
|
+
"bg-[#f1f1f1ab] cursor-default!": !selectedCustomer.includes(customer._id) && isReached
|
|
68
68
|
}),
|
|
69
69
|
gapX: 60,
|
|
70
70
|
padding: 60,
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
3
|
import { linkListQuery } from "../api/query.js";
|
|
3
4
|
const useLinklist = (props = {})=>{
|
|
4
5
|
const { skip, first, query, filterKeys } = props;
|
|
5
|
-
const { data,
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(linkListQuery, {
|
|
6
7
|
skip,
|
|
7
8
|
variables: {
|
|
8
9
|
first,
|
|
9
10
|
query,
|
|
10
11
|
filterKeys
|
|
11
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
12
14
|
});
|
|
13
15
|
const linklists = data?.linklists?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
14
16
|
const pageInfo = data?.linklists?.pageInfo;
|
|
17
|
+
const isLoadingLinklist = networkStatus === NetworkStatus.loading;
|
|
15
18
|
const fetchMoreLinklists = ()=>{
|
|
16
19
|
if (!pageInfo?.hasNextPage) return;
|
|
17
20
|
fetchMore({
|
|
@@ -6,5 +6,5 @@ type Props = {
|
|
|
6
6
|
onClose?: () => void;
|
|
7
7
|
onOk?: (linklist: string[]) => void;
|
|
8
8
|
};
|
|
9
|
-
declare const LinkListPicker: ({ title, initialIds, limit, okButtonLoading, onClose, onOk }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const LinkListPicker: ({ title, initialIds, limit, okButtonLoading, onClose, onOk, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default LinkListPicker;
|
|
@@ -62,8 +62,8 @@ const LinkListPicker = ({ title = "Linklist", initialIds = [], limit = 1 / 0, ok
|
|
|
62
62
|
children: [
|
|
63
63
|
linklists?.map((linklist)=>/*#__PURE__*/ jsxs(InlineStack, {
|
|
64
64
|
stack: "full",
|
|
65
|
-
className: classnames(
|
|
66
|
-
|
|
65
|
+
className: classnames("lg:cursor-pointer border-t border-t-[#ebebeb]!", {
|
|
66
|
+
"bg-[#f1f1f1ab] cursor-default!": !selectedLinklist.includes(linklist._id) && isReached
|
|
67
67
|
}),
|
|
68
68
|
gapX: 60,
|
|
69
69
|
padding: 60,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MetaDataProps } from "./MetaDataItem";
|
|
2
|
-
declare const VariantRefMetaField: ({ value, children }: MetaDataProps) => import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
|
|
2
|
+
declare const VariantRefMetaField: ({ value, children }: MetaDataProps) => import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[] | undefined;
|
|
3
3
|
export default VariantRefMetaField;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
3
|
import { metaobjectEntriesQuery } from "../api/query.js";
|
|
3
4
|
const useMetaobjectEntries = (props = {})=>{
|
|
4
5
|
const { skip, first, query, filterKeys } = props;
|
|
5
|
-
const { data,
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(metaobjectEntriesQuery, {
|
|
6
7
|
skip,
|
|
7
8
|
variables: {
|
|
8
9
|
first,
|
|
9
10
|
query,
|
|
10
11
|
filterKeys
|
|
11
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
12
14
|
});
|
|
13
15
|
const metaobjectEntries = data?.metaobjectEntries?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
14
16
|
const pageInfo = data?.metaobjectEntries?.pageInfo;
|
|
17
|
+
const isLoadingMetaobjectEntries = networkStatus === NetworkStatus.loading;
|
|
15
18
|
const fetchMoreMetaobjectEntries = ()=>{
|
|
16
19
|
if (!pageInfo?.hasNextPage) return;
|
|
17
20
|
fetchMore({
|
|
@@ -7,5 +7,5 @@ type Props = {
|
|
|
7
7
|
onClose?: () => void;
|
|
8
8
|
onOk?: (metaobjectEntries: string[]) => void;
|
|
9
9
|
};
|
|
10
|
-
declare const MetaobjectEntriesPicker: ({ title, initialIds, limit, metaobjects, okButtonLoading, onClose, onOk }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const MetaobjectEntriesPicker: ({ title, initialIds, limit, metaobjects, okButtonLoading, onClose, onOk, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default MetaobjectEntriesPicker;
|
|
@@ -65,8 +65,8 @@ const MetaobjectEntriesPicker = ({ title = "Metaobject entries", initialIds = []
|
|
|
65
65
|
children: [
|
|
66
66
|
metaobjectEntries?.map((metaobjectEntry)=>/*#__PURE__*/ jsxs(InlineStack, {
|
|
67
67
|
stack: "full",
|
|
68
|
-
className: classnames(
|
|
69
|
-
|
|
68
|
+
className: classnames("lg:cursor-pointer border-t border-t-[#ebebeb]!", {
|
|
69
|
+
"bg-[#f1f1f1ab] cursor-default!": !selectedMetaobjectEntries.includes(metaobjectEntry._id) && isReached
|
|
70
70
|
}),
|
|
71
71
|
gapX: 60,
|
|
72
72
|
padding: 60,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const meta: {
|
|
2
2
|
title: string;
|
|
3
|
-
component: ({ title, initialIds, limit, metaobjects, okButtonLoading, onClose, onOk }: {
|
|
3
|
+
component: ({ title, initialIds, limit, metaobjects, okButtonLoading, onClose, onOk, }: {
|
|
4
4
|
title?: string;
|
|
5
5
|
initialIds?: string[];
|
|
6
6
|
limit?: number;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
3
|
import { metaobjectQuery } from "../api/query.js";
|
|
3
4
|
const useMetaobjects = (props = {})=>{
|
|
4
5
|
const { skip, first, query, filterKeys } = props;
|
|
5
|
-
const { data,
|
|
6
|
+
const { data, networkStatus, fetchMore } = useQuery(metaobjectQuery, {
|
|
6
7
|
skip,
|
|
7
8
|
variables: {
|
|
8
9
|
first,
|
|
9
10
|
query,
|
|
10
11
|
filterKeys
|
|
11
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
12
14
|
});
|
|
13
15
|
const metaobjects = data?.metaobjects?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
14
16
|
const pageInfo = data?.metaobjects?.pageInfo;
|
|
17
|
+
const isMetaobjectsLoading = networkStatus === NetworkStatus.loading;
|
|
15
18
|
const fetchMoreMetaobjects = ()=>{
|
|
16
19
|
if (!pageInfo?.hasNextPage) return;
|
|
17
20
|
fetchMore({
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
3
|
import { pagesQuery } from "../api/query.js";
|
|
3
4
|
const usePages = (props = {})=>{
|
|
4
5
|
const { skip, first, query, filterKeys } = props;
|
|
5
|
-
const { data,
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(pagesQuery, {
|
|
6
7
|
skip,
|
|
7
8
|
variables: {
|
|
8
9
|
first,
|
|
9
10
|
query,
|
|
10
11
|
filterKeys
|
|
11
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
12
14
|
});
|
|
13
15
|
const pages = data?.pages?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
14
16
|
const pageInfo = data?.pages?.pageInfo;
|
|
17
|
+
const isLoadingPages = networkStatus === NetworkStatus.loading;
|
|
15
18
|
const fetchMorePages = ()=>{
|
|
16
19
|
if (!pageInfo?.hasNextPage) return;
|
|
17
20
|
fetchMore({
|
|
@@ -62,8 +62,8 @@ const PagesPicker = ({ title = "Pages", initialIds = [], limit = 1 / 0, okButton
|
|
|
62
62
|
children: [
|
|
63
63
|
pages?.map((page)=>/*#__PURE__*/ jsxs(InlineStack, {
|
|
64
64
|
stack: "full",
|
|
65
|
-
className: classnames(
|
|
66
|
-
|
|
65
|
+
className: classnames("lg:cursor-pointer border-t border-t-[#ebebeb]!", {
|
|
66
|
+
"bg-[#f1f1f1ab] cursor-default!": !selectedPage.includes(page._id) && isReached
|
|
67
67
|
}),
|
|
68
68
|
gapX: 60,
|
|
69
69
|
padding: 60,
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
3
|
import { productsQuery } from "../api/query.js";
|
|
3
4
|
const useProducts = (props = {})=>{
|
|
4
5
|
const { first, query, filterKeys, skip } = props;
|
|
5
|
-
const { data,
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(productsQuery, {
|
|
6
7
|
skip,
|
|
7
8
|
variables: {
|
|
8
9
|
first,
|
|
9
10
|
query,
|
|
10
11
|
filterKeys
|
|
11
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
12
14
|
});
|
|
13
15
|
const products = data?.products?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
14
16
|
const pageInfo = data?.products?.pageInfo;
|
|
17
|
+
const isLoadingProducts = networkStatus === NetworkStatus.loading;
|
|
15
18
|
const fetchMoreProducts = ()=>{
|
|
16
19
|
if (!pageInfo?.hasNextPage) return;
|
|
17
20
|
fetchMore({
|
|
@@ -6,5 +6,5 @@ type Props = {
|
|
|
6
6
|
onClose?: () => void;
|
|
7
7
|
onOk?: (products: string[]) => void;
|
|
8
8
|
};
|
|
9
|
-
declare const ProductsPicker: ({ title, initialIds, limit, okButtonLoading, onClose, onOk }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const ProductsPicker: ({ title, initialIds, limit, okButtonLoading, onClose, onOk, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default ProductsPicker;
|
|
@@ -63,8 +63,8 @@ const ProductsPicker = ({ title = "Products", initialIds = [], limit = 1 / 0, ok
|
|
|
63
63
|
children: [
|
|
64
64
|
products?.map((product)=>/*#__PURE__*/ jsxs(InlineStack, {
|
|
65
65
|
stack: "full",
|
|
66
|
-
className: classnames(
|
|
67
|
-
|
|
66
|
+
className: classnames("lg:cursor-pointer border-t border-t-[#ebebeb]!", {
|
|
67
|
+
"bg-[#f1f1f1ab] cursor-default!": !selectedProduct.includes(product._id) && isReached
|
|
68
68
|
}),
|
|
69
69
|
gapX: 60,
|
|
70
70
|
padding: 60,
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
|
-
import { useRef } from "react";
|
|
3
3
|
import { regionQuery } from "../api/query.js";
|
|
4
4
|
const useRegion = (props = {})=>{
|
|
5
5
|
const { skip, first, query, filterKeys } = props;
|
|
6
|
-
const
|
|
7
|
-
const { data, loading: isLoadingRegion, error, fetchMore } = useQuery(regionQuery, {
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(regionQuery, {
|
|
8
7
|
skip,
|
|
9
8
|
variables: {
|
|
10
9
|
first,
|
|
11
10
|
query,
|
|
12
11
|
filterKeys
|
|
13
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
14
14
|
});
|
|
15
|
-
const regions = data?._regions?.edges?.map((edge)=>edge?.node).filter((node)=>null != node)
|
|
15
|
+
const regions = data?._regions?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
16
16
|
const pageInfo = data?._regions?.pageInfo;
|
|
17
|
+
const isLoadingRegion = networkStatus === NetworkStatus.loading;
|
|
17
18
|
const fetchMoreRegions = ()=>{
|
|
18
19
|
if (!pageInfo?.hasNextPage) return;
|
|
19
20
|
fetchMore({
|
|
@@ -25,6 +26,7 @@ const useRegion = (props = {})=>{
|
|
|
25
26
|
},
|
|
26
27
|
updateQuery (prev, { fetchMoreResult }) {
|
|
27
28
|
if (!fetchMoreResult._regions?.edges || !prev._regions?.edges) return prev;
|
|
29
|
+
console.log(fetchMoreResult._regions);
|
|
28
30
|
return {
|
|
29
31
|
_regions: {
|
|
30
32
|
...fetchMoreResult._regions,
|
|
@@ -9,7 +9,7 @@ import { useRegion } from "../model/useRegion.js";
|
|
|
9
9
|
const RegionPicker = ({ title, initialIds, countries, limit = 1 / 0, okButtonLoading, onClose, onOk })=>{
|
|
10
10
|
const [selectedRegion, setSelectedRegion] = useState(initialIds ?? []);
|
|
11
11
|
const { query, debounceQuery, onChangeQuery } = useFilterQuery();
|
|
12
|
-
const { regions, pageInfo, isLoadingRegion, fetchMoreRegions
|
|
12
|
+
const { regions, pageInfo, isLoadingRegion, fetchMoreRegions } = useRegion({
|
|
13
13
|
first: 20,
|
|
14
14
|
query: debounceQuery,
|
|
15
15
|
filterKeys: {
|
|
@@ -64,10 +64,10 @@ const RegionPicker = ({ title, initialIds, countries, limit = 1 / 0, okButtonLoa
|
|
|
64
64
|
})
|
|
65
65
|
}) : /*#__PURE__*/ jsxs(BlockStack, {
|
|
66
66
|
children: [
|
|
67
|
-
regions
|
|
67
|
+
regions?.map((region)=>/*#__PURE__*/ jsx(InlineStack, {
|
|
68
68
|
stack: "full",
|
|
69
|
-
className: classnames(
|
|
70
|
-
|
|
69
|
+
className: classnames("lg:cursor-pointer border-t border-t-[#ebebeb]!", {
|
|
70
|
+
"bg-[#f1f1f1ab] cursor-default!": !selectedRegion.includes(region._id) && isReached
|
|
71
71
|
}),
|
|
72
72
|
gapX: 60,
|
|
73
73
|
padding: 60,
|
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
import { graphql } from "../../../shared/graphql/index.js";
|
|
2
|
-
const segmentsQuery = graphql(`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
const segmentsQuery = graphql(`
|
|
3
|
+
query CustomerSegments(
|
|
4
|
+
$after: ID
|
|
5
|
+
$before: ID
|
|
6
|
+
$first: Int
|
|
7
|
+
$last: Int
|
|
8
|
+
$query: String
|
|
9
|
+
$filterKeys: CustomerSegmentFilterKeys
|
|
10
|
+
) {
|
|
11
|
+
customerSegments(
|
|
12
|
+
after: $after
|
|
13
|
+
before: $before
|
|
14
|
+
first: $first
|
|
15
|
+
last: $last
|
|
16
|
+
query: $query
|
|
17
|
+
filterKeys: $filterKeys
|
|
18
|
+
) {
|
|
19
|
+
pageInfo {
|
|
20
|
+
endCursor
|
|
21
|
+
hasNextPage
|
|
22
|
+
hasPreviousPage
|
|
23
|
+
startCursor
|
|
24
|
+
}
|
|
25
|
+
edges {
|
|
26
|
+
node {
|
|
27
|
+
_id
|
|
28
|
+
title
|
|
29
|
+
}
|
|
14
30
|
}
|
|
15
31
|
}
|
|
16
32
|
}
|
|
17
|
-
|
|
33
|
+
`);
|
|
18
34
|
export { segmentsQuery };
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
|
-
import { useRef } from "react";
|
|
3
3
|
import { segmentsQuery } from "../api/query.js";
|
|
4
4
|
const useSegments = (props = {})=>{
|
|
5
5
|
const { skip, first, query, filterKeys } = props;
|
|
6
|
-
const
|
|
7
|
-
const { data, loading: isLoadingSegments, error, fetchMore } = useQuery(segmentsQuery, {
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(segmentsQuery, {
|
|
8
7
|
skip,
|
|
9
8
|
variables: {
|
|
10
9
|
first,
|
|
11
10
|
query,
|
|
12
11
|
filterKeys
|
|
13
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
14
14
|
});
|
|
15
|
+
const segments = data?.customerSegments?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
15
16
|
const pageInfo = data?.customerSegments?.pageInfo;
|
|
16
|
-
const
|
|
17
|
+
const isLoadingSegments = networkStatus === NetworkStatus.loading;
|
|
17
18
|
const fetchMoreSegments = ()=>{
|
|
18
19
|
if (!pageInfo?.hasNextPage) return;
|
|
19
20
|
fetchMore({
|
|
@@ -6,5 +6,5 @@ type Props = {
|
|
|
6
6
|
onClose?: () => void;
|
|
7
7
|
onOk?: (customers: string[]) => void;
|
|
8
8
|
};
|
|
9
|
-
declare const SegmentPicker: ({ title, initialIds, limit, okButtonLoading, onClose, onOk }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const SegmentPicker: ({ title, initialIds, limit, okButtonLoading, onClose, onOk, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default SegmentPicker;
|
|
@@ -61,10 +61,10 @@ const SegmentPicker = ({ title = "Segments", initialIds = [], limit = 1 / 0, okB
|
|
|
61
61
|
})
|
|
62
62
|
}) : /*#__PURE__*/ jsxs(BlockStack, {
|
|
63
63
|
children: [
|
|
64
|
-
segments
|
|
64
|
+
segments?.map((segment)=>/*#__PURE__*/ jsx(InlineStack, {
|
|
65
65
|
stack: "full",
|
|
66
|
-
className: classnames(
|
|
67
|
-
|
|
66
|
+
className: classnames("lg:cursor-pointer border-t border-t-[#ebebeb]!", {
|
|
67
|
+
"bg-[#f1f1f1ab] cursor-default!": !selectedSegment.includes(segment._id) && isReached
|
|
68
68
|
}),
|
|
69
69
|
gapX: 60,
|
|
70
70
|
padding: 60,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import { NetworkStatus } from "@apollo/client";
|
|
1
2
|
import { useQuery } from "@apollo/client/react";
|
|
2
|
-
import { useRef } from "react";
|
|
3
3
|
import { variantsQuery } from "../api/query.js";
|
|
4
4
|
const useVariants = (props = {})=>{
|
|
5
5
|
const { skip, first, query, filterKeys } = props;
|
|
6
|
-
const
|
|
7
|
-
const { data, loading: isLoadingVariants, error, fetchMore } = useQuery(variantsQuery, {
|
|
6
|
+
const { data, error, networkStatus, fetchMore } = useQuery(variantsQuery, {
|
|
8
7
|
skip,
|
|
9
8
|
variables: {
|
|
10
9
|
first,
|
|
11
10
|
query,
|
|
12
11
|
filterKeys
|
|
13
|
-
}
|
|
12
|
+
},
|
|
13
|
+
notifyOnNetworkStatusChange: true
|
|
14
14
|
});
|
|
15
|
-
const variants = data?.variants?.edges?.map((edge)=>edge?.node).filter((node)=>null != node)
|
|
15
|
+
const variants = data?.variants?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
16
16
|
const pageInfo = data?.variants?.pageInfo;
|
|
17
17
|
const fetchMoreVariants = ()=>{
|
|
18
18
|
if (!pageInfo?.hasNextPage) return;
|
|
@@ -37,6 +37,7 @@ const useVariants = (props = {})=>{
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
+
const isLoadingVariants = networkStatus === NetworkStatus.loading;
|
|
40
41
|
return {
|
|
41
42
|
variants,
|
|
42
43
|
pageInfo,
|
|
@@ -61,7 +61,7 @@ const VariantsPicker = ({ title = "Variants", initialIds = [], limit = 1 / 0, ok
|
|
|
61
61
|
})
|
|
62
62
|
}) : /*#__PURE__*/ jsxs(BlockStack, {
|
|
63
63
|
children: [
|
|
64
|
-
variants
|
|
64
|
+
variants?.map((variant)=>/*#__PURE__*/ jsxs(InlineStack, {
|
|
65
65
|
stack: "full",
|
|
66
66
|
className: classnames('lg:cursor-pointer border-t border-t-[#ebebeb]!', {
|
|
67
67
|
'bg-[#f1f1f1ab] cursor-default!': !selectedVariant.includes(variant._id) && isReached
|
|
@@ -29,7 +29,7 @@ type Documents = {
|
|
|
29
29
|
"query Pages($filterKeys: PageFilterKeys, $after: ID, $before: ID, $first: Int, $last: Int, $query: String) {\n pages(filterKeys: $filterKeys, after: $after, before: $before, first: $first, last: $last, query: $query) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n title\n image {\n _id\n url\n }\n }\n }\n }\n}": typeof types.PagesDocument;
|
|
30
30
|
"\n query Products($after: ID, $before: ID, $first: Int, $last: Int, $query: String,$filterKeys: ProductFilterKeys) {\n products(after: $after, before: $before, first: $first, last: $last, query: $query,filterKeys: $filterKeys) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n title\n image {\n _id\n url\n }\n }\n }\n }\n }\n": typeof types.ProductsDocument;
|
|
31
31
|
"query _regions($filterKeys: _RegionFilterKeys, $query: String, $after: ID, $before: ID, $first: Int, $last: Int) {\n _regions(filterKeys: $filterKeys, query: $query, after: $after, before: $before, first: $first, last: $last) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n name\n }\n }\n }\n}": typeof types._RegionsDocument;
|
|
32
|
-
"query CustomerSegments($after: ID
|
|
32
|
+
"\n query CustomerSegments(\n $after: ID\n $before: ID\n $first: Int\n $last: Int\n $query: String\n $filterKeys: CustomerSegmentFilterKeys\n ) {\n customerSegments(\n after: $after\n before: $before\n first: $first\n last: $last\n query: $query\n filterKeys: $filterKeys\n ) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n title\n }\n }\n }\n }\n": typeof types.CustomerSegmentsDocument;
|
|
33
33
|
"\n query Variants($after: ID, $before: ID, $first: Int, $last: Int, $query: String,$filterKeys: VariantFilterKeys) {\n variants(after: $after, before: $before, first: $first, last: $last, query: $query,filterKeys: $filterKeys) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n option1\n option2\n option3\n image {\n _id\n url\n }\n product {\n _id\n title\n }\n }\n }\n }\n }\n": typeof types.VariantsDocument;
|
|
34
34
|
};
|
|
35
35
|
declare const documents: Documents;
|
|
@@ -117,7 +117,7 @@ export declare function graphql(source: "query _regions($filterKeys: _RegionFilt
|
|
|
117
117
|
/**
|
|
118
118
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
119
119
|
*/
|
|
120
|
-
export declare function graphql(source: "query CustomerSegments($after: ID
|
|
120
|
+
export declare function graphql(source: "\n query CustomerSegments(\n $after: ID\n $before: ID\n $first: Int\n $last: Int\n $query: String\n $filterKeys: CustomerSegmentFilterKeys\n ) {\n customerSegments(\n after: $after\n before: $before\n first: $first\n last: $last\n query: $query\n filterKeys: $filterKeys\n ) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n title\n }\n }\n }\n }\n"): (typeof documents)["\n query CustomerSegments(\n $after: ID\n $before: ID\n $first: Int\n $last: Int\n $query: String\n $filterKeys: CustomerSegmentFilterKeys\n ) {\n customerSegments(\n after: $after\n before: $before\n first: $first\n last: $last\n query: $query\n filterKeys: $filterKeys\n ) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n title\n }\n }\n }\n }\n"];
|
|
121
121
|
/**
|
|
122
122
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
123
123
|
*/
|
|
@@ -17,7 +17,7 @@ const documents = {
|
|
|
17
17
|
"query Pages($filterKeys: PageFilterKeys, $after: ID, $before: ID, $first: Int, $last: Int, $query: String) {\n pages(filterKeys: $filterKeys, after: $after, before: $before, first: $first, last: $last, query: $query) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n title\n image {\n _id\n url\n }\n }\n }\n }\n}": PagesDocument,
|
|
18
18
|
"\n query Products($after: ID, $before: ID, $first: Int, $last: Int, $query: String,$filterKeys: ProductFilterKeys) {\n products(after: $after, before: $before, first: $first, last: $last, query: $query,filterKeys: $filterKeys) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n title\n image {\n _id\n url\n }\n }\n }\n }\n }\n": ProductsDocument,
|
|
19
19
|
"query _regions($filterKeys: _RegionFilterKeys, $query: String, $after: ID, $before: ID, $first: Int, $last: Int) {\n _regions(filterKeys: $filterKeys, query: $query, after: $after, before: $before, first: $first, last: $last) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n name\n }\n }\n }\n}": _RegionsDocument,
|
|
20
|
-
"query CustomerSegments($after: ID
|
|
20
|
+
"\n query CustomerSegments(\n $after: ID\n $before: ID\n $first: Int\n $last: Int\n $query: String\n $filterKeys: CustomerSegmentFilterKeys\n ) {\n customerSegments(\n after: $after\n before: $before\n first: $first\n last: $last\n query: $query\n filterKeys: $filterKeys\n ) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n title\n }\n }\n }\n }\n": CustomerSegmentsDocument,
|
|
21
21
|
"\n query Variants($after: ID, $before: ID, $first: Int, $last: Int, $query: String,$filterKeys: VariantFilterKeys) {\n variants(after: $after, before: $before, first: $first, last: $last, query: $query,filterKeys: $filterKeys) {\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n edges {\n node {\n _id\n option1\n option2\n option3\n image {\n _id\n url\n }\n product {\n _id\n title\n }\n }\n }\n }\n }\n": VariantsDocument
|
|
22
22
|
};
|
|
23
23
|
function graphql(source) {
|