diff --git a/.changeset/angry-buckets-marry.md b/.changeset/angry-buckets-marry.md deleted file mode 100644 index 5720c9e429a..00000000000 --- a/.changeset/angry-buckets-marry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Send order lines in orderGrantRefundCreate mutation diff --git a/.changeset/bright-horses-peel.md b/.changeset/bright-horses-peel.md deleted file mode 100644 index ac95e6b3a3c..00000000000 --- a/.changeset/bright-horses-peel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -fixes failing test: product visible in shop SALEOR_2506 diff --git a/.changeset/brown-readers-hang.md b/.changeset/brown-readers-hang.md deleted file mode 100644 index 5c652277efd..00000000000 --- a/.changeset/brown-readers-hang.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix sending attibutes on variant create/update in datagrid on product details page diff --git a/.changeset/brown-years-wash.md b/.changeset/brown-years-wash.md deleted file mode 100644 index cf586db92ce..00000000000 --- a/.changeset/brown-years-wash.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix sending too many request on line item update diff --git a/.changeset/chilled-ties-join.md b/.changeset/chilled-ties-join.md deleted file mode 100644 index 5429f252627..00000000000 --- a/.changeset/chilled-ties-join.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix changeset action for forks, block automation on contributions diff --git a/.changeset/cuddly-points-appear.md b/.changeset/cuddly-points-appear.md deleted file mode 100644 index 7c8629a28c0..00000000000 --- a/.changeset/cuddly-points-appear.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Attributes critical test migrated to playwright diff --git a/.changeset/curly-rules-sin.md b/.changeset/curly-rules-sin.md deleted file mode 100644 index e12d7f14558..00000000000 --- a/.changeset/curly-rules-sin.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Updates data-test-id for variant name input on variant page diff --git a/.changeset/curly-zoos-do.md b/.changeset/curly-zoos-do.md deleted file mode 100644 index c428b5117d4..00000000000 --- a/.changeset/curly-zoos-do.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Add 'feature' as extempt label for stalebot diff --git a/.changeset/curvy-bulldogs-drum.md b/.changeset/curvy-bulldogs-drum.md deleted file mode 100644 index 1312450159b..00000000000 --- a/.changeset/curvy-bulldogs-drum.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Use changes files to detect if changeset file is present diff --git a/.changeset/dirty-dragons-film.md b/.changeset/dirty-dragons-film.md deleted file mode 100644 index f234946f4af..00000000000 --- a/.changeset/dirty-dragons-film.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix pasting data into page create type picker diff --git a/.changeset/fast-masks-deny.md b/.changeset/fast-masks-deny.md deleted file mode 100644 index b7285eeec74..00000000000 --- a/.changeset/fast-masks-deny.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix input placeholder text in the tax classes section diff --git a/.changeset/few-drinks-compete.md b/.changeset/few-drinks-compete.md deleted file mode 100644 index e67def19a06..00000000000 --- a/.changeset/few-drinks-compete.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Remove flaky product update page test diff --git a/.changeset/fifty-peas-cheer.md b/.changeset/fifty-peas-cheer.md deleted file mode 100644 index a1376cb6304..00000000000 --- a/.changeset/fifty-peas-cheer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix form blink in customer edition for orders diff --git a/.changeset/five-days-film.md b/.changeset/five-days-film.md deleted file mode 100644 index 200313ef37b..00000000000 --- a/.changeset/five-days-film.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -update e2e voucher code creation tests diff --git a/.changeset/five-eggs-brake.md b/.changeset/five-eggs-brake.md deleted file mode 100644 index a845151cc84..00000000000 --- a/.changeset/five-eggs-brake.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/fluffy-buckets-tell.md b/.changeset/fluffy-buckets-tell.md deleted file mode 100644 index e9806120dab..00000000000 --- a/.changeset/fluffy-buckets-tell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix GHA worflow that runs chromatic on main branch diff --git a/.changeset/fresh-forks-battle.md b/.changeset/fresh-forks-battle.md deleted file mode 100644 index fe688d303e1..00000000000 --- a/.changeset/fresh-forks-battle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix saving previously removed country exceptions diff --git a/.changeset/fresh-teachers-pretend.md b/.changeset/fresh-teachers-pretend.md deleted file mode 100644 index 9dea6f3c8de..00000000000 --- a/.changeset/fresh-teachers-pretend.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Add new issue request templates diff --git a/.changeset/funny-badgers-begin.md b/.changeset/funny-badgers-begin.md deleted file mode 100644 index ed3c4b47d22..00000000000 --- a/.changeset/funny-badgers-begin.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Delay home queries to be non-blocking for the UI diff --git a/.changeset/healthy-walls-exist.md b/.changeset/healthy-walls-exist.md deleted file mode 100644 index 3aa14d46b29..00000000000 --- a/.changeset/healthy-walls-exist.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Implement the e2e instance managing diff --git a/.changeset/honest-otters-bow.md b/.changeset/honest-otters-bow.md deleted file mode 100644 index cc923742199..00000000000 --- a/.changeset/honest-otters-bow.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Use macaw-ui alias to 1.0.0 versions diff --git a/.changeset/itchy-beds-develop.md b/.changeset/itchy-beds-develop.md deleted file mode 100644 index d3f7455b896..00000000000 --- a/.changeset/itchy-beds-develop.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -removed redundant if statement in nightly workflow blocking e2e tests diff --git a/.changeset/large-geckos-change.md b/.changeset/large-geckos-change.md deleted file mode 100644 index 7ae0348658e..00000000000 --- a/.changeset/large-geckos-change.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -fix pt-br locale diff --git a/.changeset/late-cooks-kiss.md b/.changeset/late-cooks-kiss.md deleted file mode 100644 index 96183f64118..00000000000 --- a/.changeset/late-cooks-kiss.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix incorrect indexing in concurrent variant datagrid bulk mutations diff --git a/.changeset/lovely-walls-shake.md b/.changeset/lovely-walls-shake.md deleted file mode 100644 index 337a36f01b3..00000000000 --- a/.changeset/lovely-walls-shake.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Introduce voucher codes datagrid diff --git a/.changeset/metal-cows-yawn.md b/.changeset/metal-cows-yawn.md deleted file mode 100644 index 34595fcd04d..00000000000 --- a/.changeset/metal-cows-yawn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Migrated "TC: SALEOR_26 Create basic info variant - via edit variant page" to playwright diff --git a/.changeset/ninety-pillows-sing.md b/.changeset/ninety-pillows-sing.md deleted file mode 100644 index 4854b907514..00000000000 --- a/.changeset/ninety-pillows-sing.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix error related to can not read property of undefined in metadata and reading search page info diff --git a/.changeset/olive-walls-joke.md b/.changeset/olive-walls-joke.md deleted file mode 100644 index 24ad1bbeee3..00000000000 --- a/.changeset/olive-walls-joke.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Home page critical test migration to playwright diff --git a/.changeset/perfect-ligers-hope.md b/.changeset/perfect-ligers-hope.md deleted file mode 100644 index cfc7b1deeda..00000000000 --- a/.changeset/perfect-ligers-hope.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -migrated navigation tests to playwright diff --git a/.changeset/proud-shirts-hammer.md b/.changeset/proud-shirts-hammer.md deleted file mode 100644 index 8db023518e0..00000000000 --- a/.changeset/proud-shirts-hammer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Removed unused get info request diff --git a/.changeset/quiet-wasps-sing.md b/.changeset/quiet-wasps-sing.md deleted file mode 100644 index c7036b5da0f..00000000000 --- a/.changeset/quiet-wasps-sing.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix assign attribute value dialogs showing previous search results diff --git a/.changeset/rare-cats-guess.md b/.changeset/rude-falcons-peel.md similarity index 53% rename from .changeset/rare-cats-guess.md rename to .changeset/rude-falcons-peel.md index a156a13f556..bea7b15d904 100644 --- a/.changeset/rare-cats-guess.md +++ b/.changeset/rude-falcons-peel.md @@ -2,4 +2,4 @@ "saleor-dashboard": patch --- -Update graphql schema +Improve channel delete dialogs diff --git a/.changeset/short-deers-learn.md b/.changeset/short-deers-learn.md deleted file mode 100644 index 9aee0d9e113..00000000000 --- a/.changeset/short-deers-learn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Migrated warehouse creat test to playwright diff --git a/.changeset/tricky-needles-brush.md b/.changeset/six-deers-exist.md similarity index 51% rename from .changeset/tricky-needles-brush.md rename to .changeset/six-deers-exist.md index 7bdb5ada186..079707b1bd1 100644 --- a/.changeset/tricky-needles-brush.md +++ b/.changeset/six-deers-exist.md @@ -2,4 +2,4 @@ "saleor-dashboard": patch --- -Fix language switcher +Add missing units for attributes diff --git a/.changeset/soft-hornets-relax.md b/.changeset/soft-hornets-relax.md deleted file mode 100644 index f9d0b5a439a..00000000000 --- a/.changeset/soft-hornets-relax.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Change e2e default browser to electron diff --git a/.changeset/spotty-files-dance.md b/.changeset/spotty-files-dance.md deleted file mode 100644 index ab0aaf670c7..00000000000 --- a/.changeset/spotty-files-dance.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix assigning products to collection diff --git a/.changeset/stale-shirts-lie.md b/.changeset/stale-shirts-lie.md deleted file mode 100644 index 52811fa3dce..00000000000 --- a/.changeset/stale-shirts-lie.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix pasting float number into datagrid diff --git a/.changeset/ten-wasps-raise.md b/.changeset/ten-wasps-raise.md deleted file mode 100644 index bd631665eee..00000000000 --- a/.changeset/ten-wasps-raise.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Migrated Create basic order test to playwright diff --git a/.changeset/tidy-planes-wash.md b/.changeset/tidy-planes-wash.md deleted file mode 100644 index d48b9b48d31..00000000000 --- a/.changeset/tidy-planes-wash.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Update selector for orders tests in cypress diff --git a/.changeset/tricky-feet-type.md b/.changeset/tricky-feet-type.md deleted file mode 100644 index 311cbc371b7..00000000000 --- a/.changeset/tricky-feet-type.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix clear datagrid added variants after submit diff --git a/.changeset/twenty-shrimps-breathe.md b/.changeset/twenty-shrimps-breathe.md deleted file mode 100644 index b4b062c0911..00000000000 --- a/.changeset/twenty-shrimps-breathe.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Migrated shipping methods tests to playwright diff --git a/.changeset/twenty-snails-retire.md b/.changeset/twenty-snails-retire.md deleted file mode 100644 index cd3f2947066..00000000000 --- a/.changeset/twenty-snails-retire.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix copy on back button when failure during apo installation diff --git a/.changeset/wicked-planes-lick.md b/.changeset/wicked-planes-lick.md new file mode 100644 index 00000000000..7a35b76449b --- /dev/null +++ b/.changeset/wicked-planes-lick.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Prevent empty subscription query for new webhooks diff --git a/.changeset/yellow-rats-swim.md b/.changeset/yellow-rats-swim.md deleted file mode 100644 index 3545397cdfa..00000000000 --- a/.changeset/yellow-rats-swim.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": minor ---- - -Integrate voucher codes with API diff --git a/.changeset/young-spoons-count.md b/.changeset/young-spoons-count.md deleted file mode 100644 index d5ffc35a392..00000000000 --- a/.changeset/young-spoons-count.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"saleor-dashboard": patch ---- - -Fix disappearing labels of reference attributes diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index d30b602643e..a0468ef3faa 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -1867,16 +1867,16 @@ "context": "page type name", "string": "Content Type Name" }, + "BR8au7": { + "context": "delete channel", + "string": "Select channel that you wish to move existing orders to." + }, "BUKMzM": { "string": "Variant removed" }, "BWpuKl": { "string": "Update" }, - "BXMSl4": { - "context": "currency channel", - "string": "There is no available channel to move order information to. Please create a channel with same currency so that information can be moved to it." - }, "BXkF8Z": { "context": "header", "string": "Activity" @@ -2575,6 +2575,10 @@ "context": "ProductTypeDeleteWarningDialog single assigned items button label", "string": "View products" }, + "GCho9N": { + "context": "delete channel", + "string": "All channel settings information such as shipping, product listings, warehouse assignments, etc, will be lost." + }, "GD/bom": { "context": "label", "string": "Min Delivery Time" @@ -2609,6 +2613,10 @@ "GOdq5V": { "string": "Catalog" }, + "GP0zGO": { + "context": "dialog header", + "string": "Select destination channel:" + }, "GTCg9O": { "string": "You must add at least one voucher code" }, @@ -2640,6 +2648,10 @@ "context": "aria-label, negative money amount", "string": "minus" }, + "Ge+dUe": { + "context": "currency channel", + "string": "To delete {channelSlug} you have to create a chanel with currency: {currency} to be able to move all existing orders." + }, "Gfbp36": { "context": "dialog header", "string": "Unassign Products From Shipping" @@ -3301,6 +3313,10 @@ "context": "channel select label", "string": "Channel" }, + "LATHyi": { + "context": "dialog header", + "string": "Delete Channel: {channelSlug}" + }, "LEZZkK": { "context": "WarehouseSettings all warehouses description", "string": "If selected customer will be able to choose this warehouse as pickup point. Ordered products can be shipped here from a different warehouse" @@ -3516,10 +3532,6 @@ "context": "add discount button", "string": "Add Discount" }, - "Mz0cx+": { - "context": "delete channel", - "string": "Deleting channel will delete all product data regarding this channel. Are you sure you want to delete this channel?" - }, "N2SbNc": { "string": "{counter,plural,one{Are you sure you want to delete this customer?} other{Are you sure you want to delete {displayQuantity} customers?}}" }, @@ -4065,10 +4077,6 @@ "context": "button, unassign attribute from object", "string": "Unassign and save" }, - "QZoU0r": { - "context": "dialog header", - "string": "Delete Channel" - }, "Qb2XN5": { "string": "\"Mark as paid\" feature creates a {link} - used by Payment Apps" }, @@ -4354,10 +4362,6 @@ "context": "set variant as default, button", "string": "Set as default" }, - "SZJhvK": { - "context": "dialog header", - "string": "Select Channel" - }, "SZt9kC": { "context": "export filtered items to csv file", "string": "Current search ({number})" @@ -5521,6 +5525,10 @@ "aKSUWR": { "string": "Cannot create transaction to non-existing order" }, + "aMWJ7/": { + "context": "local error", + "string": "This field cannot be blank for a new webhook" + }, "aMwxYb": { "string": "Countries" }, @@ -8010,10 +8018,6 @@ "context": "no products placeholder", "string": "No products are available in the channel assigned to this order." }, - "sidKce": { - "context": "delete channel", - "string": "All order information from this channel need to be moved to a different channel. Please select channel orders need to be moved to:." - }, "sjRXXz": { "string": "Order #{orderId} was placed from draft by {userEmail}" }, @@ -8578,6 +8582,10 @@ "wWTUrM": { "string": "No activities found" }, + "wXFttp": { + "context": "note on currency", + "string": "Note: Only channels with matching currency are available." + }, "wbsq7O": { "string": "Usage" }, diff --git a/package-lock.json b/package-lock.json index 92bd6897a5a..fee67a43614 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "saleor-dashboard", - "version": "3.18.0-dev", + "version": "3.19.0-dev", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "saleor-dashboard", - "version": "3.18.0-dev", + "version": "3.19.0-dev", "hasInstallScript": true, "license": "BSD-3-Clause", "dependencies": { diff --git a/package.json b/package.json index 4770e9c313e..bf566e80abb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "saleor-dashboard", - "version": "3.18.0-dev", + "version": "3.19.0-dev", "main": "src/index.tsx", "repository": { "type": "git", diff --git a/src/attributes/components/AttributeDetails/messages.tsx b/src/attributes/components/AttributeDetails/messages.tsx index 603c167e0b6..9db9debca88 100644 --- a/src/attributes/components/AttributeDetails/messages.tsx +++ b/src/attributes/components/AttributeDetails/messages.tsx @@ -165,17 +165,22 @@ export const unitMessages = defineMessages({ }); export const units = { + cubicMillimeter: <>mm³, cubicCentimeter: <>cm³, cubicDecimeter: <>dm³, cubicMeter: <>m³, liter: "l", centimeter: "cm", + decimeter: "dm", meter: "m", + millimeter: "mm", kilometer: "km", gram: "g", kilogram: "kg", tonne: "t", + squareMillimeter: <>mm², squareCentimeter: <>cm², + squareDecimeter: <>dm², squareMeter: <>m², squareKilometer: <>km², cubicFoot: <>ft³, diff --git a/src/attributes/components/AttributeDetails/utils.ts b/src/attributes/components/AttributeDetails/utils.ts index 65d840968f6..4e8ef2fc20f 100644 --- a/src/attributes/components/AttributeDetails/utils.ts +++ b/src/attributes/components/AttributeDetails/utils.ts @@ -26,17 +26,22 @@ const UNIT_MESSAGES_MAPPING = { [MeasurementUnitsEnum.SQ_FT]: M.units.squareFt, [MeasurementUnitsEnum.SQ_YD]: M.units.squareYd, [MeasurementUnitsEnum.SQ_INCH]: M.units.squareInch, + [MeasurementUnitsEnum.CUBIC_MILLIMETER]: M.units.cubicMillimeter, [MeasurementUnitsEnum.CUBIC_CENTIMETER]: M.units.cubicCentimeter, [MeasurementUnitsEnum.CUBIC_DECIMETER]: M.units.cubicDecimeter, [MeasurementUnitsEnum.CUBIC_METER]: M.units.cubicMeter, [MeasurementUnitsEnum.LITER]: M.units.liter, [MeasurementUnitsEnum.CM]: M.units.centimeter, + [MeasurementUnitsEnum.DM]: M.units.decimeter, + [MeasurementUnitsEnum.MM]: M.units.millimeter, [MeasurementUnitsEnum.M]: M.units.meter, [MeasurementUnitsEnum.KM]: M.units.kilometer, [MeasurementUnitsEnum.G]: M.units.gram, [MeasurementUnitsEnum.KG]: M.units.kilogram, [MeasurementUnitsEnum.TONNE]: M.units.tonne, + [MeasurementUnitsEnum.SQ_MM]: M.units.squareMillimeter, [MeasurementUnitsEnum.SQ_CM]: M.units.squareCentimeter, + [MeasurementUnitsEnum.SQ_DM]: M.units.squareDecimeter, [MeasurementUnitsEnum.SQ_M]: M.units.squareMeter, [MeasurementUnitsEnum.SQ_KM]: M.units.squareKilometer, }; @@ -48,7 +53,7 @@ export const getMeasurementUnitMessage = ( const message = UNIT_MESSAGES_MAPPING[unit]; return typeof message === "string" || React.isValidElement(message) ? message - : formatMessage(message); + : formatMessage(message as MessageDescriptor); }; export const unitSystemChoices: Array> = [ @@ -107,13 +112,16 @@ export const unitMapping = { }, metric: { volume: [ + MeasurementUnitsEnum.CUBIC_MILLIMETER, MeasurementUnitsEnum.CUBIC_CENTIMETER, MeasurementUnitsEnum.CUBIC_DECIMETER, MeasurementUnitsEnum.CUBIC_METER, MeasurementUnitsEnum.LITER, ], distance: [ + MeasurementUnitsEnum.MM, MeasurementUnitsEnum.CM, + MeasurementUnitsEnum.DM, MeasurementUnitsEnum.M, MeasurementUnitsEnum.KM, ], @@ -123,7 +131,9 @@ export const unitMapping = { MeasurementUnitsEnum.TONNE, ], area: [ + MeasurementUnitsEnum.SQ_MM, MeasurementUnitsEnum.SQ_CM, + MeasurementUnitsEnum.SQ_DM, MeasurementUnitsEnum.SQ_M, MeasurementUnitsEnum.SQ_KM, ], diff --git a/src/channels/components/ChannelDeleteDialog/ChannelDeleteDialog.tsx b/src/channels/components/ChannelDeleteDialog/ChannelDeleteDialog.tsx index b33aa8db579..b5baf3baa15 100644 --- a/src/channels/components/ChannelDeleteDialog/ChannelDeleteDialog.tsx +++ b/src/channels/components/ChannelDeleteDialog/ChannelDeleteDialog.tsx @@ -14,37 +14,43 @@ import { useStyles } from "../styles"; const messages = defineMessages({ deleteChannel: { - id: "QZoU0r", - defaultMessage: "Delete Channel", + id: "LATHyi", + defaultMessage: "Delete Channel: {channelSlug} ", description: "dialog header", }, deletingAllProductData: { - id: "Mz0cx+", + id: "GCho9N", defaultMessage: - "Deleting channel will delete all product data regarding this channel. Are you sure you want to delete this channel?", + "All channel settings information such as shipping, product listings, warehouse assignments, etc, will be lost.", description: "delete channel", }, needToBeMoved: { - id: "sidKce", - defaultMessage: - "All order information from this channel need to be moved to a different channel. Please select channel orders need to be moved to:.", + id: "BR8au7", + defaultMessage: "Select channel that you wish to move existing orders to.", description: "delete channel", }, + note: { + id: "wXFttp", + defaultMessage: "Note: Only channels with matching currency are available.", + description: "note on currency", + }, noAvailableChannel: { - id: "BXMSl4", + id: "Ge+dUe", defaultMessage: - "There is no available channel to move order information to. Please create a channel with same currency so that information can be moved to it.", + "To delete {channelSlug} you have to create a chanel with currency: {currency} to be able to move all existing orders.", description: "currency channel", }, selectChannel: { - id: "SZJhvK", - defaultMessage: "Select Channel", + id: "GP0zGO", + defaultMessage: "Select destination channel:", description: "dialog header", }, }); export interface ChannelDeleteDialogProps { channelsChoices: Choices; + channelSlug: string; + currency: string; hasOrders: boolean; confirmButtonState: ConfirmButtonTransitionState; open: boolean; @@ -55,10 +61,12 @@ export interface ChannelDeleteDialogProps { const ChannelDeleteDialog: React.FC = ({ channelsChoices = [], + channelSlug, hasOrders, confirmButtonState, open, onBack, + currency, onClose, onConfirm, }) => { @@ -75,21 +83,32 @@ const ChannelDeleteDialog: React.FC = ({ return ( (canBeDeleted ? onConfirm(choice) : onBack())} - title={intl.formatMessage(messages.deleteChannel)} + title={intl.formatMessage(messages.deleteChannel, { channelSlug })} confirmButtonLabel={intl.formatMessage( - canBeDeleted ? buttonMessages.delete : buttonMessages.ok, + canBeDeleted ? buttonMessages.delete : buttonMessages.cancel, )} - variant={canBeDeleted ? "delete" : "default"} + variant={canBeDeleted ? "delete" : "info"} >
{hasOrders ? ( hasChannels ? ( <> + + {intl.formatMessage(messages.deletingAllProductData)} + +
{intl.formatMessage(messages.needToBeMoved)} +
+ {intl.formatMessage(messages.note)}
= ({ onChange={e => setChoice(e.target.value)} />
- - {intl.formatMessage(messages.deletingAllProductData)} - ) : ( - {intl.formatMessage(messages.noAvailableChannel)} + {intl.formatMessage(messages.noAvailableChannel, { + channelSlug: {channelSlug}, + currency: {currency}, + })} ) ) : ( diff --git a/src/channels/views/ChannelDetails/ChannelDetails.tsx b/src/channels/views/ChannelDetails/ChannelDetails.tsx index 3eff4b8a405..f31775e4132 100644 --- a/src/channels/views/ChannelDetails/ChannelDetails.tsx +++ b/src/channels/views/ChannelDetails/ChannelDetails.tsx @@ -278,6 +278,8 @@ export const ChannelDetails: React.FC = ({ countries={shop?.countries || []} /> = ({ params }) => { {!!selectedChannel && ( = ({ setQuery(prettified); }, [prettified]); + const [localErrors, setLocalErrors] = React.useState( + [], + ); + const handleSubmit = (data: WebhookFormData) => { + if (!webhook && query.length === 0) { + setLocalErrors([ + { + __typename: "WebhookError", + code: WebhookErrorCode.REQUIRED, + field: "subscriptionQuery", + message: intl.formatMessage(messages.subscriptionQueryBlankError), + }, + ]); + + return; + } + onSubmit({ ...data, ...{ subscriptionQuery: query } }); }; @@ -143,6 +161,7 @@ const WebhookDetailsPage: React.FC = ({ query={query} setQuery={setQuery} data={data} + errors={localErrors} /> diff --git a/src/custom-apps/components/WebhookDetailsPage/messages.ts b/src/custom-apps/components/WebhookDetailsPage/messages.ts index 9c839531731..26b84dbcb95 100644 --- a/src/custom-apps/components/WebhookDetailsPage/messages.ts +++ b/src/custom-apps/components/WebhookDetailsPage/messages.ts @@ -19,6 +19,11 @@ export const messages = defineMessages({ defaultMessage: "Create Webhook", description: "header", }, + subscriptionQueryBlankError: { + id: "aMWJ7/", + defaultMessage: "This field cannot be blank for a new webhook", + description: "local error", + }, }); export const getHeaderTitle = ( diff --git a/src/custom-apps/components/WebhookSubscriptionQuery/WebhookSubscriptionQuery.test.tsx b/src/custom-apps/components/WebhookSubscriptionQuery/WebhookSubscriptionQuery.test.tsx index 4e44c4236fd..ebf50d51279 100644 --- a/src/custom-apps/components/WebhookSubscriptionQuery/WebhookSubscriptionQuery.test.tsx +++ b/src/custom-apps/components/WebhookSubscriptionQuery/WebhookSubscriptionQuery.test.tsx @@ -41,6 +41,7 @@ describe("WebhookSubscriptionQuery", () => { subscriptionQuery: "", customHeaders: "", }, + errors: [], }; // Act diff --git a/src/custom-apps/components/WebhookSubscriptionQuery/WebhookSubscriptionQuery.tsx b/src/custom-apps/components/WebhookSubscriptionQuery/WebhookSubscriptionQuery.tsx index 78123992499..f06a636ab05 100644 --- a/src/custom-apps/components/WebhookSubscriptionQuery/WebhookSubscriptionQuery.tsx +++ b/src/custom-apps/components/WebhookSubscriptionQuery/WebhookSubscriptionQuery.tsx @@ -2,9 +2,12 @@ import "graphiql/graphiql.min.css"; import CardTitle from "@dashboard/components/CardTitle"; +import { WebhookErrorFragment } from "@dashboard/graphql"; +import { getFormErrors } from "@dashboard/utils/errors"; import { useExplorerPlugin } from "@graphiql/plugin-explorer"; import { createGraphiQLFetcher } from "@graphiql/toolkit"; import { Card, CardContent } from "@material-ui/core"; +import clsx from "clsx"; import React from "react"; import { defineMessages, useIntl } from "react-intl"; @@ -24,6 +27,7 @@ interface WebhookSubscriptionQueryProps { query: any; setQuery: React.Dispatch; data: WebhookFormData; + errors: WebhookErrorFragment[]; } const fetcher = createGraphiQLFetcher({ @@ -31,6 +35,7 @@ const fetcher = createGraphiQLFetcher({ }); const WebhookSubscriptionQuery: React.FC = ({ + errors, query, setQuery, data, @@ -45,9 +50,15 @@ const WebhookSubscriptionQuery: React.FC = ({ const classes = useStyles(); + const formErrors = getFormErrors(["subscriptionQuery"], errors); + return ( - + ({ @@ -16,6 +17,12 @@ export const useStyles = makeStyles( cardTitle: { paddingLeft: 0, }, + error: { + color: vars.colors.foreground.textCriticalDefault, + "& .MuiTypography-colorTextSecondary": { + color: vars.colors.foreground.textCriticalDefault, + }, + }, }), { name: "WebhookSubscriptionQuery" }, );