
* Add gift cards section to menu and add empty list component * Update messages * Change styling of app wide page header to match design * Add gift cards list table wip * Update prop name for status chip component to make it more consistent with other components * Replace old trash icon with new one * Add Size type based on action dialog sizes to be used app wide * Add delete icon button * Add new sizes option to status chip component * Add / update gift cards list components * Add bulk actions type * Work on gift cards list WIP * Small refactor * Fix styling of gift cards table * Remove temp files * Remove unnecessary type * Add gift cards section to menu and add empty list component * Update schema and types * Add link to gift card update page to gift cards list and add route to gift cards index * Extract order page title with status chip into a separate generic component and use it in order page title * wip * Update money component * Add gift card details card balance section * Refactor gift card details * Add vertical spacer component * Update schema and types * Add gift card tag input component along with necessary queries * Add gift card tag input to gift card update page * Add gift card update details card expiry section WIP * Add time period select field WIP * Post rebase refactor * Add time period select field to gift card update view * Fixes after review * Update schema, types and gift cards query * Add getFullName util function and replace existing manual usages * Add text with select field component * Add gift card update info card and refactor * Fix import * Add displaying order link in gift card update * Refactor * Connect gift card list to api * refactor * Add gift card create dialog * Fix gift card list styles, change location for gift card list query, minor refactor * Fix menu structure data for gift cards * Add channel currencies type to shop * Refactor text with select field * Add gift card expiry select component * Add gift card error type and fragment * Update global types * Add default prop to getFormErrors function * Move gift card details provider to providers dir * Update global utils with mapSingleValueNodeToChoice function * Update gift card tag input * Move and refactor time period field * Update schema * move format money function to other money ulities * Update gift card urls * Add content or skeleton component * Add gift card create util for extracting expiry settings input data * Remove content or skeleton component and move displaying logic to existing skeleton * Move displaying logic of gift card create dialog to list * Refactor * Add hooks for gift card bulk actions and gift card list to be used instead of context directly * Fix types for text with select field + add parsing for number typed field * Add initial currency to gift card create form * Fix gift card create dialog closing animation * Add gift card update info card * Refactor gift card update details card * Add gift card balance dialog * Move gift card update form providers to providers dir * Connect gift card update page to api, add necessary contexts etc. * Refactor * Refactor * Add hooks to use instead of gift card contexts directly * Fix types * Fix text field target name missing in passed event in text with select field * Add minimal value option to text with select field, add to gift card inputs * Fix gift card update balance dialog not changing hasChanged prop after submit * Refactor * Fix update balance dialog crashing the app when enetered wrong amount * Fix gift card list table header styles * Add enable / disable section to gift card update * Refactor * Refactor * Refactor * Add metadata to gift card update * Update messages ids * Refactor * Refactor * Refactor * Refactor * Update types after rebase * Fix types * Fixes after qa * Fix tests
218 lines
5.5 KiB
TypeScript
218 lines
5.5 KiB
TypeScript
import { MutationResult } from "react-apollo";
|
|
|
|
import { ConfirmButtonTransitionState } from "./components/ConfirmButton";
|
|
import { IFilter } from "./components/Filter";
|
|
import { MultiAutocompleteChoiceType } from "./components/MultiAutocompleteSelectField";
|
|
import { User_userPermissions } from "./fragments/types/User";
|
|
|
|
export interface UserError {
|
|
field: string | null;
|
|
message?: string;
|
|
}
|
|
|
|
export interface DialogProps {
|
|
open: boolean;
|
|
onClose: () => void;
|
|
}
|
|
|
|
export interface ListSettings<TColumn extends string = string> {
|
|
columns?: TColumn[];
|
|
rowNumber: number;
|
|
}
|
|
|
|
export enum ListViews {
|
|
APPS_LIST = "APPS_LIST",
|
|
ATTRIBUTE_LIST = "ATTRIBUTE_LIST",
|
|
ATTRIBUTE_VALUE_LIST = "ATTRIBUTE_VALUE_LIST",
|
|
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",
|
|
PAGE_TYPES_LIST = "PAGE_TYPES_LIST",
|
|
PLUGINS_LIST = "PLUGIN_LIST",
|
|
PRODUCT_LIST = "PRODUCT_LIST",
|
|
PERMISSION_GROUP_LIST = "PERMISSION_GROUP_LIST",
|
|
PRODUCT_TYPE_LIST = "PRODUCT_TYPE_LIST",
|
|
SALES_LIST = "SALES_LIST",
|
|
SHIPPING_METHODS_LIST = "SHIPPING_METHODS_LIST",
|
|
STAFF_MEMBERS_LIST = "STAFF_MEMBERS_LIST",
|
|
VOUCHER_LIST = "VOUCHER_LIST",
|
|
WAREHOUSE_LIST = "WAREHOUSE_LIST",
|
|
WEBHOOK_LIST = "WEBHOOK_LIST",
|
|
TRANSLATION_ATTRIBUTE_VALUE_LIST = "TRANSLATION_ATTRIBUTE_VALUE_LIST",
|
|
GIFT_CARD_LIST = " GIFT_CARD_LIST"
|
|
}
|
|
|
|
export interface ListProps<TColumns extends string = string> {
|
|
disabled: boolean;
|
|
pageInfo?: {
|
|
hasNextPage: boolean;
|
|
hasPreviousPage: boolean;
|
|
};
|
|
settings?: ListSettings<TColumns>;
|
|
onNextPage: () => void;
|
|
onPreviousPage: () => void;
|
|
onRowClick: (id: string) => () => void;
|
|
onUpdateListSettings?: <T extends keyof ListSettings<TColumns>>(
|
|
key: T,
|
|
value: ListSettings<TColumns>[T]
|
|
) => void;
|
|
onListSettingsReset?: () => void;
|
|
}
|
|
|
|
export interface SortPage<TSortKey extends string> {
|
|
sort: Sort<TSortKey>;
|
|
onSort: (field: TSortKey, id?: string) => void;
|
|
}
|
|
|
|
/**
|
|
* @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.
|
|
*/
|
|
|
|
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;
|
|
}
|
|
export interface PageListProps<TColumns extends string = string>
|
|
extends ListProps<TColumns> {
|
|
defaultSettings?: ListSettings<TColumns>;
|
|
onAdd: () => void;
|
|
}
|
|
|
|
export interface SearchProps {
|
|
onSearchChange: (value: string) => void;
|
|
}
|
|
export interface SearchPageProps extends SearchProps {
|
|
initialSearch: string;
|
|
}
|
|
export interface FilterPageProps<TKeys extends string, TOpts extends {}>
|
|
extends FilterProps<TKeys>,
|
|
SearchPageProps,
|
|
TabPageProps {
|
|
filterOpts: TOpts;
|
|
}
|
|
|
|
export interface FilterProps<TKeys extends string> {
|
|
currencySymbol?: string;
|
|
onFilterChange: (filter: IFilter<TKeys>) => void;
|
|
onFilterAttributeFocus?: (id?: string) => void;
|
|
}
|
|
|
|
export interface TabPageProps {
|
|
currentTab: number;
|
|
tabs: string[];
|
|
onAll: () => void;
|
|
onTabChange: (tab: number) => void;
|
|
onTabDelete: () => void;
|
|
onTabSave: () => void;
|
|
}
|
|
|
|
export interface ChannelProps {
|
|
selectedChannelId: string;
|
|
}
|
|
|
|
export interface PartialMutationProviderOutput<
|
|
TData extends {} = {},
|
|
TVariables extends {} = {}
|
|
> {
|
|
opts: MutationResult<TData> & MutationResultAdditionalProps;
|
|
mutate: (variables: TVariables) => void;
|
|
}
|
|
|
|
export interface Node {
|
|
id: string;
|
|
}
|
|
export interface SlugNode {
|
|
slug: string;
|
|
}
|
|
|
|
export interface TagNode {
|
|
tag: string;
|
|
}
|
|
|
|
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>
|
|
>;
|
|
export type FiltersWithMultipleValues<TFilters extends string> = Partial<
|
|
Record<TFilters, string[]>
|
|
>;
|
|
export type FiltersAsDictWithMultipleValues<TFilters extends string> = Partial<
|
|
Record<TFilters, Record<string, string[]>>
|
|
>;
|
|
export type Search = Partial<{
|
|
query: string;
|
|
}>;
|
|
export type SingleAction = Partial<{
|
|
id: string;
|
|
}>;
|
|
export type Sort<TSort extends string = string> = Partial<{
|
|
asc: boolean;
|
|
sort: TSort;
|
|
}>;
|
|
export type BulkAction = Partial<{
|
|
ids: string[];
|
|
}>;
|
|
|
|
export interface ReorderEvent {
|
|
oldIndex: number;
|
|
newIndex: number;
|
|
}
|
|
export type ReorderAction = (event: ReorderEvent) => void;
|
|
|
|
export interface FetchMoreProps {
|
|
loading: boolean;
|
|
hasMore: boolean;
|
|
totalCount?: number;
|
|
onFetchMore: () => void;
|
|
}
|
|
|
|
export type TabActionDialog = "save-search" | "delete-search";
|
|
|
|
export interface UserPermissionProps {
|
|
userPermissions: User_userPermissions[];
|
|
}
|
|
|
|
export interface MutationResultAdditionalProps {
|
|
status: ConfirmButtonTransitionState;
|
|
}
|
|
|
|
export type MinMax = Record<"min" | "max", string>;
|
|
|
|
export interface FilterOpts<T> {
|
|
active: boolean;
|
|
value: T;
|
|
}
|
|
|
|
export interface AutocompleteFilterOpts
|
|
extends FetchMoreProps,
|
|
SearchPageProps {
|
|
choices: MultiAutocompleteChoiceType[];
|
|
displayValues: MultiAutocompleteChoiceType[];
|
|
}
|
|
|
|
export type Ids = string[];
|