
* Temporary merged schema and types update * Update typing for zipCodeRules -> postalCodeRules * Refactor zipCodes to postalCodes * Fix new schema webhooks * Delete postal code unassign dialog * Query inclusion type from backend * Clean up schema from old mutations * Proper new mutations structure, all postal code related changes * Linter changes * Fix bug with save not being refreshed after codes are added / deleted / inclusion change * Tests and translations * Fix warnings across app, minor variables refactor * Linting * Trigger deployment * CR changes, cleanups and refactors * Update snapshots * Resolve bug with radio not shows correct value on page refresh * Fix price and weight creation of codes * Reducer * Revert "Reducer" This reverts commit 07a3aed9c88332bde7d9be61b6dbc29e34e4edba.
96 lines
2.3 KiB
TypeScript
96 lines
2.3 KiB
TypeScript
import { shippingZone } from "@saleor/shipping/fixtures";
|
|
import Decorator from "@saleor/storybook//Decorator";
|
|
import { ShippingMethodTypeEnum } from "@saleor/types/globalTypes";
|
|
import { storiesOf } from "@storybook/react";
|
|
import React from "react";
|
|
|
|
import ShippingZoneRatesPage, {
|
|
ShippingZoneRatesPageProps
|
|
} from "./ShippingZoneRatesPage";
|
|
|
|
const channels = [
|
|
{
|
|
currency: "USD",
|
|
id: "1",
|
|
maxValue: "10",
|
|
minValue: "0",
|
|
name: "channel",
|
|
price: "5"
|
|
},
|
|
{
|
|
currency: "USD",
|
|
id: "2",
|
|
maxValue: "20",
|
|
minValue: "1",
|
|
name: "test",
|
|
price: "6"
|
|
}
|
|
];
|
|
|
|
const defaultChannels = [
|
|
{
|
|
currency: "USD",
|
|
id: "1",
|
|
maxValue: "",
|
|
minValue: "",
|
|
name: "channel",
|
|
price: ""
|
|
}
|
|
];
|
|
|
|
const props: ShippingZoneRatesPageProps = {
|
|
allChannelsCount: 3,
|
|
channelErrors: [],
|
|
disabled: false,
|
|
errors: [],
|
|
isChecked: () => undefined,
|
|
onBack: () => undefined,
|
|
onChannelsChange: () => undefined,
|
|
onDelete: () => undefined,
|
|
onNextPage: () => undefined,
|
|
onPostalCodeAssign: () => undefined,
|
|
onPostalCodeInclusionChange: () => undefined,
|
|
onPostalCodeUnassign: () => undefined,
|
|
onPreviousPage: () => undefined,
|
|
onProductAssign: () => undefined,
|
|
onProductUnassign: () => undefined,
|
|
onSubmit: () => undefined,
|
|
openChannelsModal: () => undefined,
|
|
rate: shippingZone.shippingMethods[0],
|
|
saveButtonBarState: "default",
|
|
selected: 0,
|
|
shippingChannels: defaultChannels,
|
|
toggle: () => undefined,
|
|
toggleAll: () => undefined,
|
|
toolbar: () => undefined,
|
|
variant: ShippingMethodTypeEnum.PRICE
|
|
};
|
|
|
|
storiesOf("Views / Shipping / Shipping rate", module)
|
|
.addDecorator(Decorator)
|
|
.add("create price rate", () => <ShippingZoneRatesPage {...props} />)
|
|
.add("create weight rate", () => (
|
|
<ShippingZoneRatesPage {...props} variant={ShippingMethodTypeEnum.WEIGHT} />
|
|
))
|
|
.add("loading", () => (
|
|
<ShippingZoneRatesPage
|
|
{...props}
|
|
disabled={true}
|
|
rate={undefined}
|
|
saveButtonBarState={"loading"}
|
|
/>
|
|
))
|
|
.add("update price rate", () => (
|
|
<ShippingZoneRatesPage
|
|
{...props}
|
|
shippingChannels={channels}
|
|
rate={shippingZone.shippingMethods[2]}
|
|
/>
|
|
))
|
|
.add("update weight rate", () => (
|
|
<ShippingZoneRatesPage
|
|
{...props}
|
|
shippingChannels={channels}
|
|
variant={ShippingMethodTypeEnum.WEIGHT}
|
|
/>
|
|
));
|