diff --git a/cypress/elements/channels/add-channel-form-selectors.js b/cypress/elements/channels/add-channel-form-selectors.js index a37ce37c1..dce16fe3c 100644 --- a/cypress/elements/channels/add-channel-form-selectors.js +++ b/cypress/elements/channels/add-channel-form-selectors.js @@ -9,7 +9,10 @@ export const ADD_CHANNEL_FORM_SELECTORS = { slugValidationMessage: "[data-test-id='slug-text-input-helper-text']", currencyAutocompleteDropdown: "[data-test-id='single-autocomplete-select-option'][data-test-type='custom']", - addShippingZoneButton: '[data-test-id="add-shipping-zone-button"]', + addShippingZoneButton: '[data-test-id="shipping-add-button"]', + addWarehouseButton: '[data-test-id="warehouse-add-button"]', shippingAutocompleteSelect: "[data-test-id='shipping-auto-complete-select']", - countryAutocompleteInput: '[data-test-id="country-select-input"]' + warehouseAutocompleteSelect: + "[data-test-id='warehouse-auto-complete-select']", + countryAutocompleteInput: '[data-test-id="country-select-input"]', }; diff --git a/introspection.json b/introspection.json index d685bfc22..07a5bc03c 100644 --- a/introspection.json +++ b/introspection.json @@ -2805,7 +2805,7 @@ }, { "name": "dataPrivacyUrl", - "description": "Url to details about the privacy policy on the app owner page.", + "description": "URL to details about the privacy policy on the app owner page.", "args": [], "type": { "kind": "SCALAR", @@ -2841,7 +2841,7 @@ }, { "name": "configurationUrl", - "description": "Url to iframe with the configuration for the app.", + "description": "URL to iframe with the configuration for the app.", "args": [], "type": { "kind": "SCALAR", @@ -2853,7 +2853,7 @@ }, { "name": "appUrl", - "description": "Url to iframe with the app.", + "description": "URL to iframe with the app.", "args": [], "type": { "kind": "SCALAR", @@ -2865,7 +2865,7 @@ }, { "name": "manifestUrl", - "description": "Url to manifest used during app's installation.\n\nAdded in Saleor 3.5.", + "description": "URL to manifest used during app's installation.\n\nAdded in Saleor 3.5.", "args": [], "type": { "kind": "SCALAR", @@ -8674,6 +8674,83 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "AttributeValueCreated", + "description": null, + "fields": [ + { + "name": "issuedAt", + "description": "Time of the event.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "Saleor version that triggered the event.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issuingPrincipal", + "description": "The user or application that triggered the event.", + "args": [], + "type": { + "kind": "UNION", + "name": "IssuingPrincipal", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "recipient", + "description": "The application receiving the webhook.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "App", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "attributeValue", + "description": "The attribute value the event relates to.\n\nAdded in Saleor 3.5.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "AttributeValue", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Event", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "AttributeValueDelete", @@ -8757,6 +8834,83 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "AttributeValueDeleted", + "description": null, + "fields": [ + { + "name": "issuedAt", + "description": "Time of the event.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "Saleor version that triggered the event.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issuingPrincipal", + "description": "The user or application that triggered the event.", + "args": [], + "type": { + "kind": "UNION", + "name": "IssuingPrincipal", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "recipient", + "description": "The application receiving the webhook.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "App", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "attributeValue", + "description": "The attribute value the event relates to.\n\nAdded in Saleor 3.5.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "AttributeValue", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Event", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "AttributeValueFilterInput", @@ -9434,6 +9588,83 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "AttributeValueUpdated", + "description": null, + "fields": [ + { + "name": "issuedAt", + "description": "Time of the event.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "version", + "description": "Saleor version that triggered the event.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issuingPrincipal", + "description": "The user or application that triggered the event.", + "args": [], + "type": { + "kind": "UNION", + "name": "IssuingPrincipal", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "recipient", + "description": "The application receiving the webhook.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "App", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "attributeValue", + "description": "The attribute value the event relates to.\n\nAdded in Saleor 3.5.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "AttributeValue", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Event", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "BulkAttributeValueInput", @@ -11737,6 +11968,30 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "warehouses", + "description": "List of warehouses assigned to this channel.\n\nAdded in Saleor 3.5.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Warehouse", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -11910,6 +12165,46 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "addShippingZones", + "description": "List of shipping zones to assign to the channel.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "addWarehouses", + "description": "List of warehouses to assign to the channel.\n\nAdded in Saleor 3.5.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "name", "description": "Name of the channel.", @@ -11960,7 +12255,7 @@ }, { "name": "defaultCountry", - "description": "Default country for the channel. Default country can be used in checkout to determine the stock quantities or calculate taxes when the country was not explicitly provided.\n\nAdded in Saleor 3.1.", + "description": "Default country for the channel. Default country can be used in checkout to determine the stock quantities or calculate taxes when the country was not explicitly provided.\n\nAdded in Saleor 3.1.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", "type": { "kind": "NON_NULL", "name": null, @@ -11973,26 +12268,6 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null - }, - { - "name": "addShippingZones", - "description": "List of shipping zones to assign to the channel.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null } ], "interfaces": null, @@ -12386,6 +12661,26 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "warehouses", + "description": "List of warehouses IDs which causes the error.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -12624,6 +12919,46 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "addShippingZones", + "description": "List of shipping zones to assign to the channel.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "addWarehouses", + "description": "List of warehouses to assign to the channel.\n\nAdded in Saleor 3.5.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "name", "description": "Name of the channel.", @@ -12661,8 +12996,8 @@ "deprecationReason": null }, { - "name": "addShippingZones", - "description": "List of shipping zones to assign to the channel.", + "name": "removeShippingZones", + "description": "List of shipping zones to unassign from the channel.", "type": { "kind": "LIST", "name": null, @@ -12681,8 +13016,8 @@ "deprecationReason": null }, { - "name": "removeShippingZones", - "description": "List of shipping zones to unassign from the channel.", + "name": "removeWarehouses", + "description": "List of warehouses to unassign from the channel.\n\nAdded in Saleor 3.5.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", "type": { "kind": "LIST", "name": null, @@ -14781,6 +15116,178 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "privateMetadata", + "description": "List of private metadata items. Requires staff permissions to access.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MetadataItem", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "privateMetafield", + "description": "A single key from private metadata. Requires staff permissions to access.\n\nTip: Use GraphQL aliases to fetch multiple keys.\n\nAdded in Saleor 3.3.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [ + { + "name": "key", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "privateMetafields", + "description": "Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.\n\nAdded in Saleor 3.3.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [ + { + "name": "keys", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Metadata", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "metadata", + "description": "List of public metadata items. Can be accessed without permissions.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MetadataItem", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "metafield", + "description": "A single key from public metadata.\n\nTip: Use GraphQL aliases to fetch multiple keys.\n\nAdded in Saleor 3.3.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [ + { + "name": "key", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "metafields", + "description": "Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.\n\nAdded in Saleor 3.3.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [ + { + "name": "keys", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Metadata", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "variant", "description": null, @@ -14900,6 +15407,11 @@ "kind": "INTERFACE", "name": "Node", "ofType": null + }, + { + "kind": "INTERFACE", + "name": "ObjectWithMetadata", + "ofType": null } ], "enumValues": null, @@ -24026,6 +24538,21 @@ "name": "AttributeUpdated", "ofType": null }, + { + "kind": "OBJECT", + "name": "AttributeValueCreated", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "AttributeValueDeleted", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "AttributeValueUpdated", + "ofType": null + }, { "kind": "OBJECT", "name": "CategoryCreated", @@ -37877,7 +38404,7 @@ }, { "name": "configurationUrl", - "description": "Url to iframe with the configuration for the app.", + "description": "URL to iframe with the configuration for the app.", "args": [], "type": { "kind": "SCALAR", @@ -53751,6 +54278,11 @@ "name": "Checkout", "ofType": null }, + { + "kind": "OBJECT", + "name": "CheckoutLine", + "ofType": null + }, { "kind": "OBJECT", "name": "Collection", @@ -53791,6 +54323,11 @@ "name": "Order", "ofType": null }, + { + "kind": "OBJECT", + "name": "OrderLine", + "ofType": null + }, { "kind": "OBJECT", "name": "Page", @@ -58579,6 +59116,178 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "privateMetadata", + "description": "List of private metadata items. Requires staff permissions to access.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MetadataItem", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "privateMetafield", + "description": "A single key from private metadata. Requires staff permissions to access.\n\nTip: Use GraphQL aliases to fetch multiple keys.\n\nAdded in Saleor 3.3.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [ + { + "name": "key", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "privateMetafields", + "description": "Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.\n\nAdded in Saleor 3.3.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [ + { + "name": "keys", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Metadata", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "metadata", + "description": "List of public metadata items. Can be accessed without permissions.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MetadataItem", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "metafield", + "description": "A single key from public metadata.\n\nTip: Use GraphQL aliases to fetch multiple keys.\n\nAdded in Saleor 3.3.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [ + { + "name": "key", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "metafields", + "description": "Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.\n\nAdded in Saleor 3.3.\n\nNote: this API is currently in Feature Preview and can be subject to changes at later point.", + "args": [ + { + "name": "keys", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Metadata", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "productName", "description": null, @@ -58927,6 +59636,11 @@ "kind": "INTERFACE", "name": "Node", "ofType": null + }, + { + "kind": "INTERFACE", + "name": "ObjectWithMetadata", + "ofType": null } ], "enumValues": null, @@ -99627,6 +100341,26 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "channels", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null } ], "interfaces": null, @@ -100924,6 +101658,24 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "ATTRIBUTE_VALUE_CREATED", + "description": "A new attribute value is created.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ATTRIBUTE_VALUE_UPDATED", + "description": "An attribute value is updated.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ATTRIBUTE_VALUE_DELETED", + "description": "An attribute value is deleted.", + "isDeprecated": false, + "deprecationReason": null + }, { "name": "CATEGORY_CREATED", "description": "A new category created.", @@ -101128,6 +101880,12 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "CUSTOMER_DELETED", + "description": "A customer account is deleted.", + "isDeprecated": false, + "deprecationReason": null + }, { "name": "COLLECTION_CREATED", "description": "A new collection is created.", @@ -101451,6 +102209,24 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "ATTRIBUTE_VALUE_CREATED", + "description": "A new attribute value is created.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ATTRIBUTE_VALUE_UPDATED", + "description": "An attribute value is updated.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ATTRIBUTE_VALUE_DELETED", + "description": "An attribute value is deleted.", + "isDeprecated": false, + "deprecationReason": null + }, { "name": "CATEGORY_CREATED", "description": "A new category created.", @@ -101655,6 +102431,12 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "CUSTOMER_DELETED", + "description": "A customer account is deleted.", + "isDeprecated": false, + "deprecationReason": null + }, { "name": "COLLECTION_CREATED", "description": "A new collection is created.", @@ -102103,6 +102885,24 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "ATTRIBUTE_VALUE_CREATED", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ATTRIBUTE_VALUE_UPDATED", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ATTRIBUTE_VALUE_DELETED", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "CATEGORY_CREATED", "description": null, @@ -102307,6 +103107,12 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "CUSTOMER_DELETED", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "COLLECTION_CREATED", "description": null, diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index 92c2a31a8..0f05f1c7a 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -27,10 +27,6 @@ "context": "order shipping method name", "string": "Shipping" }, - "+G9l7u": { - "context": "all selected zones card message", - "string": "All available shipping zones have been selected" - }, "+HuipK": { "context": "variant sku", "string": "SKU {sku}" @@ -170,6 +166,10 @@ "context": "dialog header", "string": "Add Tracking Code" }, + "/C//FB": { + "context": "header, allocated product quantity", + "string": "Allocated" + }, "/JENWS": { "string": "Reduced Tax Rates" }, @@ -224,6 +224,10 @@ "/glQgs": { "string": "No channels found" }, + "/iijFq": { + "context": "input label", + "string": "Global threshold" + }, "/kWzY1": { "string": "Are you sure you want to delete this address from users address book?" }, @@ -601,9 +605,6 @@ "context": "payment status", "string": "Fully paid" }, - "2qJc9y": { - "string": "CANCEL END DATE" - }, "2r4cTE": { "context": "button", "string": "Enable Dark Mode" @@ -1126,9 +1127,6 @@ "context": "attribute value deleted", "string": "Value deleted" }, - "7Ii5ZQ": { - "string": "SETUP END DATE" - }, "7JAAul": { "context": "product field", "string": "Export Product Weight" @@ -1206,10 +1204,6 @@ "context": "info text", "string": "This rate will apply to all orders" }, - "7wkGxW": { - "context": "app has been installed", - "string": "{unitsLeft} units left" - }, "7yKZvp": { "context": "section header", "string": "User Status" @@ -1226,10 +1220,6 @@ "context": "navigator placeholder", "string": "Order Number" }, - "8CbACQ": { - "context": "add shipping zone title", - "string": "Add Shipping Zones" - }, "8EGagh": { "context": "search box label", "string": "Filter Countries" @@ -1331,6 +1321,10 @@ "context": "option", "string": "Create single variant" }, + "9IWg/f": { + "context": "button", + "string": "SETUP END DATE" + }, "9OtpHt": { "string": "Order line deleted" }, @@ -1462,10 +1456,6 @@ "context": "order refund subtitle", "string": "Refunded items can't be fulfilled" }, - "ANRRpG": { - "context": "card title", - "string": "Shipping Zones" - }, "AOI4LW": { "context": "navigator placeholder", "string": "Search in Catalog" @@ -1710,10 +1700,6 @@ "context": "dialog content", "string": "{counter,plural,one{Are you sure you want to delete this shipping zone?} other{Are you sure you want to delete {displayQuantity} shipping zones?}}" }, - "CEavJt": { - "context": "section header", - "string": "Unlimited" - }, "CG+awx": { "context": "dialog content", "string": "Which address would you like to use as shipping address for selected customer:" @@ -2033,6 +2019,10 @@ "ErNH3D": { "string": "Define where this attribute should be used in Saleor system" }, + "ErvPaM": { + "context": "header", + "string": "Warehouse Name" + }, "EsZH44": { "context": "VariantDetailsChannelsAvailabilityCard item subtitle hidden", "string": "Hidden" @@ -2041,6 +2031,10 @@ "context": "header", "string": "{pluginName} Details" }, + "EuOXmr": { + "context": "add items title", + "string": "Add {itemsName}" + }, "Ev6SEF": { "string": "New Password" }, @@ -2428,6 +2422,10 @@ "context": "number of variants", "string": "Variants ({quantity})" }, + "HYC6cH": { + "context": "input description", + "string": "Threshold that cannot be exceeded even if per channel thresholds are still available" + }, "HYHLsB": { "context": "product field", "string": "Export Variant ID" @@ -2585,6 +2583,10 @@ "context": "header", "string": "Edit Media" }, + "ImTelT": { + "context": "card subtitle", + "string": "Select warehouses that will be used in this channel. You can assign warehouses to multiple channels." + }, "IoCMjg": { "context": "no collections", "string": "No collections found" @@ -2748,6 +2750,10 @@ "context": "section header", "string": "Organize Product" }, + "JkO0jp": { + "context": "input description", + "string": "{unitsLeft} units left" + }, "JnzDrI": { "context": "discount type", "string": "Fixed Amount" @@ -2779,10 +2785,6 @@ "context": "select product informations to be exported", "string": "Information exported:" }, - "JyQEHU": { - "context": "tabel column header", - "string": "Channels" - }, "JyQoES": { "context": "delete attribute value", "string": "Are you sure you want to delete \"{name}\" value?" @@ -2847,10 +2849,6 @@ "context": "product available for purchase date", "string": "will become available on {date}" }, - "KTAg0f": { - "context": "tabel column header", - "string": "Warehouse Name" - }, "KXkdMH": { "context": "order discount removed title", "string": "Order discount was removed by" @@ -3202,9 +3200,6 @@ "context": "gift card bulk create success dialog content", "string": "We have issued all of your requested gift cards. You can download the list of new gift cards using the button below." }, - "NcY4ph": { - "string": "Threshold that cannot be exceeded even if per channel thresholds are still available" - }, "Nfh9QM": { "context": "checkbox gift cards label description", "string": "when activated non-shippable gift cards will be automatically set as fulfilled and sent to customer" @@ -3699,9 +3694,6 @@ "context": "use attribute in filtering", "string": "Use in Filtering" }, - "RJ5QxE": { - "string": "Global threshold" - }, "RLBLPQ": { "context": "no warehouses info", "string": "There are no warehouses set up for your store. To add stock quantity to the product please configure a warehouse" @@ -3833,6 +3825,10 @@ "SKFr04": { "string": "Attribute not found." }, + "SM+yG0": { + "context": "input label", + "string": "SKU (Stock Keeping Unit)" + }, "SMakqb": { "context": "customer contact section, header", "string": "Contact Information" @@ -4208,6 +4204,10 @@ "context": "dialog header", "string": "Edit Shipping Method" }, + "V1MytH": { + "context": "shipping zones section name", + "string": "Shipping Zones" + }, "V1mqpZ": { "context": "button", "string": "Create Permission Group" @@ -4466,6 +4466,10 @@ "context": "gift card bulk create success dialog title", "string": "Bulk Issue Gift Cards" }, + "Wyl25+": { + "context": "product inventory, checkbox description", + "string": "Active inventory tracking will automatically calculate changes of stock" + }, "WzA5Ll": { "string": "Cannot remove user from last group" }, @@ -5395,9 +5399,6 @@ "context": "button", "string": "Choose file" }, - "ekXood": { - "string": "Unlimited" - }, "erC44f": { "context": "filters error messages dependencies missing", "string": "Filter requires other filters: {dependencies}" @@ -5550,10 +5551,6 @@ "g/BrOt": { "string": "Url has invalid format" }, - "g/FRtd": { - "context": "table column header, allocated product quantity", - "string": "Allocated" - }, "g1WQlC": { "context": "page title", "string": "Summary" @@ -5612,10 +5609,6 @@ "context": "plugin filters error messages channels", "string": "No channels selected" }, - "ge/xFX": { - "context": "table column header", - "string": "Quantity" - }, "ghGLbJ": { "context": "OrderPayment click&collect shipping method", "string": "click&collect" @@ -5643,10 +5636,6 @@ "context": "page header", "string": "Create Page" }, - "gtKcPf": { - "context": "title", - "string": "{zonesCount} / {totalCount} shipping zones" - }, "gvOzOl": { "string": "Page Title" }, @@ -5890,9 +5879,6 @@ "context": "attribute values", "string": "Values" }, - "jABdx1": { - "string": "Active inventory tracking will automatically calculate changes of stock" - }, "jBu2yj": { "context": "acre-inch unit", "string": "acre-inch" @@ -7174,10 +7160,18 @@ "context": "Header row stock label", "string": "Stock" }, + "taS/08": { + "context": "variant stocks section subtitle", + "string": "Assign this variant to a channel in the product channel manager to define warehouses allocation" + }, "taX/V3": { "context": "order total amount", "string": "Total" }, + "tlGXkh": { + "context": "input description", + "string": "Unlimited" + }, "toDL5R": { "context": "order status", "string": "Draft" @@ -7247,6 +7241,10 @@ "context": "app has been removed", "string": "App successfully removed" }, + "uKlrEk": { + "context": "all selected items message", + "string": "All available {itemsName} have been selected" + }, "uMpv1v": { "string": "Fulfillment successfully cancelled" }, @@ -7364,6 +7362,10 @@ "v3WWK+": { "string": "Status is invalid" }, + "v9ILn/": { + "context": "button", + "string": "CANCEL END DATE" + }, "vC8vyb": { "context": "enabled status option label", "string": "Enabled" @@ -7628,9 +7630,6 @@ "context": "dialog header", "string": "Assign Variant" }, - "xB7BTp": { - "string": "SKU (Stock Keeping Unit)" - }, "xHj9Qe": { "context": "gift card settings header", "string": "Gift Cards Settings" diff --git a/schema.graphql b/schema.graphql index 198dd6404..e36633610 100644 --- a/schema.graphql +++ b/schema.graphql @@ -493,7 +493,7 @@ type App implements Node & ObjectWithMetadata { """Description of the data privacy defined for this app.""" dataPrivacy: String @deprecated(reason: "This field will be removed in Saleor 4.0. Use `dataPrivacyUrl` instead.") - """Url to details about the privacy policy on the app owner page.""" + """URL to details about the privacy policy on the app owner page.""" dataPrivacyUrl: String """Homepage of the app.""" @@ -502,14 +502,14 @@ type App implements Node & ObjectWithMetadata { """Support page for the app.""" supportUrl: String - """Url to iframe with the configuration for the app.""" + """URL to iframe with the configuration for the app.""" configurationUrl: String @deprecated(reason: "This field will be removed in Saleor 4.0. Use `appUrl` instead.") - """Url to iframe with the app.""" + """URL to iframe with the app.""" appUrl: String """ - Url to manifest used during app's installation. + URL to manifest used during app's installation. Added in Saleor 3.5. """ @@ -1711,6 +1711,29 @@ input AttributeValueCreateInput { name: String! } +type AttributeValueCreated implements Event { + """Time of the event.""" + issuedAt: DateTime + + """Saleor version that triggered the event.""" + version: String + + """The user or application that triggered the event.""" + issuingPrincipal: IssuingPrincipal + + """The application receiving the webhook.""" + recipient: App + + """ + The attribute value the event relates to. + + Added in Saleor 3.5. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + attributeValue: AttributeValue +} + """ Deletes a value of an attribute. @@ -1724,6 +1747,29 @@ type AttributeValueDelete { attributeValue: AttributeValue } +type AttributeValueDeleted implements Event { + """Time of the event.""" + issuedAt: DateTime + + """Saleor version that triggered the event.""" + version: String + + """The user or application that triggered the event.""" + issuingPrincipal: IssuingPrincipal + + """The application receiving the webhook.""" + recipient: App + + """ + The attribute value the event relates to. + + Added in Saleor 3.5. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + attributeValue: AttributeValue +} + input AttributeValueFilterInput { search: String ids: [ID!] @@ -1871,6 +1917,29 @@ input AttributeValueUpdateInput { name: String } +type AttributeValueUpdated implements Event { + """Time of the event.""" + issuedAt: DateTime + + """Saleor version that triggered the event.""" + version: String + + """The user or application that triggered the event.""" + issuingPrincipal: IssuingPrincipal + + """The application receiving the webhook.""" + recipient: App + + """ + The attribute value the event relates to. + + Added in Saleor 3.5. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + attributeValue: AttributeValue +} + input BulkAttributeValueInput { """ID of the selected attribute.""" id: ID @@ -2373,6 +2442,15 @@ type Channel implements Node { Added in Saleor 3.1. """ defaultCountry: CountryDisplay! + + """ + List of warehouses assigned to this channel. + + Added in Saleor 3.5. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + warehouses: [Warehouse!]! } """ @@ -2402,6 +2480,18 @@ input ChannelCreateInput { """isActive flag.""" isActive: Boolean + """List of shipping zones to assign to the channel.""" + addShippingZones: [ID!] + + """ + List of warehouses to assign to the channel. + + Added in Saleor 3.5. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + addWarehouses: [ID!] + """Name of the channel.""" name: String! @@ -2415,11 +2505,10 @@ input ChannelCreateInput { Default country for the channel. Default country can be used in checkout to determine the stock quantities or calculate taxes when the country was not explicitly provided. Added in Saleor 3.1. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. """ defaultCountry: CountryCode! - - """List of shipping zones to assign to the channel.""" - addShippingZones: [ID!] } type ChannelCreated implements Event { @@ -2510,6 +2599,9 @@ type ChannelError { """List of shipping zone IDs which causes the error.""" shippingZones: [ID!] + + """List of warehouses IDs which causes the error.""" + warehouses: [ID!] } """An enumeration.""" @@ -2563,6 +2655,18 @@ input ChannelUpdateInput { """isActive flag.""" isActive: Boolean + """List of shipping zones to assign to the channel.""" + addShippingZones: [ID!] + + """ + List of warehouses to assign to the channel. + + Added in Saleor 3.5. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + addWarehouses: [ID!] + """Name of the channel.""" name: String @@ -2576,11 +2680,17 @@ input ChannelUpdateInput { """ defaultCountry: CountryCode - """List of shipping zones to assign to the channel.""" - addShippingZones: [ID!] - """List of shipping zones to unassign from the channel.""" removeShippingZones: [ID!] + + """ + List of warehouses to unassign from the channel. + + Added in Saleor 3.5. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + removeWarehouses: [ID!] } type ChannelUpdated implements Event { @@ -2972,8 +3082,54 @@ type CheckoutLanguageCodeUpdate { } """Represents an item in the checkout.""" -type CheckoutLine implements Node { +type CheckoutLine implements Node & ObjectWithMetadata { id: ID! + + """List of private metadata items. Requires staff permissions to access.""" + privateMetadata: [MetadataItem!]! + + """ + A single key from private metadata. Requires staff permissions to access. + + Tip: Use GraphQL aliases to fetch multiple keys. + + Added in Saleor 3.3. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + privateMetafield(key: String!): String + + """ + Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything. + + Added in Saleor 3.3. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + privateMetafields(keys: [String!]): Metadata + + """List of public metadata items. Can be accessed without permissions.""" + metadata: [MetadataItem!]! + + """ + A single key from public metadata. + + Tip: Use GraphQL aliases to fetch multiple keys. + + Added in Saleor 3.3. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + metafield(key: String!): String + + """ + Public metadata. Use `keys` to control which fields you want to include. The default is to include everything. + + Added in Saleor 3.3. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + metafields(keys: [String!]): Metadata variant: ProductVariant! quantity: Int! @@ -7520,7 +7676,7 @@ type Manifest { permissions: [Permission!] appUrl: String - """Url to iframe with the configuration for the app.""" + """URL to iframe with the configuration for the app.""" configurationUrl: String @deprecated(reason: "This field will be removed in Saleor 4.0. Use `appUrl` instead.") tokenTargetUrl: String @@ -12818,8 +12974,54 @@ type OrderFullyPaid implements Event { } """Represents order line of particular order.""" -type OrderLine implements Node { +type OrderLine implements Node & ObjectWithMetadata { id: ID! + + """List of private metadata items. Requires staff permissions to access.""" + privateMetadata: [MetadataItem!]! + + """ + A single key from private metadata. Requires staff permissions to access. + + Tip: Use GraphQL aliases to fetch multiple keys. + + Added in Saleor 3.3. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + privateMetafield(key: String!): String + + """ + Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything. + + Added in Saleor 3.3. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + privateMetafields(keys: [String!]): Metadata + + """List of public metadata items. Can be accessed without permissions.""" + metadata: [MetadataItem!]! + + """ + A single key from public metadata. + + Tip: Use GraphQL aliases to fetch multiple keys. + + Added in Saleor 3.3. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + metafield(key: String!): String + + """ + Public metadata. Use `keys` to control which fields you want to include. The default is to include everything. + + Added in Saleor 3.3. + + Note: this API is currently in Feature Preview and can be subject to changes at later point. + """ + metafields(keys: [String!]): Metadata productName: String! variantName: String! productSku: String @@ -21946,6 +22148,7 @@ input WarehouseFilterInput { search: String ids: [ID!] isPrivate: Boolean + channels: [ID!] } """ @@ -22247,6 +22450,15 @@ enum WebhookEventTypeAsyncEnum { """An attribute is deleted.""" ATTRIBUTE_DELETED + """A new attribute value is created.""" + ATTRIBUTE_VALUE_CREATED + + """An attribute value is updated.""" + ATTRIBUTE_VALUE_UPDATED + + """An attribute value is deleted.""" + ATTRIBUTE_VALUE_DELETED + """A new category created.""" CATEGORY_CREATED @@ -22341,6 +22553,9 @@ enum WebhookEventTypeAsyncEnum { """A customer account is updated.""" CUSTOMER_UPDATED + """A customer account is deleted.""" + CUSTOMER_DELETED + """A new collection is created.""" COLLECTION_CREATED @@ -22488,6 +22703,15 @@ enum WebhookEventTypeEnum { """An attribute is deleted.""" ATTRIBUTE_DELETED + """A new attribute value is created.""" + ATTRIBUTE_VALUE_CREATED + + """An attribute value is updated.""" + ATTRIBUTE_VALUE_UPDATED + + """An attribute value is deleted.""" + ATTRIBUTE_VALUE_DELETED + """A new category created.""" CATEGORY_CREATED @@ -22582,6 +22806,9 @@ enum WebhookEventTypeEnum { """A customer account is updated.""" CUSTOMER_UPDATED + """A customer account is deleted.""" + CUSTOMER_DELETED + """A new collection is created.""" COLLECTION_CREATED @@ -22730,6 +22957,9 @@ enum WebhookSampleEventTypeEnum { ATTRIBUTE_CREATED ATTRIBUTE_UPDATED ATTRIBUTE_DELETED + ATTRIBUTE_VALUE_CREATED + ATTRIBUTE_VALUE_UPDATED + ATTRIBUTE_VALUE_DELETED CATEGORY_CREATED CATEGORY_UPDATED CATEGORY_DELETED @@ -22764,6 +22994,7 @@ enum WebhookSampleEventTypeEnum { INVOICE_SENT CUSTOMER_CREATED CUSTOMER_UPDATED + CUSTOMER_DELETED COLLECTION_CREATED COLLECTION_UPDATED COLLECTION_DELETED diff --git a/src/channels/components/AssignmentList/AssignmentList.tsx b/src/channels/components/AssignmentList/AssignmentList.tsx new file mode 100644 index 000000000..37364cbb3 --- /dev/null +++ b/src/channels/components/AssignmentList/AssignmentList.tsx @@ -0,0 +1,60 @@ +import { Accordion, Divider, Typography } from "@material-ui/core"; +import React from "react"; +import { defineMessages, useIntl } from "react-intl"; + +import AssignmentListFooter from "./AssignmentListFooter"; +import AssignmentListHeader from "./AssignmentListHeader"; +import Item from "./Item"; +import { useExpanderStyles, useStyles } from "./styles"; +import { AssignmentListProps } from "./types"; + +const messages = defineMessages({ + allSelectedMessage: { + id: "uKlrEk", + defaultMessage: "All available {itemsName} have been selected", + description: "all selected items message", + }, +}); + +const AssignmentList: React.FC = props => { + const { + items, + itemsName, + fetchMoreItems: { totalCount }, + removeItem, + } = props; + + const intl = useIntl(); + const classes = useStyles(); + const expanderClasses = useExpanderStyles(); + + const hasMoreItemsToBeSelected = totalCount !== items.length; + + return ( + + + + {items.map(item => ( + + ))} + {hasMoreItemsToBeSelected ? ( + + ) : ( + + {intl.formatMessage(messages.allSelectedMessage, { + itemsName: itemsName.toLowerCase(), + })} + + )} + + ); +}; +export default AssignmentList; diff --git a/src/channels/components/ShippingZonesCard/ShippingZonesCardListFooter.tsx b/src/channels/components/AssignmentList/AssignmentListFooter.tsx similarity index 51% rename from src/channels/components/ShippingZonesCard/ShippingZonesCardListFooter.tsx rename to src/channels/components/AssignmentList/AssignmentListFooter.tsx index 97c67a46a..c32634a1c 100644 --- a/src/channels/components/ShippingZonesCard/ShippingZonesCardListFooter.tsx +++ b/src/channels/components/AssignmentList/AssignmentListFooter.tsx @@ -1,82 +1,87 @@ import { ClickAwayListener } from "@material-ui/core"; -import { ChannelShippingZones } from "@saleor/channels/pages/ChannelDetailsPage/types"; import SingleAutocompleteSelectField from "@saleor/components/SingleAutocompleteSelectField"; import CardAddItemsFooter from "@saleor/products/components/ProductStocks/CardAddItemsFooter"; import { mapNodeToChoice } from "@saleor/utils/maps"; import React, { useEffect, useRef, useState } from "react"; -import { defineMessages } from "react-intl"; +import { defineMessages, useIntl } from "react-intl"; -import useStyles from "./styles"; -import { ShippingZonesProps } from "./types"; +import { useStyles } from "./styles"; +import { AssignItem, AssignmentListProps } from "./types"; const messages = defineMessages({ - addZoneTitle: { - id: "8CbACQ", - defaultMessage: "Add Shipping Zones", - description: "add shipping zone title", + addItemTitle: { + id: "EuOXmr", + defaultMessage: "Add {itemsName}", + description: "add items title", }, }); -type ShippingZonesCardListFooterProps = ShippingZonesProps; +type AssignmentListFooterProps = AssignmentListProps; -const ShippingZonesCardListFooter: React.FC = ({ - shippingZonesChoices, - searchShippingZones, - fetchMoreShippingZones, - addShippingZone, - shippingZones, +const AssignmentListFooter: React.FC = ({ + items, + itemsChoices, + itemsName, + inputName, + dataTestId, + addItem, + searchItems, + fetchMoreItems, }) => { + const intl = useIntl(); const classes = useStyles(); const [isChoicesSelectShown, setIsChoicesSelectShown] = useState(false); - const shippingZonesRef = useRef(shippingZones); + const itemsRef = useRef(items); // select holds value and displays it so it needs remounting // to display empty input after adding new zone useEffect(() => { - if (shippingZones.length > shippingZonesRef.current.length) { + if (items.length > itemsRef.current.length) { setIsChoicesSelectShown(true); } - shippingZonesRef.current = shippingZones; - }, [shippingZones]); + itemsRef.current = items; + }, [items]); const handleChoice = ({ target }) => { setIsChoicesSelectShown(false); - addShippingZone(target.value); + addItem(target.value); }; const handleFooterClickAway = () => { setIsChoicesSelectShown(false); - searchShippingZones(""); + searchItems(""); }; return isChoicesSelectShown ? (
) : ( setIsChoicesSelectShown(true)} - title={messages.addZoneTitle} + title={intl.formatMessage(messages.addItemTitle, { + itemsName, + })} testIds={{ - link: "add-shipping-zone-link", - button: "add-shipping-zone-button", + link: `${dataTestId}-add-link`, + button: `${dataTestId}-add-button`, }} /> ); }; -export default ShippingZonesCardListFooter; +export default AssignmentListFooter; diff --git a/src/channels/components/AssignmentList/AssignmentListHeader.tsx b/src/channels/components/AssignmentList/AssignmentListHeader.tsx new file mode 100644 index 000000000..3b1f586b1 --- /dev/null +++ b/src/channels/components/AssignmentList/AssignmentListHeader.tsx @@ -0,0 +1,33 @@ +import { AccordionSummary, Typography } from "@material-ui/core"; +import HorizontalSpacer from "@saleor/apps/components/HorizontalSpacer"; +import IconChevronDown from "@saleor/icons/ChevronDown"; +import React from "react"; + +import { useHeaderStyles } from "./styles"; + +interface AssignmentListHeaderProps { + assignCount: number; + totalCount: number; + itemsName: string; +} + +const AssignmentListHeader: React.FC = ({ + assignCount, + totalCount, + itemsName, +}) => { + const classes = useHeaderStyles(); + + return ( +
+ } classes={classes}> + + {`${assignCount} / ${totalCount} ${itemsName.toLowerCase()}`} + + + +
+ ); +}; + +export default AssignmentListHeader; diff --git a/src/channels/components/ShippingZonesCard/ShippingZoneItem.tsx b/src/channels/components/AssignmentList/Item.tsx similarity index 51% rename from src/channels/components/ShippingZonesCard/ShippingZoneItem.tsx rename to src/channels/components/AssignmentList/Item.tsx index 4225e8d81..f70732e69 100644 --- a/src/channels/components/ShippingZonesCard/ShippingZoneItem.tsx +++ b/src/channels/components/AssignmentList/Item.tsx @@ -1,21 +1,18 @@ import { Divider, Typography } from "@material-ui/core"; -import { ChannelShippingZone } from "@saleor/channels/pages/ChannelDetailsPage/types"; import DeletableItem from "@saleor/components/DeletableItem"; import React from "react"; -import useStyles from "./styles"; +import { useStyles } from "./styles"; +import { AssignItem } from "./types"; -interface ShippingZoneItemProps { - zone: ChannelShippingZone; +interface ItemProps { + item: AssignItem; onDelete: (id: string) => void; } -const ShippingZoneItem: React.FC = ({ - zone, - onDelete, -}) => { - const { id, name } = zone; - const classes = useStyles({}); +const Item: React.FC = ({ item, onDelete }) => { + const { id, name } = item; + const classes = useStyles(); return ( <> @@ -28,4 +25,4 @@ const ShippingZoneItem: React.FC = ({ ); }; -export default ShippingZoneItem; +export default Item; diff --git a/src/channels/components/AssignmentList/index.tsx b/src/channels/components/AssignmentList/index.tsx new file mode 100644 index 000000000..79a515079 --- /dev/null +++ b/src/channels/components/AssignmentList/index.tsx @@ -0,0 +1,2 @@ +export * from "./AssignmentList"; +export { default } from "./AssignmentList"; diff --git a/src/channels/components/AssignmentList/styles.ts b/src/channels/components/AssignmentList/styles.ts new file mode 100644 index 000000000..3115c1056 --- /dev/null +++ b/src/channels/components/AssignmentList/styles.ts @@ -0,0 +1,73 @@ +import { makeStyles } from "@saleor/macaw-ui"; + +export const useExpanderStyles = makeStyles( + theme => ({ + expanded: {}, + root: { + boxShadow: "none", + padding: theme.spacing(1, 4), + + "&:before": { + content: "none", + }, + + "&$expanded": { + margin: 0, + border: "none", + }, + }, + }), + { name: "Expander" }, +); + +export const useHeaderStyles = makeStyles( + theme => ({ + container: { + width: "100%", + display: "flex", + flexDirection: "row", + alignItems: "center", + }, + // empty expanded needed for mui to use root styles + expanded: {}, + root: { + width: "100%", + border: "none", + marginRight: theme.spacing(1), + padding: 0, + paddingBottom: theme.spacing(2), + minHeight: 0, + + "&$expanded": { + minHeight: 0, + }, + }, + content: { + margin: 0, + + "&$expanded": { + margin: 0, + }, + }, + }), + { name: "AssignmentListHeader" }, +); + +export const useStyles = makeStyles( + theme => ({ + container: { + padding: theme.spacing(1, 0), + display: "flex", + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + }, + root: { + paddingRight: theme.spacing(1), + }, + infoMessage: { + padding: theme.spacing(3), + }, + }), + { name: "AssignmentList" }, +); diff --git a/src/channels/components/AssignmentList/types.ts b/src/channels/components/AssignmentList/types.ts new file mode 100644 index 000000000..bcff228ad --- /dev/null +++ b/src/channels/components/AssignmentList/types.ts @@ -0,0 +1,18 @@ +import { FetchMoreProps } from "@saleor/types"; + +export interface AssignItem { + id: string; + name: string; +} + +export interface AssignmentListProps { + items: AssignItem[]; + itemsChoices: AssignItem[]; + itemsName: string; + fetchMoreItems: FetchMoreProps; + inputName: string; + dataTestId: string; + addItem: (id: string) => void; + removeItem: (id: string) => void; + searchItems: (searchPhrase: string) => void; +} diff --git a/src/channels/components/ChannelForm/ChannelForm.stories.tsx b/src/channels/components/ChannelForm/ChannelForm.stories.tsx index 80377acb0..f6cbf5e9c 100644 --- a/src/channels/components/ChannelForm/ChannelForm.stories.tsx +++ b/src/channels/components/ChannelForm/ChannelForm.stories.tsx @@ -12,6 +12,8 @@ const props: ChannelFormProps = { currencyCode: "euro", shippingZonesIdsToAdd: [], shippingZonesIdsToRemove: [], + warehousesIdsToAdd: [], + warehousesIdsToRemove: [], name: "Test", slug: "test", defaultCountry: CountryCode.PL, diff --git a/src/channels/components/ChannelForm/ChannelForm.tsx b/src/channels/components/ChannelForm/ChannelForm.tsx index 44642584c..0df3b42ca 100644 --- a/src/channels/components/ChannelForm/ChannelForm.tsx +++ b/src/channels/components/ChannelForm/ChannelForm.tsx @@ -29,6 +29,8 @@ export interface FormData { slug: string; shippingZonesIdsToAdd: string[]; shippingZonesIdsToRemove: string[]; + warehousesIdsToAdd: string[]; + warehousesIdsToRemove: string[]; defaultCountry: CountryCode; } diff --git a/src/channels/components/ShippingZonesCard/ShippingZonesCard.stories.tsx b/src/channels/components/ShippingZones/ShippingZones.stories.tsx similarity index 82% rename from src/channels/components/ShippingZonesCard/ShippingZonesCard.stories.tsx rename to src/channels/components/ShippingZones/ShippingZones.stories.tsx index 71032b7c4..1a682a2a0 100644 --- a/src/channels/components/ShippingZonesCard/ShippingZonesCard.stories.tsx +++ b/src/channels/components/ShippingZones/ShippingZones.stories.tsx @@ -3,7 +3,7 @@ import CommonDecorator from "@saleor/storybook/Decorator"; import { storiesOf } from "@storybook/react"; import React from "react"; -import ShippingZonesCard from "./ShippingZonesCard"; +import ShippingZones from "./ShippingZones"; const shippingZones = [ { @@ -32,11 +32,11 @@ const baseProps = { shippingZonesChoices: shippingZones as ChannelShippingZones, }; -storiesOf("Shipping zones card", module) +storiesOf("Shipping zones", module) .addDecorator(CommonDecorator) - .add("with no options selected", () => ) + .add("with no options selected", () => ) .add("with options selected", () => ( - diff --git a/src/channels/components/ShippingZones/ShippingZones.tsx b/src/channels/components/ShippingZones/ShippingZones.tsx new file mode 100644 index 000000000..4edcdd383 --- /dev/null +++ b/src/channels/components/ShippingZones/ShippingZones.tsx @@ -0,0 +1,63 @@ +import { Card, CardContent, Typography } from "@material-ui/core"; +import { ChannelShippingZones } from "@saleor/channels/pages/ChannelDetailsPage/types"; +import CardTitle from "@saleor/components/CardTitle"; +import { SearchShippingZonesQuery } from "@saleor/graphql"; +import { sectionNames } from "@saleor/intl"; +import { FetchMoreProps, RelayToFlat } from "@saleor/types"; +import React from "react"; +import { defineMessages, useIntl } from "react-intl"; + +import AssignmentList from "../AssignmentList"; + +const messages = defineMessages({ + subtitle: { + id: "Ic7Wln", + defaultMessage: + "Select shipping zones that will be supplied via this channel. You can assign shipping zones to multiple channels.", + description: "card subtitle", + }, +}); + +interface ShippingZonesProps { + addShippingZone: (id: string) => void; + removeShippingZone: (id: string) => void; + searchShippingZones: (searchPhrase: string) => void; + fetchMoreShippingZones: FetchMoreProps; + shippingZones: ChannelShippingZones; + shippingZonesChoices: RelayToFlat; +} + +const ShippingZones: React.FC = props => { + const { + addShippingZone, + removeShippingZone, + searchShippingZones, + fetchMoreShippingZones, + shippingZones, + shippingZonesChoices, + } = props; + + const intl = useIntl(); + + return ( + + + + {intl.formatMessage(messages.subtitle)} + + + + ); +}; + +export default ShippingZones; diff --git a/src/channels/components/ShippingZones/index.tsx b/src/channels/components/ShippingZones/index.tsx new file mode 100644 index 000000000..b99c82c0b --- /dev/null +++ b/src/channels/components/ShippingZones/index.tsx @@ -0,0 +1,2 @@ +export * from "./ShippingZones"; +export { default } from "./ShippingZones"; diff --git a/src/channels/components/ShippingZonesCard/styles.ts b/src/channels/components/ShippingZones/styles.ts similarity index 50% rename from src/channels/components/ShippingZonesCard/styles.ts rename to src/channels/components/ShippingZones/styles.ts index 7f3ec55de..83b6abc2a 100644 --- a/src/channels/components/ShippingZonesCard/styles.ts +++ b/src/channels/components/ShippingZones/styles.ts @@ -1,25 +1,5 @@ import { makeStyles } from "@saleor/macaw-ui"; -export const useExpanderStyles = makeStyles( - theme => ({ - expanded: {}, - root: { - boxShadow: "none", - padding: theme.spacing(1, 4), - - "&:before": { - content: "none", - }, - - "&$expanded": { - margin: 0, - border: "none", - }, - }, - }), - { name: "Expander" }, -); - const useStyles = makeStyles( theme => ({ container: { @@ -33,7 +13,7 @@ const useStyles = makeStyles( paddingRight: theme.spacing(1), }, }), - { name: "ShippingZonesCard" }, + { name: "ShippingZones" }, ); export default useStyles; diff --git a/src/channels/components/ShippingZonesCard/ShippingZonesCard.tsx b/src/channels/components/ShippingZonesCard/ShippingZonesCard.tsx deleted file mode 100644 index 2e2b34194..000000000 --- a/src/channels/components/ShippingZonesCard/ShippingZonesCard.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import { - Accordion, - Card, - CardContent, - Divider, - makeStyles, - Typography, -} from "@material-ui/core"; -import CardTitle from "@saleor/components/CardTitle"; -import React from "react"; -import { defineMessages, useIntl } from "react-intl"; - -import ShippingZoneItem from "./ShippingZoneItem"; -import ShippingZonesCardListFooter from "./ShippingZonesCardListFooter"; -import ShippingZonesListHeader from "./ShippingZonesListHeader"; -import { useExpanderStyles } from "./styles"; -import { ShippingZonesProps } from "./types"; - -const messages = defineMessages({ - title: { - id: "ANRRpG", - defaultMessage: "Shipping Zones", - description: "card title", - }, - subtitle: { - id: "Ic7Wln", - defaultMessage: - "Select shipping zones that will be supplied via this channel. You can assign shipping zones to multiple channels.", - description: "card subtitle", - }, - allSelectedMessage: { - id: "+G9l7u", - defaultMessage: "All available shipping zones have been selected", - description: "all selected zones card message", - }, -}); - -const useStyles = makeStyles( - theme => ({ - infoMessage: { - padding: theme.spacing(3), - }, - }), - { name: "ShippingZonesCard" }, -); - -type ShippingZonesCardProps = ShippingZonesProps; - -const ShippingZonesCard: React.FC = props => { - const { - shippingZones, - removeShippingZone, - fetchMoreShippingZones: { totalCount }, - } = props; - - const expanderClasses = useExpanderStyles({}); - const classes = useStyles(); - const intl = useIntl(); - - const hasMoreZonesToBeSelected = totalCount !== shippingZones.length; - - return ( - - - - {intl.formatMessage(messages.subtitle)} - - - - - {shippingZones.map(zone => ( - - ))} - {hasMoreZonesToBeSelected ? ( - - ) : ( - - {intl.formatMessage(messages.allSelectedMessage)} - - )} - - - ); -}; - -export default ShippingZonesCard; diff --git a/src/channels/components/ShippingZonesCard/ShippingZonesListHeader.tsx b/src/channels/components/ShippingZonesCard/ShippingZonesListHeader.tsx deleted file mode 100644 index 3e596abfb..000000000 --- a/src/channels/components/ShippingZonesCard/ShippingZonesListHeader.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import { AccordionSummary, Typography } from "@material-ui/core"; -import HorizontalSpacer from "@saleor/apps/components/HorizontalSpacer"; -import { ChannelShippingZones } from "@saleor/channels/pages/ChannelDetailsPage/types"; -import IconChevronDown from "@saleor/icons/ChevronDown"; -import { makeStyles } from "@saleor/macaw-ui"; -import React from "react"; -import { defineMessages, useIntl } from "react-intl"; - -const useStyles = makeStyles( - theme => ({ - container: { - width: "100%", - display: "flex", - flexDirection: "row", - alignItems: "center", - }, - // empty expanded needed for mui to use root styles - expanded: {}, - root: { - width: "100%", - border: "none", - marginRight: theme.spacing(1), - padding: 0, - paddingBottom: theme.spacing(2), - minHeight: 0, - - "&$expanded": { - minHeight: 0, - }, - }, - content: { - margin: 0, - - "&$expanded": { - margin: 0, - }, - }, - }), - { name: "ShippingZonesListHeader" }, -); - -const messages = defineMessages({ - title: { - id: "gtKcPf", - defaultMessage: "{zonesCount} / {totalCount} shipping zones", - description: "title", - }, -}); - -interface ShippingZonesListHeaderProps { - shippingZones: ChannelShippingZones; - totalCount: number; -} - -const ShippingZonesListHeader: React.FC = ({ - shippingZones, - totalCount, -}) => { - const classes = useStyles({}); - const intl = useIntl(); - - return ( -
- } classes={classes}> - - {intl.formatMessage(messages.title, { - zonesCount: shippingZones.length, - totalCount, - })} - - - -
- ); -}; - -export default ShippingZonesListHeader; diff --git a/src/channels/components/ShippingZonesCard/index.tsx b/src/channels/components/ShippingZonesCard/index.tsx deleted file mode 100644 index c38cdab7d..000000000 --- a/src/channels/components/ShippingZonesCard/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./ShippingZonesCard"; -export { default } from "./ShippingZonesCard"; diff --git a/src/channels/components/ShippingZonesCard/types.ts b/src/channels/components/ShippingZonesCard/types.ts deleted file mode 100644 index 6b330f3fa..000000000 --- a/src/channels/components/ShippingZonesCard/types.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ChannelShippingZones } from "@saleor/channels/pages/ChannelDetailsPage/types"; -import { SearchShippingZonesQuery } from "@saleor/graphql"; -import { FetchMoreProps, RelayToFlat } from "@saleor/types"; - -export interface ShippingZonesProps { - addShippingZone: (id: string) => void; - removeShippingZone: (id: string) => void; - searchShippingZones: (searchPhrase: string) => void; - fetchMoreShippingZones: FetchMoreProps; - shippingZones: ChannelShippingZones; - shippingZonesChoices: RelayToFlat; -} diff --git a/src/channels/components/Warehouses/Warehouses.stories.tsx b/src/channels/components/Warehouses/Warehouses.stories.tsx new file mode 100644 index 000000000..ed44ab251 --- /dev/null +++ b/src/channels/components/Warehouses/Warehouses.stories.tsx @@ -0,0 +1,40 @@ +import { ChannelWarehouses } from "@saleor/channels/pages/ChannelDetailsPage/types"; +import CommonDecorator from "@saleor/storybook/Decorator"; +import { storiesOf } from "@storybook/react"; +import React from "react"; + +import Warehouses from "./Warehouses"; + +const warehouses = [ + { + __typename: "Warehouse", + id: "2", + name: "Fancy warehouse", + }, + { + __typename: "Warehouse", + id: "3", + name: "Nice warehouse", + }, +]; + +const baseProps = { + addWarehouse: () => undefined, + removeWarehouse: () => undefined, + searchWarehouses: () => undefined, + fetchMoreWarehouses: { + loading: false, + hasMore: false, + onFetchMore: () => undefined, + totalCount: 0, + }, + warehouses: [], + warehousesChoices: warehouses as ChannelWarehouses, +}; + +storiesOf("Warehouses", module) + .addDecorator(CommonDecorator) + .add("with no options selected", () => ) + .add("with options selected", () => ( + + )); diff --git a/src/channels/components/Warehouses/Warehouses.tsx b/src/channels/components/Warehouses/Warehouses.tsx new file mode 100644 index 000000000..7cfb2a0fb --- /dev/null +++ b/src/channels/components/Warehouses/Warehouses.tsx @@ -0,0 +1,62 @@ +import { Card, CardContent, Typography } from "@material-ui/core"; +import { ChannelWarehouses } from "@saleor/channels/pages/ChannelDetailsPage/types"; +import CardTitle from "@saleor/components/CardTitle"; +import { SearchWarehousesQuery } from "@saleor/graphql"; +import { sectionNames } from "@saleor/intl"; +import { FetchMoreProps, RelayToFlat } from "@saleor/types"; +import React from "react"; +import { defineMessages, useIntl } from "react-intl"; + +import AssignmentList from "../AssignmentList"; + +const messages = defineMessages({ + subtitle: { + id: "ImTelT", + defaultMessage: + "Select warehouses that will be used in this channel. You can assign warehouses to multiple channels.", + description: "card subtitle", + }, +}); + +interface WarehousesProps { + addWarehouse: (id: string) => void; + removeWarehouse: (id: string) => void; + searchWarehouses: (searchPhrase: string) => void; + fetchMoreWarehouses: FetchMoreProps; + warehouses: ChannelWarehouses; + warehousesChoices: RelayToFlat; +} + +const Warehouses: React.FC = props => { + const { + addWarehouse, + removeWarehouse, + searchWarehouses, + fetchMoreWarehouses, + warehouses, + warehousesChoices, + } = props; + + const intl = useIntl(); + + return ( + + + + {intl.formatMessage(messages.subtitle)} + + + + ); +}; +export default Warehouses; diff --git a/src/channels/components/Warehouses/index.tsx b/src/channels/components/Warehouses/index.tsx new file mode 100644 index 000000000..737674d60 --- /dev/null +++ b/src/channels/components/Warehouses/index.tsx @@ -0,0 +1,2 @@ +export * from "./Warehouses"; +export { default } from "./Warehouses"; diff --git a/src/channels/components/Warehouses/styles.ts b/src/channels/components/Warehouses/styles.ts new file mode 100644 index 000000000..264221bd6 --- /dev/null +++ b/src/channels/components/Warehouses/styles.ts @@ -0,0 +1,19 @@ +import { makeStyles } from "@saleor/macaw-ui"; + +const useStyles = makeStyles( + theme => ({ + container: { + padding: theme.spacing(1, 0), + display: "flex", + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + }, + root: { + paddingRight: theme.spacing(1), + }, + }), + { name: "Warehouses" }, +); + +export default useStyles; diff --git a/src/channels/pages/ChannelDetailsPage/ChannelDetailsPage.stories.tsx b/src/channels/pages/ChannelDetailsPage/ChannelDetailsPage.stories.tsx index 3fdffa606..f3a998c71 100644 --- a/src/channels/pages/ChannelDetailsPage/ChannelDetailsPage.stories.tsx +++ b/src/channels/pages/ChannelDetailsPage/ChannelDetailsPage.stories.tsx @@ -22,6 +22,8 @@ const props: ChannelDetailsPageProps = { updateChannelStatus: () => undefined, searchShippingZones: () => undefined, searchShippingZonesData: undefined, + searchWarehouses: () => undefined, + searchWarehousesData: undefined, countries: countries.map(({ name, code }) => ({ code, country: name, @@ -45,6 +47,24 @@ const props: ChannelDetailsPageProps = { onFetchMore: () => undefined, totalCount: 0, }, + channelWarehouses: [ + { + __typename: "Warehouse", + id: "warehouse-1", + name: "Warehouse 1", + }, + { + __typename: "Warehouse", + id: "warehouse-2", + name: "Warehouse 2", + }, + ], + fetchMoreWarehouses: { + loading: false, + hasMore: false, + onFetchMore: () => undefined, + totalCount: 0, + }, }; storiesOf("Views / Channels / Channel details", module) diff --git a/src/channels/pages/ChannelDetailsPage/ChannelDetailsPage.tsx b/src/channels/pages/ChannelDetailsPage/ChannelDetailsPage.tsx index 27e006c35..340c38277 100644 --- a/src/channels/pages/ChannelDetailsPage/ChannelDetailsPage.tsx +++ b/src/channels/pages/ChannelDetailsPage/ChannelDetailsPage.tsx @@ -1,4 +1,5 @@ -import ShippingZonesCard from "@saleor/channels/components/ShippingZonesCard/ShippingZonesCard"; +import ShippingZones from "@saleor/channels/components/ShippingZones"; +import Warehouses from "@saleor/channels/components/Warehouses"; import { channelsListUrl } from "@saleor/channels/urls"; import CardSpacer from "@saleor/components/CardSpacer"; import Form from "@saleor/components/Form"; @@ -11,6 +12,7 @@ import { CountryCode, CountryFragment, SearchShippingZonesQuery, + SearchWarehousesQuery, } from "@saleor/graphql"; import { SearchData } from "@saleor/hooks/makeTopLevelSearch"; import { getParsedSearchData } from "@saleor/hooks/makeTopLevelSearch/utils"; @@ -29,7 +31,7 @@ import React, { useState } from "react"; import { ChannelForm, FormData } from "../../components/ChannelForm"; import { ChannelStatus } from "../../components/ChannelStatus/ChannelStatus"; -import { ChannelShippingZones } from "./types"; +import { ChannelShippingZones, ChannelWarehouses } from "./types"; import { getUpdatedIdsWithNewId, getUpdatedIdsWithoutNewId } from "./utils"; export interface ChannelDetailsPageProps { @@ -42,11 +44,15 @@ export interface ChannelDetailsPageProps { searchShippingZonesData?: SearchData; fetchMoreShippingZones: FetchMoreProps; channelShippingZones?: ChannelShippingZones; + searchWarehousesData?: SearchData; + fetchMoreWarehouses: FetchMoreProps; + channelWarehouses?: ChannelWarehouses; countries: CountryFragment[]; onDelete?: () => void; onSubmit: (data: FormData) => SubmitPromise; updateChannelStatus?: () => void; searchShippingZones: (query: string) => void; + searchWarehouses: (query: string) => void; } const ChannelDetailsPage = function({ @@ -62,8 +68,12 @@ const ChannelDetailsPage = function({ searchShippingZones, searchShippingZonesData, fetchMoreShippingZones, - countries, channelShippingZones = [], + searchWarehouses, + searchWarehousesData, + fetchMoreWarehouses, + channelWarehouses = [], + countries, }: ChannelDetailsPageProps) { const navigate = useNavigator(); @@ -76,6 +86,9 @@ const ChannelDetailsPage = function({ const [shippingZonesToDisplay, setShippingZonesToDisplay] = useStateFromProps< ChannelShippingZones >(channelShippingZones); + const [warehousesToDisplay, setWarehousesToDisplay] = useStateFromProps< + ChannelWarehouses + >(channelWarehouses); const countryChoices = mapCountriesToChoices(countries || []); @@ -86,6 +99,8 @@ const ChannelDetailsPage = function({ slug: "", shippingZonesIdsToAdd: [], shippingZonesIdsToRemove: [], + warehousesIdsToAdd: [], + warehousesIdsToRemove: [], defaultCountry: (defaultCountry?.code || "") as CountryCode, ...formData, }; @@ -96,6 +111,12 @@ const ChannelDetailsPage = function({ !shippingZonesToDisplay.some(({ id }) => id === searchedZoneId), ); + const getFilteredWarehousesChoices = (): RelayToFlat => + getParsedSearchData({ data: searchWarehousesData }).filter( + ({ id: searchedWarehouseId }) => + !warehousesToDisplay.some(({ id }) => id === searchedWarehouseId), + ); + const checkIfSaveIsDisabled = (data: FormData) => { const isValid = !!data.name && @@ -114,7 +135,7 @@ const ChannelDetailsPage = function({ initial={initialData} checkIfSaveIsDisabled={checkIfSaveIsDisabled} > - {({ change, data, submit, set, isSaveDisabled }) => { + {({ change, data, submit, set, isSaveDisabled, triggerChange }) => { const handleCurrencyCodeSelect = createSingleAutocompleteSelectHandler( change, setSelectedCurrencyCode, @@ -127,6 +148,8 @@ const ChannelDetailsPage = function({ ); const addShippingZone = (zoneId: string) => { + triggerChange(); + set({ ...data, shippingZonesIdsToRemove: getUpdatedIdsWithoutNewId( @@ -148,6 +171,8 @@ const ChannelDetailsPage = function({ }; const removeShippingZone = (zoneId: string) => { + triggerChange(); + set({ ...data, shippingZonesIdsToAdd: getUpdatedIdsWithoutNewId( @@ -165,6 +190,49 @@ const ChannelDetailsPage = function({ ); }; + const addWarehouse = (warehouseId: string) => { + triggerChange(); + + set({ + ...data, + warehousesIdsToRemove: getUpdatedIdsWithoutNewId( + data.warehousesIdsToRemove, + warehouseId, + ), + warehousesIdsToAdd: getUpdatedIdsWithNewId( + data.warehousesIdsToAdd, + warehouseId, + ), + }); + + setWarehousesToDisplay([ + ...warehousesToDisplay, + getParsedSearchData({ data: searchWarehousesData }).find( + getById(warehouseId), + ), + ]); + }; + + const removeWarehouse = (warehouseId: string) => { + triggerChange(); + + set({ + ...data, + warehousesIdsToAdd: getUpdatedIdsWithoutNewId( + data.warehousesIdsToAdd, + warehouseId, + ), + warehousesIdsToRemove: getUpdatedIdsWithNewId( + data.warehousesIdsToRemove, + warehouseId, + ), + }); + + setWarehousesToDisplay( + warehousesToDisplay.filter(getByUnmatchingId(warehouseId)), + ); + }; + return ( <> @@ -193,7 +261,7 @@ const ChannelDetailsPage = function({ )} - ({ searchShippingZones={searchShippingZones} fetchMoreShippingZones={fetchMoreShippingZones} /> + + ; export type ChannelShippingZone = ChannelShippingZones[0]; + +export type ChannelWarehouses = RelayToFlat< + ChannelWarehousesQuery["warehouses"] +>; + +export type ChannelWarehouse = ChannelWarehouses[0]; diff --git a/src/channels/views/ChannelCreate/ChannelCreate.tsx b/src/channels/views/ChannelCreate/ChannelCreate.tsx index a7a6b6b77..31cd17aff 100644 --- a/src/channels/views/ChannelCreate/ChannelCreate.tsx +++ b/src/channels/views/ChannelCreate/ChannelCreate.tsx @@ -16,6 +16,7 @@ import useShop from "@saleor/hooks/useShop"; import { sectionNames } from "@saleor/intl"; import { extractMutationErrors } from "@saleor/misc"; import useShippingZonesSearch from "@saleor/searches/useShippingZonesSearch"; +import useWarehouseSearch from "@saleor/searches/useWarehouseSearch"; import currencyCodes from "currency-codes"; import React from "react"; import { useIntl } from "react-intl"; @@ -44,6 +45,8 @@ export const ChannelCreateView = ({}) => { const handleSubmit = ({ shippingZonesIdsToAdd, shippingZonesIdsToRemove, + warehousesIdsToAdd, + warehousesIdsToRemove, currencyCode, ...rest }: FormData) => @@ -54,6 +57,7 @@ export const ChannelCreateView = ({}) => { ...rest, currencyCode: currencyCode.toUpperCase(), addShippingZones: shippingZonesIdsToAdd, + addWarehouses: warehousesIdsToAdd, }, }, }), @@ -67,6 +71,14 @@ export const ChannelCreateView = ({}) => { variables: DEFAULT_INITIAL_SEARCH_DATA, }); + const { + loadMore: fetchMoreWarehouses, + search: searchWarehouses, + result: searchWarehousesResult, + } = useWarehouseSearch({ + variables: DEFAULT_INITIAL_SEARCH_DATA, + }); + const currencyCodeChoices = currencyCodes.data.map(currencyData => ({ label: intl.formatMessage( { @@ -109,6 +121,12 @@ export const ChannelCreateView = ({}) => { searchShippingZonesResult, fetchMoreShippingZones, )} + searchWarehouses={searchWarehouses} + searchWarehousesData={searchWarehousesResult.data} + fetchMoreWarehouses={getSearchFetchMoreProps( + searchWarehousesResult, + fetchMoreWarehouses, + )} disabled={createChannelOpts.loading} errors={createChannelOpts?.data?.channelCreate?.errors || []} currencyCodes={currencyCodeChoices} diff --git a/src/channels/views/ChannelDetails/ChannelDetails.tsx b/src/channels/views/ChannelDetails/ChannelDetails.tsx index 452ec2534..f7e7b4d5c 100644 --- a/src/channels/views/ChannelDetails/ChannelDetails.tsx +++ b/src/channels/views/ChannelDetails/ChannelDetails.tsx @@ -17,6 +17,7 @@ import { useChannelShippingZonesQuery, useChannelsQuery, useChannelUpdateMutation, + useChannelWarehousesQuery, } from "@saleor/graphql"; import { getSearchFetchMoreProps } from "@saleor/hooks/makeTopLevelSearch/utils"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -26,6 +27,7 @@ import useShop from "@saleor/hooks/useShop"; import { sectionNames } from "@saleor/intl"; import { extractMutationErrors } from "@saleor/misc"; import useShippingZonesSearch from "@saleor/searches/useShippingZonesSearch"; +import useWarehouseSearch from "@saleor/searches/useWarehouseSearch"; import getChannelsErrorMessage from "@saleor/utils/errors/channels"; import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers"; import React from "react"; @@ -103,6 +105,8 @@ export const ChannelDetails: React.FC = ({ slug, shippingZonesIdsToRemove, shippingZonesIdsToAdd, + warehousesIdsToRemove, + warehousesIdsToAdd, defaultCountry, }: FormData) => extractMutationErrors( @@ -115,6 +119,8 @@ export const ChannelDetails: React.FC = ({ defaultCountry, addShippingZones: shippingZonesIdsToAdd, removeShippingZones: shippingZonesIdsToRemove, + addWarehouses: warehousesIdsToAdd, + removeWarehouses: warehousesIdsToRemove, }, }, }), @@ -176,6 +182,25 @@ export const ChannelDetails: React.FC = ({ variables: DEFAULT_INITIAL_SEARCH_DATA, }); + const { + data: channelWarehousesData, + loading: channelsWarehousesLoading, + } = useChannelWarehousesQuery({ + variables: { + filter: { + channels: [id], + }, + }, + }); + + const { + loadMore: fetchMoreWarehouses, + search: searchWarehouses, + result: searchWarehousesResult, + } = useWarehouseSearch({ + variables: DEFAULT_INITIAL_SEARCH_DATA, + }); + return ( <> = ({ searchShippingZonesResult, fetchMoreShippingZones, )} + channelWarehouses={channelWarehousesData?.warehouses?.edges?.map( + ({ node }) => node, + )} + searchWarehouses={searchWarehouses} + searchWarehousesData={searchWarehousesResult.data} + fetchMoreWarehouses={getSearchFetchMoreProps( + searchWarehousesResult, + fetchMoreWarehouses, + )} channel={data?.channel} disabled={ - updateChannelOpts.loading || loading || channelsShippingZonesLoading + updateChannelOpts.loading || + loading || + channelsShippingZonesLoading || + channelsWarehousesLoading } disabledStatus={ activateChannelOpts.loading || deactivateChannelOpts.loading diff --git a/src/graphql/fragmentTypes.generated.ts b/src/graphql/fragmentTypes.generated.ts index ac5005bb8..7a96c3d5e 100644 --- a/src/graphql/fragmentTypes.generated.ts +++ b/src/graphql/fragmentTypes.generated.ts @@ -22,6 +22,9 @@ "AttributeCreated", "AttributeDeleted", "AttributeUpdated", + "AttributeValueCreated", + "AttributeValueDeleted", + "AttributeValueUpdated", "CategoryCreated", "CategoryDeleted", "CategoryUpdated", @@ -195,6 +198,7 @@ "Attribute", "Category", "Checkout", + "CheckoutLine", "Collection", "DigitalContent", "Fulfillment", @@ -203,6 +207,7 @@ "Menu", "MenuItem", "Order", + "OrderLine", "Page", "PageType", "Payment", diff --git a/src/graphql/hooks.generated.ts b/src/graphql/hooks.generated.ts index b498bdc8e..309daef22 100644 --- a/src/graphql/hooks.generated.ts +++ b/src/graphql/hooks.generated.ts @@ -13495,6 +13495,7 @@ export const SearchWarehousesDocument = gql` sortBy: {direction: ASC, field: NAME} filter: {search: $query} ) { + totalCount edges { node { id @@ -16343,6 +16344,46 @@ export function useWarehouseDetailsLazyQuery(baseOptions?: ApolloReactHooks.Lazy export type WarehouseDetailsQueryHookResult = ReturnType; export type WarehouseDetailsLazyQueryHookResult = ReturnType; export type WarehouseDetailsQueryResult = Apollo.QueryResult; +export const ChannelWarehousesDocument = gql` + query ChannelWarehouses($filter: WarehouseFilterInput) { + warehouses(filter: $filter, first: 100) { + edges { + node { + id + name + } + } + } +} + `; + +/** + * __useChannelWarehousesQuery__ + * + * To run a query within a React component, call `useChannelWarehousesQuery` and pass it any options that fit your needs. + * When your component renders, `useChannelWarehousesQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useChannelWarehousesQuery({ + * variables: { + * filter: // value for 'filter' + * }, + * }); + */ +export function useChannelWarehousesQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return ApolloReactHooks.useQuery(ChannelWarehousesDocument, options); + } +export function useChannelWarehousesLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return ApolloReactHooks.useLazyQuery(ChannelWarehousesDocument, options); + } +export type ChannelWarehousesQueryHookResult = ReturnType; +export type ChannelWarehousesLazyQueryHookResult = ReturnType; +export type ChannelWarehousesQueryResult = Apollo.QueryResult; export const WebhookCreateDocument = gql` mutation WebhookCreate($input: WebhookCreateInput!) { webhookCreate(input: $input) { diff --git a/src/graphql/typePolicies.generated.ts b/src/graphql/typePolicies.generated.ts index 68cc8bfd1..8e6f5837e 100644 --- a/src/graphql/typePolicies.generated.ts +++ b/src/graphql/typePolicies.generated.ts @@ -518,6 +518,14 @@ export type AttributeValueCreateFieldPolicy = { errors?: FieldPolicy | FieldReadFunction, attributeValue?: FieldPolicy | FieldReadFunction }; +export type AttributeValueCreatedKeySpecifier = ('issuedAt' | 'version' | 'issuingPrincipal' | 'recipient' | 'attributeValue' | AttributeValueCreatedKeySpecifier)[]; +export type AttributeValueCreatedFieldPolicy = { + issuedAt?: FieldPolicy | FieldReadFunction, + version?: FieldPolicy | FieldReadFunction, + issuingPrincipal?: FieldPolicy | FieldReadFunction, + recipient?: FieldPolicy | FieldReadFunction, + attributeValue?: FieldPolicy | FieldReadFunction +}; export type AttributeValueDeleteKeySpecifier = ('attribute' | 'attributeErrors' | 'errors' | 'attributeValue' | AttributeValueDeleteKeySpecifier)[]; export type AttributeValueDeleteFieldPolicy = { attribute?: FieldPolicy | FieldReadFunction, @@ -525,6 +533,14 @@ export type AttributeValueDeleteFieldPolicy = { errors?: FieldPolicy | FieldReadFunction, attributeValue?: FieldPolicy | FieldReadFunction }; +export type AttributeValueDeletedKeySpecifier = ('issuedAt' | 'version' | 'issuingPrincipal' | 'recipient' | 'attributeValue' | AttributeValueDeletedKeySpecifier)[]; +export type AttributeValueDeletedFieldPolicy = { + issuedAt?: FieldPolicy | FieldReadFunction, + version?: FieldPolicy | FieldReadFunction, + issuingPrincipal?: FieldPolicy | FieldReadFunction, + recipient?: FieldPolicy | FieldReadFunction, + attributeValue?: FieldPolicy | FieldReadFunction +}; export type AttributeValueTranslatableContentKeySpecifier = ('id' | 'name' | 'richText' | 'plainText' | 'translation' | 'attributeValue' | AttributeValueTranslatableContentKeySpecifier)[]; export type AttributeValueTranslatableContentFieldPolicy = { id?: FieldPolicy | FieldReadFunction, @@ -555,6 +571,14 @@ export type AttributeValueUpdateFieldPolicy = { errors?: FieldPolicy | FieldReadFunction, attributeValue?: FieldPolicy | FieldReadFunction }; +export type AttributeValueUpdatedKeySpecifier = ('issuedAt' | 'version' | 'issuingPrincipal' | 'recipient' | 'attributeValue' | AttributeValueUpdatedKeySpecifier)[]; +export type AttributeValueUpdatedFieldPolicy = { + issuedAt?: FieldPolicy | FieldReadFunction, + version?: FieldPolicy | FieldReadFunction, + issuingPrincipal?: FieldPolicy | FieldReadFunction, + recipient?: FieldPolicy | FieldReadFunction, + attributeValue?: FieldPolicy | FieldReadFunction +}; export type BulkProductErrorKeySpecifier = ('field' | 'message' | 'code' | 'attributes' | 'values' | 'index' | 'warehouses' | 'channels' | BulkProductErrorKeySpecifier)[]; export type BulkProductErrorFieldPolicy = { field?: FieldPolicy | FieldReadFunction, @@ -684,7 +708,7 @@ export type CategoryUpdatedFieldPolicy = { recipient?: FieldPolicy | FieldReadFunction, category?: FieldPolicy | FieldReadFunction }; -export type ChannelKeySpecifier = ('id' | 'name' | 'isActive' | 'currencyCode' | 'slug' | 'hasOrders' | 'defaultCountry' | ChannelKeySpecifier)[]; +export type ChannelKeySpecifier = ('id' | 'name' | 'isActive' | 'currencyCode' | 'slug' | 'hasOrders' | 'defaultCountry' | 'warehouses' | ChannelKeySpecifier)[]; export type ChannelFieldPolicy = { id?: FieldPolicy | FieldReadFunction, name?: FieldPolicy | FieldReadFunction, @@ -692,7 +716,8 @@ export type ChannelFieldPolicy = { currencyCode?: FieldPolicy | FieldReadFunction, slug?: FieldPolicy | FieldReadFunction, hasOrders?: FieldPolicy | FieldReadFunction, - defaultCountry?: FieldPolicy | FieldReadFunction + defaultCountry?: FieldPolicy | FieldReadFunction, + warehouses?: FieldPolicy | FieldReadFunction }; export type ChannelActivateKeySpecifier = ('channel' | 'channelErrors' | 'errors' | ChannelActivateKeySpecifier)[]; export type ChannelActivateFieldPolicy = { @@ -734,12 +759,13 @@ export type ChannelDeletedFieldPolicy = { recipient?: FieldPolicy | FieldReadFunction, channel?: FieldPolicy | FieldReadFunction }; -export type ChannelErrorKeySpecifier = ('field' | 'message' | 'code' | 'shippingZones' | ChannelErrorKeySpecifier)[]; +export type ChannelErrorKeySpecifier = ('field' | 'message' | 'code' | 'shippingZones' | 'warehouses' | ChannelErrorKeySpecifier)[]; export type ChannelErrorFieldPolicy = { field?: FieldPolicy | FieldReadFunction, message?: FieldPolicy | FieldReadFunction, code?: FieldPolicy | FieldReadFunction, - shippingZones?: FieldPolicy | FieldReadFunction + shippingZones?: FieldPolicy | FieldReadFunction, + warehouses?: FieldPolicy | FieldReadFunction }; export type ChannelStatusChangedKeySpecifier = ('issuedAt' | 'version' | 'issuingPrincipal' | 'recipient' | 'channel' | ChannelStatusChangedKeySpecifier)[]; export type ChannelStatusChangedFieldPolicy = { @@ -886,9 +912,15 @@ export type CheckoutLanguageCodeUpdateFieldPolicy = { checkoutErrors?: FieldPolicy | FieldReadFunction, errors?: FieldPolicy | FieldReadFunction }; -export type CheckoutLineKeySpecifier = ('id' | 'variant' | 'quantity' | 'unitPrice' | 'undiscountedUnitPrice' | 'totalPrice' | 'undiscountedTotalPrice' | 'requiresShipping' | CheckoutLineKeySpecifier)[]; +export type CheckoutLineKeySpecifier = ('id' | 'privateMetadata' | 'privateMetafield' | 'privateMetafields' | 'metadata' | 'metafield' | 'metafields' | 'variant' | 'quantity' | 'unitPrice' | 'undiscountedUnitPrice' | 'totalPrice' | 'undiscountedTotalPrice' | 'requiresShipping' | CheckoutLineKeySpecifier)[]; export type CheckoutLineFieldPolicy = { id?: FieldPolicy | FieldReadFunction, + privateMetadata?: FieldPolicy | FieldReadFunction, + privateMetafield?: FieldPolicy | FieldReadFunction, + privateMetafields?: FieldPolicy | FieldReadFunction, + metadata?: FieldPolicy | FieldReadFunction, + metafield?: FieldPolicy | FieldReadFunction, + metafields?: FieldPolicy | FieldReadFunction, variant?: FieldPolicy | FieldReadFunction, quantity?: FieldPolicy | FieldReadFunction, unitPrice?: FieldPolicy | FieldReadFunction, @@ -2736,9 +2768,15 @@ export type OrderFullyPaidFieldPolicy = { recipient?: FieldPolicy | FieldReadFunction, order?: FieldPolicy | FieldReadFunction }; -export type OrderLineKeySpecifier = ('id' | 'productName' | 'variantName' | 'productSku' | 'productVariantId' | 'isShippingRequired' | 'quantity' | 'quantityFulfilled' | 'unitDiscountReason' | 'taxRate' | 'digitalContentUrl' | 'thumbnail' | 'unitPrice' | 'undiscountedUnitPrice' | 'unitDiscount' | 'unitDiscountValue' | 'totalPrice' | 'variant' | 'translatedProductName' | 'translatedVariantName' | 'allocations' | 'quantityToFulfill' | 'unitDiscountType' | OrderLineKeySpecifier)[]; +export type OrderLineKeySpecifier = ('id' | 'privateMetadata' | 'privateMetafield' | 'privateMetafields' | 'metadata' | 'metafield' | 'metafields' | 'productName' | 'variantName' | 'productSku' | 'productVariantId' | 'isShippingRequired' | 'quantity' | 'quantityFulfilled' | 'unitDiscountReason' | 'taxRate' | 'digitalContentUrl' | 'thumbnail' | 'unitPrice' | 'undiscountedUnitPrice' | 'unitDiscount' | 'unitDiscountValue' | 'totalPrice' | 'variant' | 'translatedProductName' | 'translatedVariantName' | 'allocations' | 'quantityToFulfill' | 'unitDiscountType' | OrderLineKeySpecifier)[]; export type OrderLineFieldPolicy = { id?: FieldPolicy | FieldReadFunction, + privateMetadata?: FieldPolicy | FieldReadFunction, + privateMetafield?: FieldPolicy | FieldReadFunction, + privateMetafields?: FieldPolicy | FieldReadFunction, + metadata?: FieldPolicy | FieldReadFunction, + metafield?: FieldPolicy | FieldReadFunction, + metafields?: FieldPolicy | FieldReadFunction, productName?: FieldPolicy | FieldReadFunction, variantName?: FieldPolicy | FieldReadFunction, productSku?: FieldPolicy | FieldReadFunction, @@ -5271,10 +5309,18 @@ export type StrictTypedTypePolicies = { keyFields?: false | AttributeValueCreateKeySpecifier | (() => undefined | AttributeValueCreateKeySpecifier), fields?: AttributeValueCreateFieldPolicy, }, + AttributeValueCreated?: Omit & { + keyFields?: false | AttributeValueCreatedKeySpecifier | (() => undefined | AttributeValueCreatedKeySpecifier), + fields?: AttributeValueCreatedFieldPolicy, + }, AttributeValueDelete?: Omit & { keyFields?: false | AttributeValueDeleteKeySpecifier | (() => undefined | AttributeValueDeleteKeySpecifier), fields?: AttributeValueDeleteFieldPolicy, }, + AttributeValueDeleted?: Omit & { + keyFields?: false | AttributeValueDeletedKeySpecifier | (() => undefined | AttributeValueDeletedKeySpecifier), + fields?: AttributeValueDeletedFieldPolicy, + }, AttributeValueTranslatableContent?: Omit & { keyFields?: false | AttributeValueTranslatableContentKeySpecifier | (() => undefined | AttributeValueTranslatableContentKeySpecifier), fields?: AttributeValueTranslatableContentFieldPolicy, @@ -5291,6 +5337,10 @@ export type StrictTypedTypePolicies = { keyFields?: false | AttributeValueUpdateKeySpecifier | (() => undefined | AttributeValueUpdateKeySpecifier), fields?: AttributeValueUpdateFieldPolicy, }, + AttributeValueUpdated?: Omit & { + keyFields?: false | AttributeValueUpdatedKeySpecifier | (() => undefined | AttributeValueUpdatedKeySpecifier), + fields?: AttributeValueUpdatedFieldPolicy, + }, BulkProductError?: Omit & { keyFields?: false | BulkProductErrorKeySpecifier | (() => undefined | BulkProductErrorKeySpecifier), fields?: BulkProductErrorFieldPolicy, diff --git a/src/graphql/types.generated.ts b/src/graphql/types.generated.ts index 08321c827..7fa63618e 100644 --- a/src/graphql/types.generated.ts +++ b/src/graphql/types.generated.ts @@ -603,6 +603,16 @@ export type CategorySortingInput = { export type ChannelCreateInput = { /** isActive flag. */ isActive?: InputMaybe; + /** List of shipping zones to assign to the channel. */ + addShippingZones?: InputMaybe>; + /** + * List of warehouses to assign to the channel. + * + * Added in Saleor 3.5. + * + * Note: this API is currently in Feature Preview and can be subject to changes at later point. + */ + addWarehouses?: InputMaybe>; /** Name of the channel. */ name: Scalars['String']; /** Slug of the channel. */ @@ -613,10 +623,10 @@ export type ChannelCreateInput = { * Default country for the channel. Default country can be used in checkout to determine the stock quantities or calculate taxes when the country was not explicitly provided. * * Added in Saleor 3.1. + * + * Note: this API is currently in Feature Preview and can be subject to changes at later point. */ defaultCountry: CountryCode; - /** List of shipping zones to assign to the channel. */ - addShippingZones?: InputMaybe>; }; export type ChannelDeleteInput = { @@ -640,6 +650,16 @@ export enum ChannelErrorCode { export type ChannelUpdateInput = { /** isActive flag. */ isActive?: InputMaybe; + /** List of shipping zones to assign to the channel. */ + addShippingZones?: InputMaybe>; + /** + * List of warehouses to assign to the channel. + * + * Added in Saleor 3.5. + * + * Note: this API is currently in Feature Preview and can be subject to changes at later point. + */ + addWarehouses?: InputMaybe>; /** Name of the channel. */ name?: InputMaybe; /** Slug of the channel. */ @@ -650,10 +670,16 @@ export type ChannelUpdateInput = { * Added in Saleor 3.1. */ defaultCountry?: InputMaybe; - /** List of shipping zones to assign to the channel. */ - addShippingZones?: InputMaybe>; /** List of shipping zones to unassign from the channel. */ removeShippingZones?: InputMaybe>; + /** + * List of warehouses to unassign from the channel. + * + * Added in Saleor 3.5. + * + * Note: this API is currently in Feature Preview and can be subject to changes at later point. + */ + removeWarehouses?: InputMaybe>; }; export type CheckoutCreateInput = { @@ -4812,6 +4838,7 @@ export type WarehouseFilterInput = { search?: InputMaybe; ids?: InputMaybe>; isPrivate?: InputMaybe; + channels?: InputMaybe>; }; export enum WarehouseSortField { @@ -4917,6 +4944,12 @@ export enum WebhookEventTypeAsyncEnum { ATTRIBUTE_UPDATED = 'ATTRIBUTE_UPDATED', /** An attribute is deleted. */ ATTRIBUTE_DELETED = 'ATTRIBUTE_DELETED', + /** A new attribute value is created. */ + ATTRIBUTE_VALUE_CREATED = 'ATTRIBUTE_VALUE_CREATED', + /** An attribute value is updated. */ + ATTRIBUTE_VALUE_UPDATED = 'ATTRIBUTE_VALUE_UPDATED', + /** An attribute value is deleted. */ + ATTRIBUTE_VALUE_DELETED = 'ATTRIBUTE_VALUE_DELETED', /** A new category created. */ CATEGORY_CREATED = 'CATEGORY_CREATED', /** A category is updated. */ @@ -4979,6 +5012,8 @@ export enum WebhookEventTypeAsyncEnum { CUSTOMER_CREATED = 'CUSTOMER_CREATED', /** A customer account is updated. */ CUSTOMER_UPDATED = 'CUSTOMER_UPDATED', + /** A customer account is deleted. */ + CUSTOMER_DELETED = 'CUSTOMER_DELETED', /** A new collection is created. */ COLLECTION_CREATED = 'COLLECTION_CREATED', /** A collection is updated. */ @@ -5080,6 +5115,12 @@ export enum WebhookEventTypeEnum { ATTRIBUTE_UPDATED = 'ATTRIBUTE_UPDATED', /** An attribute is deleted. */ ATTRIBUTE_DELETED = 'ATTRIBUTE_DELETED', + /** A new attribute value is created. */ + ATTRIBUTE_VALUE_CREATED = 'ATTRIBUTE_VALUE_CREATED', + /** An attribute value is updated. */ + ATTRIBUTE_VALUE_UPDATED = 'ATTRIBUTE_VALUE_UPDATED', + /** An attribute value is deleted. */ + ATTRIBUTE_VALUE_DELETED = 'ATTRIBUTE_VALUE_DELETED', /** A new category created. */ CATEGORY_CREATED = 'CATEGORY_CREATED', /** A category is updated. */ @@ -5142,6 +5183,8 @@ export enum WebhookEventTypeEnum { CUSTOMER_CREATED = 'CUSTOMER_CREATED', /** A customer account is updated. */ CUSTOMER_UPDATED = 'CUSTOMER_UPDATED', + /** A customer account is deleted. */ + CUSTOMER_DELETED = 'CUSTOMER_DELETED', /** A new collection is created. */ COLLECTION_CREATED = 'COLLECTION_CREATED', /** A collection is updated. */ @@ -5255,6 +5298,9 @@ export enum WebhookSampleEventTypeEnum { ATTRIBUTE_CREATED = 'ATTRIBUTE_CREATED', ATTRIBUTE_UPDATED = 'ATTRIBUTE_UPDATED', ATTRIBUTE_DELETED = 'ATTRIBUTE_DELETED', + ATTRIBUTE_VALUE_CREATED = 'ATTRIBUTE_VALUE_CREATED', + ATTRIBUTE_VALUE_UPDATED = 'ATTRIBUTE_VALUE_UPDATED', + ATTRIBUTE_VALUE_DELETED = 'ATTRIBUTE_VALUE_DELETED', CATEGORY_CREATED = 'CATEGORY_CREATED', CATEGORY_UPDATED = 'CATEGORY_UPDATED', CATEGORY_DELETED = 'CATEGORY_DELETED', @@ -5289,6 +5335,7 @@ export enum WebhookSampleEventTypeEnum { INVOICE_SENT = 'INVOICE_SENT', CUSTOMER_CREATED = 'CUSTOMER_CREATED', CUSTOMER_UPDATED = 'CUSTOMER_UPDATED', + CUSTOMER_DELETED = 'CUSTOMER_DELETED', COLLECTION_CREATED = 'COLLECTION_CREATED', COLLECTION_UPDATED = 'COLLECTION_UPDATED', COLLECTION_DELETED = 'COLLECTION_DELETED', @@ -6308,6 +6355,8 @@ type Metadata_Category_Fragment = { __typename: 'Category', metadata: Array<{ __ type Metadata_Checkout_Fragment = { __typename: 'Checkout', metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> }; +type Metadata_CheckoutLine_Fragment = { __typename: 'CheckoutLine', metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> }; + type Metadata_Collection_Fragment = { __typename: 'Collection', metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> }; type Metadata_DigitalContent_Fragment = { __typename: 'DigitalContent', metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> }; @@ -6324,6 +6373,8 @@ type Metadata_MenuItem_Fragment = { __typename: 'MenuItem', metadata: Array<{ __ type Metadata_Order_Fragment = { __typename: 'Order', metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> }; +type Metadata_OrderLine_Fragment = { __typename: 'OrderLine', metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> }; + type Metadata_Page_Fragment = { __typename: 'Page', metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> }; type Metadata_PageType_Fragment = { __typename: 'PageType', metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> }; @@ -6352,7 +6403,7 @@ type Metadata_Voucher_Fragment = { __typename: 'Voucher', metadata: Array<{ __ty type Metadata_Warehouse_Fragment = { __typename: 'Warehouse', metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> }; -export type MetadataFragment = Metadata_App_Fragment | Metadata_Attribute_Fragment | Metadata_Category_Fragment | Metadata_Checkout_Fragment | Metadata_Collection_Fragment | Metadata_DigitalContent_Fragment | Metadata_Fulfillment_Fragment | Metadata_GiftCard_Fragment | Metadata_Invoice_Fragment | Metadata_Menu_Fragment | Metadata_MenuItem_Fragment | Metadata_Order_Fragment | Metadata_Page_Fragment | Metadata_PageType_Fragment | Metadata_Payment_Fragment | Metadata_Product_Fragment | Metadata_ProductType_Fragment | Metadata_ProductVariant_Fragment | Metadata_Sale_Fragment | Metadata_ShippingMethod_Fragment | Metadata_ShippingMethodType_Fragment | Metadata_ShippingZone_Fragment | Metadata_TransactionItem_Fragment | Metadata_User_Fragment | Metadata_Voucher_Fragment | Metadata_Warehouse_Fragment; +export type MetadataFragment = Metadata_App_Fragment | Metadata_Attribute_Fragment | Metadata_Category_Fragment | Metadata_Checkout_Fragment | Metadata_CheckoutLine_Fragment | Metadata_Collection_Fragment | Metadata_DigitalContent_Fragment | Metadata_Fulfillment_Fragment | Metadata_GiftCard_Fragment | Metadata_Invoice_Fragment | Metadata_Menu_Fragment | Metadata_MenuItem_Fragment | Metadata_Order_Fragment | Metadata_OrderLine_Fragment | Metadata_Page_Fragment | Metadata_PageType_Fragment | Metadata_Payment_Fragment | Metadata_Product_Fragment | Metadata_ProductType_Fragment | Metadata_ProductVariant_Fragment | Metadata_Sale_Fragment | Metadata_ShippingMethod_Fragment | Metadata_ShippingMethodType_Fragment | Metadata_ShippingZone_Fragment | Metadata_TransactionItem_Fragment | Metadata_User_Fragment | Metadata_Voucher_Fragment | Metadata_Warehouse_Fragment; export type MenuFragment = { __typename: 'Menu', id: string, name: string, items: Array<{ __typename: 'MenuItem', id: string }> | null }; @@ -7836,7 +7887,7 @@ export type SearchWarehousesQueryVariables = Exact<{ }>; -export type SearchWarehousesQuery = { __typename: 'Query', search: { __typename: 'WarehouseCountableConnection', edges: Array<{ __typename: 'WarehouseCountableEdge', node: { __typename: 'Warehouse', id: string, name: string } }>, pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null } } | null }; +export type SearchWarehousesQuery = { __typename: 'Query', search: { __typename: 'WarehouseCountableConnection', totalCount: number | null, edges: Array<{ __typename: 'WarehouseCountableEdge', node: { __typename: 'Warehouse', id: string, name: string } }>, pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null } } | null }; export type DeleteShippingZoneMutationVariables = Exact<{ id: Scalars['ID']; @@ -8327,7 +8378,7 @@ export type UpdateMetadataMutationVariables = Exact<{ }>; -export type UpdateMetadataMutation = { __typename: 'Mutation', updateMetadata: { __typename: 'UpdateMetadata', errors: Array<{ __typename: 'MetadataError', code: MetadataErrorCode, field: string | null, message: string | null }>, item: { __typename: 'App', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Attribute', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Category', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Checkout', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Collection', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'DigitalContent', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Fulfillment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'GiftCard', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Invoice', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Menu', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'MenuItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Order', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Page', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'PageType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Payment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Product', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductVariant', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Sale', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethod', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethodType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingZone', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'TransactionItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'User', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Voucher', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Warehouse', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | null } | null, deleteMetadata: { __typename: 'DeleteMetadata', errors: Array<{ __typename: 'MetadataError', code: MetadataErrorCode, field: string | null, message: string | null }>, item: { __typename: 'App', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Attribute', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Category', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Checkout', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Collection', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'DigitalContent', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Fulfillment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'GiftCard', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Invoice', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Menu', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'MenuItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Order', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Page', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'PageType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Payment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Product', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductVariant', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Sale', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethod', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethodType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingZone', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'TransactionItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'User', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Voucher', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Warehouse', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | null } | null }; +export type UpdateMetadataMutation = { __typename: 'Mutation', updateMetadata: { __typename: 'UpdateMetadata', errors: Array<{ __typename: 'MetadataError', code: MetadataErrorCode, field: string | null, message: string | null }>, item: { __typename: 'App', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Attribute', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Category', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Checkout', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'CheckoutLine', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Collection', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'DigitalContent', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Fulfillment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'GiftCard', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Invoice', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Menu', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'MenuItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Order', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'OrderLine', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Page', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'PageType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Payment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Product', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductVariant', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Sale', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethod', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethodType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingZone', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'TransactionItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'User', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Voucher', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Warehouse', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | null } | null, deleteMetadata: { __typename: 'DeleteMetadata', errors: Array<{ __typename: 'MetadataError', code: MetadataErrorCode, field: string | null, message: string | null }>, item: { __typename: 'App', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Attribute', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Category', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Checkout', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'CheckoutLine', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Collection', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'DigitalContent', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Fulfillment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'GiftCard', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Invoice', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Menu', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'MenuItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Order', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'OrderLine', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Page', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'PageType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Payment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Product', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductVariant', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Sale', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethod', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethodType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingZone', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'TransactionItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'User', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Voucher', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Warehouse', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | null } | null }; export type UpdatePrivateMetadataMutationVariables = Exact<{ id: Scalars['ID']; @@ -8336,7 +8387,7 @@ export type UpdatePrivateMetadataMutationVariables = Exact<{ }>; -export type UpdatePrivateMetadataMutation = { __typename: 'Mutation', updatePrivateMetadata: { __typename: 'UpdatePrivateMetadata', errors: Array<{ __typename: 'MetadataError', code: MetadataErrorCode, field: string | null, message: string | null }>, item: { __typename: 'App', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Attribute', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Category', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Checkout', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Collection', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'DigitalContent', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Fulfillment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'GiftCard', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Invoice', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Menu', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'MenuItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Order', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Page', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'PageType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Payment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Product', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductVariant', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Sale', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethod', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethodType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingZone', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'TransactionItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'User', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Voucher', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Warehouse', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | null } | null, deletePrivateMetadata: { __typename: 'DeletePrivateMetadata', errors: Array<{ __typename: 'MetadataError', code: MetadataErrorCode, field: string | null, message: string | null }>, item: { __typename: 'App', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Attribute', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Category', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Checkout', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Collection', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'DigitalContent', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Fulfillment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'GiftCard', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Invoice', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Menu', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'MenuItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Order', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Page', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'PageType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Payment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Product', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductVariant', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Sale', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethod', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethodType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingZone', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'TransactionItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'User', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Voucher', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Warehouse', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | null } | null }; +export type UpdatePrivateMetadataMutation = { __typename: 'Mutation', updatePrivateMetadata: { __typename: 'UpdatePrivateMetadata', errors: Array<{ __typename: 'MetadataError', code: MetadataErrorCode, field: string | null, message: string | null }>, item: { __typename: 'App', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Attribute', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Category', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Checkout', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'CheckoutLine', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Collection', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'DigitalContent', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Fulfillment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'GiftCard', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Invoice', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Menu', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'MenuItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Order', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'OrderLine', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Page', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'PageType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Payment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Product', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductVariant', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Sale', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethod', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethodType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingZone', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'TransactionItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'User', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Voucher', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Warehouse', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | null } | null, deletePrivateMetadata: { __typename: 'DeletePrivateMetadata', errors: Array<{ __typename: 'MetadataError', code: MetadataErrorCode, field: string | null, message: string | null }>, item: { __typename: 'App', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Attribute', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Category', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Checkout', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'CheckoutLine', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Collection', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'DigitalContent', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Fulfillment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'GiftCard', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Invoice', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Menu', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'MenuItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Order', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'OrderLine', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Page', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'PageType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Payment', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Product', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ProductVariant', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Sale', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethod', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingMethodType', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'ShippingZone', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'TransactionItem', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'User', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Voucher', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | { __typename: 'Warehouse', id: string, metadata: Array<{ __typename: 'MetadataItem', key: string, value: string }>, privateMetadata: Array<{ __typename: 'MetadataItem', key: string, value: string }> } | null } | null }; export type WarehouseDeleteMutationVariables = Exact<{ id: Scalars['ID']; @@ -8379,6 +8430,13 @@ export type WarehouseDetailsQueryVariables = Exact<{ export type WarehouseDetailsQuery = { __typename: 'Query', warehouse: { __typename: 'Warehouse', isPrivate: boolean, clickAndCollectOption: WarehouseClickAndCollectOptionEnum, id: string, name: string, address: { __typename: 'Address', city: string, cityArea: string, companyName: string, countryArea: string, firstName: string, id: string, lastName: string, phone: string | null, postalCode: string, streetAddress1: string, streetAddress2: string, country: { __typename: 'CountryDisplay', code: string, country: string } }, shippingZones: { __typename: 'ShippingZoneCountableConnection', edges: Array<{ __typename: 'ShippingZoneCountableEdge', node: { __typename: 'ShippingZone', id: string, name: string } }> } } | null }; +export type ChannelWarehousesQueryVariables = Exact<{ + filter?: InputMaybe; +}>; + + +export type ChannelWarehousesQuery = { __typename: 'Query', warehouses: { __typename: 'WarehouseCountableConnection', edges: Array<{ __typename: 'WarehouseCountableEdge', node: { __typename: 'Warehouse', id: string, name: string } }> } | null }; + export type WebhookCreateMutationVariables = Exact<{ input: WebhookCreateInput; }>; diff --git a/src/intl.ts b/src/intl.ts index 63c6a0384..df3b635bc 100644 --- a/src/intl.ts +++ b/src/intl.ts @@ -447,6 +447,11 @@ export const sectionNames = defineMessages({ defaultMessage: "Shipping Methods", description: "shipping section name", }, + shippingZones: { + id: "V1MytH", + defaultMessage: "Shipping Zones", + description: "shipping zones section name", + }, siteSettings: { id: "viFkCw", defaultMessage: "Site Settings", diff --git a/src/orders/fixtures.ts b/src/orders/fixtures.ts index 5f29881f3..a64c6f2ca 100644 --- a/src/orders/fixtures.ts +++ b/src/orders/fixtures.ts @@ -2319,6 +2319,7 @@ export const shopOrderSettings: ShopOrderSettingsFragment = { }; export const warehouseSearch: SearchWarehousesQuery["search"] = { + totalCount: 20, edges: [ { node: { diff --git a/src/products/components/ProductStocks/CardAddItemsFooter.tsx b/src/products/components/ProductStocks/CardAddItemsFooter.tsx index dffc96de8..2e4a3c9d5 100644 --- a/src/products/components/ProductStocks/CardAddItemsFooter.tsx +++ b/src/products/components/ProductStocks/CardAddItemsFooter.tsx @@ -2,7 +2,6 @@ import AddIcon from "@material-ui/icons/Add"; import Link from "@saleor/components/Link"; import { IconButton, makeStyles } from "@saleor/macaw-ui"; import React, { MutableRefObject } from "react"; -import { MessageDescriptor, useIntl } from "react-intl"; const useStyles = makeStyles( theme => ({ @@ -21,7 +20,7 @@ const useStyles = makeStyles( ); interface CardAddItemsFooterProps { - title: MessageDescriptor; + title: string; onAdd: () => void; testIds: { link: string; @@ -37,13 +36,12 @@ const CardAddItemsFooter: React.FC = ({ ref, children, }) => { - const intl = useIntl(); const classes = useStyles({}); return (
- {intl.formatMessage(title)} + {title} void; } -const useStyles = makeStyles( - theme => ({ - colAction: { - padding: 0, - width: `calc(${ICONBUTTON_SIZE}px + ${theme.spacing(1)})`, - }, - colName: {}, - colQuantity: { - textAlign: "right", - width: 150, - }, - colSoldUnits: { - textAlign: "right", - width: 150, - }, - colThreshold: { - textAlign: "right", - width: 180, - }, - editWarehouses: { - marginRight: theme.spacing(-1), - }, - input: { - padding: theme.spacing(1.5), - textAlign: "right", - }, - menuItem: { - "&:not(:last-of-type)": { - marginBottom: theme.spacing(2), - }, - }, - noWarehouseInfo: { - marginTop: theme.spacing(), - }, - paper: { - padding: theme.spacing(2), - }, - popper: { - marginTop: theme.spacing(1), - zIndex: 2, - }, - quantityContainer: { - paddingTop: theme.spacing(), - }, - quantityHeader: { - alignItems: "center", - display: "flex", - justifyContent: "space-between", - }, - skuInputContainer: { - display: "grid", - gridColumnGap: theme.spacing(3), - gridTemplateColumns: "repeat(2, 1fr)", - }, - dateTimeInputs: { - marginTop: theme.spacing(2), - marginBottom: theme.spacing(2), - }, - preorderInfo: { - marginBottom: theme.spacing(2), - marginTop: theme.spacing(2), - display: "block", - }, - caption: { - fontSize: 14, - }, - thresholdRow: { - display: "grid", - gridColumnGap: theme.spacing(3), - gridTemplateColumns: "3fr 1fr", - marginTop: theme.spacing(1), - }, - thresholdInput: { - maxWidth: 400, - }, - preorderItemsLeftCount: { - fontSize: 14, - paddingTop: theme.spacing(2), - textAlign: "center", - }, - preorderLimitInfo: { - marginTop: theme.spacing(3), - }, - preview: { - marginLeft: theme.spacing(1), - }, - }), - { - name: "ProductStocks", - }, -); - const ProductStocks: React.FC = ({ data, disabled, @@ -200,7 +104,7 @@ const ProductStocks: React.FC = ({ onWarehouseStockDelete, onWarehouseConfigure, }) => { - const classes = useStyles({}); + const classes = useStyles(); const intl = useIntl(); const anchor = React.useRef(); const [isExpanded, setExpansionState] = React.useState(false); @@ -218,13 +122,7 @@ const ProductStocks: React.FC = ({ return ( - +
= ({ error={!!formErrors.sku} fullWidth helperText={getProductErrorMessage(formErrors.sku, intl)} - label={intl.formatMessage({ - id: "xB7BTp", - defaultMessage: "SKU (Stock Keeping Unit)", - })} + label={intl.formatMessage(messages.sku)} name="sku" onChange={onFormDataChange} value={data.sku} @@ -252,11 +147,7 @@ const ProductStocks: React.FC = ({ disabled={disabled} label={ <> - + } @@ -272,16 +163,9 @@ const ProductStocks: React.FC = ({ disabled={disabled} label={ <> - + - + } @@ -295,14 +179,18 @@ const ProductStocks: React.FC = ({
- +
+ {!productVariantChannelListings?.length && ( + <> + + + + + + )} {!warehouses?.length && ( = ({ {hasVariants ? ( <> ( {chunks} @@ -325,9 +211,7 @@ const ProductStocks: React.FC = ({ ) : ( <> ( {chunks} @@ -340,149 +224,130 @@ const ProductStocks: React.FC = ({ )} )} - {warehouses?.length > 0 && !data.isPreorder && ( - - - - - - - - - - - - - - - - - - - - - - {renderCollection(stocks, stock => { - const handleQuantityChange = createNonNegativeValueChangeHandler( - event => onChange(stock.id, event.target.value), - ); + {productVariantChannelListings?.length > 0 && + warehouses?.length > 0 && + !data.isPreorder && ( +
+ + + + + + + + + + + + + + + + + + + + + {renderCollection(stocks, stock => { + const handleQuantityChange = createNonNegativeValueChangeHandler( + event => onChange(stock.id, event.target.value), + ); - return ( - - - {stock.label} - - - {stock.data?.quantityAllocated || 0} - - - + return ( + + + {stock.label} + + + {stock.data?.quantityAllocated || 0} + + + + + + onWarehouseStockDelete(stock.id)} + > + + + + + ); + })} + {warehousesToAssign.length > 0 && ( + + + + + - onWarehouseStockDelete(stock.id)} + setExpansionState(false)} > - - +
+ setExpansionState(!isExpanded)} + > + + + + {({ TransitionProps }) => ( + + + {warehousesToAssign.map(warehouse => ( + + onWarehouseStockAdd(warehouse.id) + } + > + {warehouse.name} + + ))} + + + )} + +
+
- ); - })} - {warehousesToAssign.length > 0 && ( - - - - - - - - setExpansionState(false)} - > -
- setExpansionState(!isExpanded)} - > - - - - {({ TransitionProps }) => ( - - - {warehousesToAssign.map(warehouse => ( - - onWarehouseStockAdd(warehouse.id) - } - > - {warehouse.name} - - ))} - - - )} - -
-
-
-
- )} -
-
- )} + )} + + + )} {data.isPreorder && ( - {intl.formatMessage({ - id: "REVk27", - defaultMessage: - "Set up an end date of preorder. When end date will be reached product will be automatically taken from preorder to standard selling", - description: "info text", - })} + {data.hasPreorderEndDate && ( @@ -519,22 +384,11 @@ const ProductStocks: React.FC = ({ } > {data.hasPreorderEndDate - ? intl.formatMessage({ - id: "2qJc9y", - defaultMessage: "CANCEL END DATE", - }) - : intl.formatMessage({ - id: "7Ii5ZQ", - defaultMessage: "SETUP END DATE", - })} + ? intl.formatMessage(messages.endDateCancel) + : intl.formatMessage(messages.endDateSetup)} - {intl.formatMessage({ - id: "Gz+4CI", - defaultMessage: - "Preordered products will be available in all warehouses. You can set a threshold for sold quantity. Leaving input blank will be interpreted as no limit to sale. Sold items will be allocated at the warehouse assigned to chosen shipping zone.", - description: "info text", - })} +
= ({ }} disabled={disabled} fullWidth - helperText={intl.formatMessage({ - id: "NcY4ph", - defaultMessage: - "Threshold that cannot be exceeded even if per channel thresholds are still available", - })} - label={intl.formatMessage({ - id: "RJ5QxE", - defaultMessage: "Global threshold", - })} + helperText={intl.formatMessage( + messages.preorderTresholdDescription, + )} + label={intl.formatMessage(messages.preorderTresholdLabel)} name="globalThreshold" onChange={onThresholdChange} value={data.globalThreshold ?? ""} @@ -563,19 +412,10 @@ const ProductStocks: React.FC = ({ className={classes.preorderItemsLeftCount} > {data.globalThreshold - ? intl.formatMessage( - { - id: "7wkGxW", - defaultMessage: "{unitsLeft} units left", - description: "app has been installed", - }, - { unitsLeft }, - ) - : intl.formatMessage({ - id: "CEavJt", - defaultMessage: "Unlimited", - description: "section header", - })} + ? intl.formatMessage(messages.preorderTresholdUnitsLeft, { + unitsLeft, + }) + : intl.formatMessage(messages.preorderTresholdUnlimited)} )}
@@ -592,25 +432,13 @@ const ProductStocks: React.FC = ({ - + - + - + @@ -638,10 +466,9 @@ const ProductStocks: React.FC = ({ min: 0, type: "number", }} - placeholder={intl.formatMessage({ - id: "ekXood", - defaultMessage: "Unlimited", - })} + placeholder={intl.formatMessage( + messages.preorderTresholdUnlimited, + )} onChange={e => { onVariantChannelListingChange(listing.id, { costPrice: listing.costPrice, diff --git a/src/products/components/ProductStocks/messages.ts b/src/products/components/ProductStocks/messages.ts new file mode 100644 index 000000000..3c0c2bbad --- /dev/null +++ b/src/products/components/ProductStocks/messages.ts @@ -0,0 +1,121 @@ +import { defineMessages } from "react-intl"; + +export const messages = defineMessages({ + title: { + id: "4qe6hO", + defaultMessage: "Inventory", + description: "product stock, section header", + }, + sku: { + id: "SM+yG0", + defaultMessage: "SKU (Stock Keeping Unit)", + description: "input label", + }, + variantInPreorder: { + id: "eAFU/E", + defaultMessage: "Variant currently in preorder", + description: "product inventory, checkbox", + }, + trackInventory: { + id: "TjGYna", + defaultMessage: "Track Inventory", + description: "product inventory, checkbox", + }, + trackInventoryDescription: { + id: "Wyl25+", + defaultMessage: + "Active inventory tracking will automatically calculate changes of stock", + description: "product inventory, checkbox description", + }, + quantity: { + id: "bp/i0x", + defaultMessage: "Quantity", + description: "header", + }, + warehouseName: { + id: "ErvPaM", + defaultMessage: "Warehouse Name", + description: "header", + }, + allocated: { + id: "/C//FB", + defaultMessage: "Allocated", + description: "header, allocated product quantity", + }, + noChannelWarehousesAllocation: { + id: "taS/08", + defaultMessage: + "Assign this variant to a channel in the product channel manager to define warehouses allocation", + description: "variant stocks section subtitle", + }, + configureWarehouseForVariant: { + id: "D8nsBc", + defaultMessage: + "There are no warehouses set up for your store. To add stock quantity to the variant please configure a warehouse", + description: "no warehouses info", + }, + configureWarehouseForProduct: { + id: "RLBLPQ", + defaultMessage: + "There are no warehouses set up for your store. To add stock quantity to the product please configure a warehouse", + description: "no warehouses info", + }, + assignWarehouse: { + id: "cBHRxx", + defaultMessage: "Assign Warehouse", + description: "button", + }, + preorderEndDateSetup: { + id: "REVk27", + defaultMessage: + "Set up an end date of preorder. When end date will be reached product will be automatically taken from preorder to standard selling", + description: "info text", + }, + endDateCancel: { + id: "v9ILn/", + defaultMessage: "CANCEL END DATE", + description: "button", + }, + endDateSetup: { + id: "9IWg/f", + defaultMessage: "SETUP END DATE", + description: "button", + }, + preorderProductsAvailability: { + id: "Gz+4CI", + defaultMessage: + "Preordered products will be available in all warehouses. You can set a threshold for sold quantity. Leaving input blank will be interpreted as no limit to sale. Sold items will be allocated at the warehouse assigned to chosen shipping zone.", + description: "info text", + }, + preorderTresholdLabel: { + id: "/iijFq", + defaultMessage: "Global threshold", + description: "input label", + }, + preorderTresholdDescription: { + id: "HYC6cH", + defaultMessage: + "Threshold that cannot be exceeded even if per channel thresholds are still available", + description: "input description", + }, + preorderTresholdUnitsLeft: { + id: "JkO0jp", + defaultMessage: "{unitsLeft} units left", + description: "input description", + }, + preorderTresholdUnlimited: { + id: "tlGXkh", + defaultMessage: "Unlimited", + description: "input description", + }, + soldUnits: { + id: "HcQEUk", + defaultMessage: "Sold units", + description: "table column header, sold units preorder quantity", + }, + channelTreshold: { + id: "MNZY28", + defaultMessage: "Channel threshold", + description: "table column header", + }, +}); diff --git a/src/products/components/ProductStocks/styles.ts b/src/products/components/ProductStocks/styles.ts new file mode 100644 index 000000000..8579b6523 --- /dev/null +++ b/src/products/components/ProductStocks/styles.ts @@ -0,0 +1,93 @@ +import { ICONBUTTON_SIZE, makeStyles } from "@saleor/macaw-ui"; + +export const useStyles = makeStyles( + theme => ({ + colAction: { + padding: 0, + width: `calc(${ICONBUTTON_SIZE}px + ${theme.spacing(1)})`, + }, + colName: {}, + colQuantity: { + textAlign: "right", + width: 150, + }, + colSoldUnits: { + textAlign: "right", + width: 150, + }, + colThreshold: { + textAlign: "right", + width: 180, + }, + editWarehouses: { + marginRight: theme.spacing(-1), + }, + input: { + padding: theme.spacing(1.5), + textAlign: "right", + }, + menuItem: { + "&:not(:last-of-type)": { + marginBottom: theme.spacing(2), + }, + }, + noWarehouseInfo: { + marginTop: theme.spacing(), + }, + paper: { + padding: theme.spacing(2), + }, + popper: { + marginTop: theme.spacing(1), + zIndex: 2, + }, + quantityContainer: { + paddingTop: theme.spacing(), + }, + quantityHeader: { + alignItems: "center", + display: "flex", + justifyContent: "space-between", + }, + skuInputContainer: { + display: "grid", + gridColumnGap: theme.spacing(3), + gridTemplateColumns: "repeat(2, 1fr)", + }, + dateTimeInputs: { + marginTop: theme.spacing(2), + marginBottom: theme.spacing(2), + }, + preorderInfo: { + marginBottom: theme.spacing(2), + marginTop: theme.spacing(2), + display: "block", + }, + caption: { + fontSize: 14, + }, + thresholdRow: { + display: "grid", + gridColumnGap: theme.spacing(3), + gridTemplateColumns: "3fr 1fr", + marginTop: theme.spacing(1), + }, + thresholdInput: { + maxWidth: 400, + }, + preorderItemsLeftCount: { + fontSize: 14, + paddingTop: theme.spacing(2), + textAlign: "center", + }, + preorderLimitInfo: { + marginTop: theme.spacing(3), + }, + preview: { + marginLeft: theme.spacing(1), + }, + }), + { + name: "ProductStocks", + }, +); diff --git a/src/products/views/ProductCreate/ProductCreate.tsx b/src/products/views/ProductCreate/ProductCreate.tsx index e51c2ef72..47c591c22 100644 --- a/src/products/views/ProductCreate/ProductCreate.tsx +++ b/src/products/views/ProductCreate/ProductCreate.tsx @@ -112,12 +112,6 @@ export const ProductCreateView: React.FC = ({ params }) => { result: searchAttributeValuesOpts, reset: searchAttributeReset, } = useAttributeValueSearchHandler(DEFAULT_INITIAL_SEARCH_DATA); - const warehouses = useWarehouseListQuery({ - displayLoader: true, - variables: { - first: 50, - }, - }); const [updateMetadata] = useUpdateMetadataMutation({}); const [updatePrivateMetadata] = useUpdatePrivateMetadataMutation({}); const taxTypes = useTaxTypeListQuery({}); @@ -160,6 +154,16 @@ export const ProductCreateView: React.FC = ({ params }) => { }, ); + const warehouses = useWarehouseListQuery({ + displayLoader: true, + variables: { + first: 50, + filter: { + channels: currentChannels.map(channel => channel.id), + }, + }, + }); + const handleSuccess = (productId: string) => { notify({ status: "success", diff --git a/src/products/views/ProductUpdate/ProductUpdate.tsx b/src/products/views/ProductUpdate/ProductUpdate.tsx index 53cf4ac22..45ca5ffc7 100644 --- a/src/products/views/ProductUpdate/ProductUpdate.tsx +++ b/src/products/views/ProductUpdate/ProductUpdate.tsx @@ -156,12 +156,6 @@ export const ProductUpdate: React.FC = ({ id, params }) => { result: searchAttributeValuesOpts, reset: searchAttributeReset, } = useAttributeValueSearchHandler(DEFAULT_INITIAL_SEARCH_DATA); - const warehouses = useWarehouseListQuery({ - displayLoader: true, - variables: { - first: 50, - }, - }); const shop = useShop(); const [updateMetadata] = useUpdateMetadataMutation({}); const [updatePrivateMetadata] = useUpdatePrivateMetadataMutation({}); @@ -324,6 +318,16 @@ export const ProductUpdate: React.FC = ({ id, params }) => { { formId: PRODUCT_UPDATE_FORM_ID }, ); + const warehouses = useWarehouseListQuery({ + displayLoader: true, + variables: { + first: 50, + filter: { + channels: currentChannels.map(channel => channel.id), + }, + }, + }); + const [ updateChannels, updateChannelsOpts, diff --git a/src/products/views/ProductVariant.tsx b/src/products/views/ProductVariant.tsx index fd414b2cf..a26fb0f26 100644 --- a/src/products/views/ProductVariant.tsx +++ b/src/products/views/ProductVariant.tsx @@ -82,13 +82,6 @@ export const ProductVariant: React.FC = ({ setErrors([]); }, [variantId]); - const warehouses = useWarehouseListQuery({ - displayLoader: true, - variables: { - first: 50, - }, - }); - const { data, loading } = useProductVariantDetailsQuery({ displayLoader: true, variables: { @@ -196,6 +189,16 @@ export const ProductVariant: React.FC = ({ const variant = data?.productVariant; const channels = createVariantChannels(variant); + const warehouses = useWarehouseListQuery({ + displayLoader: true, + variables: { + first: 50, + filter: { + channels: channels.map(channel => channel.id), + }, + }, + }); + const [ deactivatePreorder, deactivatePreoderOpts, diff --git a/src/searches/useWarehouseSearch.ts b/src/searches/useWarehouseSearch.ts index 080839869..b7c9593b6 100644 --- a/src/searches/useWarehouseSearch.ts +++ b/src/searches/useWarehouseSearch.ts @@ -14,6 +14,7 @@ export const searchWarehouses = gql` sortBy: { direction: ASC, field: NAME } filter: { search: $query } ) { + totalCount edges { node { id diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 730926308..a7e2ffef7 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -23989,323 +23989,6 @@ exports[`Storyshots Shipping / UnassignDialog default 1`] = ` /> `; -exports[`Storyshots Shipping zones card with no options selected 1`] = ` -
-
-
-
- - Shipping Zones - -
-
-
-
- Select shipping zones that will be supplied via this channel. You can assign shipping zones to multiple channels. -
-
-
-
- -
-
-
-
-
-
-
-
- All available shipping zones have been selected -
-
-
-
-
-
-
-
-`; - -exports[`Storyshots Shipping zones card with options selected 1`] = ` -
-
-
-
- - Shipping Zones - -
-
-
-
- Select shipping zones that will be supplied via this channel. You can assign shipping zones to multiple channels. -
-
-
-
- -
-
-
-
-
-
-
-
-
- Fancy shipping zone -
- -
-
-
-
- Nice shipping zone -
- -
-
- -
-
-
-
-
-
-
-`; - exports[`Storyshots Shipping zones details / Settings Card default 1`] = `
`; +exports[`Storyshots Shipping zones with no options selected 1`] = ` +
+
+
+
+ + Shipping Zones + +
+
+
+
+ Select shipping zones that will be supplied via this channel. You can assign shipping zones to multiple channels. +
+
+
+
+ +
+
+
+
+
+
+
+
+ All available shipping zones have been selected +
+
+
+
+
+
+
+
+`; + +exports[`Storyshots Shipping zones with options selected 1`] = ` +
+
+
+
+ + Shipping Zones + +
+
+
+
+ Select shipping zones that will be supplied via this channel. You can assign shipping zones to multiple channels. +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ Fancy shipping zone +
+ +
+
+
+
+ Nice shipping zone +
+ +
+
+ +
+
+
+
+
+
+
+`; + exports[`Storyshots TypeDeleteWarningDialog.stories loading 1`] = `
+
+
+
+
+ + Warehouses + +
+
+
+
+ Select warehouses that will be used in this channel. You can assign warehouses to multiple channels. +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ Warehouse 1 +
+ +
+
+
+
+ Warehouse 2 +
+ +
+
+
+ + Add Warehouses + + +
+
+
+
+
+
+
+
+
+
+
+ + Warehouses + +
+
+
+
+ Select warehouses that will be used in this channel. You can assign warehouses to multiple channels. +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ Warehouse 1 +
+ +
+
+
+
+ Warehouse 2 +
+ +
+
+
+ + Add Warehouses + + +
+
+
+
+
+
+
+
+
+
+
+ + Warehouses + +
+
+
+
+ Select warehouses that will be used in this channel. You can assign warehouses to multiple channels. +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ Warehouse 1 +
+ +
+
+
+
+ Warehouse 2 +
+ +
+
+
+ + Add Warehouses + + +
+
+
+
+
+
+
+
+
+
+
+ + Warehouses + +
+
+
+
+ Select warehouses that will be used in this channel. You can assign warehouses to multiple channels. +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ Warehouse 1 +
+ +
+
+
+
+ Warehouse 2 +
+ +
+
+
+ + Add Warehouses + + +
+
+
+
+
+
+
+
+
+
+
+ + Warehouses + +
+
+
+
+ Select warehouses that will be used in this channel. You can assign warehouses to multiple channels. +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ Warehouse 1 +
+ +
+
+
+
+ Warehouse 2 +
+ +
+
+
+ + Add Warehouses + + +
+
+
+
+
+
+
+
+
+
+
+ + Warehouses + +
+
+
+
+ Select warehouses that will be used in this channel. You can assign warehouses to multiple channels. +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ Warehouse 1 +
+ +
+
+
+
+ Warehouse 2 +
+ +
+
+
+ + Add Warehouses + +
+
+
+ Assign this variant to a channel in the product channel manager to define warehouses allocation +
- - - - - - - - - - - - - - - - - - - -
- Warehouse Name - - Allocated - - Quantity - -
-
- Assign Warehouse -
-
-
- -
-
+
+
+ Assign this variant to a channel in the product channel manager to define warehouses allocation +
- - - - - - - - - - - - - - - - - - - -
- Warehouse Name - - Allocated - - Quantity - -
-
- Assign Warehouse -
-
-
- -
-
+
+
+ Assign this variant to a channel in the product channel manager to define warehouses allocation +
@@ -188813,102 +189859,15 @@ exports[`Storyshots Views / Products / Create product variant when loading data
+
+
+ Assign this variant to a channel in the product channel manager to define warehouses allocation +
- - - - - - - - - - - - - - - - - - - -
- Warehouse Name - - Allocated - - Quantity - -
-
- Assign Warehouse -
-
-
- -
-
+
+
+ Assign this variant to a channel in the product channel manager to define warehouses allocation +
- - - - - - - - - - - - - - - - - - - -
- Warehouse Name - - Allocated - - Quantity - -
-
- Assign Warehouse -
-
-
- -
-
+
+
+ Assign this variant to a channel in the product channel manager to define warehouses allocation +
- - - - - - - - - - - - - - - - - - - -
- Warehouse Name - - Allocated - - Quantity - -
-
- Assign Warehouse -
-
-
- -
-
`; + +exports[`Storyshots Warehouses with no options selected 1`] = ` +
+
+
+
+ + Warehouses + +
+
+
+
+ Select warehouses that will be used in this channel. You can assign warehouses to multiple channels. +
+
+
+
+ +
+
+
+
+
+
+
+
+ All available warehouses have been selected +
+
+
+
+
+
+
+
+`; + +exports[`Storyshots Warehouses with options selected 1`] = ` +
+
+
+
+ + Warehouses + +
+
+
+
+ Select warehouses that will be used in this channel. You can assign warehouses to multiple channels. +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ Fancy warehouse +
+ +
+
+
+
+ Nice warehouse +
+ +
+
+
+ + Add Warehouses + + +
+
+
+
+
+
+
+
+`; diff --git a/src/warehouses/queries.ts b/src/warehouses/queries.ts index 3829b86c7..e1304c701 100644 --- a/src/warehouses/queries.ts +++ b/src/warehouses/queries.ts @@ -36,3 +36,17 @@ export const warehouseDetails = gql` } } `; + +// first: 100 - to be removed when we implement pagintion in ui for this query +export const channelWarehouses = gql` + query ChannelWarehouses($filter: WarehouseFilterInput) { + warehouses(filter: $filter, first: 100) { + edges { + node { + id + name + } + } + } + } +`;