diff --git a/introspection.json b/introspection.json index 6d1b18ba5..36a3cd5b4 100644 --- a/introspection.json +++ b/introspection.json @@ -2412,7 +2412,7 @@ }, { "name": "extensions", - "description": "New in Saleor 3.1. App's dashboard extensions.", + "description": "New in Saleor 3.1. App's dashboard extensions. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "NON_NULL", @@ -11014,7 +11014,7 @@ }, { "name": "availableCollectionPoints", - "description": "New in Saleor 3.1. Collection points that can be used for this order.", + "description": "New in Saleor 3.1. Collection points that can be used for this order. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "NON_NULL", @@ -11174,7 +11174,7 @@ }, { "name": "deliveryMethod", - "description": "New in Saleor 3.1. The delivery method selected for this checkout.", + "description": "New in Saleor 3.1. The delivery method selected for this checkout. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "UNION", @@ -11619,7 +11619,7 @@ "ofType": null }, "isDeprecated": true, - "deprecationReason": "This field will be removed in Saleor 4.0. Always returns `True`." + "deprecationReason": "This field will be removed in Saleor 4.0. Always returns `true`." }, { "name": "checkoutErrors", @@ -11923,7 +11923,7 @@ { "kind": "OBJECT", "name": "CheckoutDeliveryMethodUpdate", - "description": "New in Saleor 3.1. Updates the delivery method (shipping method or pick up point) of the checkout.", + "description": "New in Saleor 3.1. Updates the delivery method (shipping method or pick up point) of the checkout. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "checkout", @@ -18063,6 +18063,18 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "DateTimeRangeInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null } ], "interfaces": null, @@ -18541,7 +18553,7 @@ { "kind": "UNION", "name": "DeliveryMethod", - "description": "Represents a delivery method chosen for the checkout. `Warehouse` type is used when checkout is marked as \"click and collect\" and `ShippingMethod` otherwise.", + "description": "New in Saleor 3.1. Represents a delivery method chosen for the checkout. `Warehouse` type is used when checkout is marked as \"click and collect\" and `ShippingMethod` otherwise. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": null, "inputFields": null, "interfaces": null, @@ -21776,19 +21788,25 @@ "enumValues": [ { "name": "STATUS", - "description": "Sort export file by status.", + "description": null, "isDeprecated": false, "deprecationReason": null }, { "name": "CREATED_AT", - "description": "Sort export file by created at.", + "description": null, "isDeprecated": false, "deprecationReason": null }, { "name": "UPDATED_AT", - "description": "Sort export file by updated at.", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LAST_MODIFIED_AT", + "description": null, "isDeprecated": false, "deprecationReason": null } @@ -21841,7 +21859,7 @@ { "kind": "OBJECT", "name": "ExportGiftCards", - "description": "New in Saleor 3.1. Export gift cards to csv file.", + "description": "New in Saleor 3.1. Export gift cards to csv file. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "exportFile", @@ -24014,7 +24032,7 @@ }, { "name": "createdBy", - "description": "New in Saleor 3.1. The user who bought or issued a gift card.", + "description": "New in Saleor 3.1. The user who bought or issued a gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "OBJECT", @@ -24026,7 +24044,7 @@ }, { "name": "usedBy", - "description": "New in Saleor 3.1. The customer who used a gift card.", + "description": "New in Saleor 3.1. The customer who used a gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "OBJECT", @@ -24038,7 +24056,7 @@ }, { "name": "createdByEmail", - "description": "New in Saleor 3.1. Email address of the user who bought or issued gift card.", + "description": "New in Saleor 3.1. Email address of the user who bought or issued gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "SCALAR", @@ -24050,7 +24068,7 @@ }, { "name": "usedByEmail", - "description": "New in Saleor 3.1. Email address of the customer who used a gift card.", + "description": "New in Saleor 3.1. Email address of the customer who used a gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "SCALAR", @@ -24086,7 +24104,7 @@ }, { "name": "app", - "description": "New in Saleor 3.1. App which created the gift card.", + "description": "New in Saleor 3.1. App which created the gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "OBJECT", @@ -24098,7 +24116,7 @@ }, { "name": "product", - "description": "New in Saleor 3.1. Related gift card product.", + "description": "New in Saleor 3.1. Related gift card product. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "OBJECT", @@ -24110,7 +24128,7 @@ }, { "name": "events", - "description": "New in Saleor 3.1. List of events associated with the gift card.", + "description": "New in Saleor 3.1. List of events associated with the gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "filter", @@ -24147,7 +24165,7 @@ }, { "name": "tags", - "description": "New in Saleor 3.1. The gift card tag.", + "description": "New in Saleor 3.1. The gift card tag. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "NON_NULL", @@ -24171,7 +24189,7 @@ }, { "name": "boughtInChannel", - "description": "{ADDED_IN_31} Slug of the channel where the gift card was bought.", + "description": "New in Saleor 3.1. Slug of the channel where the gift card was bought. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "SCALAR", @@ -24348,7 +24366,7 @@ { "kind": "OBJECT", "name": "GiftCardAddNote", - "description": "New in Saleor 3.1. Adds note to the gift card.", + "description": "New in Saleor 3.1. Adds note to the gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "giftCard", @@ -24434,7 +24452,7 @@ { "kind": "OBJECT", "name": "GiftCardBulkActivate", - "description": "New in Saleor 3.1. Activate gift cards.", + "description": "New in Saleor 3.1. Activate gift cards. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "count", @@ -24485,7 +24503,7 @@ { "kind": "OBJECT", "name": "GiftCardBulkCreate", - "description": "New in Saleor 3.1. Create gift cards.", + "description": "New in Saleor 3.1. Create gift cards. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "count", @@ -24651,7 +24669,7 @@ { "kind": "OBJECT", "name": "GiftCardBulkDeactivate", - "description": "New in Saleor 3.1. Deactivate gift cards.", + "description": "New in Saleor 3.1. Deactivate gift cards. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "count", @@ -24702,7 +24720,7 @@ { "kind": "OBJECT", "name": "GiftCardBulkDelete", - "description": "New in Saleor 3.1. Delete gift cards.", + "description": "New in Saleor 3.1. Delete gift cards. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "count", @@ -24935,7 +24953,7 @@ "inputFields": [ { "name": "addTags", - "description": "New in Saleor 3.1. The gift card tags to add.", + "description": "New in Saleor 3.1. The gift card tags to add. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "LIST", "name": null, @@ -24955,7 +24973,7 @@ }, { "name": "expiryDate", - "description": "New in Saleor 3.1. The gift card expiry date.", + "description": "New in Saleor 3.1. The gift card expiry date. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "SCALAR", "name": "Date", @@ -25019,7 +25037,7 @@ }, { "name": "channel", - "description": "New in Saleor 3.1. Slug of a channel from which the email should be sent.", + "description": "New in Saleor 3.1. Slug of a channel from which the email should be sent. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "SCALAR", "name": "String", @@ -25031,7 +25049,7 @@ }, { "name": "isActive", - "description": "New in Saleor 3.1. Determine if gift card is active.", + "description": "New in Saleor 3.1. Determine if gift card is active. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "NON_NULL", "name": null, @@ -25059,7 +25077,7 @@ }, { "name": "note", - "description": "New in Saleor 3.1. The gift card note from the staff member.", + "description": "New in Saleor 3.1. The gift card note from the staff member. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "SCALAR", "name": "String", @@ -25148,7 +25166,7 @@ { "kind": "OBJECT", "name": "GiftCardDelete", - "description": "New in Saleor 3.1. Delete gift card.", + "description": "New in Saleor 3.1. Delete gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "giftCardErrors", @@ -25349,7 +25367,7 @@ { "kind": "OBJECT", "name": "GiftCardEvent", - "description": "New in Saleor 3.1. History log of the gift card.", + "description": "New in Saleor 3.1. History log of the gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "id", @@ -25890,7 +25908,7 @@ { "kind": "OBJECT", "name": "GiftCardResend", - "description": "New in Saleor 3.1. Resend a gift card.", + "description": "New in Saleor 3.1. Resend a gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "giftCard", @@ -26288,7 +26306,7 @@ { "kind": "OBJECT", "name": "GiftCardTag", - "description": "New in Saleor 3.1. The gift card tag.", + "description": "New in Saleor 3.1. The gift card tag. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "id", @@ -26542,7 +26560,7 @@ "inputFields": [ { "name": "addTags", - "description": "New in Saleor 3.1. The gift card tags to add.", + "description": "New in Saleor 3.1. The gift card tags to add. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "LIST", "name": null, @@ -26562,7 +26580,7 @@ }, { "name": "expiryDate", - "description": "New in Saleor 3.1. The gift card expiry date.", + "description": "New in Saleor 3.1. The gift card expiry date. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "SCALAR", "name": "Date", @@ -26598,7 +26616,7 @@ }, { "name": "removeTags", - "description": "New in Saleor 3.1. The gift card tags to remove.", + "description": "New in Saleor 3.1. The gift card tags to remove. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "LIST", "name": null, @@ -26618,7 +26636,7 @@ }, { "name": "balanceAmount", - "description": "New in Saleor 3.1. The gift card balance amount.", + "description": "New in Saleor 3.1. The gift card balance amount. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "SCALAR", "name": "PositiveDecimal", @@ -27683,7 +27701,7 @@ { "kind": "SCALAR", "name": "JSONString", - "description": "Allows use of a JSON String for input / output from the GraphQL schema.\n\nUse of this type is *not recommended* as you lose the benefits of having a defined, static\nschema (one of the key benefits of GraphQL).", + "description": null, "fields": null, "inputFields": null, "interfaces": null, @@ -35250,6 +35268,12 @@ "description": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "NOT_UPDATED", + "description": null, + "isDeprecated": false, + "deprecationReason": null } ], "possibleTypes": null @@ -38855,7 +38879,7 @@ }, { "name": "productVariantPreorderDeactivate", - "description": "New in Saleor 3.1. Deactivates product variant preorder.It changes all preorder allocation into regular allocation.", + "description": "New in Saleor 3.1. Deactivates product variant preorder. It changes all preorder allocation into regular allocation. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "id", @@ -41858,7 +41882,7 @@ }, { "name": "giftCardDelete", - "description": "New in Saleor 3.1. Delete gift card.", + "description": "New in Saleor 3.1. Delete gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "id", @@ -41961,7 +41985,7 @@ }, { "name": "giftCardResend", - "description": "New in Saleor 3.1. Resend a gift card.", + "description": "New in Saleor 3.1. Resend a gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "input", @@ -41990,7 +42014,7 @@ }, { "name": "giftCardAddNote", - "description": "New in Saleor 3.1. Adds note to the gift card.", + "description": "New in Saleor 3.1. Adds note to the gift card. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "id", @@ -42035,7 +42059,7 @@ }, { "name": "giftCardBulkCreate", - "description": "New in Saleor 3.1. Create gift cards.", + "description": "New in Saleor 3.1. Create gift cards. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "input", @@ -42064,7 +42088,7 @@ }, { "name": "giftCardBulkDelete", - "description": "New in Saleor 3.1. Delete gift cards.", + "description": "New in Saleor 3.1. Delete gift cards. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "ids", @@ -42097,7 +42121,7 @@ }, { "name": "giftCardBulkActivate", - "description": "New in Saleor 3.1. Activate gift cards.", + "description": "New in Saleor 3.1. Activate gift cards. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "ids", @@ -42130,7 +42154,7 @@ }, { "name": "giftCardBulkDeactivate", - "description": "New in Saleor 3.1. Deactivate gift cards.", + "description": "New in Saleor 3.1. Deactivate gift cards. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "ids", @@ -42970,7 +42994,7 @@ }, { "name": "exportGiftCards", - "description": "New in Saleor 3.1. Export gift cards to csv file.", + "description": "New in Saleor 3.1. Export gift cards to csv file. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "input", @@ -43807,7 +43831,7 @@ }, { "name": "checkoutDeliveryMethodUpdate", - "description": "New in Saleor 3.1. Updates the delivery method (shipping method or pick up point) of the checkout.", + "description": "New in Saleor 3.1. Updates the delivery method (shipping method or pick up point) of the checkout. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "deliveryMethodId", @@ -47245,6 +47269,22 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "status", "description": null, @@ -47447,7 +47487,7 @@ }, { "name": "availableCollectionPoints", - "description": "New in Saleor 3.1. Collection points that can be used for this order.", + "description": "New in Saleor 3.1. Collection points that can be used for this order. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "NON_NULL", @@ -47903,7 +47943,7 @@ }, { "name": "deliveryMethod", - "description": "New in Saleor 3.1. The delivery method selected for this checkout.", + "description": "New in Saleor 3.1. The delivery method selected for this checkout. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "UNION", @@ -47955,7 +47995,7 @@ "ofType": null }, "isDeprecated": true, - "deprecationReason": "This field will be removed in Saleor 4.0. Use discounts field." + "deprecationReason": "This field will be removed in Saleor 4.0. Use the `discounts` field instead." }, { "name": "discountName", @@ -47967,7 +48007,7 @@ "ofType": null }, "isDeprecated": true, - "deprecationReason": "This field will be removed in Saleor 4.0. Use discounts field." + "deprecationReason": "This field will be removed in Saleor 4.0. Use the `discounts` field instead." }, { "name": "translatedDiscountName", @@ -47979,7 +48019,7 @@ "ofType": null }, "isDeprecated": true, - "deprecationReason": "This field will be removed in Saleor 4.0. Use discounts field. " + "deprecationReason": "This field will be removed in Saleor 4.0. Use the `discounts` field instead. " }, { "name": "discounts", @@ -50430,6 +50470,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "updatedAt", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "DateTimeRangeInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "isClickAndCollect", "description": null, @@ -52364,7 +52416,19 @@ }, { "name": "CREATION_DATE", - "description": "Sort orders by creation date.", + "description": "Sort orders by creation date. \n\nDEPRECATED: this field will be removed in Saleor 4.0.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CREATED_AT", + "description": "Sort orders by creation date. \n\nDEPRECATED: this field will be removed in Saleor 4.0.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LAST_MODIFIED_AT", + "description": "Sort orders by last modified at.", "isDeprecated": false, "deprecationReason": null }, @@ -59019,14 +59083,34 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "created", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "updatedAt", "description": null, "args": [], "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } }, "isDeprecated": false, "deprecationReason": null @@ -61263,6 +61347,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "updatedAt", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "DateTimeRangeInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "productTypes", "description": null, @@ -62316,6 +62412,12 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "LAST_MODIFIED", + "description": "Sort products by update date.", + "isDeprecated": false, + "deprecationReason": null + }, { "name": "DATE", "description": "Sort products by update date.", @@ -62340,6 +62442,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "PUBLISHED_AT", + "description": "Sort products by publication date.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LAST_MODIFIED_AT", + "description": "Sort products by update date.", + "isDeprecated": false, + "deprecationReason": null + }, { "name": "COLLECTION", "description": "Sort products by collection. Note: This option is available only for the `Collection.products` query.", @@ -64664,7 +64778,7 @@ }, { "name": "preorder", - "description": "New in Saleor 3.1. Preorder data for product variant.", + "description": "New in Saleor 3.1. Preorder data for product variant. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "OBJECT", @@ -64673,6 +64787,38 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "created", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -64858,7 +65004,7 @@ }, { "name": "preorder", - "description": "New in Saleor 3.1. Determines if variant is in preorder.", + "description": "New in Saleor 3.1. Determines if variant is in preorder. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "INPUT_OBJECT", "name": "PreorderSettingsInput", @@ -64870,7 +65016,7 @@ }, { "name": "quantityLimitPerCustomer", - "description": "New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout.", + "description": "New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "SCALAR", "name": "Int", @@ -65075,7 +65221,7 @@ }, { "name": "preorderThreshold", - "description": "New in Saleor 3.1. Preorder variant data.", + "description": "New in Saleor 3.1. Preorder variant data. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "OBJECT", @@ -65149,7 +65295,7 @@ }, { "name": "preorderThreshold", - "description": "New in Saleor 3.1. The threshold for preorder variant in channel.", + "description": "New in Saleor 3.1. The threshold for preorder variant in channel. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "SCALAR", "name": "Int", @@ -65480,7 +65626,7 @@ }, { "name": "preorder", - "description": "New in Saleor 3.1. Determines if variant is in preorder.", + "description": "New in Saleor 3.1. Determines if variant is in preorder. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "INPUT_OBJECT", "name": "PreorderSettingsInput", @@ -65492,7 +65638,7 @@ }, { "name": "quantityLimitPerCustomer", - "description": "New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout.", + "description": "New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "SCALAR", "name": "Int", @@ -65675,6 +65821,18 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "DateTimeRangeInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null } ], "interfaces": null, @@ -65745,7 +65903,7 @@ }, { "name": "preorder", - "description": "New in Saleor 3.1. Determines if variant is in preorder.", + "description": "New in Saleor 3.1. Determines if variant is in preorder. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "INPUT_OBJECT", "name": "PreorderSettingsInput", @@ -65757,7 +65915,7 @@ }, { "name": "quantityLimitPerCustomer", - "description": "New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout.", + "description": "New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "SCALAR", "name": "Int", @@ -65775,7 +65933,7 @@ { "kind": "OBJECT", "name": "ProductVariantPreorderDeactivate", - "description": "New in Saleor 3.1. Deactivates product variant preorder.It changes all preorder allocation into regular allocation.", + "description": "New in Saleor 3.1. Deactivates product variant preorder. It changes all preorder allocation into regular allocation. Note: this feature is in a preview state and can be subject to changes at later point.", "fields": [ { "name": "productVariant", @@ -66032,6 +66190,66 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "ENUM", + "name": "ProductVariantSortField", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "LAST_MODIFIED_AT", + "description": "Sort products variants by last modified at.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ProductVariantSortingInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "direction", + "description": "Specifies the direction in which to sort products.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "field", + "description": "Sort productVariants by the selected field.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProductVariantSortField", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "ProductVariantStocksCreate", @@ -67927,6 +68145,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "sortBy", + "description": "Sort products variants.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ProductVariantSortingInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "before", "description": "Return the elements in the list that come before the specified cursor.", @@ -69084,7 +69314,7 @@ "args": [ { "name": "sortBy", - "description": "New in Saleor 3.1. Sort gift cards.", + "description": "New in Saleor 3.1. Sort gift cards. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "INPUT_OBJECT", "name": "GiftCardSortingInput", @@ -69096,7 +69326,7 @@ }, { "name": "filter", - "description": "New in Saleor 3.1. Filtering options for gift cards.", + "description": "New in Saleor 3.1. Filtering options for gift cards. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "INPUT_OBJECT", "name": "GiftCardFilterInput", @@ -69165,7 +69395,7 @@ }, { "name": "giftCardCurrencies", - "description": "New in Saleor 3.1. List of gift card currencies.", + "description": "New in Saleor 3.1. List of gift card currencies. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "NON_NULL", @@ -69189,7 +69419,7 @@ }, { "name": "giftCardTags", - "description": "{ADDED_IN_31} List of gift card tags.", + "description": "New in Saleor 3.1. List of gift card tags. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "filter", @@ -70302,7 +70532,7 @@ }, { "name": "appExtensions", - "description": "New in Saleor 3.1. List of all extensions", + "description": "New in Saleor 3.1. List of all extensions. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "filter", @@ -70375,7 +70605,7 @@ }, { "name": "appExtension", - "description": "New in Saleor 3.1. Look up an app extension by ID.", + "description": "New in Saleor 3.1. Look up an app extension by ID. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [ { "name": "id", @@ -71319,6 +71549,38 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "created", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "categories", "description": "List of categories this sale applies to.", @@ -72366,6 +72628,18 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "DateTimeRangeInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null } ], "interfaces": null, @@ -72615,6 +72889,18 @@ "description": "Sort sales by type.", "isDeprecated": false, "deprecationReason": null + }, + { + "name": "CREATED_AT", + "description": "Sort sales by created at.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LAST_MODIFIED_AT", + "description": "Sort sales by last modified at.", + "isDeprecated": false, + "deprecationReason": null } ], "possibleTypes": null @@ -73332,7 +73618,7 @@ { "kind": "OBJECT", "name": "ShippingMethod", - "description": "('Shipping methods that can be used as means of shippingfor orders and checkouts.',)", + "description": "Shipping methods that can be used as means of shipping for orders and checkouts.", "fields": [ { "name": "id", @@ -76646,7 +76932,7 @@ }, { "name": "limitQuantityPerCheckout", - "description": "New in Saleor 3.1. Default number of maximum line quantity in single checkout (per single checkout line).", + "description": "New in Saleor 3.1. Default number of maximum line quantity in single checkout (per single checkout line). Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "SCALAR", @@ -77287,7 +77573,7 @@ }, { "name": "limitQuantityPerCheckout", - "description": "New in Saleor 3.1. Default number of maximum line quantity in single checkout. Minimum possible value is 1, default value is 50.", + "description": "New in Saleor 3.1. Default number of maximum line quantity in single checkout. Minimum possible value is 1, default value is 50. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "SCALAR", "name": "Int", @@ -80386,7 +80672,7 @@ "ofType": null }, "isDeprecated": true, - "deprecationReason": "This field will be removed in Saleor 4.0. Use the `checkout_tokens` field to fetch the user checkouts." + "deprecationReason": "This field will be removed in Saleor 4.0. Use the `checkoutTokens` field to fetch the user checkouts." }, { "name": "checkoutTokens", @@ -80740,6 +81026,22 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -81323,6 +81625,18 @@ "description": "Sort users by order count.", "isDeprecated": false, "deprecationReason": null + }, + { + "name": "CREATED_AT", + "description": "Sort users by created at.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LAST_MODIFIED_AT", + "description": "Sort users by last modified at.", + "isDeprecated": false, + "deprecationReason": null } ], "possibleTypes": null @@ -84157,7 +84471,7 @@ }, { "name": "clickAndCollectOption", - "description": "New in Saleor 3.1. Click and collect options: local, all or disabled", + "description": "New in Saleor 3.1. Click and collect options: local, all or disabled. Note: this feature is in a preview state and can be subject to changes at later point.", "args": [], "type": { "kind": "NON_NULL", @@ -85103,7 +85417,7 @@ }, { "name": "clickAndCollectOption", - "description": "New in Saleor 3.1. Click and collect options: local, all or disabled", + "description": "New in Saleor 3.1. Click and collect options: local, all or disabled. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "ENUM", "name": "WarehouseClickAndCollectOptionEnum", @@ -85115,7 +85429,7 @@ }, { "name": "isPrivate", - "description": "New in Saleor 3.1. Visibility of warehouse stocks", + "description": "New in Saleor 3.1. Visibility of warehouse stocks. Note: this feature is in a preview state and can be subject to changes at later point.", "type": { "kind": "SCALAR", "name": "Boolean", @@ -86420,6 +86734,18 @@ "description": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "ORDER_FILTER_SHIPPING_METHODS", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CHECKOUT_FILTER_SHIPPING_METHODS", + "description": null, + "isDeprecated": false, + "deprecationReason": null } ], "possibleTypes": null @@ -86479,6 +86805,18 @@ "description": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "ORDER_FILTER_SHIPPING_METHODS", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CHECKOUT_FILTER_SHIPPING_METHODS", + "description": null, + "isDeprecated": false, + "deprecationReason": null } ], "possibleTypes": null @@ -87017,7 +87355,7 @@ { "kind": "SCALAR", "name": "_Any", - "description": "Anything", + "description": "_Any value scalar as defined by Federation spec.", "fields": null, "inputFields": null, "interfaces": null, @@ -87027,7 +87365,7 @@ { "kind": "UNION", "name": "_Entity", - "description": null, + "description": "_Entity union as defined by Federation spec.", "fields": null, "inputFields": null, "interfaces": null, @@ -87093,7 +87431,7 @@ { "kind": "OBJECT", "name": "_Service", - "description": null, + "description": "_Service manifest as defined by Federation spec.", "fields": [ { "name": "sdl", diff --git a/src/auth/components/SectionRoute.tsx b/src/auth/components/SectionRoute.tsx index c33e3a671..cc8d1824d 100644 --- a/src/auth/components/SectionRoute.tsx +++ b/src/auth/components/SectionRoute.tsx @@ -22,6 +22,11 @@ export const SectionRoute: React.FC = ({ }) => { const { user } = useUser(); + // Prevents race condition + if (user === undefined) { + return null; + } + const hasSectionPermissions = () => { if (!permissions) { return true; diff --git a/src/customers/views/CustomerDetails.tsx b/src/customers/views/CustomerDetails.tsx index c940e2b43..e9cda446c 100644 --- a/src/customers/views/CustomerDetails.tsx +++ b/src/customers/views/CustomerDetails.tsx @@ -137,7 +137,13 @@ const CustomerDetailsViewInner: React.FC = ({ navigate(customerUrl(id), { replace: true })} - onConfirm={() => removeCustomer()} + onConfirm={() => + removeCustomer({ + variables: { + id + } + }) + } title={intl.formatMessage({ defaultMessage: "Delete Customer", description: "dialog header" diff --git a/src/graphql/typePolicies.generated.ts b/src/graphql/typePolicies.generated.ts index 9fc42603a..a8beac12f 100644 --- a/src/graphql/typePolicies.generated.ts +++ b/src/graphql/typePolicies.generated.ts @@ -2066,12 +2066,13 @@ export type ObjectWithMetadataFieldPolicy = { privateMetadata?: FieldPolicy | FieldReadFunction, metadata?: FieldPolicy | FieldReadFunction }; -export type OrderKeySpecifier = ('id' | 'privateMetadata' | 'metadata' | 'created' | 'status' | 'user' | 'trackingClientId' | 'billingAddress' | 'shippingAddress' | 'shippingMethodName' | 'collectionPointName' | 'channel' | 'fulfillments' | 'lines' | 'actions' | 'availableShippingMethods' | 'shippingMethods' | 'availableCollectionPoints' | 'invoices' | 'number' | 'original' | 'origin' | 'isPaid' | 'paymentStatus' | 'paymentStatusDisplay' | 'payments' | 'total' | 'undiscountedTotal' | 'shippingMethod' | 'shippingPrice' | 'shippingTaxRate' | 'token' | 'voucher' | 'giftCards' | 'displayGrossPrices' | 'customerNote' | 'weight' | 'redirectUrl' | 'subtotal' | 'statusDisplay' | 'canFinalize' | 'totalAuthorized' | 'totalCaptured' | 'events' | 'totalBalance' | 'userEmail' | 'isShippingRequired' | 'deliveryMethod' | 'languageCode' | 'languageCodeEnum' | 'discount' | 'discountName' | 'translatedDiscountName' | 'discounts' | 'errors' | OrderKeySpecifier)[]; +export type OrderKeySpecifier = ('id' | 'privateMetadata' | 'metadata' | 'created' | 'updatedAt' | 'status' | 'user' | 'trackingClientId' | 'billingAddress' | 'shippingAddress' | 'shippingMethodName' | 'collectionPointName' | 'channel' | 'fulfillments' | 'lines' | 'actions' | 'availableShippingMethods' | 'shippingMethods' | 'availableCollectionPoints' | 'invoices' | 'number' | 'original' | 'origin' | 'isPaid' | 'paymentStatus' | 'paymentStatusDisplay' | 'payments' | 'total' | 'undiscountedTotal' | 'shippingMethod' | 'shippingPrice' | 'shippingTaxRate' | 'token' | 'voucher' | 'giftCards' | 'displayGrossPrices' | 'customerNote' | 'weight' | 'redirectUrl' | 'subtotal' | 'statusDisplay' | 'canFinalize' | 'totalAuthorized' | 'totalCaptured' | 'events' | 'totalBalance' | 'userEmail' | 'isShippingRequired' | 'deliveryMethod' | 'languageCode' | 'languageCodeEnum' | 'discount' | 'discountName' | 'translatedDiscountName' | 'discounts' | 'errors' | OrderKeySpecifier)[]; export type OrderFieldPolicy = { id?: FieldPolicy | FieldReadFunction, privateMetadata?: FieldPolicy | FieldReadFunction, metadata?: FieldPolicy | FieldReadFunction, created?: FieldPolicy | FieldReadFunction, + updatedAt?: FieldPolicy | FieldReadFunction, status?: FieldPolicy | FieldReadFunction, user?: FieldPolicy | FieldReadFunction, trackingClientId?: FieldPolicy | FieldReadFunction, @@ -2722,7 +2723,7 @@ export type PreorderThresholdFieldPolicy = { quantity?: FieldPolicy | FieldReadFunction, soldUnits?: FieldPolicy | FieldReadFunction }; -export type ProductKeySpecifier = ('id' | 'privateMetadata' | 'metadata' | 'seoTitle' | 'seoDescription' | 'name' | 'description' | 'productType' | 'slug' | 'category' | 'updatedAt' | 'chargeTaxes' | 'weight' | 'defaultVariant' | 'rating' | 'channel' | 'descriptionJson' | 'thumbnail' | 'pricing' | 'isAvailable' | 'taxType' | 'attributes' | 'channelListings' | 'mediaById' | 'imageById' | 'variants' | 'media' | 'images' | 'collections' | 'translation' | 'availableForPurchase' | 'isAvailableForPurchase' | ProductKeySpecifier)[]; +export type ProductKeySpecifier = ('id' | 'privateMetadata' | 'metadata' | 'seoTitle' | 'seoDescription' | 'name' | 'description' | 'productType' | 'slug' | 'category' | 'created' | 'updatedAt' | 'chargeTaxes' | 'weight' | 'defaultVariant' | 'rating' | 'channel' | 'descriptionJson' | 'thumbnail' | 'pricing' | 'isAvailable' | 'taxType' | 'attributes' | 'channelListings' | 'mediaById' | 'imageById' | 'variants' | 'media' | 'images' | 'collections' | 'translation' | 'availableForPurchase' | 'isAvailableForPurchase' | ProductKeySpecifier)[]; export type ProductFieldPolicy = { id?: FieldPolicy | FieldReadFunction, privateMetadata?: FieldPolicy | FieldReadFunction, @@ -2734,6 +2735,7 @@ export type ProductFieldPolicy = { productType?: FieldPolicy | FieldReadFunction, slug?: FieldPolicy | FieldReadFunction, category?: FieldPolicy | FieldReadFunction, + created?: FieldPolicy | FieldReadFunction, updatedAt?: FieldPolicy | FieldReadFunction, chargeTaxes?: FieldPolicy | FieldReadFunction, weight?: FieldPolicy | FieldReadFunction, @@ -3001,7 +3003,7 @@ export type ProductUpdateFieldPolicy = { errors?: FieldPolicy | FieldReadFunction, product?: FieldPolicy | FieldReadFunction }; -export type ProductVariantKeySpecifier = ('id' | 'privateMetadata' | 'metadata' | 'name' | 'sku' | 'product' | 'trackInventory' | 'quantityLimitPerCustomer' | 'weight' | 'channel' | 'channelListings' | 'pricing' | 'attributes' | 'margin' | 'quantityOrdered' | 'revenue' | 'images' | 'media' | 'translation' | 'digitalContent' | 'stocks' | 'quantityAvailable' | 'preorder' | ProductVariantKeySpecifier)[]; +export type ProductVariantKeySpecifier = ('id' | 'privateMetadata' | 'metadata' | 'name' | 'sku' | 'product' | 'trackInventory' | 'quantityLimitPerCustomer' | 'weight' | 'channel' | 'channelListings' | 'pricing' | 'attributes' | 'margin' | 'quantityOrdered' | 'revenue' | 'images' | 'media' | 'translation' | 'digitalContent' | 'stocks' | 'quantityAvailable' | 'preorder' | 'created' | 'updatedAt' | ProductVariantKeySpecifier)[]; export type ProductVariantFieldPolicy = { id?: FieldPolicy | FieldReadFunction, privateMetadata?: FieldPolicy | FieldReadFunction, @@ -3025,7 +3027,9 @@ export type ProductVariantFieldPolicy = { digitalContent?: FieldPolicy | FieldReadFunction, stocks?: FieldPolicy | FieldReadFunction, quantityAvailable?: FieldPolicy | FieldReadFunction, - preorder?: FieldPolicy | FieldReadFunction + preorder?: FieldPolicy | FieldReadFunction, + created?: FieldPolicy | FieldReadFunction, + updatedAt?: FieldPolicy | FieldReadFunction }; export type ProductVariantBulkCreateKeySpecifier = ('count' | 'productVariants' | 'bulkProductErrors' | 'errors' | ProductVariantBulkCreateKeySpecifier)[]; export type ProductVariantBulkCreateFieldPolicy = { @@ -3249,7 +3253,7 @@ export type RequestPasswordResetFieldPolicy = { accountErrors?: FieldPolicy | FieldReadFunction, errors?: FieldPolicy | FieldReadFunction }; -export type SaleKeySpecifier = ('id' | 'privateMetadata' | 'metadata' | 'name' | 'type' | 'startDate' | 'endDate' | 'categories' | 'collections' | 'products' | 'variants' | 'translation' | 'channelListings' | 'discountValue' | 'currency' | SaleKeySpecifier)[]; +export type SaleKeySpecifier = ('id' | 'privateMetadata' | 'metadata' | 'name' | 'type' | 'startDate' | 'endDate' | 'created' | 'updatedAt' | 'categories' | 'collections' | 'products' | 'variants' | 'translation' | 'channelListings' | 'discountValue' | 'currency' | SaleKeySpecifier)[]; export type SaleFieldPolicy = { id?: FieldPolicy | FieldReadFunction, privateMetadata?: FieldPolicy | FieldReadFunction, @@ -3258,6 +3262,8 @@ export type SaleFieldPolicy = { type?: FieldPolicy | FieldReadFunction, startDate?: FieldPolicy | FieldReadFunction, endDate?: FieldPolicy | FieldReadFunction, + created?: FieldPolicy | FieldReadFunction, + updatedAt?: FieldPolicy | FieldReadFunction, categories?: FieldPolicy | FieldReadFunction, collections?: FieldPolicy | FieldReadFunction, products?: FieldPolicy | FieldReadFunction, @@ -3770,7 +3776,7 @@ export type UploadErrorFieldPolicy = { message?: FieldPolicy | FieldReadFunction, code?: FieldPolicy | FieldReadFunction }; -export type UserKeySpecifier = ('id' | 'privateMetadata' | 'metadata' | 'email' | 'firstName' | 'lastName' | 'isStaff' | 'isActive' | 'addresses' | 'checkout' | 'checkoutTokens' | 'giftCards' | 'note' | 'orders' | 'userPermissions' | 'permissionGroups' | 'editableGroups' | 'avatar' | 'events' | 'storedPaymentSources' | 'languageCode' | 'defaultShippingAddress' | 'defaultBillingAddress' | 'lastLogin' | 'dateJoined' | UserKeySpecifier)[]; +export type UserKeySpecifier = ('id' | 'privateMetadata' | 'metadata' | 'email' | 'firstName' | 'lastName' | 'isStaff' | 'isActive' | 'addresses' | 'checkout' | 'checkoutTokens' | 'giftCards' | 'note' | 'orders' | 'userPermissions' | 'permissionGroups' | 'editableGroups' | 'avatar' | 'events' | 'storedPaymentSources' | 'languageCode' | 'defaultShippingAddress' | 'defaultBillingAddress' | 'lastLogin' | 'dateJoined' | 'updatedAt' | UserKeySpecifier)[]; export type UserFieldPolicy = { id?: FieldPolicy | FieldReadFunction, privateMetadata?: FieldPolicy | FieldReadFunction, @@ -3796,7 +3802,8 @@ export type UserFieldPolicy = { defaultShippingAddress?: FieldPolicy | FieldReadFunction, defaultBillingAddress?: FieldPolicy | FieldReadFunction, lastLogin?: FieldPolicy | FieldReadFunction, - dateJoined?: FieldPolicy | FieldReadFunction + dateJoined?: FieldPolicy | FieldReadFunction, + updatedAt?: FieldPolicy | FieldReadFunction }; export type UserAvatarDeleteKeySpecifier = ('user' | 'accountErrors' | 'errors' | UserAvatarDeleteKeySpecifier)[]; export type UserAvatarDeleteFieldPolicy = { diff --git a/src/graphql/types.generated.ts b/src/graphql/types.generated.ts index fa99bcf8a..38bda5079 100644 --- a/src/graphql/types.generated.ts +++ b/src/graphql/types.generated.ts @@ -29,12 +29,6 @@ export type Scalars = { * String, Boolean, Int, Float, List or Object. */ GenericScalar: any; - /** - * Allows use of a JSON String for input / output from the GraphQL schema. - * - * Use of this type is *not recommended* as you lose the benefits of having a defined, static - * schema (one of the key benefits of GraphQL). - */ JSONString: any; /** * Positive Decimal scalar implementation. @@ -46,7 +40,7 @@ export type Scalars = { /** Variables of this type must be set to null in mutations. They will be replaced with a filename from a following multipart part containing a binary file. See: https://github.com/jaydenseric/graphql-multipart-request-spec. */ Upload: any; WeightScalar: any; - /** Anything */ + /** _Any value scalar as defined by Federation spec. */ _Any: any; }; @@ -1085,6 +1079,7 @@ export type CustomerFilterInput = { placedOrders?: InputMaybe; search?: InputMaybe; metadata?: InputMaybe>>; + updatedAt?: InputMaybe; }; export type CustomerInput = { @@ -1292,12 +1287,10 @@ export type ExportFileFilterInput = { }; export enum ExportFileSortField { - /** Sort export file by status. */ STATUS = 'STATUS', - /** Sort export file by created at. */ CREATED_AT = 'CREATED_AT', - /** Sort export file by updated at. */ - UPDATED_AT = 'UPDATED_AT' + UPDATED_AT = 'UPDATED_AT', + LAST_MODIFIED_AT = 'LAST_MODIFIED_AT' } export type ExportFileSortingInput = { @@ -1416,9 +1409,9 @@ export type GiftCardBulkCreateInput = { }; export type GiftCardCreateInput = { - /** New in Saleor 3.1. The gift card tags to add. */ + /** New in Saleor 3.1. The gift card tags to add. Note: this feature is in a preview state and can be subject to changes at later point. */ addTags?: InputMaybe>; - /** New in Saleor 3.1. The gift card expiry date. */ + /** New in Saleor 3.1. The gift card expiry date. Note: this feature is in a preview state and can be subject to changes at later point. */ expiryDate?: InputMaybe; /** * Start date of the gift card in ISO 8601 format. @@ -1436,9 +1429,9 @@ export type GiftCardCreateInput = { balance: PriceInput; /** Email of the customer to whom gift card will be sent. */ userEmail?: InputMaybe; - /** New in Saleor 3.1. Slug of a channel from which the email should be sent. */ + /** New in Saleor 3.1. Slug of a channel from which the email should be sent. Note: this feature is in a preview state and can be subject to changes at later point. */ channel?: InputMaybe; - /** New in Saleor 3.1. Determine if gift card is active. */ + /** New in Saleor 3.1. Determine if gift card is active. Note: this feature is in a preview state and can be subject to changes at later point. */ isActive: Scalars['Boolean']; /** * Code to use the gift card. @@ -1446,7 +1439,7 @@ export type GiftCardCreateInput = { * DEPRECATED: this field will be removed in Saleor 4.0. The code is now auto generated. */ code?: InputMaybe; - /** New in Saleor 3.1. The gift card note from the staff member. */ + /** New in Saleor 3.1. The gift card note from the staff member. Note: this feature is in a preview state and can be subject to changes at later point. */ note?: InputMaybe; }; @@ -1546,9 +1539,9 @@ export type GiftCardTagFilterInput = { }; export type GiftCardUpdateInput = { - /** New in Saleor 3.1. The gift card tags to add. */ + /** New in Saleor 3.1. The gift card tags to add. Note: this feature is in a preview state and can be subject to changes at later point. */ addTags?: InputMaybe>; - /** New in Saleor 3.1. The gift card expiry date. */ + /** New in Saleor 3.1. The gift card expiry date. Note: this feature is in a preview state and can be subject to changes at later point. */ expiryDate?: InputMaybe; /** * Start date of the gift card in ISO 8601 format. @@ -1562,9 +1555,9 @@ export type GiftCardUpdateInput = { * DEPRECATED: this field will be removed in Saleor 4.0. Use `expiryDate` from `expirySettings` instead. */ endDate?: InputMaybe; - /** New in Saleor 3.1. The gift card tags to remove. */ + /** New in Saleor 3.1. The gift card tags to remove. Note: this feature is in a preview state and can be subject to changes at later point. */ removeTags?: InputMaybe>; - /** New in Saleor 3.1. The gift card balance amount. */ + /** New in Saleor 3.1. The gift card balance amount. Note: this feature is in a preview state and can be subject to changes at later point. */ balanceAmount?: InputMaybe; }; @@ -2529,7 +2522,8 @@ export enum MetadataErrorCode { GRAPHQL_ERROR = 'GRAPHQL_ERROR', INVALID = 'INVALID', NOT_FOUND = 'NOT_FOUND', - REQUIRED = 'REQUIRED' + REQUIRED = 'REQUIRED', + NOT_UPDATED = 'NOT_UPDATED' } export type MetadataFilter = { @@ -2719,6 +2713,7 @@ export type OrderFilterInput = { search?: InputMaybe; metadata?: InputMaybe>>; channels?: InputMaybe>>; + updatedAt?: InputMaybe; isClickAndCollect?: InputMaybe; isPreorder?: InputMaybe; ids?: InputMaybe>>; @@ -2839,8 +2834,20 @@ export type OrderSettingsUpdateInput = { export enum OrderSortField { /** Sort orders by number. */ NUMBER = 'NUMBER', - /** Sort orders by creation date. */ + /** + * Sort orders by creation date. + * + * DEPRECATED: this field will be removed in Saleor 4.0. + */ CREATION_DATE = 'CREATION_DATE', + /** + * Sort orders by creation date. + * + * DEPRECATED: this field will be removed in Saleor 4.0. + */ + CREATED_AT = 'CREATED_AT', + /** Sort orders by last modified at. */ + LAST_MODIFIED_AT = 'LAST_MODIFIED_AT', /** Sort orders by customer. */ CUSTOMER = 'CUSTOMER', /** Sort orders by payment. */ @@ -3343,6 +3350,7 @@ export type ProductFilterInput = { metadata?: InputMaybe>>; price?: InputMaybe; minimalPrice?: InputMaybe; + updatedAt?: InputMaybe; productTypes?: InputMaybe>>; giftCard?: InputMaybe; ids?: InputMaybe>>; @@ -3430,6 +3438,8 @@ export enum ProductOrderField { /** Sort products by a minimal price of a product's variant. */ MINIMAL_PRICE = 'MINIMAL_PRICE', /** Sort products by update date. */ + LAST_MODIFIED = 'LAST_MODIFIED', + /** Sort products by update date. */ DATE = 'DATE', /** Sort products by type. */ TYPE = 'TYPE', @@ -3437,6 +3447,10 @@ export enum ProductOrderField { PUBLISHED = 'PUBLISHED', /** Sort products by publication date. */ PUBLICATION_DATE = 'PUBLICATION_DATE', + /** Sort products by publication date. */ + PUBLISHED_AT = 'PUBLISHED_AT', + /** Sort products by update date. */ + LAST_MODIFIED_AT = 'LAST_MODIFIED_AT', /** Sort products by collection. Note: This option is available only for the `Collection.products` query. */ COLLECTION = 'COLLECTION', /** Sort products by rating. */ @@ -3521,9 +3535,9 @@ export type ProductVariantBulkCreateInput = { trackInventory?: InputMaybe; /** Weight of the Product Variant. */ weight?: InputMaybe; - /** New in Saleor 3.1. Determines if variant is in preorder. */ + /** New in Saleor 3.1. Determines if variant is in preorder. Note: this feature is in a preview state and can be subject to changes at later point. */ preorder?: InputMaybe; - /** New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout. */ + /** New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout. Note: this feature is in a preview state and can be subject to changes at later point. */ quantityLimitPerCustomer?: InputMaybe; /** Stocks of a product available for sale. */ stocks?: InputMaybe>; @@ -3538,7 +3552,7 @@ export type ProductVariantChannelListingAddInput = { price: Scalars['PositiveDecimal']; /** Cost price of the variant in channel. */ costPrice?: InputMaybe; - /** New in Saleor 3.1. The threshold for preorder variant in channel. */ + /** New in Saleor 3.1. The threshold for preorder variant in channel. Note: this feature is in a preview state and can be subject to changes at later point. */ preorderThreshold?: InputMaybe; }; @@ -3551,9 +3565,9 @@ export type ProductVariantCreateInput = { trackInventory?: InputMaybe; /** Weight of the Product Variant. */ weight?: InputMaybe; - /** New in Saleor 3.1. Determines if variant is in preorder. */ + /** New in Saleor 3.1. Determines if variant is in preorder. Note: this feature is in a preview state and can be subject to changes at later point. */ preorder?: InputMaybe; - /** New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout. */ + /** New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout. Note: this feature is in a preview state and can be subject to changes at later point. */ quantityLimitPerCustomer?: InputMaybe; /** Product ID of which type is the variant. */ product: Scalars['ID']; @@ -3566,6 +3580,7 @@ export type ProductVariantFilterInput = { sku?: InputMaybe>>; metadata?: InputMaybe>>; isPreorder?: InputMaybe; + updatedAt?: InputMaybe; }; export type ProductVariantInput = { @@ -3577,12 +3592,24 @@ export type ProductVariantInput = { trackInventory?: InputMaybe; /** Weight of the Product Variant. */ weight?: InputMaybe; - /** New in Saleor 3.1. Determines if variant is in preorder. */ + /** New in Saleor 3.1. Determines if variant is in preorder. Note: this feature is in a preview state and can be subject to changes at later point. */ preorder?: InputMaybe; - /** New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout. */ + /** New in Saleor 3.1. Determines maximum quantity of `ProductVariant`,that can be bought in a single checkout. Note: this feature is in a preview state and can be subject to changes at later point. */ quantityLimitPerCustomer?: InputMaybe; }; +export enum ProductVariantSortField { + /** Sort products variants by last modified at. */ + LAST_MODIFIED_AT = 'LAST_MODIFIED_AT' +} + +export type ProductVariantSortingInput = { + /** Specifies the direction in which to sort products. */ + direction: OrderDirection; + /** Sort productVariants by the selected field. */ + field: ProductVariantSortField; +}; + export type PublishableChannelListingInput = { /** ID of a channel. */ channelId: Scalars['ID']; @@ -3624,6 +3651,7 @@ export type SaleFilterInput = { started?: InputMaybe; search?: InputMaybe; metadata?: InputMaybe>>; + updatedAt?: InputMaybe; }; export type SaleInput = { @@ -3656,7 +3684,11 @@ export enum SaleSortField { /** Sort sales by value. */ VALUE = 'VALUE', /** Sort sales by type. */ - TYPE = 'TYPE' + TYPE = 'TYPE', + /** Sort sales by created at. */ + CREATED_AT = 'CREATED_AT', + /** Sort sales by last modified at. */ + LAST_MODIFIED_AT = 'LAST_MODIFIED_AT' } export type SaleSortingInput = { @@ -3848,7 +3880,7 @@ export type ShopSettingsInput = { reserveStockDurationAnonymousUser?: InputMaybe; /** New in Saleor 3.1. Default number of minutes stock will be reserved for authenticated checkout. Enter 0 or null to disable. */ reserveStockDurationAuthenticatedUser?: InputMaybe; - /** New in Saleor 3.1. Default number of maximum line quantity in single checkout. Minimum possible value is 1, default value is 50. */ + /** New in Saleor 3.1. Default number of maximum line quantity in single checkout. Minimum possible value is 1, default value is 50. Note: this feature is in a preview state and can be subject to changes at later point. */ limitQuantityPerCheckout?: InputMaybe; }; @@ -4058,7 +4090,11 @@ export enum UserSortField { /** Sort users by email. */ EMAIL = 'EMAIL', /** Sort users by order count. */ - ORDER_COUNT = 'ORDER_COUNT' + ORDER_COUNT = 'ORDER_COUNT', + /** Sort users by created at. */ + CREATED_AT = 'CREATED_AT', + /** Sort users by last modified at. */ + LAST_MODIFIED_AT = 'LAST_MODIFIED_AT' } export type UserSortingInput = { @@ -4251,9 +4287,9 @@ export type WarehouseUpdateInput = { name?: InputMaybe; /** Address of the warehouse. */ address?: InputMaybe; - /** New in Saleor 3.1. Click and collect options: local, all or disabled */ + /** New in Saleor 3.1. Click and collect options: local, all or disabled. Note: this feature is in a preview state and can be subject to changes at later point. */ clickAndCollectOption?: InputMaybe; - /** New in Saleor 3.1. Visibility of warehouse stocks */ + /** New in Saleor 3.1. Visibility of warehouse stocks. Note: this feature is in a preview state and can be subject to changes at later point. */ isPrivate?: InputMaybe; }; @@ -4409,7 +4445,9 @@ export enum WebhookEventTypeEnum { PAYMENT_PROCESS = 'PAYMENT_PROCESS', PAYMENT_REFUND = 'PAYMENT_REFUND', PAYMENT_VOID = 'PAYMENT_VOID', - SHIPPING_LIST_METHODS_FOR_CHECKOUT = 'SHIPPING_LIST_METHODS_FOR_CHECKOUT' + SHIPPING_LIST_METHODS_FOR_CHECKOUT = 'SHIPPING_LIST_METHODS_FOR_CHECKOUT', + ORDER_FILTER_SHIPPING_METHODS = 'ORDER_FILTER_SHIPPING_METHODS', + CHECKOUT_FILTER_SHIPPING_METHODS = 'CHECKOUT_FILTER_SHIPPING_METHODS' } /** Enum determining type of webhook. */ @@ -4421,7 +4459,9 @@ export enum WebhookEventTypeSyncEnum { PAYMENT_PROCESS = 'PAYMENT_PROCESS', PAYMENT_REFUND = 'PAYMENT_REFUND', PAYMENT_VOID = 'PAYMENT_VOID', - SHIPPING_LIST_METHODS_FOR_CHECKOUT = 'SHIPPING_LIST_METHODS_FOR_CHECKOUT' + SHIPPING_LIST_METHODS_FOR_CHECKOUT = 'SHIPPING_LIST_METHODS_FOR_CHECKOUT', + ORDER_FILTER_SHIPPING_METHODS = 'ORDER_FILTER_SHIPPING_METHODS', + CHECKOUT_FILTER_SHIPPING_METHODS = 'CHECKOUT_FILTER_SHIPPING_METHODS' } /** An enumeration. */ @@ -6696,7 +6736,7 @@ export type ProductListQueryVariables = Exact<{ }>; -export type ProductListQuery = { __typename: 'Query', products: { __typename: 'ProductCountableConnection', totalCount: number | null, edges: Array<{ __typename: 'ProductCountableEdge', node: { __typename: 'Product', updatedAt: any | null, id: string, name: string, attributes?: Array<{ __typename: 'SelectedAttribute', attribute: { __typename: 'Attribute', id: string }, values: Array<{ __typename: 'AttributeValue', id: string, name: string | null, slug: string | null, reference: string | null, boolean: boolean | null, date: any | null, dateTime: any | null, value: string | null, file: { __typename: 'File', url: string, contentType: string | null } | null } | null> }>, thumbnail: { __typename: 'Image', url: string } | null, productType: { __typename: 'ProductType', id: string, name: string, hasVariants: boolean }, channelListings: Array<{ __typename: 'ProductChannelListing', isPublished: boolean, publicationDate: any | null, isAvailableForPurchase: boolean | null, availableForPurchase: any | null, visibleInListings: boolean, pricing?: { __typename: 'ProductPricingInfo', priceRange: { __typename: 'TaxedMoneyRange', start: { __typename: 'TaxedMoney', net: { __typename: 'Money', amount: number, currency: string } } | null, stop: { __typename: 'TaxedMoney', net: { __typename: 'Money', amount: number, currency: string } } | null } | null } | null, channel: { __typename: 'Channel', id: string, name: string, currencyCode: string } }> | null } }>, pageInfo: { __typename: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor: string | null, endCursor: string | null } } | null }; +export type ProductListQuery = { __typename: 'Query', products: { __typename: 'ProductCountableConnection', totalCount: number | null, edges: Array<{ __typename: 'ProductCountableEdge', node: { __typename: 'Product', updatedAt: any, id: string, name: string, attributes?: Array<{ __typename: 'SelectedAttribute', attribute: { __typename: 'Attribute', id: string }, values: Array<{ __typename: 'AttributeValue', id: string, name: string | null, slug: string | null, reference: string | null, boolean: boolean | null, date: any | null, dateTime: any | null, value: string | null, file: { __typename: 'File', url: string, contentType: string | null } | null } | null> }>, thumbnail: { __typename: 'Image', url: string } | null, productType: { __typename: 'ProductType', id: string, name: string, hasVariants: boolean }, channelListings: Array<{ __typename: 'ProductChannelListing', isPublished: boolean, publicationDate: any | null, isAvailableForPurchase: boolean | null, availableForPurchase: any | null, visibleInListings: boolean, pricing?: { __typename: 'ProductPricingInfo', priceRange: { __typename: 'TaxedMoneyRange', start: { __typename: 'TaxedMoney', net: { __typename: 'Money', amount: number, currency: string } } | null, stop: { __typename: 'TaxedMoney', net: { __typename: 'Money', amount: number, currency: string } } | null } | null } | null, channel: { __typename: 'Channel', id: string, name: string, currencyCode: string } }> | null } }>, pageInfo: { __typename: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor: string | null, endCursor: string | null } } | null }; export type ProductCountQueryVariables = Exact<{ filter?: InputMaybe; diff --git a/src/plugins/components/PluginAuthorization/PluginAuthorization.tsx b/src/plugins/components/PluginAuthorization/PluginAuthorization.tsx index 8572eaefe..b0edcf217 100644 --- a/src/plugins/components/PluginAuthorization/PluginAuthorization.tsx +++ b/src/plugins/components/PluginAuthorization/PluginAuthorization.tsx @@ -3,6 +3,7 @@ import CardTitle from "@saleor/components/CardTitle"; import Hr from "@saleor/components/Hr"; import { ConfigurationItemFragment, + ConfigurationItemInput, ConfigurationTypeFieldEnum } from "@saleor/graphql"; import { buttonMessages } from "@saleor/intl"; @@ -12,6 +13,7 @@ import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; interface PluginAuthorizationProps { + data: ConfigurationItemInput[]; fields: ConfigurationItemFragment[]; onClear: (field: string) => void; onEdit: (field: string) => void; @@ -37,7 +39,7 @@ const useStyles = makeStyles( ); const PluginAuthorization: React.FC = props => { - const { fields, onClear, onEdit } = props; + const { data, fields, onClear, onEdit } = props; const classes = useStyles(props); const intl = useIntl(); @@ -55,47 +57,53 @@ const PluginAuthorization: React.FC = props => { })} /> - {secretFields.map((field, fieldIndex) => ( - -
- {field.type === ConfigurationTypeFieldEnum.SECRET || - field.type === ConfigurationTypeFieldEnum.SECRETMULTILINE ? ( -
+ {secretFields.map((field, fieldIndex) => { + const inputData = data.find( + dataField => dataField.name === field.name + ); + + return ( + +
+ {field.type === ConfigurationTypeFieldEnum.SECRET || + field.type === ConfigurationTypeFieldEnum.SECRETMULTILINE ? ( +
+ {field.label} + {field.value !== null && ( + **** {inputData.value} + )} +
+ ) : ( {field.label} - {field.value !== null && ( - **** {field.value} - )} -
- ) : ( - {field.label} - )} -
- {field.value === null ? ( - - ) : ( - <> - + )} +
+ {field.value === null ? ( - + ) : ( + <> + + + + )} +
+ {fieldIndex !== secretFields.length - 1 && ( +
)} -
- {fieldIndex !== secretFields.length - 1 && ( -
- )} -
- ))} + + ); + })} ); diff --git a/src/plugins/components/PluginsDetailsPage/PluginsDetailsPage.tsx b/src/plugins/components/PluginsDetailsPage/PluginsDetailsPage.tsx index b89977ea5..6f96d18cf 100644 --- a/src/plugins/components/PluginsDetailsPage/PluginsDetailsPage.tsx +++ b/src/plugins/components/PluginsDetailsPage/PluginsDetailsPage.tsx @@ -55,7 +55,7 @@ const PluginsDetailsPage: React.FC = ({ }) => { const intl = useIntl(); - const initialFormData = (): PluginDetailsPageFormData => ({ + const initialFormData: PluginDetailsPageFormData = { active: selectedConfig?.active, configuration: selectedConfig?.configuration ?.filter( @@ -65,14 +65,14 @@ const PluginsDetailsPage: React.FC = ({ ...field, value: field.value || "" })) - }); + }; const selectedChannelId = selectedConfig?.channel?.id; return (
= ({ const { name, value } = event.target; const newData = { active: name === "active" ? value : data.active, - configuration: data.configuration + configuration: data.configuration.map(configItem => + configItem.name === name + ? { + ...configItem, + value + } + : configItem + ) }; - if (newData.configuration) { - newData.configuration.map(item => { - if (item.name === name) { - item.value = value; - } - }); - - selectedConfig.configuration.map(item => { - if (item.name === name) { - item.value = value; - } - }); - } - set(newData); }; return ( @@ -149,7 +142,8 @@ const PluginsDetailsPage: React.FC = ({ <> diff --git a/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.tsx b/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.tsx index 433b1b46c..309474298 100644 --- a/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.tsx +++ b/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.tsx @@ -1,9 +1,7 @@ -import { OutputData } from "@editorjs/editorjs"; import { ChannelShippingData } from "@saleor/channels/utils"; import CardSpacer from "@saleor/components/CardSpacer"; import ChannelsAvailabilityCard from "@saleor/components/ChannelsAvailabilityCard"; import Container from "@saleor/components/Container"; -import Form, { FormDataWithOpts } from "@saleor/components/Form"; import { WithFormId } from "@saleor/components/Form/ExitFormDialogProvider"; import Grid from "@saleor/components/Grid"; import PageHeader from "@saleor/components/PageHeader"; @@ -16,7 +14,8 @@ import { ShippingMethodTypeEnum, ShippingMethodTypeFragment } from "@saleor/graphql"; -import { SubmitPromise } from "@saleor/hooks/useForm"; +import useForm, { SubmitPromise } from "@saleor/hooks/useForm"; +import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; import { Backlink, ConfirmButtonTransitionState } from "@saleor/macaw-ui"; import { validatePrice } from "@saleor/products/utils/validation"; import OrderValue from "@saleor/shipping/components/OrderValue"; @@ -24,7 +23,8 @@ import OrderWeight from "@saleor/shipping/components/OrderWeight"; import PricingCard from "@saleor/shipping/components/PricingCard"; import ShippingRateInfo from "@saleor/shipping/components/ShippingRateInfo"; import { createChannelsChangeHandler } from "@saleor/shipping/handlers"; -import React from "react"; +import useRichText from "@saleor/utils/richText/useRichText"; +import React, { FormEventHandler } from "react"; import { FormattedMessage, useIntl } from "react-intl"; import ShippingZonePostalCodes from "../ShippingZonePostalCodes"; @@ -86,119 +86,134 @@ export const ShippingZoneRatesCreatePage: React.FC - ) => { - const formDisabled = data.channelListings?.some(channel => - validatePrice(channel.price) - ); + const { + change, + data: formData, + hasChanged, + setChanged, + setIsSubmitDisabled, + triggerChange + } = useForm(initialForm, undefined, { confirmLeave: true, formId }); - return disabled || formDisabled || (!data.hasChanged && !hasChannelChanged); + const handleFormSubmit = useHandleFormSubmit({ + formId, + onSubmit, + setChanged + }); + + const [description, changeDescription] = useRichText({ + initial: null, + triggerChange + }); + + // Prevents closing ref in submit functions + const getData = () => ({ + ...formData, + description: description.current + }); + const data = getData(); + + const handleFormElementSubmit: FormEventHandler = event => { + event.preventDefault(); + handleFormSubmit(getData()); }; + const handleSubmit = () => handleFormSubmit(getData()); + + const handleChannelsChange = createChannelsChangeHandler( + shippingChannels, + onChannelsChange, + triggerChange + ); + const formDisabled = data.channelListings?.some(channel => + validatePrice(channel.price) + ); + const isSaveDisabled = + disabled || formDisabled || (!hasChanged && !hasChannelChanged); + setIsSubmitDisabled(isSaveDisabled); return ( - - {({ change, data, isSaveDisabled, submit, triggerChange, set }) => { - const handleChannelsChange = createChannelsChangeHandler( - shippingChannels, - onChannelsChange, - triggerChange - ); - const onDescriptionChange = (description: OutputData) => { - set({ description }); - triggerChange(); - }; - - return ( - - - - - + + + + + + +
+ - -
- - - {isPriceVariant ? ( - - ) : ( - - )} - - - - -
-
- -
-
- + {isPriceVariant ? ( + + ) : ( + + )} + + - - ); - }} - + + +
+
+ +
+
+ +
+ ); }; diff --git a/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.tsx b/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.tsx index 746f2d261..7f0a70fac 100644 --- a/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.tsx +++ b/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.tsx @@ -1,9 +1,7 @@ -import { OutputData } from "@editorjs/editorjs"; import { ChannelShippingData } from "@saleor/channels/utils"; import CardSpacer from "@saleor/components/CardSpacer"; import ChannelsAvailabilityCard from "@saleor/components/ChannelsAvailabilityCard"; import Container from "@saleor/components/Container"; -import Form, { FormDataWithOpts } from "@saleor/components/Form"; import { WithFormId } from "@saleor/components/Form/ExitFormDialogProvider"; import Grid from "@saleor/components/Grid"; import Metadata from "@saleor/components/Metadata/Metadata"; @@ -18,7 +16,8 @@ import { ShippingMethodTypeFragment, ShippingZoneQuery } from "@saleor/graphql"; -import { SubmitPromise } from "@saleor/hooks/useForm"; +import useForm, { SubmitPromise } from "@saleor/hooks/useForm"; +import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; import { Backlink, ConfirmButtonTransitionState } from "@saleor/macaw-ui"; import { validatePrice } from "@saleor/products/utils/validation"; import OrderValue from "@saleor/shipping/components/OrderValue"; @@ -30,7 +29,8 @@ import { createChannelsChangeHandler } from "@saleor/shipping/handlers"; import { ListActions, ListProps } from "@saleor/types"; import { mapEdgesToItems, mapMetadataItemToInput } from "@saleor/utils/maps"; import useMetadataChangeTrigger from "@saleor/utils/metadata/useMetadataChangeTrigger"; -import React from "react"; +import useRichText from "@saleor/utils/richText/useRichText"; +import React, { FormEventHandler } from "react"; import { FormattedMessage } from "react-intl"; import ShippingZonePostalCodes from "../ShippingZonePostalCodes"; @@ -94,7 +94,7 @@ export const ShippingZoneRatesPage: React.FC = ({ }) => { const isPriceVariant = variant === ShippingMethodTypeEnum.PRICE; - const initialForm: ShippingZoneRateUpdateFormData = { + const initialForm: Omit = { channelListings: shippingChannels, maxDays: rate?.maximumDeliveryDays?.toString() || "", maxValue: rate?.maximumOrderWeight?.value.toString() || "", @@ -102,134 +102,148 @@ export const ShippingZoneRatesPage: React.FC = ({ minDays: rate?.minimumDeliveryDays?.toString() || "", minValue: rate?.minimumOrderWeight?.value.toString() || "", name: rate?.name || "", - description: rate?.description && JSON.parse(rate.description), orderValueRestricted: !!rate?.channelListings.length, privateMetadata: rate?.privateMetadata.map(mapMetadataItemToInput), type: rate?.type || null }; + const { + change, + data: formData, + hasChanged, + setChanged, + setIsSubmitDisabled, + triggerChange + } = useForm(initialForm, undefined, { confirmLeave: true, formId }); + + const handleFormSubmit = useHandleFormSubmit({ + formId, + onSubmit, + setChanged + }); + + const [description, changeDescription] = useRichText({ + initial: rate?.description, + triggerChange + }); + const { makeChangeHandler: makeMetadataChangeHandler } = useMetadataChangeTrigger(); - const checkIfSaveIsDisabled = ( - data: FormDataWithOpts - ) => { - const formDisabled = data.channelListings?.some(channel => - validatePrice(channel.price) - ); - const formIsUnchanged = - !data.hasChanged && !hasChannelChanged && !havePostalCodesChanged; + // Prevents closing ref in submit functions + const getData = () => ({ + ...formData, + description: description.current + }); + const data = getData(); - return disabled || formDisabled || formIsUnchanged; + const handleFormElementSubmit: FormEventHandler = event => { + event.preventDefault(); + handleFormSubmit(getData()); }; + const handleSubmit = () => handleFormSubmit(getData()); + + const handleChannelsChange = createChannelsChangeHandler( + shippingChannels, + onChannelsChange, + triggerChange + ); + const formDisabled = formData.channelListings?.some(channel => + validatePrice(channel.price) + ); + + const changeMetadata = makeMetadataChangeHandler(change); + const formIsUnchanged = + !hasChanged && !hasChannelChanged && !havePostalCodesChanged; + + const isSaveDisabled = disabled || formDisabled || formIsUnchanged; + setIsSubmitDisabled(isSaveDisabled); return ( -
- {({ change, data, isSaveDisabled, submit, set, triggerChange }) => { - const handleChannelsChange = createChannelsChangeHandler( - shippingChannels, - onChannelsChange, - triggerChange - ); - const onDescriptionChange = (description: OutputData) => { - set({ description }); - triggerChange(); - }; - - const changeMetadata = makeMetadataChangeHandler(change); - - return ( - - - - - - -
- - - {isPriceVariant ? ( - - ) : ( - - )} - - - - - - - - -
-
- ({ - id: channel.id, - name: channel.name - }))} - openModal={openChannelsModal} - /> -
-
- + + + + + + +
+ - - ); - }} - + + {isPriceVariant ? ( + + ) : ( + + )} + + + + + + + + +
+
+ ({ + id: channel.id, + name: channel.name + }))} + openModal={openChannelsModal} + /> +
+
+ +
+ ); }; diff --git a/src/staff/views/StaffDetails.tsx b/src/staff/views/StaffDetails.tsx index 00662acc4..771daf2fe 100644 --- a/src/staff/views/StaffDetails.tsx +++ b/src/staff/views/StaffDetails.tsx @@ -224,7 +224,11 @@ export const StaffDetails: React.FC = ({ id, params }) => { confirmButtonState={deleteResult.status} variant="delete" onClose={closeModal} - onConfirm={deleteStaffMember} + onConfirm={() => + deleteStaffMember({ + variables: { id } + }) + } >