rad-coder 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/package.json +3 -3
- package/public/test.html +3 -16
- package/templates/AGENTS.md +29 -0
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rad-coder",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Development environment for testing ResponsiveAds creative custom JS with hot-reload",
|
|
5
5
|
"bin": {
|
|
6
|
-
"rad-coder": "
|
|
6
|
+
"rad-coder": "bin/cli.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "node bin/cli.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "https://github.com/ResponsiveAds/rad-coder"
|
|
29
|
+
"url": "git+https://github.com/ResponsiveAds/rad-coder.git"
|
|
30
30
|
},
|
|
31
31
|
"author": "ResponsiveAds",
|
|
32
32
|
"license": "MIT",
|
package/public/test.html
CHANGED
|
@@ -87,23 +87,8 @@
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
.ad-container {
|
|
90
|
-
padding: 20px;
|
|
91
|
-
display: flex;
|
|
92
|
-
justify-content: center;
|
|
93
|
-
align-items: flex-start;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.ad-wrapper {
|
|
97
|
-
background: #fff;
|
|
98
|
-
border-radius: 8px;
|
|
99
|
-
overflow: hidden;
|
|
100
|
-
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
|
|
101
90
|
}
|
|
102
91
|
|
|
103
|
-
.inner-content {
|
|
104
|
-
width: 100%;
|
|
105
|
-
min-height: 300px;
|
|
106
|
-
}
|
|
107
92
|
|
|
108
93
|
/* Toast notification for reload */
|
|
109
94
|
.toast {
|
|
@@ -180,6 +165,8 @@
|
|
|
180
165
|
document.getElementById('creative-id').textContent = 'Loading...';
|
|
181
166
|
|
|
182
167
|
const config = await fetchConfigWithRetry();
|
|
168
|
+
//not sure why we get URL that does not work https://edit.responsiveads.com/flowlines
|
|
169
|
+
config.flSource = 'https://s3-eu-west-1.amazonaws.com/publish.responsiveads.com/flowlines/';
|
|
183
170
|
|
|
184
171
|
// Update UI
|
|
185
172
|
document.getElementById('creative-id').textContent = `ID: ${config.creativeId}`;
|
|
@@ -231,7 +218,7 @@
|
|
|
231
218
|
tracking: false,
|
|
232
219
|
isFluid: config.isFluid,
|
|
233
220
|
screenshot: false,
|
|
234
|
-
crossOrigin:
|
|
221
|
+
crossOrigin: false,
|
|
235
222
|
flSource: config.flSource,
|
|
236
223
|
config: {
|
|
237
224
|
_default: {
|
package/templates/AGENTS.md
CHANGED
|
@@ -4,6 +4,9 @@ You are an agent writing only JS for a responsive creative. The creative was bui
|
|
|
4
4
|
|
|
5
5
|
To do this you can only edit the `custom.js` file in this directory. When you edit and save this file the creative will be automatically loaded on the test page: http://localhost:3000/test.html. The code you wrote in `custom.js` will be applied to the creative.
|
|
6
6
|
|
|
7
|
+
Use the http://localhost:3000/test.html URL to open creative in the browser. Inspect the HTML dom so that you can use IDs from elements inside the custom.js code. Alo use the browser to test the code and make sure there are no console.log errors.
|
|
8
|
+
|
|
9
|
+
|
|
7
10
|
Use modern JS standards and code practices.
|
|
8
11
|
|
|
9
12
|
We can use custom in situations when we want to add extra interactivity to our responsive creative. Use the Radical API to access elements added from the editor, update their behavior, and add custom functionalities to your ad.
|
|
@@ -16,6 +19,32 @@ You can use all available JavaScript functions to manipulate element position an
|
|
|
16
19
|
|
|
17
20
|
This document outlines the specific implementation patterns and lifecycle hooks for the Radical API. Use this guide to programmatically control elements, manage dynamic data (DCO), and handle cross-window interactions in ResponsiveAds creatives.
|
|
18
21
|
|
|
22
|
+
Use this as a good starting point always call functions from `!rad.getMergedContent().inEditor` check to prevent messing up the editor code.
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
var rad = Radical.getAdByWindow(window);
|
|
26
|
+
var container = rad.getContainer();
|
|
27
|
+
|
|
28
|
+
var inScreenshot = window.location.href.indexOf('preview?screenshot=1') > -1 ? true : false;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
if (!rad.getMergedContent().inEditor) {
|
|
32
|
+
rad.onLoad(onAdLoaded);
|
|
33
|
+
rad.onBeforeRender(onBeforeRender);
|
|
34
|
+
rad.onRender(onAdRender);
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
function onAdLoaded() {}
|
|
38
|
+
function onBeforeRender(arg) {
|
|
39
|
+
console.log('onBeforeRender', arg);
|
|
40
|
+
}
|
|
41
|
+
function onAdRender() {
|
|
42
|
+
console.log('onAdRender');
|
|
43
|
+
const el = rad.getElementById('a2');
|
|
44
|
+
console.log(el);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
19
48
|
## 1. Initializing the Controller
|
|
20
49
|
|
|
21
50
|
Every script must first reference the ad instance and its container.
|