
* Update changelog with file attributes * Add file type attribute * Update attribute properties form * Update translation messages with file upload * Create generic attributes component (#832) * Create generic Attributes component * Add story for Attributes component * Remove deprecated attribute value type field from queries * Update test snapshots of attributes component * Add file upload field to atributes (#888) * Add story for Attributes component * Update test snapshots of attributes component * Create file upload field in attributes * Update upload file input data-test * Update storybook test snapshots of attributes * Add dedicated input props to file field * Run Cypress using custom API * Add missing error handling in file upload field Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com> * Add file attribute upload to page attributes (#894) * Support upload file attribute for pages * Update after review * Add file attribute upload to variant attributes (#892) * Support upload file attribute for variants * Update after review * Refactor attribute values errors merging * Update after review * Add file attribute upload to product attributes (#826) * Support upload file attribute for products * Update after review * Refactor attribute values errors merging * Refactor product attribute value delete handling * Fix deleting file in file upload field * Fix delete attribute values errors handling * Add link to file upload field (#898) * Update file attributes updates (#899) * Update file attributes updates * Refactor file uploads handling * Move attributes utils to attributes directory * Fix product channel listing updates * Clear file field value if file is not passed as prop * Delete attribute values before update (#908) * Delete file attributes after file update * Triggr CI * Show skeleton in file upload field during loading Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
103 lines
2.4 KiB
TypeScript
103 lines
2.4 KiB
TypeScript
import {
|
|
pageErrorFragment,
|
|
pageErrorWithAttributesFragment
|
|
} from "@saleor/fragments/errors";
|
|
import { pageDetailsFragment } from "@saleor/fragments/pages";
|
|
import makeMutation from "@saleor/hooks/makeMutation";
|
|
import gql from "graphql-tag";
|
|
|
|
import { TypedMutation } from "../mutations";
|
|
import {
|
|
PageBulkPublish,
|
|
PageBulkPublishVariables
|
|
} from "./types/PageBulkPublish";
|
|
import {
|
|
PageBulkRemove,
|
|
PageBulkRemoveVariables
|
|
} from "./types/PageBulkRemove";
|
|
import { PageCreate, PageCreateVariables } from "./types/PageCreate";
|
|
import { PageRemove, PageRemoveVariables } from "./types/PageRemove";
|
|
import { PageUpdate, PageUpdateVariables } from "./types/PageUpdate";
|
|
|
|
const pageCreate = gql`
|
|
${pageDetailsFragment}
|
|
${pageErrorWithAttributesFragment}
|
|
mutation PageCreate($input: PageCreateInput!) {
|
|
pageCreate(input: $input) {
|
|
errors: pageErrors {
|
|
...PageErrorWithAttributesFragment
|
|
message
|
|
}
|
|
page {
|
|
...PageDetailsFragment
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
export const TypedPageCreate = TypedMutation<PageCreate, PageCreateVariables>(
|
|
pageCreate
|
|
);
|
|
|
|
const pageUpdate = gql`
|
|
${pageDetailsFragment}
|
|
${pageErrorWithAttributesFragment}
|
|
mutation PageUpdate($id: ID!, $input: PageInput!) {
|
|
pageUpdate(id: $id, input: $input) {
|
|
errors: pageErrors {
|
|
...PageErrorWithAttributesFragment
|
|
}
|
|
page {
|
|
...PageDetailsFragment
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
export const usePageUpdateMutation = makeMutation<
|
|
PageUpdate,
|
|
PageUpdateVariables
|
|
>(pageUpdate);
|
|
|
|
const pageRemove = gql`
|
|
${pageErrorFragment}
|
|
mutation PageRemove($id: ID!) {
|
|
pageDelete(id: $id) {
|
|
errors: pageErrors {
|
|
...PageErrorFragment
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
export const usePageRemoveMutation = makeMutation<
|
|
PageRemove,
|
|
PageRemoveVariables
|
|
>(pageRemove);
|
|
|
|
const pageBulkPublish = gql`
|
|
mutation PageBulkPublish($ids: [ID]!, $isPublished: Boolean!) {
|
|
pageBulkPublish(ids: $ids, isPublished: $isPublished) {
|
|
errors {
|
|
field
|
|
message
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
export const TypedPageBulkPublish = TypedMutation<
|
|
PageBulkPublish,
|
|
PageBulkPublishVariables
|
|
>(pageBulkPublish);
|
|
|
|
const pageBulkRemove = gql`
|
|
mutation PageBulkRemove($ids: [ID]!) {
|
|
pageBulkDelete(ids: $ids) {
|
|
errors {
|
|
field
|
|
message
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
export const TypedPageBulkRemove = TypedMutation<
|
|
PageBulkRemove,
|
|
PageBulkRemoveVariables
|
|
>(pageBulkRemove);
|