From 13dc0c988cf3e55f6f3fbb82d3873befda7ca0b5 Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Thu, 11 Jan 2024 18:19:36 -0600 Subject: [PATCH 01/22] Draft version --- src/pages/events/convert-existing-fields.md | 105 ++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 src/pages/events/convert-existing-fields.md diff --git a/src/pages/events/convert-existing-fields.md b/src/pages/events/convert-existing-fields.md new file mode 100644 index 00000000..f32a4a2d --- /dev/null +++ b/src/pages/events/convert-existing-fields.md @@ -0,0 +1,105 @@ +--- +title: Convert exisiting fields for the event payload +description: Learn how to convert a field value based on a condition +keywords: + - Events + - Extensibility +--- + +# Convert subscribed field value + +Your custom module might generate data that would be useful to insert into an existing Commerce event. Converters allow you to enrich the data contained in an event before it is transmitted to the eventing service. + + + +You must configure a module's `io_events.xml` or root `app/etc/io_events.xml` file to update the required fields. You can also declare them in the system `config.php` file or add them using the CLI while subsrcibing to an event. + +## Command line + +The `bin/magento events:subscribe --force --fields= --fields='{"":"", "converter":""}' --fields='{"":"", "converter":""}'` command creates and registers custom and native Commerce events. + +## CLI Example +`bin/magento events:subscribe observer.catalog_category_save_after --fields="name" --fields='{"name":"store_id", "converter": "Magento\AdobeCommerceEventsClient\Event\TestConverterStoreid"}'` + +## Configure the `io_events.xml` file + +The `converter` attribute defines the converter class that updates the event data field value for the specified event. Only one converter class can be used per field + +Attribute | Required | Description +--- | --- | --- +`converter` | No | The fully-qualified class name. + + +The following example will update the value of the field `name` present in the `observer.catalog_category_save_after` event payload using the converter class `TestConverterName`. + +```xml + + + + + + + + + +``` + +The event payload will be similar to the following without converter: + +```json +{ + "value": { + "name": "Men", + "store_id": "2", + "is_active": "1" + + } +} +``` +The event payload will be similar to the following with converter: + +```json +{ + "value": { + "name": "Test Name", + "store_id": "2", + "is_active": "1" + + } +} +``` +## Converter definition + +The converter class must implement `FieldConverterInterface`. This interface contains the `convert` method, which accepts the following arguments. It returns a mixed type. + +`public function convert(mixed $value, Event $event): mixed` + +In the following example, the `TestConverterName` converter class updates the value of the `name` field in the `eventData` array. + +In the provided code excerpt, the initial value of the `name` field was `Men` and after applying the converter, the updated value is now `Test Name` +```php + Date: Fri, 12 Jan 2024 15:29:35 -0600 Subject: [PATCH 02/22] Update src/pages/events/convert-existing-fields.md Co-authored-by: Kevin Harper --- src/pages/events/convert-existing-fields.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/events/convert-existing-fields.md b/src/pages/events/convert-existing-fields.md index f32a4a2d..37bffb26 100644 --- a/src/pages/events/convert-existing-fields.md +++ b/src/pages/events/convert-existing-fields.md @@ -1,5 +1,5 @@ --- -title: Convert exisiting fields for the event payload +title: Convert payload field values description: Learn how to convert a field value based on a condition keywords: - Events From 8ae3d93719deebd3e75ad1708eb18d028c375943 Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Fri, 12 Jan 2024 15:29:53 -0600 Subject: [PATCH 03/22] Update src/pages/events/convert-existing-fields.md Co-authored-by: Kevin Harper --- src/pages/events/convert-existing-fields.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/events/convert-existing-fields.md b/src/pages/events/convert-existing-fields.md index 37bffb26..87c32040 100644 --- a/src/pages/events/convert-existing-fields.md +++ b/src/pages/events/convert-existing-fields.md @@ -6,7 +6,7 @@ keywords: - Extensibility --- -# Convert subscribed field value +# Convert payload field values Your custom module might generate data that would be useful to insert into an existing Commerce event. Converters allow you to enrich the data contained in an event before it is transmitted to the eventing service. From 014868a90f8c1d17ed20cdcbf02136875a6de423 Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Fri, 12 Jan 2024 15:31:31 -0600 Subject: [PATCH 04/22] Update src/pages/events/convert-existing-fields.md Co-authored-by: Kevin Harper --- src/pages/events/convert-existing-fields.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/events/convert-existing-fields.md b/src/pages/events/convert-existing-fields.md index 87c32040..b679d26a 100644 --- a/src/pages/events/convert-existing-fields.md +++ b/src/pages/events/convert-existing-fields.md @@ -30,7 +30,7 @@ Attribute | Required | Description `converter` | No | The fully-qualified class name. -The following example will update the value of the field `name` present in the `observer.catalog_category_save_after` event payload using the converter class `TestConverterName`. +The following example updates the value of the field `name` present in the `observer.catalog_category_save_after` event payload using the `TestConverterName` converter class. ```xml From 95e1d630bf4f7626fdde405caf672aad934324e3 Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Fri, 12 Jan 2024 15:31:37 -0600 Subject: [PATCH 05/22] Update src/pages/events/convert-existing-fields.md Co-authored-by: Kevin Harper --- src/pages/events/convert-existing-fields.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/events/convert-existing-fields.md b/src/pages/events/convert-existing-fields.md index b679d26a..12ba6d9e 100644 --- a/src/pages/events/convert-existing-fields.md +++ b/src/pages/events/convert-existing-fields.md @@ -44,7 +44,7 @@ The following example updates the value of the field `name` present in the `obse ``` -The event payload will be similar to the following without converter: +The default event payload is similar to the following: ```json { From 49abe27fa0bfd1c976b44633b706ea6f4a66a1ed Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Fri, 12 Jan 2024 15:31:43 -0600 Subject: [PATCH 06/22] Update src/pages/events/convert-existing-fields.md Co-authored-by: Kevin Harper --- src/pages/events/convert-existing-fields.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/events/convert-existing-fields.md b/src/pages/events/convert-existing-fields.md index 12ba6d9e..3e43e637 100644 --- a/src/pages/events/convert-existing-fields.md +++ b/src/pages/events/convert-existing-fields.md @@ -56,7 +56,7 @@ The default event payload is similar to the following: } } ``` -The event payload will be similar to the following with converter: +The value of the `field` changes after the conversion: ```json { From 515dacda7c25e12e2d29849acc1c0ea55dfe4dfb Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Fri, 12 Jan 2024 15:31:51 -0600 Subject: [PATCH 07/22] Update src/pages/events/convert-existing-fields.md Co-authored-by: Kevin Harper --- src/pages/events/convert-existing-fields.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/events/convert-existing-fields.md b/src/pages/events/convert-existing-fields.md index 3e43e637..acc40fda 100644 --- a/src/pages/events/convert-existing-fields.md +++ b/src/pages/events/convert-existing-fields.md @@ -74,7 +74,7 @@ The converter class must implement `FieldConverterInterface`. This interface con `public function convert(mixed $value, Event $event): mixed` -In the following example, the `TestConverterName` converter class updates the value of the `name` field in the `eventData` array. +In the following example, the `TestConverterName` converter class updates the value of the `name` field in the `eventData` array to `Test Name`. In the sample payload above, this value was `Men`. In the provided code excerpt, the initial value of the `name` field was `Men` and after applying the converter, the updated value is now `Test Name` ```php From 4d815e651cb10827ae757b08d89a7f8172fbc089 Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Fri, 12 Jan 2024 16:25:13 -0600 Subject: [PATCH 08/22] revised docs --- src/pages/events/convert-existing-fields.md | 50 ++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/pages/events/convert-existing-fields.md b/src/pages/events/convert-existing-fields.md index acc40fda..6ca0e2c2 100644 --- a/src/pages/events/convert-existing-fields.md +++ b/src/pages/events/convert-existing-fields.md @@ -8,20 +8,28 @@ keywords: # Convert payload field values -Your custom module might generate data that would be useful to insert into an existing Commerce event. Converters allow you to enrich the data contained in an event before it is transmitted to the eventing service. +The event payload might include field values that are not easily interpretable for third-party implementations. Building the implementation solely based on identifiers can be challenging. To address this issue, a converter can be implemented, allowing customization for each field in the payload. - +## Converter definition + +The converter class must implement `FieldConverterInterface`. This interface contains the `convert` method, which accepts the following arguments. It returns a mixed data type. + +`public function convert(mixed $value, Event $event): mixed` -You must configure a module's `io_events.xml` or root `app/etc/io_events.xml` file to update the required fields. You can also declare them in the system `config.php` file or add them using the CLI while subsrcibing to an event. +## Configure -## Command line +You must configure a module's `io_events.xml` or root `app/etc/io_events.xml` file to update the required + fields. You can also declare them in the system `config.php` file or add them using the CLI while subsrcibing to an event. + +### Command line The `bin/magento events:subscribe --force --fields= --fields='{"":"", "converter":""}' --fields='{"":"", "converter":""}'` command creates and registers custom and native Commerce events. -## CLI Example -`bin/magento events:subscribe observer.catalog_category_save_after --fields="name" --fields='{"name":"store_id", "converter": "Magento\AdobeCommerceEventsClient\Event\TestConverterStoreid"}'` + ```bash + bin/magento events:subscribe observer.catalog_category_save_after --fields="name" --fields='{"name":"store_id", "converter": "Magento\AdobeCommerceEventsClient\Event\TestConverterStoreid"}'` + ``` -## Configure the `io_events.xml` file +### Configure the `io_events.xml` file The `converter` attribute defines the converter class that updates the event data field value for the specified event. Only one converter class can be used per field @@ -29,15 +37,14 @@ Attribute | Required | Description --- | --- | --- `converter` | No | The fully-qualified class name. - -The following example updates the value of the field `name` present in the `observer.catalog_category_save_after` event payload using the `TestConverterName` converter class. +The following example updates the value of the field `store_id` present in the `observer.catalog_category_save_after` event payload using the `TestConverterStoreid` converter class. ```xml - - + + @@ -52,31 +59,24 @@ The default event payload is similar to the following: "name": "Men", "store_id": "2", "is_active": "1" - } } ``` + The value of the `field` changes after the conversion: ```json { "value": { - "name": "Test Name", - "store_id": "2", + "name": "Men", + "store_id": "4", "is_active": "1" - } } ``` -## Converter definition -The converter class must implement `FieldConverterInterface`. This interface contains the `convert` method, which accepts the following arguments. It returns a mixed type. +In the following example, the `TestConverterStoreid` converter class updates the value of the `store_id` field in the `eventData` array to `4`. In the sample payload above, this value was `2`. -`public function convert(mixed $value, Event $event): mixed` - -In the following example, the `TestConverterName` converter class updates the value of the `name` field in the `eventData` array to `Test Name`. In the sample payload above, this value was `Men`. - -In the provided code excerpt, the initial value of the `name` field was `Men` and after applying the converter, the updated value is now `Test Name` ```php Date: Fri, 12 Jan 2024 16:38:23 -0600 Subject: [PATCH 09/22] added converter option and link --- src/data/navigation/sections/events.js | 4 ++++ src/pages/events/commands.md | 2 ++ src/pages/events/convert-existing-fields.md | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/data/navigation/sections/events.js b/src/data/navigation/sections/events.js index 3d92d1a2..cb3da632 100644 --- a/src/data/navigation/sections/events.js +++ b/src/data/navigation/sections/events.js @@ -27,6 +27,10 @@ module.exports = [ title: "Add custom fields", path: "/events/custom-event-fields.md" }, + { + title: "Convert exisiting field value", + path: "/events/convert-existing-fields.md" + }, { title: "Command reference", path: "/events/commands.md", diff --git a/src/pages/events/commands.md b/src/pages/events/commands.md index 86bad2a3..29b76867 100644 --- a/src/pages/events/commands.md +++ b/src/pages/events/commands.md @@ -203,6 +203,8 @@ If you are implementing eventing in a performance testing environment, run the ` `--rules=||` Defines a rule that will be applied to the subscribed event. You can apply multiple rules to an event, but each rule must be defined separately. A rule definition must specify the field to be evaluated, an operator, and the value to be evaluated, in that order. The field name in a rule definition does not have to match a field specified with the `--fields` option. +`--fields='{"":"", "converter":""}'` Applies the converter class to the given field. + ### Example To subscribe to a native event: diff --git a/src/pages/events/convert-existing-fields.md b/src/pages/events/convert-existing-fields.md index 6ca0e2c2..9599732d 100644 --- a/src/pages/events/convert-existing-fields.md +++ b/src/pages/events/convert-existing-fields.md @@ -102,4 +102,4 @@ class TestConverterStoreid implements FieldConverterInterface return 4; } } -``` \ No newline at end of file +``` From 7b20e56c45af465c56df67a07fe157d82cae7ebe Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Fri, 12 Jan 2024 16:41:35 -0600 Subject: [PATCH 10/22] updated fieldName --- src/pages/events/commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/events/commands.md b/src/pages/events/commands.md index 29b76867..8b5f1810 100644 --- a/src/pages/events/commands.md +++ b/src/pages/events/commands.md @@ -203,7 +203,7 @@ If you are implementing eventing in a performance testing environment, run the ` `--rules=||` Defines a rule that will be applied to the subscribed event. You can apply multiple rules to an event, but each rule must be defined separately. A rule definition must specify the field to be evaluated, an operator, and the value to be evaluated, in that order. The field name in a rule definition does not have to match a field specified with the `--fields` option. -`--fields='{"":"", "converter":""}'` Applies the converter class to the given field. +`--fields='{"":"", "converter":""}'` Applies the converter class to the given field. ### Example From aa36b01a5c2da28a777fa8383b4ec0e903ec1f3f Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Wed, 17 Jan 2024 17:04:20 -0600 Subject: [PATCH 11/22] Major revisions --- src/data/navigation/sections/events.js | 4 +- src/pages/events/commands.md | 2 +- src/pages/events/convert-existing-fields.md | 105 ---------------- src/pages/events/convert-field-values.md | 133 ++++++++++++++++++++ src/pages/events/module-development.md | 2 + 5 files changed, 138 insertions(+), 108 deletions(-) delete mode 100644 src/pages/events/convert-existing-fields.md create mode 100644 src/pages/events/convert-field-values.md diff --git a/src/data/navigation/sections/events.js b/src/data/navigation/sections/events.js index cb3da632..3a18d10c 100644 --- a/src/data/navigation/sections/events.js +++ b/src/data/navigation/sections/events.js @@ -28,8 +28,8 @@ module.exports = [ path: "/events/custom-event-fields.md" }, { - title: "Convert exisiting field value", - path: "/events/convert-existing-fields.md" + title: "Convert payload field values", + path: "/events/convert-field-values.md" }, { title: "Command reference", diff --git a/src/pages/events/commands.md b/src/pages/events/commands.md index 8b5f1810..c749cbcb 100644 --- a/src/pages/events/commands.md +++ b/src/pages/events/commands.md @@ -193,7 +193,7 @@ If you are implementing eventing in a performance testing environment, run the ` ### Options -`--fields=` Required. An event field to transmit to the Adobe App Builder application. You can specify this option multiple times. Each instance can contain only one field name. +`--fields='{"":"", "converter":""}'` Required, but the `converter` argument is optional. Specifies an event field to transmit to the Adobe App Builder application. You can specify this option multiple times. Each instance can contain only one field name. The `converter` argument applies the [converter class](convert-field-values.md) to the specified field. `--force`, `-f` Forces subscription to the event, even if it hasn't been defined locally. diff --git a/src/pages/events/convert-existing-fields.md b/src/pages/events/convert-existing-fields.md deleted file mode 100644 index 9599732d..00000000 --- a/src/pages/events/convert-existing-fields.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -title: Convert payload field values -description: Learn how to convert a field value based on a condition -keywords: - - Events - - Extensibility ---- - -# Convert payload field values - -The event payload might include field values that are not easily interpretable for third-party implementations. Building the implementation solely based on identifiers can be challenging. To address this issue, a converter can be implemented, allowing customization for each field in the payload. - -## Converter definition - -The converter class must implement `FieldConverterInterface`. This interface contains the `convert` method, which accepts the following arguments. It returns a mixed data type. - -`public function convert(mixed $value, Event $event): mixed` - -## Configure - -You must configure a module's `io_events.xml` or root `app/etc/io_events.xml` file to update the required - fields. You can also declare them in the system `config.php` file or add them using the CLI while subsrcibing to an event. - -### Command line - -The `bin/magento events:subscribe --force --fields= --fields='{"":"", "converter":""}' --fields='{"":"", "converter":""}'` command creates and registers custom and native Commerce events. - - ```bash - bin/magento events:subscribe observer.catalog_category_save_after --fields="name" --fields='{"name":"store_id", "converter": "Magento\AdobeCommerceEventsClient\Event\TestConverterStoreid"}'` - ``` - -### Configure the `io_events.xml` file - -The `converter` attribute defines the converter class that updates the event data field value for the specified event. Only one converter class can be used per field - -Attribute | Required | Description ---- | --- | --- -`converter` | No | The fully-qualified class name. - -The following example updates the value of the field `store_id` present in the `observer.catalog_category_save_after` event payload using the `TestConverterStoreid` converter class. - -```xml - - - - - - - - - -``` - -The default event payload is similar to the following: - -```json -{ - "value": { - "name": "Men", - "store_id": "2", - "is_active": "1" - } -} -``` - -The value of the `field` changes after the conversion: - -```json -{ - "value": { - "name": "Men", - "store_id": "4", - "is_active": "1" - } -} -``` - -In the following example, the `TestConverterStoreid` converter class updates the value of the `store_id` field in the `eventData` array to `4`. In the sample payload above, this value was `2`. - -```php - + +As an example, the `observer.catalog_product_save_after` event contains a top-level `visibility` field, which must contain an integer value. You want to convert these values to strings that match values on the external system. The following table describes these values. + +Commerce value | Converted value | Description +--- | --- | --- +1 | NOT_VISIBLE_INDIVIDUALLY | This product should not be displayed if it is part of a configurable product. +2 | CATALOG_ONLY | This product appears in catalog listings, but not in searches. +3 | SEARCH_ONLY | This product appears in searches, but not catalog listings. +4 | CATALOG_AND_SEARCH | This product appears in catalog listings and searches. For most products, this is the default. + +In the following example, the `TestConverterVisibility` converter class updates the value of the `visibility` field to a string. + + + +```php + + +You must configure a module's `io_events.xml` or root `app/etc/io_events.xml` file to update the required fields. You can also declare them in the system `config.php` file or add them using the CLI while subscribing to an event. + +### Command line + +The [`bin/magento events:subscribe --fields` command](commands.md#subscribe-to-an-event) defines the fields and converters to include in the payload of a subscribed event. The example command adds the `visibility` field and provides the path to the converter class. You can specify multiple fields in the same request. + +```bash +bin/magento events:subscribe observer.catalog_category_save_after --fields="name" --fields='{"name":"visibility", "converter": "Magento\AdobeCommerceEventsClient\Event\TestConverterVisibility"}'` +``` + +### Configure an `io_events.xml` file + +The `converter` attribute defines the converter class that updates the event data field value for the specified event. Only one converter class can be used per field + +Attribute | Required | Description +--- | --- | --- +`converter` | No | The fully-qualified class name. + +The following example updates the value of the field `visibility` present in the `observer.catalog_product_save_after` event payload using the `TestConverterVisibility` converter class. + +```xml + + + + + + + +``` diff --git a/src/pages/events/module-development.md b/src/pages/events/module-development.md index 6ccdd69b..58531709 100644 --- a/src/pages/events/module-development.md +++ b/src/pages/events/module-development.md @@ -223,6 +223,8 @@ The contents of an `observer.catalog_product_save_after` event are similar to th } ``` +The `` element can also contain the `converter` attribute. Use this attribute to change the value of a field in the event payload. [Convert payload field values](./convert-field-values.md) describes its usage. + ### Array of nested objects When the payload contains an array of objects, use the following construction to register specific fields from that array: From 4a90c8199cbbcb149aeda022a7a4e8fce6da3d6a Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Thu, 18 Jan 2024 12:49:22 -0600 Subject: [PATCH 12/22] CEXT-1699-Docs minor updates --- src/pages/events/convert-field-values.md | 27 ++++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/pages/events/convert-field-values.md b/src/pages/events/convert-field-values.md index 3135b8d3..07ece948 100644 --- a/src/pages/events/convert-field-values.md +++ b/src/pages/events/convert-field-values.md @@ -12,7 +12,7 @@ The payload of an event often includes field values that are not easily interpre ## Converter definition -Your converter class must implement `FieldConverterInterface`. This interface contains the `convert` method, which accepts `mixed` and `Event` arguments following arguments. The method returns a `mixed` data type. +Your converter class must implement `FieldConverterInterface`. This interface contains the `convert` method, which accepts `mixed` and `Event` arguments following arguments. The method returns a `mixed` data type. Individual converter classes must be created for each field when aiming to convert multiple fields within a payload. Conversely, the same class can be reused to replace a specific field across multiple events. ```php interface FieldConverterInterface @@ -28,8 +28,6 @@ interface FieldConverterInterface } ``` - - As an example, the `observer.catalog_product_save_after` event contains a top-level `visibility` field, which must contain an integer value. You want to convert these values to strings that match values on the external system. The following table describes these values. Commerce value | Converted value | Description @@ -41,8 +39,6 @@ Commerce value | Converted value | Description In the following example, the `TestConverterVisibility` converter class updates the value of the `visibility` field to a string. - - ```php - You must configure a module's `io_events.xml` or root `app/etc/io_events.xml` file to update the required fields. You can also declare them in the system `config.php` file or add them using the CLI while subscribing to an event. ### Command line @@ -109,9 +103,24 @@ You must configure a module's `io_events.xml` or root `app/etc/io_events.xml` fi The [`bin/magento events:subscribe --fields` command](commands.md#subscribe-to-an-event) defines the fields and converters to include in the payload of a subscribed event. The example command adds the `visibility` field and provides the path to the converter class. You can specify multiple fields in the same request. ```bash -bin/magento events:subscribe observer.catalog_category_save_after --fields="name" --fields='{"name":"visibility", "converter": "Magento\AdobeCommerceEventsClient\Event\TestConverterVisibility"}'` +bin/magento events:subscribe observer.catalog_product_save_after --fields="store_id" --fields='{"name":"visibility", "converter": "Magento\AdobeCommerceEventsClient\Event\TestConverterVisibility"}'` ``` +### `config.php` file +```xml +'io_events' => [ + 'observer.catalog_product_save_after' => [ + 'fields' => [ + 'store_id', + [ + 'name' => 'visibility', + 'converter' => 'Magento\\AdobeCommerceEventsClient\\Event\\TestConverterVisibility' + ] + ], + 'enabled' => 1 + ] + ] +``` ### Configure an `io_events.xml` file The `converter` attribute defines the converter class that updates the event data field value for the specified event. Only one converter class can be used per field From 4fd6a5e6e06a517a1b9ebbb5dc0d48f313228b66 Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Thu, 18 Jan 2024 12:54:25 -0600 Subject: [PATCH 13/22] minor fix --- src/pages/events/convert-field-values.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/events/convert-field-values.md b/src/pages/events/convert-field-values.md index 07ece948..b77086d5 100644 --- a/src/pages/events/convert-field-values.md +++ b/src/pages/events/convert-field-values.md @@ -107,7 +107,7 @@ bin/magento events:subscribe observer.catalog_product_save_after --fields="store ``` ### `config.php` file -```xml +```php 'io_events' => [ 'observer.catalog_product_save_after' => [ 'fields' => [ From f45bc7e9f9c39784b6ff11ef4c8863dcd99dfeea Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Thu, 18 Jan 2024 13:30:44 -0600 Subject: [PATCH 14/22] updated exmaple code --- src/pages/events/convert-field-values.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/events/convert-field-values.md b/src/pages/events/convert-field-values.md index b77086d5..df6e320b 100644 --- a/src/pages/events/convert-field-values.md +++ b/src/pages/events/convert-field-values.md @@ -61,7 +61,12 @@ class TestConverterVisibility implements FieldConverterInterface */ public function convert(mixed $value, Event $event): mixed { - return 'CATALOG_AND_SEARCH'; + return match ($value) { + '1' => 'NOT_VISIBLE_INDIVIDUALLY', + '2' => 'CATALOG_ONLY', + '3' => 'SEARCH_ONLY', + '4' => 'CATALOG_AND_SEARCH' + }; } } ``` From efc968e52b5a5c0c13397722c66204cec0ea3c46 Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Thu, 18 Jan 2024 13:43:41 -0600 Subject: [PATCH 15/22] Added blank lines --- src/pages/events/convert-field-values.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/events/convert-field-values.md b/src/pages/events/convert-field-values.md index df6e320b..071a5233 100644 --- a/src/pages/events/convert-field-values.md +++ b/src/pages/events/convert-field-values.md @@ -110,8 +110,11 @@ The [`bin/magento events:subscribe --fields` command](commands.md#subscribe-to-a ```bash bin/magento events:subscribe observer.catalog_product_save_after --fields="store_id" --fields='{"name":"visibility", "converter": "Magento\AdobeCommerceEventsClient\Event\TestConverterVisibility"}'` ``` + ### `config.php` file +The following example `config.php` is the equivalent of the example `bin/magento events:subscribe` command in the **Command line** example above. + ```php 'io_events' => [ 'observer.catalog_product_save_after' => [ @@ -126,6 +129,7 @@ bin/magento events:subscribe observer.catalog_product_save_after --fields="store ] ] ``` + ### Configure an `io_events.xml` file The `converter` attribute defines the converter class that updates the event data field value for the specified event. Only one converter class can be used per field From df09805ed1f8ddda57cc049aa8b697bb1ac752af Mon Sep 17 00:00:00 2001 From: MayurBagwe Date: Thu, 18 Jan 2024 13:47:05 -0600 Subject: [PATCH 16/22] Update src/pages/events/convert-field-values.md Co-authored-by: Kevin Harper --- src/pages/events/convert-field-values.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/events/convert-field-values.md b/src/pages/events/convert-field-values.md index 071a5233..3f21a4ce 100644 --- a/src/pages/events/convert-field-values.md +++ b/src/pages/events/convert-field-values.md @@ -12,7 +12,7 @@ The payload of an event often includes field values that are not easily interpre ## Converter definition -Your converter class must implement `FieldConverterInterface`. This interface contains the `convert` method, which accepts `mixed` and `Event` arguments following arguments. The method returns a `mixed` data type. Individual converter classes must be created for each field when aiming to convert multiple fields within a payload. Conversely, the same class can be reused to replace a specific field across multiple events. +Your converter class must implement `FieldConverterInterface`. This interface contains the `convert` method, which accepts `mixed` and `Event` arguments. The method returns a `mixed` data type. You must create individual converter classes for each field when converting multiple fields within a payload. You can reuse a class to replace a specific field across multiple events. ```php interface FieldConverterInterface From 587cd7486d412074358c437f293d4a9ecc3295df Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Thu, 18 Jan 2024 14:00:10 -0600 Subject: [PATCH 17/22] Update convert-field-values.md --- src/pages/events/convert-field-values.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/events/convert-field-values.md b/src/pages/events/convert-field-values.md index 3f21a4ce..a0a27b22 100644 --- a/src/pages/events/convert-field-values.md +++ b/src/pages/events/convert-field-values.md @@ -132,11 +132,7 @@ The following example `config.php` is the equivalent of the example `bin/magento ### Configure an `io_events.xml` file -The `converter` attribute defines the converter class that updates the event data field value for the specified event. Only one converter class can be used per field - -Attribute | Required | Description ---- | --- | --- -`converter` | No | The fully-qualified class name. +The `converter` attribute of the `field` element defines the converter class that updates the event data field value for the specified event. Only one converter class can be defined per field. The following example updates the value of the field `visibility` present in the `observer.catalog_product_save_after` event payload using the `TestConverterVisibility` converter class. From 35a841925320efc72e4748e7fc6471a1076f77fe Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Thu, 18 Jan 2024 14:21:24 -0600 Subject: [PATCH 18/22] Fix the broken link to the UI Extensibility guide --- src/pages/admin-ui-sdk/app-registration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/admin-ui-sdk/app-registration.md b/src/pages/admin-ui-sdk/app-registration.md index 126772f6..9c7ec096 100644 --- a/src/pages/admin-ui-sdk/app-registration.md +++ b/src/pages/admin-ui-sdk/app-registration.md @@ -45,7 +45,7 @@ Create or update your project `extension-manifest.json` file so that it is simil ## Add an `ExtensionRegistration` component -Create an `ExtensionRegistration` component that registers the menu configuration in the App Registry. Use the `adobe/uix-sdk` with the `adobe-uix-guest` dependency. The [UI Extensibility](https://developer.adobe.com/uix/docs/overview/design/) Guide describes this process further. +Create an `ExtensionRegistration` React component that registers the menu configuration in the App Registry. Use the `adobe/uix-sdk` with the `adobe-uix-guest` dependency. The [UI Extensibility Getting Started](https://developer.adobe.com/uix/docs/getting-started/design/) guide describes this process further. 1. Add the `uix-guest` dependency in the `package.json`. From bd5b2ba473badbe5b7f1b36eaa38b9a9dbdaa376 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Thu, 18 Jan 2024 14:33:47 -0600 Subject: [PATCH 19/22] Apply suggestions from code review Co-authored-by: Jared Hoover <98363870+jhadobe@users.noreply.github.com> --- src/pages/events/convert-field-values.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/events/convert-field-values.md b/src/pages/events/convert-field-values.md index a0a27b22..ca271fdc 100644 --- a/src/pages/events/convert-field-values.md +++ b/src/pages/events/convert-field-values.md @@ -28,7 +28,7 @@ interface FieldConverterInterface } ``` -As an example, the `observer.catalog_product_save_after` event contains a top-level `visibility` field, which must contain an integer value. You want to convert these values to strings that match values on the external system. The following table describes these values. +As an example, the `observer.catalog_product_save_after` event contains a top-level `visibility` field, which must contain an integer value. Convert these values to strings that match values on the external system. The following table describes these values. Commerce value | Converted value | Description --- | --- | --- @@ -101,7 +101,7 @@ The converter changes the payload to: ## Register the converter -You must configure a module's `io_events.xml` or root `app/etc/io_events.xml` file to update the required fields. You can also declare them in the system `config.php` file or add them using the CLI while subscribing to an event. +You must configure a module's `io_events.xml` or root `app/etc/io_events.xml` file to update the required fields. You can also declare them in the system `config.php` file or add them when using the CLI to subscribe to an event. ### Command line From 3db30ff21a33c75b18e4f18d4ac19046ac9af704 Mon Sep 17 00:00:00 2001 From: Oleksandr Shmyheliuk Date: Wed, 7 Feb 2024 13:23:37 -0600 Subject: [PATCH 20/22] CEXT-2784: Release commerce eventing and webhook modules --- src/pages/events/release-notes.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pages/events/release-notes.md b/src/pages/events/release-notes.md index 189eba90..6d984e5e 100644 --- a/src/pages/events/release-notes.md +++ b/src/pages/events/release-notes.md @@ -12,6 +12,20 @@ These release notes describe the latest version of Adobe I/O Events for Adobe Co See [Update Adobe I/O Events for Adobe Commerce](installation.md#update-adobe-io-events-for-adobe-commerce) for upgrade instructions. +## Version 1.5.0 + +### Release date + +February 7, 2024 + +### Enhancements + +* Added support of field converters. Now you can specify converter class that will be applied to fields in the event payload. + +* Added event tracking ID field for better tracking of the event delivery process. + +* Increased test coverage of eventing modules + ## Version 1.4.1 ### Release date From b066654bb87de99c1405aff851f91b045eb99002 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Wed, 7 Feb 2024 13:36:46 -0600 Subject: [PATCH 21/22] Update release-notes.md Editorial comments --- src/pages/events/release-notes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/events/release-notes.md b/src/pages/events/release-notes.md index 6d984e5e..a296c4a6 100644 --- a/src/pages/events/release-notes.md +++ b/src/pages/events/release-notes.md @@ -20,11 +20,11 @@ February 7, 2024 ### Enhancements -* Added support of field converters. Now you can specify converter class that will be applied to fields in the event payload. +* Added support for [field converters](convert-field-values.md). You can now create a converter class that changes the data type or value of fields in an event payload. -* Added event tracking ID field for better tracking of the event delivery process. +* Added an event tracking ID field for better tracking of the event delivery process. -* Increased test coverage of eventing modules +* Increased test coverage of eventing modules. ## Version 1.4.1 From 10cc707b07911df6b10e19b2051ab8468349608c Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Wed, 7 Feb 2024 15:08:35 -0600 Subject: [PATCH 22/22] Update src/pages/events/release-notes.md Co-authored-by: Jared Hoover <98363870+jhadobe@users.noreply.github.com> --- src/pages/events/release-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/events/release-notes.md b/src/pages/events/release-notes.md index a296c4a6..b47a88ec 100644 --- a/src/pages/events/release-notes.md +++ b/src/pages/events/release-notes.md @@ -20,7 +20,7 @@ February 7, 2024 ### Enhancements -* Added support for [field converters](convert-field-values.md). You can now create a converter class that changes the data type or value of fields in an event payload. +* Added support for [field converters](convert-field-values.md). You can now create a converter class that changes the data type or value of fields in an event payload. * Added an event tracking ID field for better tracking of the event delivery process.