Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Generate types

dominik-zeglen312f1a254b47
diff --git a/saleor/static/dashboard-next/customers/queries.ts b/saleor/static/dashboard-next/customers/queries.ts
new file mode 100644
index 0000000000..8c255d625d
--- /dev/null
+++ b/saleor/static/dashboard-next/customers/queries.ts
@@ -0,0 +1,77 @@
+import gql from "graphql-tag";
+
+import { TypedQuery } from "../queries";
+import {
+ CustomerDetails,
+ CustomerDetailsVariables
+} from "./types/CustomerDetails";
+import { ListCustomers, ListCustomersVariables } from "./types/ListCustomers";
+import { fragmentAddress } from "../orders/queries";
+
+const customerList = gql`
+ query ListCustomers(
+ $after: String
+ $before: String
+ $first: Int
+ $last: Int
+ ) {
+ customers(after: $after, before: $before, first: $first, last: $last) {
+ edges {
+ node {
+ email
+ id
+ orders {
+ totalCount
+ }
+ }
+ }
+ pageInfo {
+ endCursor
+ hasNextPage
+ hasPreviousPage
+ startCursor
+ }
+ }
+ }
+`;
+export const TypedCustomerListQuery = TypedQuery<
+ ListCustomers,
+ ListCustomersVariables
+>(customerList);
+
+const customerDetails = gql`
+ ${fragmentAddress}
+ query CustomerDetails($id: ID!, $lastOrders: Int!) {
+ user(id: $id) {
+ defaultBillingAddress {
+ ...AddressFragment
+ }
+ defaultShippingAddress {
+ ...AddressFragment
+ }
+ email
+ id
+ isActive
+ note
+ orders(last: $lastOrders) {
+ edges {
+ node {
+ created
+ id
+ number
+ total {
+ gross {
+ amount
+ currency
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+`;
+export const TypedCustomerDetailsQuery = TypedQuery<
+ CustomerDetails,
+ CustomerDetailsVariables
+>(customerDetails);
diff --git a/saleor/static/dashboard-next/customers/types/CustomerDetails.ts b/saleor/static/dashboard-next/customers/types/CustomerDetails.ts
new file mode 100644
index 0000000000..b42bdd59b0
--- /dev/null
+++ b/saleor/static/dashboard-next/customers/types/CustomerDetails.ts
@@ -0,0 +1,99 @@
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL query operation: CustomerDetails
+// ====================================================
+
+export interface CustomerDetails_user_defaultBillingAddress_country {
+ __typename: "CountryDisplay";
+ code: string;
+ country: string;
+}
+
+export interface CustomerDetails_user_defaultBillingAddress {
+ __typename: "Address";
+ city: string;
+ cityArea: string;
+ companyName: string;
+ country: CustomerDetails_user_defaultBillingAddress_country;
+ countryArea: string;
+ firstName: string;
+ id: string;
+ lastName: string;
+ phone: string | null;
+ postalCode: string;
+ streetAddress1: string;
+ streetAddress2: string;
+}
+
+export interface CustomerDetails_user_defaultShippingAddress_country {
+ __typename: "CountryDisplay";
+ code: string;
+ country: string;
+}
+
+export interface CustomerDetails_user_defaultShippingAddress {
+ __typename: "Address";
+ city: string;
+ cityArea: string;
+ companyName: string;
+ country: CustomerDetails_user_defaultShippingAddress_country;
+ countryArea: string;
+ firstName: string;
+ id: string;
+ lastName: string;
+ phone: string | null;
+ postalCode: string;
+ streetAddress1: string;
+ streetAddress2: string;
+}
+
+export interface CustomerDetails_user_orders_edges_node_total_gross {
+ __typename: "Money";
+ amount: number;
+ currency: string;
+}
+
+export interface CustomerDetails_user_orders_edges_node_total {
+ __typename: "TaxedMoney";
+ gross: CustomerDetails_user_orders_edges_node_total_gross;
+}
+
+export interface CustomerDetails_user_orders_edges_node {
+ __typename: "Order";
+ created: any;
+ id: string;
+ number: string | null;
+ total: CustomerDetails_user_orders_edges_node_total | null;
+}
+
+export interface CustomerDetails_user_orders_edges {
+ __typename: "OrderCountableEdge";
+ node: CustomerDetails_user_orders_edges_node;
+}
+
+export interface CustomerDetails_user_orders {
+ __typename: "OrderCountableConnection";
+ edges: CustomerDetails_user_orders_edges[];
+}
+
+export interface CustomerDetails_user {
+ __typename: "User";
+ defaultBillingAddress: CustomerDetails_user_defaultBillingAddress | null;
+ defaultShippingAddress: CustomerDetails_user_defaultShippingAddress | null;
+ email: string;
+ id: string;
+ isActive: boolean;
+ note: string | null;
+ orders: CustomerDetails_user_orders | null;
+}
+
+export interface CustomerDetails {
+ user: CustomerDetails_user | null;
+}
+
+export interface CustomerDetailsVariables {
+ id: string;
+ lastOrders: number;
+}
diff --git a/saleor/static/dashboard-next/customers/types/ListCustomers.ts b/saleor/static/dashboard-next/customers/types/ListCustomers.ts
new file mode 100644
index 0000000000..44eed85517
--- /dev/null
+++ b/saleor/static/dashboard-next/customers/types/ListCustomers.ts
@@ -0,0 +1,48 @@
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL query operation: ListCustomers
+// ====================================================
+
+export interface ListCustomers_customers_edges_node_orders {
+ __typename: "OrderCountableConnection";
+ totalCount: number | null;
+}
+
+export interface ListCustomers_customers_edges_node {
+ __typename: "User";
+ email: string;
+ id: string;
+ orders: ListCustomers_customers_edges_node_orders | null;
+}
+
+export interface ListCustomers_customers_edges {
+ __typename: "UserCountableEdge";
+ node: ListCustomers_customers_edges_node;
+}
+
+export interface ListCustomers_customers_pageInfo {
+ __typename: "PageInfo";
+ endCursor: string | null;
+ hasNextPage: boolean;
+ hasPreviousPage: boolean;
+ startCursor: string | null;
+}
+
+export interface ListCustomers_customers {
+ __typename: "UserCountableConnection";
+ edges: ListCustomers_customers_edges[];
+ pageInfo: ListCustomers_customers_pageInfo;
+}
+
+export interface ListCustomers {
+ customers: ListCustomers_customers | null;
+}
+
+export interface ListCustomersVariables {
+ after?: string | null;
+ before?: string | null;
+ first?: number | null;
+ last?: number | null;
+}