Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove mount, target and options from AppExtension (#18571)
Lukasz Ostrowskid2b8ef040b3c
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0c3efcd62c..61d38bfb5c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,8 @@ All notable, unreleased changes to this project will be documented in this file.- Fix missing denormalization of shipping methods metadata when creating an order.- Shipping method metadata is now copied to dedicated order fields (`shipping_method_metadata` and `shipping_method_private_metadata`) during checkout-to-order conversion. This ensures that order metadata remains consistent even if the original shipping method is modified or deleted. As a result, updates made to a shipping method's metadata after order creation will no longer be reflected in the order's `shippingMethod.metadata` field.- Shipping method metadata is now also denormalized during draft order finalization, ensuring consistent behavior across all order creation flows.+- Fields `options`, `mount` and `target` are removed from `AppExtension` and `AppManifestExtension` types. Use `mountName`, `targetName` and `settings`+### GraphQL APIdiff --git a/saleor/app/tests/test_installation_utils.py b/saleor/app/tests/test_installation_utils.pyindex a25ffa1a73..53e683a37b 100644--- a/saleor/app/tests/test_installation_utils.py+++ b/saleor/app/tests/test_installation_utils.py@@ -623,45 +623,6 @@ def test_install_app_extension_incorrect_values(install_app(app_installation, activate=True)- "incorrect_options",- [- {"newTabTarget": {"method": "INVALID"}},- {"newTabTarget": {}},- {"newTabTarget": "invalid"},- {"widgetTarget": {"method": "INVALID"}},- {"widgetTarget": {}},- {"widgetTarget": "invalid"},- ],-)-def test_install_app_extension_incorrect_options(- incorrect_options, app_manifest, app_installation, monkeypatch-):- # given- label = "Create product with app"- url = "http://127.0.0.1:8080/app-extension"- app_manifest["permissions"] = []- app_manifest["extensions"] = [- {- "label": label,- "url": url,- "mount": "PRODUCT_OVERVIEW_CREATE",- "target": "POPUP",- "permissions": ["MANAGE_PRODUCTS"],- "options": incorrect_options,- }- ]- mocked_get_response = Mock()- mocked_get_response.json.return_value = app_manifest-- monkeypatch.setattr(HTTPSession, "request", Mock(return_value=mocked_get_response))- monkeypatch.setattr("saleor.app.installation_utils.send_app_token", Mock())-- # when & then- with pytest.raises(ValidationError):- install_app(app_installation, activate=True)--def test_install_app_with_extension_post_method(app_manifest,app_installation,diff --git a/saleor/graphql/app/enums.py b/saleor/graphql/app/enums.pyindex 9256139953..c969aa178d 100644--- a/saleor/graphql/app/enums.py+++ b/saleor/graphql/app/enums.py@@ -1,4 +1,4 @@-from ...app.types import AppExtensionMount, AppExtensionTarget, AppType+from ...app.types import AppTypefrom ..core.doc_category import DOC_CATEGORY_APPSfrom ..core.enums import to_enum@@ -57,13 +57,3 @@ CircuitBreakerStateEnum.doc_category = DOC_CATEGORY_APPSAppTypeEnum = to_enum(AppType, description=description)AppTypeEnum.doc_category = DOC_CATEGORY_APPS--AppExtensionMountEnum = to_enum(- AppExtensionMount, description=AppExtensionMount.__doc__-)-AppExtensionMountEnum.doc_category = DOC_CATEGORY_APPS--AppExtensionTargetEnum = to_enum(- AppExtensionTarget, description=AppExtensionTarget.__doc__-)-AppExtensionTargetEnum.doc_category = DOC_CATEGORY_APPSdiff --git a/saleor/graphql/app/filters.py b/saleor/graphql/app/filters.pyindex 34b69a94e1..366f5e223d 100644--- a/saleor/graphql/app/filters.py+++ b/saleor/graphql/app/filters.py@@ -2,10 +2,10 @@ import django_filtersimport graphenefrom ...app import models-from ...app.types import AppExtensionTarget, AppType-from ..core.descriptions import ADDED_IN_322, DEPRECATED_IN_3X_INPUT+from ...app.types import AppType+from ..core.descriptions import ADDED_IN_322from ..core.filters import EnumFilter, ListObjectTypeFilter-from .enums import AppExtensionMountEnum, AppExtensionTargetEnum, AppTypeEnum+from .enums import AppTypeEnumdef filter_app_search(qs, _, value):@@ -20,18 +20,6 @@ def filter_app_type(qs, _, value):return qs-def filter_app_extension_target(qs, _, value):- if value in [target for target, _ in AppExtensionTarget.CHOICES]:- qs = qs.filter(target=value)- return qs---def filter_app_extension_mount(qs, _, value):- if value:- qs = qs.filter(mount__in=value)- return qs--def filter_app_extension_mount_name(qs, _, value):if value:qs = qs.filter(mount__in=[v.lower() for v in value])@@ -55,16 +43,6 @@ class AppFilter(django_filters.FilterSet):class AppExtensionFilter(django_filters.FilterSet):- mount = ListObjectTypeFilter(- input_class=AppExtensionMountEnum,- method=filter_app_extension_mount,- help_text=f"DEPRECATED: Use `mountName` instead. {DEPRECATED_IN_3X_INPUT}",- )- target = EnumFilter(- input_class=AppExtensionTargetEnum,- method=filter_app_extension_target,- help_text=f"DEPRECATED: Use `targetName` instead. {DEPRECATED_IN_3X_INPUT}",- )mountName = ListObjectTypeFilter(input_class=graphene.String,method=filter_app_extension_mount_name,@@ -77,4 +55,4 @@ class AppExtensionFilter(django_filters.FilterSet):class Meta:model = models.AppExtension- fields = ["mount", "target", "mountName", "targetName"]+ fields = ["mountName", "targetName"]diff --git a/saleor/graphql/app/tests/benchmarks/test_app_extensions.py b/saleor/graphql/app/tests/benchmarks/test_app_extensions.pyindex 48ee3378ae..d59a98fce9 100644--- a/saleor/graphql/app/tests/benchmarks/test_app_extensions.py+++ b/saleor/graphql/app/tests/benchmarks/test_app_extensions.py@@ -3,7 +3,6 @@ import pytestfrom .....app.models import AppExtensionfrom .....app.types import AppExtensionMountfrom ....tests.utils import get_graphql_content-from ...enums import AppExtensionMountEnum, AppExtensionTargetEnum@pytest.mark.count_queries(autouse=False)@@ -21,8 +20,8 @@ def test_app_extensions(node{labelurl- mount- target+ mountName+ targetNameidaccessTokenpermissions{@@ -76,11 +75,11 @@ def test_app_extensions("filter",[{},- {"mount": AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name},- {"target": AppExtensionTargetEnum.POPUP.name},+ {"mountName": ["PRODUCT_OVERVIEW_CREATE"]},+ {"targetName": "POPUP"},{- "mount": AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name,- "target": AppExtensionTargetEnum.POPUP.name,+ "mountName": ["PRODUCT_OVERVIEW_CREATE"],+ "targetName": "POPUP",},],)@@ -100,9 +99,9 @@ def test_app_extensions_with_filter(node{labelurl- target+ targetNameid- mount+ mountNameaccessTokenpermissions{codediff --git a/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.py b/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.pyindex 5c8a695b5e..433fef97f1 100644--- a/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.py+++ b/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.py@@ -12,7 +12,6 @@ from .....app.error_codes import AppErrorCodefrom .....app.models import Appfrom .....thumbnail import IconThumbnailFormatfrom ....tests.utils import assert_no_permission, get_graphql_content-from ...enums import AppExtensionMountEnum, AppExtensionTargetEnumAPP_FETCH_MANIFEST_MUTATION = """mutation AppFetchManifest(@@ -45,8 +44,6 @@ mutation AppFetchManifest(extensions{labelurl- mount- targetmountNametargetNamesettings@@ -355,7 +352,7 @@ def test_app_fetch_manifest_missing_extension_fields("permissions": ["MANAGE_PRODUCTS"],"label": "Create product with App","url": "http://127.0.0.1:9090/app-extension",- "mount": AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name,+ "mount": "PRODUCT_OVERVIEW_CREATE",}]del app_manifest["extensions"][0][missing_field]@@ -399,7 +396,7 @@ def test_app_fetch_manifest_extensions_incorrect_enum_values("permissions": ["MANAGE_PRODUCTS"],"label": "Create product with App","url": "http://127.0.0.1:9090/app-extension",- "mount": AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name,+ "mount": "PRODUCT_OVERVIEW_CREATE",}]app_manifest["extensions"][0][incorrect_field] = "INCORRECT_VALUE"@@ -438,12 +435,12 @@ def test_app_fetch_manifest_extensions_incorrect_enum_values(@pytest.mark.parametrize(("url", "target", "app_url"),[- ("/app", AppExtensionTargetEnum.APP_PAGE.name, ""),- ("/app", AppExtensionTargetEnum.APP_PAGE.name, "https://www.example.com/app"),- ("/app", AppExtensionTargetEnum.POPUP.name, "https://www.example.com/app"),+ ("/app", "APP_PAGE", ""),+ ("/app", "APP_PAGE", "https://www.example.com/app"),+ ("/app", "POPUP", "https://www.example.com/app"),("https://www.example.com/app/form",- AppExtensionTargetEnum.NEW_TAB.name,+ "NEW_TAB","https://www.example.com/app",),],@@ -464,7 +461,7 @@ def test_app_fetch_manifest_extensions_correct_url("permissions": ["MANAGE_PRODUCTS"],"label": "Create product with App","url": url,- "mount": AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name,+ "mount": "PRODUCT_OVERVIEW_CREATE","target": target,}]@@ -493,13 +490,13 @@ def test_app_fetch_manifest_extensions_correct_url(@pytest.mark.parametrize(("url", "target"),[- ("http:/127.0.0.1:8080/app", AppExtensionTargetEnum.POPUP.name),- ("127.0.0.1:8080/app", AppExtensionTargetEnum.POPUP.name),- ("", AppExtensionTargetEnum.POPUP.name),- ("/app", AppExtensionTargetEnum.POPUP.name),- ("www.example.com/app", AppExtensionTargetEnum.POPUP.name),- ("https://www.example.com/app", AppExtensionTargetEnum.APP_PAGE.name),- ("http://www.example.com/app", AppExtensionTargetEnum.APP_PAGE.name),+ ("http:/127.0.0.1:8080/app", "POPUP"),+ ("127.0.0.1:8080/app", "POPUP"),+ ("", "POPUP"),+ ("/app", "POPUP"),+ ("www.example.com/app", "POPUP"),+ ("https://www.example.com/app", "APP_PAGE"),+ ("http://www.example.com/app", "APP_PAGE"),],)def test_app_fetch_manifest_extensions_incorrect_url(@@ -511,7 +508,7 @@ def test_app_fetch_manifest_extensions_incorrect_url("permissions": ["MANAGE_PRODUCTS"],"label": "Create product with App","url": url,- "mount": AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name,+ "mount": "PRODUCT_OVERVIEW_CREATE","target": target,}]@@ -565,7 +562,7 @@ def test_app_fetch_manifest_extensions_permission_out_of_scope("permissions": extension_permissions,"label": "Create product with App","url": "http://127.0.0.1:8080/app",- "mount": AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name,+ "mount": "PRODUCT_OVERVIEW_CREATE",}]@@ -606,7 +603,7 @@ def test_app_fetch_manifest_extensions_invalid_permission("permissions": ["incorrect_permission"],"label": "Create product with App","url": "http://127.0.0.1:8080/app",- "mount": AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name,+ "mount": "PRODUCT_OVERVIEW_CREATE",}]@@ -648,7 +645,7 @@ def test_app_fetch_manifest_with_extensions("permissions": ["MANAGE_PRODUCTS"],"label": "Create product with App","url": "http://127.0.0.1:8080/app",- "mount": AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name,+ "mount": "PRODUCT_OVERVIEW_CREATE",}]@@ -682,8 +679,6 @@ def test_app_fetch_manifest_with_extensions(]assert extension["label"] == "Create product with App"assert extension["url"] == "http://127.0.0.1:8080/app"- assert extension["mount"] == AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name- assert extension["target"] == AppExtensionTargetEnum.POPUP.nameassert extension["mountName"] == "PRODUCT_OVERVIEW_CREATE"assert extension["targetName"] == "POPUP"@@ -702,8 +697,8 @@ def test_app_fetch_manifest_with_widget_extension_settings("permissions": ["MANAGE_PRODUCTS"],"label": "Product Widget","url": "http://127.0.0.1:8080/widget",- "mount": AppExtensionMountEnum.PRODUCT_DETAILS_WIDGETS.name,- "target": AppExtensionTargetEnum.WIDGET.name,+ "mount": "PRODUCT_DETAILS_WIDGETS",+ "target": "WIDGET","options": {"widgetTarget": {"method": "POST"}},}]@@ -735,7 +730,7 @@ def test_app_fetch_manifest_with_widget_extension_settings(extension = extensions[0]assert extension["label"] == "Product Widget"- assert extension["target"] == AppExtensionTargetEnum.WIDGET.name+ assert extension["targetName"] == "WIDGET"assert extension["settings"] == {"widgetTarget": {"method": "POST"}}@@ -752,8 +747,8 @@ def test_app_fetch_manifest_with_new_tab_extension_settings("permissions": ["MANAGE_ORDERS"],"label": "Order Details","url": "https://127.0.0.1:8080/orders",- "mount": AppExtensionMountEnum.ORDER_DETAILS_MORE_ACTIONS.name,- "target": AppExtensionTargetEnum.NEW_TAB.name,+ "mount": "ORDER_DETAILS_MORE_ACTIONS",+ "target": "NEW_TAB","options": {"newTabTarget": {"method": "GET"}},}]@@ -784,7 +779,7 @@ def test_app_fetch_manifest_with_new_tab_extension_settings(extension = extensions[0]assert extension["label"] == "Order Details"- assert extension["target"] == AppExtensionTargetEnum.NEW_TAB.name+ assert extension["targetName"] == "NEW_TAB"assert extension["settings"] == {"newTabTarget": {"method": "GET"}}diff --git a/saleor/graphql/app/tests/queries/test_app.py b/saleor/graphql/app/tests/queries/test_app.pyindex deb8966898..601a877560 100644--- a/saleor/graphql/app/tests/queries/test_app.py+++ b/saleor/graphql/app/tests/queries/test_app.py@@ -45,8 +45,8 @@ QUERY_APP = """idlabelurl- mount- target+ mountName+ targetNamepermissions{code}@@ -339,8 +339,8 @@ def test_app_with_extensions_query(extensions_data = app_data["extensions"]returned_ids = {e["id"] for e in extensions_data}returned_labels = {e["label"] for e in extensions_data}- returned_mounts = {e["mount"].lower() for e in extensions_data}- returned_targets = {e["target"].lower() for e in extensions_data}+ returned_mounts = {e["mountName"].lower() for e in extensions_data}+ returned_targets = {e["targetName"].lower() for e in extensions_data}returned_permission_codes = [e["permissions"] for e in extensions_data]for app_extension in app_extensions:global_id = graphene.Node.to_global_id("AppExtension", app_extension.id)@@ -420,8 +420,8 @@ QUERY_APP_AVAILABLE_FOR_STAFF_WITHOUT_MANAGE_APPS = """idlabelurl- mount- target+ mountName+ targetNamepermissions{code}diff --git a/saleor/graphql/app/tests/queries/test_app_extension.py b/saleor/graphql/app/tests/queries/test_app_extension.pyindex 300029908c..a2e62f141a 100644--- a/saleor/graphql/app/tests/queries/test_app_extension.py+++ b/saleor/graphql/app/tests/queries/test_app_extension.py@@ -11,8 +11,6 @@ query ($id: ID!){appExtension(id: $id){labelurl- mount- targetmountNametargetNameid@@ -21,19 +19,6 @@ query ($id: ID!){code}settings- options {- ... on AppExtensionOptionsWidget{- widgetTarget {- method- }- }- ...on AppExtensionOptionsNewTab {- newTabTarget{- method- }- }-- }}}"""@@ -64,16 +49,14 @@ def test_app_extension_staff_user(app, staff_api_client, permission_manage_produextension_data = content["data"]["appExtension"]assert app_extension.label == extension_data["label"]assert app_extension.url == extension_data["url"]- assert app_extension.mount == extension_data["mount"].lower()- assert app_extension.target == extension_data["target"].lower()+ assert app_extension.mount == extension_data["mountName"].lower()+ assert app_extension.target == extension_data["targetName"].lower()assert app_extension.permissions.count() == 1assert len(extension_data["permissions"]) == 1permission_code = extension_data["permissions"][0]["code"].lower()assert app_extension.permissions.first().codename == permission_code- assert extension_data["options"]["widgetTarget"]["method"] == "POST"-assert extension_data["settings"] is not Noneassert extension_data["settings"]["widgetTarget"]["method"] == "POST"@@ -104,8 +87,8 @@ def test_app_extension_by_app(app, app_api_client, permission_manage_products):extension_data = content["data"]["appExtension"]assert app_extension.label == extension_data["label"]assert app_extension.url == extension_data["url"]- assert app_extension.mount == extension_data["mount"].lower()- assert app_extension.target == extension_data["target"].lower()+ assert app_extension.mount == extension_data["mountName"].lower()+ assert app_extension.target == extension_data["targetName"].lower()assert app_extension.permissions.count() == 1assert len(extension_data["permissions"]) == 1@@ -313,8 +296,8 @@ query ($id: ID!){appExtension(id: $id){labelurl- mount- target+ mountName+ targetNameidpermissions{code@@ -499,7 +482,7 @@ def test_app_extension_with_app_query_by_customer_without_permissions((AppExtensionTarget.NEW_TAB, "GET"),],)-def test_app_extension_type_options(+def test_app_extension_type_settings(target,method,app,@@ -527,15 +510,11 @@ def test_app_extension_type_options(content = get_graphql_content(response)extension_data = content["data"]["appExtension"]- assert extension_data["target"] == target.upper()-assert extension_data["mountName"] == "ORDER_DETAILS_WIDGETS"assert extension_data["targetName"] == app_extension.target.upper()if target == AppExtensionTarget.NEW_TAB:- assert extension_data["options"]["newTabTarget"]["method"] == methodassert extension_data["settings"]["newTabTarget"]["method"] == methodif target == AppExtensionTarget.WIDGET:- assert extension_data["options"]["widgetTarget"]["method"] == methodassert extension_data["settings"]["widgetTarget"]["method"] == methoddiff --git a/saleor/graphql/app/tests/queries/test_app_extensions.py b/saleor/graphql/app/tests/queries/test_app_extensions.pyindex e0d9540e33..4aedff6979 100644--- a/saleor/graphql/app/tests/queries/test_app_extensions.py+++ b/saleor/graphql/app/tests/queries/test_app_extensions.py@@ -4,7 +4,6 @@ from .....app.models import AppExtensionfrom .....app.types import AppExtensionMount, AppExtensionTargetfrom .....core.jwt import jwt_decodefrom ....tests.utils import assert_no_permission, get_graphql_content-from ...enums import AppExtensionMountEnum, AppExtensionTargetEnumQUERY_APP_EXTENSIONS = """query ($filter: AppExtensionFilterInput){@@ -13,26 +12,11 @@ query ($filter: AppExtensionFilterInput){node{labelurl- mount- targetmountNametargetNamesettingsidaccessToken- options {- ... on AppExtensionOptionsWidget{- widgetTarget {- method- }- }- ...on AppExtensionOptionsNewTab {- newTabTarget{- method- }- }-- }permissions{code}@@ -73,7 +57,7 @@ def test_app_extensions(staff_api_client, app, permission_manage_products):extension_data = extensions_data[0]["node"]assert app_extension.label == extension_data["label"]assert app_extension.url == extension_data["url"]- assert app_extension.mount == extension_data["mount"].lower()+ assert app_extension.mount == extension_data["mountName"].lower()assert app_extension.permissions.count() == 1assert len(extension_data["permissions"]) == 1@@ -84,7 +68,6 @@ def test_app_extensions(staff_api_client, app, permission_manage_products):decode_token = jwt_decode(extension_data["accessToken"])decode_token["permissions"] = ["MANAGE_PRODUCTS"]- assert extension_data["options"]["widgetTarget"]["method"] == "POST"assert extension_data["mountName"] == "PRODUCT_OVERVIEW_MORE_ACTIONS"assert extension_data["targetName"] == "WIDGET"@@ -172,25 +155,25 @@ def test_app_extensions_user_not_staff(("filter", "expected_count"),[({}, 4),- ({"target": AppExtensionTargetEnum.APP_PAGE.name}, 1),- ({"target": AppExtensionTargetEnum.POPUP.name}, 3),- ({"mount": [AppExtensionMountEnum.PRODUCT_OVERVIEW_MORE_ACTIONS.name]}, 1),- ({"mount": [AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name]}, 2),+ ({"targetName": "APP_PAGE"}, 1),+ ({"targetName": "POPUP"}, 3),+ ({"mountName": ["PRODUCT_OVERVIEW_MORE_ACTIONS"]}, 1),+ ({"mountName": ["PRODUCT_OVERVIEW_CREATE"]}, 2),({- "mount": [- AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name,- AppExtensionMountEnum.PRODUCT_OVERVIEW_MORE_ACTIONS.name,+ "mountName": [+ "PRODUCT_OVERVIEW_CREATE",+ "PRODUCT_OVERVIEW_MORE_ACTIONS",]},3,),({- "target": AppExtensionTargetEnum.APP_PAGE.name,- "mount": [- AppExtensionMountEnum.PRODUCT_OVERVIEW_CREATE.name,- AppExtensionMountEnum.PRODUCT_OVERVIEW_MORE_ACTIONS.name,+ "targetName": "APP_PAGE",+ "mountName": [+ "PRODUCT_OVERVIEW_CREATE",+ "PRODUCT_OVERVIEW_MORE_ACTIONS",],},1,diff --git a/saleor/graphql/app/tests/queries/test_apps.py b/saleor/graphql/app/tests/queries/test_apps.pyindex 3e01634277..042a1251c3 100644--- a/saleor/graphql/app/tests/queries/test_apps.py+++ b/saleor/graphql/app/tests/queries/test_apps.py@@ -41,8 +41,8 @@ QUERY_APPS_WITH_FILTER = """idlabelurl- mount- target+ mountName+ targetNamepermissions{code}@@ -129,8 +129,8 @@ def test_apps_with_extensions_query(extensions_data = app_data["extensions"]returned_ids = {e["id"] for e in extensions_data}returned_labels = {e["label"] for e in extensions_data}- returned_mounts = {e["mount"].lower() for e in extensions_data}- returned_targets = {e["target"].lower() for e in extensions_data}+ returned_mounts = {e["mountName"].lower() for e in extensions_data}+ returned_targets = {e["targetName"].lower() for e in extensions_data}returned_permission_codes = [e["permissions"] for e in extensions_data]for app_extension in app_extensions:global_id = graphene.Node.to_global_id("AppExtension", app_extension.id)@@ -329,8 +329,8 @@ QUERY_APPS_AVAILABLE_FOR_STAFF_WITHOUT_MANAGE_APPS = """idlabelurl- mount- target+ mountName+ targetNamepermissions{code}diff --git a/saleor/graphql/app/types.py b/saleor/graphql/app/types.pyindex 4914fbbab5..92e1bfe1f6 100644--- a/saleor/graphql/app/types.py+++ b/saleor/graphql/app/types.py@@ -55,8 +55,6 @@ from .dataloaders import (app_promise_callback,)from .enums import (- AppExtensionMountEnum,- AppExtensionTargetEnum,AppTypeEnum,CircuitBreakerState,CircuitBreakerStateEnum,@@ -117,18 +115,6 @@ class AppManifestExtension(BaseObjectType):url = graphene.String(description="URL of a view where extension's iframe is placed.", required=True)- # TODO Remove in 3.23- mount = AppExtensionMountEnum(- description="Place where given extension will be mounted.",- required=True,- deprecation_reason="Use `mountName` instead.",- )- # TODO Remove in 3.23- target = AppExtensionTargetEnum(- description="Type of way how app extension will be opened.",- required=True,- deprecation_reason="Use `targetName` instead.",- )mount_name = graphene.String(description="Name of the extension mount point in the dashboard. Replaces `mount`"@@ -180,68 +166,6 @@ class HttpMethod(BaseEnum):GET = AppExtensionHttpMethod.GET-# TODO Remove in 3.23-class NewTabTargetOptions(BaseObjectType):- method = graphene.Field(- HttpMethod,- required=True,- description="HTTP method for New Tab target (GET or POST)",- deprecation_reason="Use `settings` field directly.",- )-- class Meta:- description = "Represents the NEW_TAB target options for an app extension."- doc_category = DOC_CATEGORY_APPS---# TODO Remove in 3.23-class WidgetTargetOptions(BaseObjectType):- method = graphene.Field(- HttpMethod,- required=True,- description="HTTP method for Widget target (GET or POST)",- deprecation_reason="Use `settings` field directly.",- )-- class Meta:- description = "Represents the WIDGET target options for an app extension."- doc_category = DOC_CATEGORY_APPS---# TODO Remove in 3.23-class AppExtensionOptionsWidget(BaseObjectType):- widget_target = graphene.Field(- WidgetTargetOptions,- description="Options for displaying a Widget",- required=False,- deprecation_reason="Use `settings` field directly.",- )-- class Meta:- description = "Represents the options for an app extension."- doc_category = DOC_CATEGORY_APPS---# TODO Remove in 3.23-class AppExtensionOptionsNewTab(BaseObjectType):- new_tab_target = graphene.Field(- NewTabTargetOptions,- description="Options controlling behavior of the NEW_TAB extension target",- required=False,- deprecation_reason="Use `settings` field directly.",- )-- class Meta:- description = "Represents the options for an app extension."- doc_category = DOC_CATEGORY_APPS---# TODO Remove in 3.23-class AppExtensionPossibleOptions(graphene.Union):- class Meta:- types = (AppExtensionOptionsWidget, AppExtensionOptionsNewTab)--class AppExtension(AppManifestExtension, ModelObjectType[models.AppExtension]):id = graphene.GlobalID(required=True, description="The ID of the app extension.")app = graphene.Field(@@ -252,11 +176,6 @@ class AppExtension(AppManifestExtension, ModelObjectType[models.AppExtension]):access_token = graphene.String(description="JWT token used to authenticate by third-party app extension.")- options = graphene.Field(- AppExtensionPossibleOptions,- description="App extension options." + ADDED_IN_322,- deprecation_reason="Use `settings` field directly.",- )class Meta:description = "Represents app data."@@ -276,10 +195,6 @@ class AppExtension(AppManifestExtension, ModelObjectType[models.AppExtension]):))- @staticmethod- def resolve_target(root, _info: ResolveInfo):- return root.target-@staticmethoddef resolve_mount_name(root: models.AppExtension, _info: ResolveInfo):# Temporary upper(), but TODO return it directly from DB once we migrate DB@@ -328,22 +243,6 @@ class AppExtension(AppManifestExtension, ModelObjectType[models.AppExtension]):return AppByIdLoader(info.context).load(root.app_id).then(_resolve_access_token)- @staticmethod- def resolve_options(root: models.AppExtension, _info: ResolveInfo):- http_method = root.http_target_method-- if root.target == AppExtensionTarget.WIDGET:- return AppExtensionOptionsWidget(- widget_target=WidgetTargetOptions(method=http_method),- )-- if root.target == AppExtensionTarget.NEW_TAB:- return AppExtensionOptionsNewTab(- new_tab_target=NewTabTargetOptions(method=http_method),- )-- return None-# TODO Return settings directly from the DB@staticmethoddef resolve_settings(root: models.AppExtension, _info: ResolveInfo):diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex a77e8031d9..a4eb3dcf35 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -3025,12 +3025,6 @@ type AppExtension implements Node @doc(category: "Apps") {"""URL of a view where extension's iframe is placed."""url: String!- """Place where given extension will be mounted."""- mount: AppExtensionMountEnum! @deprecated(reason: "Use `mountName` instead.")-- """Type of way how app extension will be opened."""- target: AppExtensionTargetEnum! @deprecated(reason: "Use `targetName` instead.")-"""Name of the extension mount point in the dashboard. Replaces `mount`@@ -3057,115 +3051,10 @@ type AppExtension implements Node @doc(category: "Apps") {"""JWT token used to authenticate by third-party app extension."""accessToken: String-- """- App extension options.-- Added in Saleor 3.22.- """- options: AppExtensionPossibleOptions @deprecated(reason: "Use `settings` field directly.")-}--"""All places where app extension can be mounted."""-enum AppExtensionMountEnum @doc(category: "Apps") {- CATEGORY_OVERVIEW_CREATE- CATEGORY_OVERVIEW_MORE_ACTIONS- CATEGORY_DETAILS_MORE_ACTIONS- COLLECTION_OVERVIEW_CREATE- COLLECTION_OVERVIEW_MORE_ACTIONS- COLLECTION_DETAILS_MORE_ACTIONS- COLLECTION_DETAILS_WIDGETS- GIFT_CARD_OVERVIEW_CREATE- GIFT_CARD_OVERVIEW_MORE_ACTIONS- GIFT_CARD_DETAILS_MORE_ACTIONS- GIFT_CARD_DETAILS_WIDGETS- CUSTOMER_OVERVIEW_CREATE- CUSTOMER_OVERVIEW_MORE_ACTIONS- CUSTOMER_DETAILS_MORE_ACTIONS- CUSTOMER_DETAILS_WIDGETS- PRODUCT_OVERVIEW_CREATE- PRODUCT_OVERVIEW_MORE_ACTIONS- PRODUCT_DETAILS_MORE_ACTIONS- PRODUCT_DETAILS_WIDGETS- NAVIGATION_CATALOG- NAVIGATION_ORDERS- NAVIGATION_CUSTOMERS- NAVIGATION_DISCOUNTS- NAVIGATION_TRANSLATIONS- NAVIGATION_PAGES- ORDER_DETAILS_MORE_ACTIONS- ORDER_OVERVIEW_CREATE- ORDER_OVERVIEW_MORE_ACTIONS- ORDER_DETAILS_WIDGETS- DRAFT_ORDER_DETAILS_MORE_ACTIONS- DRAFT_ORDER_OVERVIEW_CREATE- DRAFT_ORDER_OVERVIEW_MORE_ACTIONS- DRAFT_ORDER_DETAILS_WIDGETS- DISCOUNT_DETAILS_MORE_ACTIONS- DISCOUNT_OVERVIEW_CREATE- DISCOUNT_OVERVIEW_MORE_ACTIONS- VOUCHER_DETAILS_MORE_ACTIONS- VOUCHER_OVERVIEW_CREATE- VOUCHER_OVERVIEW_MORE_ACTIONS- VOUCHER_DETAILS_WIDGETS- PAGE_DETAILS_MORE_ACTIONS- PAGE_OVERVIEW_CREATE- PAGE_OVERVIEW_MORE_ACTIONS- PAGE_TYPE_OVERVIEW_CREATE- PAGE_TYPE_OVERVIEW_MORE_ACTIONS- PAGE_TYPE_DETAILS_MORE_ACTIONS- MENU_OVERVIEW_CREATE- MENU_OVERVIEW_MORE_ACTIONS- MENU_DETAILS_MORE_ACTIONS- TRANSLATIONS_MORE_ACTIONS-}--"""-All available ways of opening an app extension.-- POPUP - app's extension will be mounted as a popup window- APP_PAGE - redirect to app's page-"""-enum AppExtensionTargetEnum @doc(category: "Apps") {- POPUP- APP_PAGE- NEW_TAB- WIDGET}scalar JSON-union AppExtensionPossibleOptions = AppExtensionOptionsWidget | AppExtensionOptionsNewTab--"""Represents the options for an app extension."""-type AppExtensionOptionsWidget @doc(category: "Apps") {- """Options for displaying a Widget"""- widgetTarget: WidgetTargetOptions @deprecated(reason: "Use `settings` field directly.")-}--"""Represents the WIDGET target options for an app extension."""-type WidgetTargetOptions @doc(category: "Apps") {- """HTTP method for Widget target (GET or POST)"""- method: HttpMethod! @deprecated(reason: "Use `settings` field directly.")-}--enum HttpMethod {- POST- GET-}--"""Represents the options for an app extension."""-type AppExtensionOptionsNewTab @doc(category: "Apps") {- """Options controlling behavior of the NEW_TAB extension target"""- newTabTarget: NewTabTargetOptions @deprecated(reason: "Use `settings` field directly.")-}--"""Represents the NEW_TAB target options for an app extension."""-type NewTabTargetOptions @doc(category: "Apps") {- """HTTP method for New Tab target (GET or POST)"""- method: HttpMethod! @deprecated(reason: "Use `settings` field directly.")-}-"""Represents the app's brand data."""type AppBrand @doc(category: "Apps") {"""App's logos details."""@@ -14897,12 +14786,6 @@ type AppExtensionCountableEdge @doc(category: "Apps") {}input AppExtensionFilterInput @doc(category: "Apps") {- """DEPRECATED: Use `mountName` instead."""- mount: [AppExtensionMountEnum!] @deprecated-- """DEPRECATED: Use `targetName` instead."""- target: AppExtensionTargetEnum @deprecated-"""Plain-text mount name (case insensitive)@@ -29959,12 +29842,6 @@ type AppManifestExtension @doc(category: "Apps") {"""URL of a view where extension's iframe is placed."""url: String!- """Place where given extension will be mounted."""- mount: AppExtensionMountEnum! @deprecated(reason: "Use `mountName` instead.")-- """Type of way how app extension will be opened."""- target: AppExtensionTargetEnum! @deprecated(reason: "Use `targetName` instead.")-"""Name of the extension mount point in the dashboard. Replaces `mount`