
* Clean up stories * Add missing props * Add zip codes section (#861) * Add zip code listing * Add list wrapping * Update snapshots * Set up API data * Fix lgtm warning * Update snapshots * Run Actions on all PR * Checks on PR * Test envs on PR * Cleanup action on PR * Update messages Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com> * Allow zip codes to be assigned to shipping method * Add zip code deletion (#871) * Add zip code range dialog * Fix path management * Use query params to handle modal actions * Allow zip codes to be assigned to shipping method * Make params optional * Fix types * Clean up urls * Add zip code range delete action * Update snapshots and messages * Update schema * Refresh zip code list after assigning them * Update types and snapshots * Update snapshots * Fix error message, checkbox default value (#880) * Fix error message, checkbox default value * Update snapshots * Update schema and types * Update stories * add excluded products section in shipping methods views * create UnassignDialog component * use priceRangeFragment in shipping queries * remove unneeded price from ShippingMethodAddProductsDialog * update messages in ShippingMethodProducts * updates after rebase * update snapshots, fix lint errors * fix ShippingMethodProductsAddDialog * update snapshots * small fix in ShippingMethodProducts * update snapshots after rebase * add handleClose func in ShippingMethodProductsAddDialog * Fix metadata not showing in category update * update snapshots again * update ShippingMethodProductsAddDialog * updates after rebase * update Price and Weight rates views Co-authored-by: dominik-zeglen <flesz3@o2.pl> Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com> Co-authored-by: Tomasz Szymański <lime129@gmail.com> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com>
63 lines
1.4 KiB
TypeScript
63 lines
1.4 KiB
TypeScript
import { pageInfoFragment } from "@saleor/fragments/pageInfo";
|
|
import {
|
|
shippingMethodWithExcludedProductsFragment,
|
|
shippingZoneFragment
|
|
} from "@saleor/fragments/shipping";
|
|
import makeQuery from "@saleor/hooks/makeQuery";
|
|
import gql from "graphql-tag";
|
|
|
|
import { ShippingZone, ShippingZoneVariables } from "./types/ShippingZone";
|
|
import { ShippingZones, ShippingZonesVariables } from "./types/ShippingZones";
|
|
|
|
const shippingZones = gql`
|
|
${pageInfoFragment}
|
|
${shippingZoneFragment}
|
|
query ShippingZones(
|
|
$first: Int
|
|
$after: String
|
|
$last: Int
|
|
$before: String
|
|
) {
|
|
shippingZones(first: $first, after: $after, last: $last, before: $before) {
|
|
edges {
|
|
node {
|
|
...ShippingZoneFragment
|
|
}
|
|
}
|
|
pageInfo {
|
|
...PageInfoFragment
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
export const useShippingZoneList = makeQuery<
|
|
ShippingZones,
|
|
ShippingZonesVariables
|
|
>(shippingZones);
|
|
|
|
const shippingZone = gql`
|
|
${shippingZoneFragment}
|
|
${shippingMethodWithExcludedProductsFragment}
|
|
query ShippingZone(
|
|
$id: ID!
|
|
$before: String
|
|
$after: String
|
|
$first: Int
|
|
$last: Int
|
|
) {
|
|
shippingZone(id: $id) {
|
|
...ShippingZoneFragment
|
|
default
|
|
shippingMethods {
|
|
...ShippingMethodWithExcludedProductsFragment
|
|
}
|
|
warehouses {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
export const useShippingZone = makeQuery<ShippingZone, ShippingZoneVariables>(
|
|
shippingZone
|
|
);
|