2019-06-19 14:40:52 +00:00
|
|
|
import { MutationResult } from "react-apollo";
|
|
|
|
|
2019-12-06 17:11:28 +00:00
|
|
|
import { ConfirmButtonTransitionState } from "./components/ConfirmButton";
|
2019-12-19 15:54:52 +00:00
|
|
|
import { IFilter } from "./components/Filter";
|
2020-01-15 15:36:45 +00:00
|
|
|
import { MultiAutocompleteChoiceType } from "./components/MultiAutocompleteSelectField";
|
2020-07-07 10:14:12 +00:00
|
|
|
import { User_userPermissions } from "./fragments/types/User";
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
export interface UserError {
|
2020-02-24 14:14:48 +00:00
|
|
|
field: string | null;
|
2020-03-24 14:05:26 +00:00
|
|
|
message?: string;
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
|
2019-11-08 10:25:17 +00:00
|
|
|
export interface DialogProps {
|
|
|
|
open: boolean;
|
|
|
|
onClose: () => void;
|
|
|
|
}
|
|
|
|
|
2019-08-09 11:14:35 +00:00
|
|
|
export interface ListSettings<TColumn extends string = string> {
|
|
|
|
columns?: TColumn[];
|
|
|
|
rowNumber: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum ListViews {
|
2020-07-22 10:54:15 +00:00
|
|
|
APPS_LIST = "APPS_LIST",
|
2019-08-09 11:14:35 +00:00
|
|
|
ATTRIBUTE_LIST = "ATTRIBUTE_LIST",
|
2021-05-24 11:01:18 +00:00
|
|
|
ATTRIBUTE_VALUE_LIST = "ATTRIBUTE_VALUE_LIST",
|
2019-08-09 11:14:35 +00:00
|
|
|
CATEGORY_LIST = "CATEGORY_LIST",
|
|
|
|
COLLECTION_LIST = "COLLECTION_LIST",
|
|
|
|
CUSTOMER_LIST = "CUSTOMER_LIST",
|
|
|
|
DRAFT_LIST = "DRAFT_LIST",
|
|
|
|
NAVIGATION_LIST = "NAVIGATION_LIST",
|
|
|
|
ORDER_LIST = "ORDER_LIST",
|
|
|
|
PAGES_LIST = "PAGES_LIST",
|
2020-11-19 14:42:14 +00:00
|
|
|
PAGE_TYPES_LIST = "PAGE_TYPES_LIST",
|
2019-08-27 12:36:19 +00:00
|
|
|
PLUGINS_LIST = "PLUGIN_LIST",
|
2019-08-09 11:14:35 +00:00
|
|
|
PRODUCT_LIST = "PRODUCT_LIST",
|
2020-04-23 15:43:08 +00:00
|
|
|
PERMISSION_GROUP_LIST = "PERMISSION_GROUP_LIST",
|
2019-09-12 13:00:25 +00:00
|
|
|
PRODUCT_TYPE_LIST = "PRODUCT_TYPE_LIST",
|
2019-08-09 11:14:35 +00:00
|
|
|
SALES_LIST = "SALES_LIST",
|
|
|
|
SHIPPING_METHODS_LIST = "SHIPPING_METHODS_LIST",
|
|
|
|
STAFF_MEMBERS_LIST = "STAFF_MEMBERS_LIST",
|
2019-10-09 06:56:46 +00:00
|
|
|
VOUCHER_LIST = "VOUCHER_LIST",
|
2020-01-30 11:46:35 +00:00
|
|
|
WAREHOUSE_LIST = "WAREHOUSE_LIST",
|
2021-06-15 08:10:13 +00:00
|
|
|
WEBHOOK_LIST = "WEBHOOK_LIST",
|
|
|
|
TRANSLATION_ATTRIBUTE_VALUE_LIST = "TRANSLATION_ATTRIBUTE_VALUE_LIST"
|
2019-08-09 11:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ListProps<TColumns extends string = string> {
|
2019-06-19 14:40:52 +00:00
|
|
|
disabled: boolean;
|
|
|
|
pageInfo?: {
|
|
|
|
hasNextPage: boolean;
|
|
|
|
hasPreviousPage: boolean;
|
|
|
|
};
|
2019-08-09 11:14:35 +00:00
|
|
|
settings?: ListSettings<TColumns>;
|
2019-06-19 14:40:52 +00:00
|
|
|
onNextPage: () => void;
|
|
|
|
onPreviousPage: () => void;
|
|
|
|
onRowClick: (id: string) => () => void;
|
2021-06-15 15:15:14 +00:00
|
|
|
onUpdateListSettings?: <T extends keyof ListSettings<TColumns>>(
|
|
|
|
key: T,
|
|
|
|
value: ListSettings<TColumns>[T]
|
2019-08-09 11:14:35 +00:00
|
|
|
) => void;
|
|
|
|
onListSettingsReset?: () => void;
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
2019-09-13 11:33:42 +00:00
|
|
|
|
|
|
|
export interface SortPage<TSortKey extends string> {
|
2019-09-13 14:17:12 +00:00
|
|
|
sort: Sort<TSortKey>;
|
2019-09-26 10:14:07 +00:00
|
|
|
onSort: (field: TSortKey, id?: string) => void;
|
2019-09-13 11:33:42 +00:00
|
|
|
}
|
2020-04-23 15:43:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param toggle Will be use to change status of item
|
|
|
|
* @param isChecked Returns true for ids of chosen items
|
|
|
|
* @param selected Number of chosen items.
|
|
|
|
*/
|
|
|
|
|
2019-06-19 14:40:52 +00:00
|
|
|
export interface ListActionsWithoutToolbar {
|
|
|
|
toggle: (id: string) => void;
|
|
|
|
toggleAll: (items: React.ReactNodeArray, selected: number) => void;
|
|
|
|
isChecked: (id: string) => boolean;
|
|
|
|
selected: number;
|
|
|
|
}
|
|
|
|
export type TabListActions<
|
|
|
|
TToolbars extends string
|
|
|
|
> = ListActionsWithoutToolbar &
|
|
|
|
Record<TToolbars, React.ReactNode | React.ReactNodeArray>;
|
|
|
|
export interface ListActions extends ListActionsWithoutToolbar {
|
|
|
|
toolbar: React.ReactNode | React.ReactNodeArray;
|
|
|
|
}
|
2019-08-09 11:14:35 +00:00
|
|
|
export interface PageListProps<TColumns extends string = string>
|
|
|
|
extends ListProps<TColumns> {
|
|
|
|
defaultSettings?: ListSettings<TColumns>;
|
2019-06-19 14:40:52 +00:00
|
|
|
onAdd: () => void;
|
|
|
|
}
|
2019-09-10 15:14:11 +00:00
|
|
|
|
2020-02-11 15:05:09 +00:00
|
|
|
export interface SearchProps {
|
2019-06-19 14:40:52 +00:00
|
|
|
onSearchChange: (value: string) => void;
|
|
|
|
}
|
2020-02-11 15:05:09 +00:00
|
|
|
export interface SearchPageProps extends SearchProps {
|
|
|
|
initialSearch: string;
|
|
|
|
}
|
2021-03-09 08:44:09 +00:00
|
|
|
export interface FilterPageProps<TKeys extends string, TOpts extends {}>
|
2019-12-20 15:53:03 +00:00
|
|
|
extends FilterProps<TKeys>,
|
|
|
|
SearchPageProps,
|
2019-09-12 14:22:42 +00:00
|
|
|
TabPageProps {
|
2019-12-20 15:53:03 +00:00
|
|
|
filterOpts: TOpts;
|
2019-09-10 15:14:11 +00:00
|
|
|
}
|
|
|
|
|
2019-12-20 15:53:03 +00:00
|
|
|
export interface FilterProps<TKeys extends string> {
|
Multichannel (#833)
* add multichannel to configuration view
* create multichannels list view
* create multichannels list view
* add ChannelsCreate view
* update channels in configuration
* add stories
* update default messages
* fix ChannelForm props
* update channels list styles
* update snapshots
* update channel form currency input
* update Channels fragments
* extract messages
* remove tabs from channelsList
* channel details, channel delete modal (#598)
* create Channel details view
* create ChannelDeleteDialog
* add channels delete dialog to channels list
* update messages and types
* fixes after review
* channels availability (#609)
* create Channel details view
* update messages and types
* create ChannelsAvailability component
* create more product channels components
* create channels stories, update fixtures, types
* update product views with channels data
* update schema and snapshots
* update defaultMessages
* update ProductUpdate view
* create ChannelsAvailabilityDropdown component
* add product channels to local storage
* update globalTypes
* Update to new schema and resolve issues
* Update messages
* create deleteChannel mutation
* add channels availability component to product create view
* refactor ProductCreate and ProductUpdate views
* CollectionProducts view cleanup
* add disabled prop to ActionDialog
* use updateChannels mutation in ProductCreate view
* ProductCreate - update submit function
* fixes after review
* update snapshots and messages
Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
* channels shipping components (#655)
* create PricingCard, OrderValue and OrderWeight components
* create ShippingZoneRatesPage and DeleteShippingRateDialog
* update ChannelsAvailability component
* updates after review
* channels shipping views (#662)
* update ChannelsAvailability component
* updates after review
* create PriceRate views, update types
* create weight rates views
* update shipping views, stories, messages
* update snapshots
* update snapshots
* update useChannels hook
* orders channels components (#698)
* create OrderChannelSectionCard component
* update OrderDetailsPage
* update DraftOrderChannelCard
* update snapshots
* update fixtures
* small change after review, update snapshots
* product pricing (#702)
* update product types
* update Pricing in simple product view
* use productVariantCreate mutation in simple product view
* update snapshots and messages
* handle create variant (#715)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update snapshots and messages
* fix update and create product handlers
* update pricing types
* channels modal - new styles, search input (#717)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update pricing types
* add search input in ChannelsAvailabilityDialog
* update ChannelsAvailabilityDialog in all views
* update snapshots
* fix search input label styles
* update toggleAllChannels function
* update variant creator (#724)
* update product types
* update Pricing in simple product view
* handle product create and update errors
* update pricing types
* add search input in ChannelsAvailabilityDialog
* update ChannelsAvailabilityDialog in all views
* update snapshots
* add channelLisitngs to variant creator
* update variant creator price styles
* update product variant creator reducer tests
* update createVariants tests
* update error handling in product variant creator
* add Skip pricing for now option
* use PriceField instead of TextField in ProductVariantCreatorSummary
* create price validation function
* fix errors handling in ProductVariantPrice component
* fixes after review
* Product List - remove publish/unpublish buttons (#727)
* ProductList - remove publish and unpublish buttons
* update messages
* update snapshots, messages
* revert changes in ChannelsAvailabilityDropdown
* products/shipping/discount list settings (#739)
* create ChannelSettingsDialog component
* update snapshots
* ProductList - open settings modal when there is no selected channel
* add settings modal to vouchers list
* add settings dialog to sales list
* add setting modal to shipping list
* update shipping
* update snapshots, messages
* useChannelsSettings - remove selectedChannelSlug
* fix channels update handler in product and shipping view
* messages update in ChannelSettingsDialog
* handle product/discount list when there is no channels
* update onSettingsOpen prop
* collection availability dropdown (#743)
* add availability dropdown to collection products list
* update channelListingProduct fragment name
* update voucher view/components with channels (#746)
* update voucher view/components with channels
* update VoucherSummary, remove defaultCurrency from voucher components
* update snapshots
* move getChannelsVariables func to discounts handlers
* update voucher messages
* sale view/components with channels (#750)
* update sale views with channels
* small fixes in discounts
* order views with channels (#752)
* update draft orders with channels
* add channel activate/deactivate mutations
* remove sort by total in orders list
* add error notification on channel activate/deactivate
* product variants channel select (#755)
* add channels selector to ProductVariants component
* remove selectedChannel from ProductUpdate, update messages and snapshots
* update product fragments
* update translations (#762)
* update translations
* fix translation types
* update messages
* update Availability component (#766)
* update ChannelsAvailability component
* update product fixtures
* update collection and channel fixtures
* ChannelsAvailability - handle errors
* update product handlers
* update ChannelsAvailability styles
* update ProductVariant
* update snapshots
* fix missing things in multichannel (#785)
* add availability dropdown to discount products list
* fix error handling in shipping components
* update product views and components
* update messages
* update category view/components
* update CategoryProducts styles
* remove defaultCurrency from shipping components
* create ChannelsSelect component
* update channels error handling after review
* another fixes after review
* Add channels to collection views/components (#791)
** update collection components and views
* update create collection view
* update error handling in collection
* remove filter bar from collection list
* update products fragments
* small fix in collection create view
* use collectionFragment in useCatalogSearch
* update defaultMessages and snapshots
* update homepage view/drop defaultCurrency (#801)
* update homepage view
* drop defaultCurrency prop
* fix onChannelChange function in home view
* remove visibility from product list filters
* update export products with channels (#803)
* update ProductExportDialog with channels
* add new channel error code
* remover VISIBLE from product export dialog Financial information
* fix input size in ProductVariantCreatorSummary (#804)
* channels currency code select (#806)
* create select with currency codes
* fix ChannelDeleteDialog
* update defaultMessages, remove unneeded ChannelDetails handlers
* fixes after rebase
* replace channelListing with channelListings
* [multichannel] Update schema]
* Fix product create test
Co-authored-by: AlicjaSzu <alicja.szukuc@gmail.com>
Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
2020-11-17 16:10:42 +00:00
|
|
|
currencySymbol?: string;
|
2019-12-20 15:53:03 +00:00
|
|
|
onFilterChange: (filter: IFilter<TKeys>) => void;
|
2021-06-14 13:31:41 +00:00
|
|
|
onFilterAttributeFocus?: (id?: string) => void;
|
2019-09-10 15:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface TabPageProps {
|
|
|
|
currentTab: number;
|
|
|
|
tabs: string[];
|
|
|
|
onAll: () => void;
|
|
|
|
onTabChange: (tab: number) => void;
|
|
|
|
onTabDelete: () => void;
|
|
|
|
onTabSave: () => void;
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
|
2020-11-23 09:39:24 +00:00
|
|
|
export interface ChannelProps {
|
|
|
|
selectedChannelId: string;
|
|
|
|
}
|
|
|
|
|
2019-06-19 14:40:52 +00:00
|
|
|
export interface PartialMutationProviderOutput<
|
|
|
|
TData extends {} = {},
|
|
|
|
TVariables extends {} = {}
|
|
|
|
> {
|
2019-12-06 17:14:19 +00:00
|
|
|
opts: MutationResult<TData> & MutationResultAdditionalProps;
|
2019-06-19 14:40:52 +00:00
|
|
|
mutate: (variables: TVariables) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Node {
|
|
|
|
id: string;
|
|
|
|
}
|
2021-06-14 13:31:41 +00:00
|
|
|
export interface SlugNode {
|
|
|
|
slug: string;
|
|
|
|
}
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
export type Pagination = Partial<{
|
|
|
|
after: string;
|
|
|
|
before: string;
|
|
|
|
}>;
|
|
|
|
|
|
|
|
export type Dialog<TDialog extends string> = Partial<{
|
|
|
|
action: TDialog;
|
|
|
|
}>;
|
|
|
|
export type ActiveTab<TTab extends string = string> = Partial<{
|
|
|
|
activeTab: TTab;
|
|
|
|
}>;
|
|
|
|
export type Filters<TFilters extends string> = Partial<
|
|
|
|
Record<TFilters, string>
|
|
|
|
>;
|
2019-09-05 13:05:12 +00:00
|
|
|
export type FiltersWithMultipleValues<TFilters extends string> = Partial<
|
2019-12-20 10:44:41 +00:00
|
|
|
Record<TFilters, string[]>
|
2019-09-05 13:05:12 +00:00
|
|
|
>;
|
2020-01-17 14:25:50 +00:00
|
|
|
export type FiltersAsDictWithMultipleValues<TFilters extends string> = Partial<
|
|
|
|
Record<TFilters, Record<string, string[]>>
|
|
|
|
>;
|
2020-01-09 13:38:04 +00:00
|
|
|
export type Search = Partial<{
|
|
|
|
query: string;
|
|
|
|
}>;
|
2019-06-19 14:40:52 +00:00
|
|
|
export type SingleAction = Partial<{
|
|
|
|
id: string;
|
|
|
|
}>;
|
2019-09-13 11:33:42 +00:00
|
|
|
export type Sort<TSort extends string = string> = Partial<{
|
|
|
|
asc: boolean;
|
|
|
|
sort: TSort;
|
|
|
|
}>;
|
2019-06-19 14:40:52 +00:00
|
|
|
export type BulkAction = Partial<{
|
|
|
|
ids: string[];
|
|
|
|
}>;
|
2019-08-09 11:14:35 +00:00
|
|
|
|
|
|
|
export interface ReorderEvent {
|
|
|
|
oldIndex: number;
|
|
|
|
newIndex: number;
|
|
|
|
}
|
|
|
|
export type ReorderAction = (event: ReorderEvent) => void;
|
|
|
|
|
2019-08-12 14:11:10 +00:00
|
|
|
export interface FetchMoreProps {
|
2019-08-09 11:14:35 +00:00
|
|
|
loading: boolean;
|
|
|
|
hasMore: boolean;
|
Add channel shipping zones (#1015)
* Add naked input option to SingleAutocompleteSelectField and update it's stories
* Add new icons - chevron up, down & trash
* Add deletable item component and stories
* Add card add items footer component to be used in warehouses and product stocks assign
* Update schema and types
* Add shipping zones card components
* Update channel details page form to also include shipping zones
* Update makeTopLevelSearch hook files directory and add getSearchFetchMoreProps function to avoid extracting it manually every time
* Update channels types & fragments
* Move getDefaultNotifierSuccessErrorData function to useNotifier utils, update dir etc., also make order discount provider use it from the new dir
* Add shippinh zone to channel update and create and add shipping zone search
* Update messages
* Fix types
* Fix lint, types etc
* Small refactor from review and quick fix styles of shipping zones card
* Refactor a bit and update snapshots
* Refactor a bit and update snapshots
* Addd / refactor channels availability components
* Add useChannelsWithProductVariants hook with utils and types
* Add / refactor more channels availability components
* Move avatar from table cell avatar to separate component for it to be usable outside of tables
* Add channels with variants logic to product create and update pages & views
* Refactor components to use updated channels availability components
* Remove unnecessary comments
* Update storybook
* Update types
* Update messages
* Fix prices for variants / simple product not uodating properly
* Post merge cleanup, update schema, types, etc.
* Change shipping zone details warehouses card into settings card and add ability to assign channels to shipping zone
* Update types
* Update snapshots
* Fix selecting / deselecting all channels in channels with variants modal
* Fixes after review, some types changes etc.
* Update snapshots
* Small types fixes
* Make price rates views use parent shipping method channels instead of all
* Make price rates views use parent shipping method channels instead of all
* Update types
* Fix bugs
* Fixes after review
* Fix channels availability data submission
* Fix lint
* Fix variant pricing card showing not related channels
* Fixes after review
* Fix types
* Hide unaviable variants in add products to draft order dialog
* Fix channels with variants availability modal showing confirm button as enabled when it shouldn't
* Fix types
* Update semi checked icon to match old designs
* Update types
* Update channels icon in channels with variants availability
* Fix product cypress test after product channels mutation changed
* Fix trash and chevron down colors in dark mode
* Fix shipping zones card footer not updating query after click away
* Fix types in schema, add condition not to display shipping zones select in channel details if all zones have already been selected
* Fix products adding in order draft dialog
* Fix simple productupdate
* Update snapshots after merge with master
* Update messages
* Fix product api request for cypress
* Add missing test id
* Fix selecting if product is simple -> form being submitted with empty data sometimes
* Update snapshots, messages and add fix for invalid date at product update
* Remove unnecessary imports
* Fix failing test in saleor 2552 (#1061)
* fix
* fix
* fix
Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
Co-authored-by: Karolina <rakoczy.karolina@gmail.com>
2021-04-14 13:44:25 +00:00
|
|
|
totalCount?: number;
|
2019-08-09 11:14:35 +00:00
|
|
|
onFetchMore: () => void;
|
|
|
|
}
|
2019-09-10 15:14:11 +00:00
|
|
|
|
|
|
|
export type TabActionDialog = "save-search" | "delete-search";
|
2019-10-08 14:19:14 +00:00
|
|
|
|
|
|
|
export interface UserPermissionProps {
|
2020-04-23 15:43:08 +00:00
|
|
|
userPermissions: User_userPermissions[];
|
2019-10-08 14:19:14 +00:00
|
|
|
}
|
2019-12-06 17:14:19 +00:00
|
|
|
|
|
|
|
export interface MutationResultAdditionalProps {
|
2019-12-06 17:17:44 +00:00
|
|
|
status: ConfirmButtonTransitionState;
|
2019-12-06 17:14:19 +00:00
|
|
|
}
|
2019-12-20 15:53:03 +00:00
|
|
|
|
|
|
|
export type MinMax = Record<"min" | "max", string>;
|
|
|
|
|
|
|
|
export interface FilterOpts<T> {
|
|
|
|
active: boolean;
|
|
|
|
value: T;
|
|
|
|
}
|
2020-01-15 15:36:45 +00:00
|
|
|
|
|
|
|
export interface AutocompleteFilterOpts
|
|
|
|
extends FetchMoreProps,
|
|
|
|
SearchPageProps {
|
|
|
|
choices: MultiAutocompleteChoiceType[];
|
|
|
|
displayValues: MultiAutocompleteChoiceType[];
|
|
|
|
}
|
2021-05-11 12:26:17 +00:00
|
|
|
|
|
|
|
export type Ids = string[];
|