Skip to content

Commit 2da8c60

Browse files
committed
Init Commit
0 parents  commit 2da8c60

112 files changed

Lines changed: 66192 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
keys
2+
3+
# package directories
4+
node_modules
5+
jspm_packages
6+
7+
# build
8+
build
9+
dist
10+
.manifest-dist.yml
11+
12+
# Config
13+
config.json
14+
.env*
15+
.aio
16+
17+
# Adobe I/O console config
18+
console.json
19+
20+
# Test output
21+
junit.xml
22+
23+
# IDE & Temp
24+
.cache
25+
.idea
26+
.nyc_output
27+
.vscode
28+
coverage
29+
.aws.tmp.creds.json
30+
.wskdebug.props.tmp
31+
32+
# Parcel
33+
.parcel-cache
34+
35+
# OSX
36+
.DS_Store
37+
38+
# yeoman
39+
.yo-repository
40+
41+
# logs folder for aio-run-detached
42+
logs
43+
44+
app.config.yaml
45+
adobe-api/mesh/mesh.json

DEVELOPMENT.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Development information and test API keys for development process
2+
3+
```
4+
apiKey: e973d547a68c403c87796a420b0e79cb
5+
mesh_source_url: https://edge-sandbox-graph.adobe.io/api/someUUID/graphql
6+
m-ac-rest-api-token: gc4chwfttwfewreey1jkk3nyzhjnened
7+
m-ac-gql-store-code: default
8+
```
9+
10+
11+
### Mesh.json variables:
12+
13+
MAGENTOURL = https://eventing-clzaefa-bm5l4hpp6cb3s.eu-4.magentosite.cloud/
14+
TOKEN = gc4chwfttwfewreey1jkk3nyzhjnened

ExtensionRegistration.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { register } from '@adobe/uix-guest';
2+
3+
export default function ExtensionRegistration() {
4+
init().catch(console.error);
5+
return <></>;
6+
}
7+
8+
const extensionId = 'comwrap-feed-generator'
9+
10+
const init = async () => {
11+
await register({
12+
id: extensionId,
13+
methods: {
14+
}
15+
}
16+
)
17+
}

INSTALL.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Installation instructions
2+
3+
## Prerequisites
4+
5+
- Node.js 18+
6+
- Adobe I/O CLI
7+
8+
## Adobe Console preparation
9+
10+
### Create a new project
11+
12+
Go to console.adobe.io and create a new project from template: "App Builder"
13+
14+
To required environment add:
15+
16+
* I/O Management API with OAuth Server-to-Server
17+
* I/O Events
18+
19+
20+
### Adobe Api Mesh
21+
22+
1. Add "Api Mesh" service to your environment.
23+
2. Rename file `adobe-api/mesh.json.dist` into `adobe-api/mesh.json`.
24+
3. Change required options inside `adobe-api/mesh.json`.
25+
* MAGENTO-URL
26+
* MAGENTO-TOKEN
27+
3. Provision Mesh by using this file.
28+
29+
## Installation
30+
31+
1. Clone the repository
32+
2. Run `npm install` to install the dependencies
33+
3. Go to [Project](https://developer.adobe.com/console), select Environment and click on "Download All" button.
34+
4. Execute `aio app use <path-to-file>` with file you just downloaded. (Merge files if you already have .env file)
35+
5. Edit `.env` file with your project details.
36+
Set following variables:
37+
38+
```
39+
MESH_SOURCE_URL= // Your Mesh URL
40+
AC_API_TOKEN= // Adobe Commerce Integration Bearer Token
41+
AC_DEFAULT_STORE_CODE= // Default Adobe Commerce Store Code
42+
```
43+
44+
6. Create Event Provider for Feed Generator. Run `aio event provider create` and define name. Copy `id` from output.
45+
Add to `.env` line `FEED_GENERATOR_PROVIDER_ID=<id>`
46+
47+
7. Create Event Metadata for Feed Generator. Run `aio event eventmetadata create PROVIDERID`. Define event code as `feed.generate` and define description as `Generate Feed`.
48+
49+
8. Go To your application environment via Browser. Click on "Add Service" -> Event -> 3rd Party Custom Events -> And select your provider and event subscription. In Receiver define "Runtime action" as `processGeneration` action.
50+
51+
9. Run `aio app deploy` to deploy the app.
52+
53+
10. App is ready to use. Pls save the link to your application environment. Additionally you can replacate all steps on your Production environment and publich application, so it will be available on your exchange dashboard.
54+

README.md

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# Comwrap Feed Generator
2+
3+
Feed Generator is a service that simplifies the process of generating product feeds. It ensures that you can easily integrate your store with various systems. With just a few configuration steps you can generate a feed that can be consumed by third-party marketplaces like Google and Facebook — or that can be used for integrating with any other third-party system. Currently module supports XML feed format. Another formats will come in the future.
4+
5+
## Installation
6+
7+
Pls see [INSTALL.md](INSTALL.md) for more details.
8+
9+
## Home page / Grid
10+
11+
On the application home page you will see list of the feeds:
12+
13+
![Home page](./docs/images/a6b730f0-513e-4c80-ab0a-460cc80d4efd.png)
14+
15+
For each feed you can:
16+
17+
* Edit Feed
18+
* Delete Feed
19+
20+
On a feed list you can find:
21+
22+
* Feed name
23+
* UUID of the feed
24+
* Adobe Commerce Store to be used
25+
* File that being generated
26+
* Date of feed creation
27+
* Date of feed generation
28+
* Type of the feed
29+
* Status of the feed:
30+
31+
* **Pending - nothing yet happened with the feed, it just was created OR edited**
32+
* **In Process - generation is currently in progress**
33+
* **Generated - Feed it ready to be used**
34+
35+
## Edit Feed
36+
37+
On a Grid page you can click on a Feed name, and you will be landed on Edit page of selected feed:
38+
39+
![Edit Feed](./docs/images/c6960caf-13fb-4d76-a42b-e43d86b802bd.png)
40+
41+
Here you can change the following elements:
42+
43+
| Field Name | Description |
44+
|-----------------------|-----------------------------------------------------------------------------|
45+
| Feed Name | Name of the feed (will be used only on application UI) |
46+
| Feed Type | Type of the feed: |
47+
| | - XML |
48+
| | - CSV - Coming in future releases |
49+
| | - JSON - Coming in future releases |
50+
| Adobe Commerce Store | Store of your AC system. Products data from selected store will be used. |
51+
| Feed Header | Header of the feed. * |
52+
| Item Body | Body of the single feed element |
53+
| Feed Footer | Footer of the feed * |
54+
55+
* Feed will be generated as following: Header + All Items + Footer
56+
57+
### Feed Body
58+
59+
For feed body variables can be used. Variables are representing GQL schem that being used (by default it is a Adobe Commerce schema).
60+
61+
Example:
62+
63+
```graphql
64+
products(search: "test", pageSize: 2)
65+
{
66+
items
67+
{
68+
name
69+
description
70+
image {
71+
url
72+
}
73+
description {
74+
html
75+
}
76+
price_range {
77+
minimum_price {
78+
regular_price {
79+
value
80+
currency
81+
}
82+
}
83+
}
84+
}
85+
}
86+
```
87+
88+
Based on this GQL schema you can use the following variables (starting inside of the “items“ schema):
89+
90+
* {{name}}
91+
* {{description}}
92+
* {{image.url}}
93+
* {{description.html}}
94+
* {{price_range.minimum_price.regular_price.value}}
95+
* {{price_range.minimum_price.regular_price.currency}}
96+
97+
… and so on depends on a schema used
98+
99+
### Placeholders
100+
101+
#### Fixed Variables
102+
103+
Header and Footer currently have a support to variables (Only 1 actualy)
104+
105+
`{{DATA}}` - Current Date/Time - will be in format 2024-10-21T14:45:30.123Z
106+
107+
### Dynamic variables
108+
109+
Variables are defined using double curly braces (`{{ }}`) and correspond to fields in the Magento GraphQL product output. For example, `{{sku}}` will be replaced with the product's SKU.
110+
111+
##### Additonal parameters
112+
113+
###### Repeating Tags with `count`
114+
115+
When a variable corresponds to an array, you can use the `count` property to repeat the XML tag for each element in the array. For instance, using `count=5` will generate up to 5 tags, each containing a different value from the array.
116+
117+
```xml
118+
<g:brand count=5>{{manufacturer}}</g:brand>
119+
```
120+
121+
##### Selecting Specific Array Elements with `index`
122+
123+
To select a specific element from an array, use the `index` property. This will generate a single tag with the value of the specified element from the array.
124+
125+
```xml
126+
<g:product_type index=2>{{categories.name}}</g:product_type>
127+
```
128+
129+
#### Example
130+
131+
```xml
132+
<item>
133+
<g:id>{{sku}}</g:id>
134+
<title>{{name}}</title>
135+
<description>{{description.html}}</description>
136+
<link>https://www.native-instruments.com/{{detail_page}}</link>
137+
<g:image_link>{{image.url}}</g:image_link>
138+
<g:condition>new</g:condition>
139+
<g:price>{{price_range.maximum_price.final_price.value}} {{price_range.maximum_price.final_price.currency}}</g:price>
140+
<g:availability>In Stock</g:availability>
141+
<g:google_product_category><![CDATA[Arts &amp; Entertainment &gt; Hobbies &amp; Creative Arts &gt; Musical Instruments &gt; Electronic Musical Instruments]]></g:google_product_category>
142+
<g:identifier_exists>true</g:identifier_exists>
143+
<g:product_type index=2>{{categories.name}}</g:product_type>
144+
<g:sale_price>{{price_range.minimum_price.final_price.value}}</g:sale_price>
145+
<g:brand count=5>{{manufacturer}}</g:brand>
146+
<g:mpn>{{sku}}</g:mpn>
147+
<g:additional_image_link><![CDATA[{{image.url}}?width=350&height=350&fit=crop]]></g:additional_image_link>
148+
</item>
149+
```
150+
151+
## Technical Module implementation
152+
153+
Delete Feed - deleting current feed from the database and from all schedules
154+
155+
Regenerate Feed - will fire event “generate.feed“ for particular feed ID. And this event will triggen and action that will create new feed.
156+
157+
### app.config.yaml
158+
159+
- List of all actions currently developed: `app.config.yaml`
160+
161+
* `saveFeed` - save the feed action. Action being invoked after user submit feed form.
162+
163+
Saving feed into key/value storage. Key for the feeds have to looks like following: `feed-UUID`.
164+
165+
* `deleteFeed` - delete the feed action. Action being invoked after user click on Delete button
166+
167+
Deleting the feed from storage by UUID
168+
169+
* `getAllFeeds` - retrieve all feeds from the key/value storage and deliver JSON back. Invoked on dashboard while loading.
170+
171+
Retrieve all available feeds from the storage. Will be used by Dashboard to render feeds list.
172+
173+
* `getFeedByUuid` - retrieve single feed by UUID
174+
175+
* `regenerateFeed` - trigger feed generation. Will place a new event, that feed generation have to be started.
176+
177+
Creating new Event on adobe I/O. Event name: `feed.generate`.
178+
This event means "Please start Force Regeneration to required feed UUID"
179+
180+
* `processGeneration` - process generation action. Regenerate required feed. Currently ID is hardcoded
181+
182+
Action will be invoked when `feed.generate` event added.
183+
184+
* `getGqlSchema` - retrieve graphql schema from target magento app.
185+
186+
* `getAllStores` - get all Magento stores by API
187+
188+
* `generateByCron` - trigger feed generation by OpenWisk alarms.
189+
190+
Action is running every 30 minutes and checking by feed settings if it have to be regenerate. Process regeneration if necessary.
191+
192+
### Web elements
193+
194+
* `index.html` - Dashboard of the project.
195+
196+
List of Feeds already saved (currently list of feeds received from Action by ajax request). Incl. paginator.
197+
198+
* Button to Create New Feed
199+
* Every already saved feed have to have a following action:
200+
* Edit Feed
201+
* Delete Feed
202+
* Force Feed Regeneration
203+
204+
Edit / Create New Feed form will contain form to save new Feed.
205+
206+
Current elements:
207+
* Feed Format - select - JSON | XML
208+
* Feed Item: Big text field to have XML | JSON there with feed item body
209+
* Feed Header
210+
* Feed Footer
211+
* Store View - select with list of available store views on Magento (websites also have to be there, but it is not possible to select them)
212+
213+
After saving the form, it saved into key/value storage and user have to be redirected to dashboard. Success message have to be shown there.
214+
215+
In case of error, error have to be displayed
216+
217+
218+
### Frontend Libraries
219+
220+
## Auto complete
221+
222+
For Text area autocompletion this library was used:
223+
https://github.com/zurb/tribute
224+

0 commit comments

Comments
 (0)