@adsterra-ad/react 0.1.3 → 0.1.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/dist/index.cjs +9 -7
- package/dist/index.js +9 -7
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -74,10 +74,10 @@ function AdBanner({
|
|
|
74
74
|
return () => window.removeEventListener("message", handler);
|
|
75
75
|
}, [onLoad, onError]);
|
|
76
76
|
if (adFailed && !showFallbackPlaceholder) return null;
|
|
77
|
-
const wrapperStyle = getWrapperStyle(
|
|
77
|
+
const wrapperStyle = getWrapperStyle(config);
|
|
78
78
|
const labelStyle = getLabelStyle(adLabelPosition);
|
|
79
79
|
const visibilityStyle = getVisibilityStyle(adLoaded || adFailed && showFallbackPlaceholder);
|
|
80
|
-
const bannerStyle = { ...parseStyle((0, import_core.getBannerStyle)(config)), overflow: "hidden"
|
|
80
|
+
const bannerStyle = { ...parseStyle((0, import_core.getBannerStyle)(config)), overflow: "hidden" };
|
|
81
81
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${className ?? ""}`.trim(), style: { ...wrapperStyle, ...visibilityStyle }, children: [
|
|
82
82
|
showAdLabel && adLabelPosition.startsWith("top") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: labelStyle, children: adLabel }) : null,
|
|
83
83
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { "data-testid": "ad-banner", style: bannerStyle, children: adFailed && showFallbackPlaceholder ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackPlaceholder, { format, text: fallbackPlaceholderText }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -140,11 +140,12 @@ function parseStyle(styleString) {
|
|
|
140
140
|
justifyContent: "center"
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
function getWrapperStyle(
|
|
143
|
+
function getWrapperStyle(config) {
|
|
144
144
|
return {
|
|
145
145
|
display: "inline-flex",
|
|
146
146
|
flexDirection: "column",
|
|
147
|
-
alignItems:
|
|
147
|
+
alignItems: "flex-start",
|
|
148
|
+
width: typeof config.width === "number" ? `${config.width}px` : config.width
|
|
148
149
|
};
|
|
149
150
|
}
|
|
150
151
|
function getLabelStyle(position) {
|
|
@@ -153,7 +154,7 @@ function getLabelStyle(position) {
|
|
|
153
154
|
fontWeight: 600,
|
|
154
155
|
letterSpacing: "0.1em",
|
|
155
156
|
textTransform: "uppercase",
|
|
156
|
-
|
|
157
|
+
opacity: 0.6,
|
|
157
158
|
marginBottom: position.startsWith("top") ? 4 : 0,
|
|
158
159
|
marginTop: position.startsWith("bottom") ? 4 : 0,
|
|
159
160
|
textAlign: position.endsWith("left") ? "left" : position.endsWith("right") ? "right" : "center",
|
|
@@ -188,8 +189,9 @@ function FallbackPlaceholder({ format, text }) {
|
|
|
188
189
|
gap: 6,
|
|
189
190
|
boxSizing: "border-box",
|
|
190
191
|
padding: 12,
|
|
191
|
-
|
|
192
|
-
|
|
192
|
+
border: "1px dashed currentColor",
|
|
193
|
+
opacity: 0.7,
|
|
194
|
+
background: "transparent",
|
|
193
195
|
textAlign: "center",
|
|
194
196
|
fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
|
|
195
197
|
},
|
package/dist/index.js
CHANGED
|
@@ -53,10 +53,10 @@ function AdBanner({
|
|
|
53
53
|
return () => window.removeEventListener("message", handler);
|
|
54
54
|
}, [onLoad, onError]);
|
|
55
55
|
if (adFailed && !showFallbackPlaceholder) return null;
|
|
56
|
-
const wrapperStyle = getWrapperStyle(
|
|
56
|
+
const wrapperStyle = getWrapperStyle(config);
|
|
57
57
|
const labelStyle = getLabelStyle(adLabelPosition);
|
|
58
58
|
const visibilityStyle = getVisibilityStyle(adLoaded || adFailed && showFallbackPlaceholder);
|
|
59
|
-
const bannerStyle = { ...parseStyle(getBannerStyle(config)), overflow: "hidden"
|
|
59
|
+
const bannerStyle = { ...parseStyle(getBannerStyle(config)), overflow: "hidden" };
|
|
60
60
|
return /* @__PURE__ */ jsxs("div", { className: `${className ?? ""}`.trim(), style: { ...wrapperStyle, ...visibilityStyle }, children: [
|
|
61
61
|
showAdLabel && adLabelPosition.startsWith("top") ? /* @__PURE__ */ jsx("span", { style: labelStyle, children: adLabel }) : null,
|
|
62
62
|
/* @__PURE__ */ jsx("div", { "data-testid": "ad-banner", style: bannerStyle, children: adFailed && showFallbackPlaceholder ? /* @__PURE__ */ jsx(FallbackPlaceholder, { format, text: fallbackPlaceholderText }) : /* @__PURE__ */ jsx(
|
|
@@ -119,11 +119,12 @@ function parseStyle(styleString) {
|
|
|
119
119
|
justifyContent: "center"
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
function getWrapperStyle(
|
|
122
|
+
function getWrapperStyle(config) {
|
|
123
123
|
return {
|
|
124
124
|
display: "inline-flex",
|
|
125
125
|
flexDirection: "column",
|
|
126
|
-
alignItems:
|
|
126
|
+
alignItems: "flex-start",
|
|
127
|
+
width: typeof config.width === "number" ? `${config.width}px` : config.width
|
|
127
128
|
};
|
|
128
129
|
}
|
|
129
130
|
function getLabelStyle(position) {
|
|
@@ -132,7 +133,7 @@ function getLabelStyle(position) {
|
|
|
132
133
|
fontWeight: 600,
|
|
133
134
|
letterSpacing: "0.1em",
|
|
134
135
|
textTransform: "uppercase",
|
|
135
|
-
|
|
136
|
+
opacity: 0.6,
|
|
136
137
|
marginBottom: position.startsWith("top") ? 4 : 0,
|
|
137
138
|
marginTop: position.startsWith("bottom") ? 4 : 0,
|
|
138
139
|
textAlign: position.endsWith("left") ? "left" : position.endsWith("right") ? "right" : "center",
|
|
@@ -167,8 +168,9 @@ function FallbackPlaceholder({ format, text }) {
|
|
|
167
168
|
gap: 6,
|
|
168
169
|
boxSizing: "border-box",
|
|
169
170
|
padding: 12,
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
border: "1px dashed currentColor",
|
|
172
|
+
opacity: 0.7,
|
|
173
|
+
background: "transparent",
|
|
172
174
|
textAlign: "center",
|
|
173
175
|
fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
|
|
174
176
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adsterra-ad/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"react": "^18.0.0 || ^19.0.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@adsterra-ad/core": "0.1.
|
|
34
|
+
"@adsterra-ad/core": "0.1.4"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsup src/index.tsx --format esm,cjs --dts",
|