@adview/react 1.0.13 → 1.0.14
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/AdViewUnit/AdViewUnit.cjs +106 -298
- package/dist/AdViewUnit/AdViewUnit.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnit.client.cjs +86 -256
- package/dist/AdViewUnit/AdViewUnit.client.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnit.client.d.cts +2 -2
- package/dist/AdViewUnit/AdViewUnit.client.d.ts +2 -2
- package/dist/AdViewUnit/AdViewUnit.client.js +69 -239
- package/dist/AdViewUnit/AdViewUnit.client.js.map +1 -1
- package/dist/AdViewUnit/AdViewUnit.d.cts +1 -1
- package/dist/AdViewUnit/AdViewUnit.d.ts +1 -1
- package/dist/AdViewUnit/AdViewUnit.js +85 -277
- package/dist/AdViewUnit/AdViewUnit.js.map +1 -1
- package/dist/AdViewUnit/AdViewUnit.server.cjs +82 -214
- package/dist/AdViewUnit/AdViewUnit.server.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnit.server.d.cts +2 -2
- package/dist/AdViewUnit/AdViewUnit.server.d.ts +2 -2
- package/dist/AdViewUnit/AdViewUnit.server.js +72 -204
- package/dist/AdViewUnit/AdViewUnit.server.js.map +1 -1
- package/dist/AdViewUnit/{AdViewUnitBanner.cjs → AdViewUnitBannerTemplate.cjs} +17 -14
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.cjs.map +1 -0
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.d.cts +12 -0
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.d.ts +12 -0
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.js +32 -0
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.js.map +1 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.cjs +48 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.cjs.map +1 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.d.cts +17 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.d.ts +17 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.js +17 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.js.map +1 -0
- package/dist/AdViewUnit/{AdViewUnitNative.cjs → AdViewUnitNativeTemplate.cjs} +12 -13
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.cjs.map +1 -0
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.d.cts +11 -0
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.d.ts +11 -0
- package/dist/AdViewUnit/{AdViewUnitNative.js → AdViewUnitNativeTemplate.js} +9 -10
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.js.map +1 -0
- package/dist/AdViewUnit/{AdViewUnitProxy.cjs → AdViewUnitProxyTemplate.cjs} +14 -13
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.cjs.map +1 -0
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.d.cts +12 -0
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.d.ts +12 -0
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.js +33 -0
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.js.map +1 -0
- package/dist/AdViewUnit/AdViewUnitTemplate.cjs +114 -0
- package/dist/AdViewUnit/AdViewUnitTemplate.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnitTemplate.d.cts +14 -1
- package/dist/AdViewUnit/AdViewUnitTemplate.d.ts +14 -1
- package/dist/AdViewUnit/AdViewUnitTemplate.js +77 -0
- package/dist/AdViewUnit/AdViewUnitTemplate.js.map +1 -1
- package/dist/AdViewUnit/useAdViewController.cjs +5 -1
- package/dist/AdViewUnit/useAdViewController.cjs.map +1 -1
- package/dist/AdViewUnit/useAdViewController.d.cts +2 -2
- package/dist/AdViewUnit/useAdViewController.d.ts +2 -2
- package/dist/AdViewUnit/useAdViewController.js +5 -1
- package/dist/AdViewUnit/useAdViewController.js.map +1 -1
- package/dist/index.cjs +250 -232
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +232 -222
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +216 -162
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +7 -6
- package/dist/server.d.ts +7 -6
- package/dist/server.js +196 -149
- package/dist/server.js.map +1 -1
- package/dist/{types-BaV07oMT.d.cts → types-B65WDsgh.d.cts} +29 -25
- package/dist/{types-BaV07oMT.d.ts → types-B65WDsgh.d.ts} +29 -25
- package/package.json +1 -1
- package/dist/AdViewUnit/AdViewUnitBanner.cjs.map +0 -1
- package/dist/AdViewUnit/AdViewUnitBanner.d.cts +0 -10
- package/dist/AdViewUnit/AdViewUnitBanner.d.ts +0 -10
- package/dist/AdViewUnit/AdViewUnitBanner.js +0 -29
- package/dist/AdViewUnit/AdViewUnitBanner.js.map +0 -1
- package/dist/AdViewUnit/AdViewUnitNative.cjs.map +0 -1
- package/dist/AdViewUnit/AdViewUnitNative.d.cts +0 -10
- package/dist/AdViewUnit/AdViewUnitNative.d.ts +0 -10
- package/dist/AdViewUnit/AdViewUnitNative.js.map +0 -1
- package/dist/AdViewUnit/AdViewUnitProxy.cjs.map +0 -1
- package/dist/AdViewUnit/AdViewUnitProxy.d.cts +0 -10
- package/dist/AdViewUnit/AdViewUnitProxy.d.ts +0 -10
- package/dist/AdViewUnit/AdViewUnitProxy.js +0 -32
- package/dist/AdViewUnit/AdViewUnitProxy.js.map +0 -1
- package/dist/AdViewUnit/AdViewUnitTypeSwitch.cjs +0 -203
- package/dist/AdViewUnit/AdViewUnitTypeSwitch.cjs.map +0 -1
- package/dist/AdViewUnit/AdViewUnitTypeSwitch.d.cts +0 -12
- package/dist/AdViewUnit/AdViewUnitTypeSwitch.d.ts +0 -12
- package/dist/AdViewUnit/AdViewUnitTypeSwitch.js +0 -170
- package/dist/AdViewUnit/AdViewUnitTypeSwitch.js.map +0 -1
- package/dist/AdViewUnit/AdViewUnitWrapper.client.cjs +0 -250
- package/dist/AdViewUnit/AdViewUnitWrapper.client.cjs.map +0 -1
- package/dist/AdViewUnit/AdViewUnitWrapper.client.d.cts +0 -11
- package/dist/AdViewUnit/AdViewUnitWrapper.client.d.ts +0 -11
- package/dist/AdViewUnit/AdViewUnitWrapper.client.js +0 -220
- package/dist/AdViewUnit/AdViewUnitWrapper.client.js.map +0 -1
- package/dist/AdViewUnit/AdViewUnitWrapper.server.cjs +0 -232
- package/dist/AdViewUnit/AdViewUnitWrapper.server.cjs.map +0 -1
- package/dist/AdViewUnit/AdViewUnitWrapper.server.d.cts +0 -11
- package/dist/AdViewUnit/AdViewUnitWrapper.server.d.ts +0 -11
- package/dist/AdViewUnit/AdViewUnitWrapper.server.js +0 -201
- package/dist/AdViewUnit/AdViewUnitWrapper.server.js.map +0 -1
|
@@ -36,11 +36,68 @@ __export(AdViewUnit_client_exports, {
|
|
|
36
36
|
default: () => AdViewUnit_client_default
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(AdViewUnit_client_exports);
|
|
39
|
-
var
|
|
39
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
40
|
+
|
|
41
|
+
// src/AdViewUnit/AdViewUnitTemplate.tsx
|
|
42
|
+
var import_react = __toESM(require("react"), 1);
|
|
43
|
+
var templateFromListRender = (tmpls, data, wrap) => {
|
|
44
|
+
let renderedRemplates = tmpls.map((tmpl, index) => {
|
|
45
|
+
let tmp = renderTemplate(tmpl, data);
|
|
46
|
+
return !!tmp && import_react.default.isValidElement(tmp) ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, { key: index }, !!wrap ? wrap(tmp) : tmp) : null;
|
|
47
|
+
}).filter((it) => !!it);
|
|
48
|
+
if (!renderedRemplates.length) {
|
|
49
|
+
renderedRemplates = tmpls.map((tmpl, index) => {
|
|
50
|
+
let tmp = renderTemplate(tmpl, { ...data, type: "default" });
|
|
51
|
+
return !!tmp && import_react.default.isValidElement(tmp) ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, { key: index }, !!wrap ? wrap(tmp) : tmp) : null;
|
|
52
|
+
}).filter((it) => !!it);
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, renderedRemplates);
|
|
55
|
+
};
|
|
56
|
+
var renderTemplate = (tmpl, data) => {
|
|
57
|
+
const isFunction = typeof tmpl === "function";
|
|
58
|
+
const isReactElement = import_react.default.isValidElement(tmpl);
|
|
59
|
+
if (isReactElement) {
|
|
60
|
+
const { type, children } = tmpl.props;
|
|
61
|
+
console.log("=====>\nrenderTemplate: React element detected, type:", type, "data:", data.type, data.type !== type);
|
|
62
|
+
if (data.type !== type) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
if (typeof children === "function") {
|
|
66
|
+
return children(data);
|
|
67
|
+
}
|
|
68
|
+
console.log("CLONE ELEMENT", tmpl);
|
|
69
|
+
return import_react.default.cloneElement(tmpl, {
|
|
70
|
+
...data,
|
|
71
|
+
children
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (isFunction) {
|
|
75
|
+
return tmpl(data);
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
};
|
|
79
|
+
var renderTemplates = (tmpls, data, listRender) => {
|
|
80
|
+
return listRender ? listRender(tmpls) : templateFromListRender(tmpls, data);
|
|
81
|
+
};
|
|
82
|
+
var renderAnyTemplates = (tmpls, data, listRender) => {
|
|
83
|
+
if (!tmpls) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if (Array.isArray(tmpls)) {
|
|
87
|
+
return renderTemplates(tmpls, data, listRender);
|
|
88
|
+
}
|
|
89
|
+
if (typeof tmpls === "function") {
|
|
90
|
+
return tmpls(data);
|
|
91
|
+
}
|
|
92
|
+
if (import_react.default.isValidElement(tmpls)) {
|
|
93
|
+
return templateFromListRender([tmpls], data);
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
};
|
|
40
97
|
|
|
41
98
|
// src/AdViewUnit/AdViewUnitTracking.tsx
|
|
42
99
|
var import_utils = require("@adview/core/utils");
|
|
43
|
-
var
|
|
100
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
44
101
|
function AdViewUnitTracking({
|
|
45
102
|
impressions,
|
|
46
103
|
views,
|
|
@@ -48,12 +105,12 @@ function AdViewUnitTracking({
|
|
|
48
105
|
children
|
|
49
106
|
}) {
|
|
50
107
|
const isServer = typeof window === "undefined";
|
|
51
|
-
const wrapperRef = (0,
|
|
52
|
-
const executeImpressionsTrackingHandler = (0,
|
|
108
|
+
const wrapperRef = (0, import_react2.useRef)(null);
|
|
109
|
+
const executeImpressionsTrackingHandler = (0, import_react2.useCallback)(
|
|
53
110
|
() => (0, import_utils.executeImpressionsTracking)(impressions),
|
|
54
111
|
[impressions]
|
|
55
112
|
);
|
|
56
|
-
const trackingObserverInstanceHandler = (0,
|
|
113
|
+
const trackingObserverInstanceHandler = (0, import_react2.useCallback)(
|
|
57
114
|
(entries) => {
|
|
58
115
|
entries.forEach((entry) => {
|
|
59
116
|
if (entry.isIntersecting) {
|
|
@@ -64,14 +121,14 @@ function AdViewUnitTracking({
|
|
|
64
121
|
},
|
|
65
122
|
[views]
|
|
66
123
|
);
|
|
67
|
-
const trackingObserverInstance = (0,
|
|
124
|
+
const trackingObserverInstance = (0, import_react2.useMemo)(() => {
|
|
68
125
|
return !isServer ? new IntersectionObserver(trackingObserverInstanceHandler) : null;
|
|
69
126
|
}, [isServer, trackingObserverInstanceHandler]);
|
|
70
|
-
const clickTrackerHandler = (0,
|
|
127
|
+
const clickTrackerHandler = (0, import_react2.useCallback)(() => {
|
|
71
128
|
(0, import_utils.executeImpressionsTracking)(clicks);
|
|
72
129
|
wrapperRef.current?.removeEventListener("click", clickTrackerHandler);
|
|
73
130
|
}, [clicks]);
|
|
74
|
-
(0,
|
|
131
|
+
(0, import_react2.useEffect)(() => {
|
|
75
132
|
if (wrapperRef.current && trackingObserverInstance) {
|
|
76
133
|
executeImpressionsTrackingHandler();
|
|
77
134
|
wrapperRef.current?.addEventListener("click", clickTrackerHandler);
|
|
@@ -89,246 +146,37 @@ function AdViewUnitTracking({
|
|
|
89
146
|
executeImpressionsTrackingHandler,
|
|
90
147
|
clickTrackerHandler
|
|
91
148
|
]);
|
|
92
|
-
return /* @__PURE__ */
|
|
149
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", { ref: wrapperRef }, children);
|
|
93
150
|
}
|
|
94
151
|
var AdViewUnitTracking_default = AdViewUnitTracking;
|
|
95
152
|
|
|
96
|
-
// src/AdViewUnit/AdViewUnitWrapper.client.tsx
|
|
97
|
-
var import_react6 = __toESM(require("react"), 1);
|
|
98
|
-
|
|
99
|
-
// src/AdViewUnit/AdViewUnitNative.tsx
|
|
100
|
-
var import_utils2 = require("@adview/core/utils");
|
|
101
|
-
var import_react2 = __toESM(require("react"), 1);
|
|
102
|
-
function AdViewUnitNative({
|
|
103
|
-
assets,
|
|
104
|
-
fields,
|
|
105
|
-
url,
|
|
106
|
-
classNames
|
|
107
|
-
}) {
|
|
108
|
-
const asset = (0, import_utils2.getAssetByName)("main", assets);
|
|
109
|
-
if (!url) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
return /* @__PURE__ */ import_react2.default.createElement("div", { className: classNames?.container }, /* @__PURE__ */ import_react2.default.createElement(
|
|
113
|
-
"a",
|
|
114
|
-
{
|
|
115
|
-
target: "_blank",
|
|
116
|
-
rel: "noopener noreferrer",
|
|
117
|
-
href: (0, import_utils2.getPrepareURL)(url),
|
|
118
|
-
className: classNames?.imageLink
|
|
119
|
-
},
|
|
120
|
-
asset && /* @__PURE__ */ import_react2.default.createElement(
|
|
121
|
-
"img",
|
|
122
|
-
{
|
|
123
|
-
alt: fields?.title,
|
|
124
|
-
title: fields?.title,
|
|
125
|
-
src: asset.path,
|
|
126
|
-
srcSet: asset.thumbs ? (0, import_utils2.getSrcSetCSSThumbs)(asset.thumbs) : void 0,
|
|
127
|
-
className: classNames?.image,
|
|
128
|
-
style: { objectFit: "cover", width: "100%", height: "100%" }
|
|
129
|
-
}
|
|
130
|
-
)
|
|
131
|
-
), /* @__PURE__ */ import_react2.default.createElement("div", { className: classNames?.label }, fields?.title && /* @__PURE__ */ import_react2.default.createElement(
|
|
132
|
-
"a",
|
|
133
|
-
{
|
|
134
|
-
target: "_blank",
|
|
135
|
-
rel: "noopener noreferrer",
|
|
136
|
-
href: (0, import_utils2.getPrepareURL)(url),
|
|
137
|
-
"data-class": "titleLink",
|
|
138
|
-
className: classNames?.titleLink
|
|
139
|
-
},
|
|
140
|
-
fields.title
|
|
141
|
-
), fields?.description && /* @__PURE__ */ import_react2.default.createElement(
|
|
142
|
-
"a",
|
|
143
|
-
{
|
|
144
|
-
target: "_blank",
|
|
145
|
-
rel: "noopener noreferrer",
|
|
146
|
-
href: (0, import_utils2.getPrepareURL)(url),
|
|
147
|
-
"data-class": "descriptionLink",
|
|
148
|
-
className: classNames?.descriptionLink
|
|
149
|
-
},
|
|
150
|
-
fields.description
|
|
151
|
-
), fields?.brandname && /* @__PURE__ */ import_react2.default.createElement(
|
|
152
|
-
"a",
|
|
153
|
-
{
|
|
154
|
-
target: "_blank",
|
|
155
|
-
rel: "noopener noreferrer",
|
|
156
|
-
href: (0, import_utils2.getPrepareURL)(url),
|
|
157
|
-
"data-class": "brandNameLink",
|
|
158
|
-
className: classNames?.brandNameLink
|
|
159
|
-
},
|
|
160
|
-
fields.brandname
|
|
161
|
-
), fields?.phone && /* @__PURE__ */ import_react2.default.createElement(
|
|
162
|
-
"a",
|
|
163
|
-
{
|
|
164
|
-
target: "_blank",
|
|
165
|
-
rel: "noopener noreferrer",
|
|
166
|
-
href: (0, import_utils2.getPrepareURL)(url),
|
|
167
|
-
"data-class": "phoneLink",
|
|
168
|
-
className: classNames?.phoneLink
|
|
169
|
-
},
|
|
170
|
-
fields.phone
|
|
171
|
-
), fields?.url && /* @__PURE__ */ import_react2.default.createElement(
|
|
172
|
-
"a",
|
|
173
|
-
{
|
|
174
|
-
target: "_blank",
|
|
175
|
-
rel: "noopener noreferrer",
|
|
176
|
-
href: (0, import_utils2.getPrepareURL)(url),
|
|
177
|
-
"data-class": "urlLink",
|
|
178
|
-
className: classNames?.urlLink
|
|
179
|
-
},
|
|
180
|
-
fields?.url
|
|
181
|
-
)));
|
|
182
|
-
}
|
|
183
|
-
var AdViewUnitNative_default = AdViewUnitNative;
|
|
184
|
-
|
|
185
|
-
// src/AdViewUnit/AdViewUnitProxy.tsx
|
|
186
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
187
|
-
function AdViewUnitProxy({
|
|
188
|
-
// assets,
|
|
189
|
-
fields,
|
|
190
|
-
url
|
|
191
|
-
}) {
|
|
192
|
-
const iframeSrc = fields?.url || url;
|
|
193
|
-
if (!iframeSrc) {
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
196
|
-
return /* @__PURE__ */ import_react3.default.createElement(
|
|
197
|
-
"iframe",
|
|
198
|
-
{
|
|
199
|
-
width: "100%",
|
|
200
|
-
height: "100%",
|
|
201
|
-
frameBorder: "0",
|
|
202
|
-
marginWidth: 0,
|
|
203
|
-
marginHeight: 0,
|
|
204
|
-
allowTransparency: true,
|
|
205
|
-
scrolling: "no",
|
|
206
|
-
allowFullScreen: true,
|
|
207
|
-
style: { width: "100%", height: "100%" },
|
|
208
|
-
src: iframeSrc
|
|
209
|
-
}
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
var AdViewUnitProxy_default = AdViewUnitProxy;
|
|
213
|
-
|
|
214
|
-
// src/AdViewUnit/AdViewUnitBanner.tsx
|
|
215
|
-
var import_utils3 = require("@adview/core/utils");
|
|
216
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
217
|
-
function AdViewUnitBanner({ assets, url }) {
|
|
218
|
-
const asset = (0, import_utils3.getAssetByName)("main", assets);
|
|
219
|
-
return /* @__PURE__ */ import_react4.default.createElement("center", null, /* @__PURE__ */ import_react4.default.createElement(
|
|
220
|
-
"a",
|
|
221
|
-
{
|
|
222
|
-
target: "_blank",
|
|
223
|
-
rel: "noopener noreferrer",
|
|
224
|
-
href: (0, import_utils3.getPrepareURL)(url),
|
|
225
|
-
className: "banner",
|
|
226
|
-
style: { fontSize: 0 }
|
|
227
|
-
},
|
|
228
|
-
asset && /* @__PURE__ */ import_react4.default.createElement(
|
|
229
|
-
"img",
|
|
230
|
-
{
|
|
231
|
-
alt: "main",
|
|
232
|
-
src: asset.path,
|
|
233
|
-
srcSet: asset.thumbs ? (0, import_utils3.getSrcSetCSSThumbs)(asset.thumbs) : ""
|
|
234
|
-
}
|
|
235
|
-
)
|
|
236
|
-
));
|
|
237
|
-
}
|
|
238
|
-
var AdViewUnitBanner_default = AdViewUnitBanner;
|
|
239
|
-
|
|
240
|
-
// src/AdViewUnit/AdViewUnitTypeSwitch.tsx
|
|
241
|
-
var import_react5 = __toESM(require("react"), 1);
|
|
242
|
-
function AdViewUnitTypeSwitch({
|
|
243
|
-
data,
|
|
244
|
-
classNames,
|
|
245
|
-
onDefault
|
|
246
|
-
}) {
|
|
247
|
-
switch (data?.type) {
|
|
248
|
-
case "native":
|
|
249
|
-
return /* @__PURE__ */ import_react5.default.createElement(AdViewUnitNative_default, { ...data, classNames: classNames?.native });
|
|
250
|
-
case "proxy":
|
|
251
|
-
return /* @__PURE__ */ import_react5.default.createElement(AdViewUnitProxy_default, { ...data, classNames: classNames?.proxy });
|
|
252
|
-
case "banner":
|
|
253
|
-
return /* @__PURE__ */ import_react5.default.createElement(AdViewUnitBanner_default, { ...data, classNames: classNames?.banner });
|
|
254
|
-
default:
|
|
255
|
-
if (import_react5.default.isValidElement(onDefault)) {
|
|
256
|
-
return import_react5.default.cloneElement(onDefault);
|
|
257
|
-
}
|
|
258
|
-
if (typeof onDefault === "function") {
|
|
259
|
-
return onDefault();
|
|
260
|
-
}
|
|
261
|
-
return null;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
var AdViewUnitTypeSwitch_default = AdViewUnitTypeSwitch;
|
|
265
|
-
|
|
266
|
-
// src/AdViewUnit/AdViewUnitWrapper.client.tsx
|
|
267
|
-
function AdViewUnitWrapperClient({
|
|
268
|
-
data,
|
|
269
|
-
state,
|
|
270
|
-
error,
|
|
271
|
-
children,
|
|
272
|
-
onDefault
|
|
273
|
-
}) {
|
|
274
|
-
const { isLoading, isError } = state;
|
|
275
|
-
const isChildrenReactNode = import_react6.default.isValidElement(children);
|
|
276
|
-
const isChildrenFunction = typeof children === "function";
|
|
277
|
-
if (isChildrenReactNode) {
|
|
278
|
-
return import_react6.default.cloneElement(children, {
|
|
279
|
-
data,
|
|
280
|
-
state,
|
|
281
|
-
error,
|
|
282
|
-
onDefault
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
if (isChildrenFunction) {
|
|
286
|
-
return children({
|
|
287
|
-
data,
|
|
288
|
-
state,
|
|
289
|
-
error,
|
|
290
|
-
onDefault
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
if (isLoading) {
|
|
294
|
-
return null;
|
|
295
|
-
}
|
|
296
|
-
if (!children && !isError && data) {
|
|
297
|
-
return /* @__PURE__ */ import_react6.default.createElement(AdViewUnitTypeSwitch_default, { data, onDefault });
|
|
298
|
-
}
|
|
299
|
-
if (import_react6.default.isValidElement(onDefault)) {
|
|
300
|
-
return import_react6.default.cloneElement(onDefault);
|
|
301
|
-
}
|
|
302
|
-
if (typeof onDefault === "function") {
|
|
303
|
-
return onDefault();
|
|
304
|
-
}
|
|
305
|
-
return null;
|
|
306
|
-
}
|
|
307
|
-
var AdViewUnitWrapper_client_default = AdViewUnitWrapperClient;
|
|
308
|
-
|
|
309
153
|
// src/AdViewUnit/useAdViewController.ts
|
|
310
|
-
var
|
|
311
|
-
var
|
|
154
|
+
var import_utils2 = require("@adview/core/utils");
|
|
155
|
+
var import_react4 = require("react");
|
|
312
156
|
|
|
313
157
|
// src/AdViewUnit/AdViewProvider.tsx
|
|
314
|
-
var
|
|
315
|
-
var AdViewProviderContext = (0,
|
|
158
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
159
|
+
var AdViewProviderContext = (0, import_react3.createContext)(
|
|
316
160
|
{}
|
|
317
161
|
);
|
|
318
162
|
|
|
319
163
|
// src/AdViewUnit/useAdViewController.ts
|
|
320
164
|
function useAdViewController(adUnitConfig, unitId, format) {
|
|
321
|
-
const [adLoadState, setAdLoadState] = (0,
|
|
322
|
-
const [adData, setAdData] = (0,
|
|
323
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
324
|
-
const globalConfig = (0,
|
|
325
|
-
const baseConfig = (0,
|
|
326
|
-
const requestUrl = (0,
|
|
165
|
+
const [adLoadState, setAdLoadState] = (0, import_react4.useState)("initial");
|
|
166
|
+
const [adData, setAdData] = (0, import_react4.useState)(null);
|
|
167
|
+
const [errorMessage, setErrorMessage] = (0, import_react4.useState)(null);
|
|
168
|
+
const globalConfig = (0, import_react4.useContext)(AdViewProviderContext);
|
|
169
|
+
const baseConfig = (0, import_utils2.getResolveConfig)({ ...adUnitConfig, ...globalConfig });
|
|
170
|
+
const requestUrl = (0, import_utils2.getAdRequestUrl)(
|
|
171
|
+
baseConfig,
|
|
172
|
+
unitId,
|
|
173
|
+
typeof format === "string" ? format : format?.join(",") || ""
|
|
174
|
+
);
|
|
327
175
|
const loadAd = async () => {
|
|
328
176
|
setAdLoadState("loading");
|
|
329
177
|
try {
|
|
330
|
-
console.log("Requesting ad data from:",
|
|
331
|
-
const response = await (0,
|
|
178
|
+
console.log("Requesting ad data from:", import_utils2.adViewFetcher, "with URL:", requestUrl);
|
|
179
|
+
const response = await (0, import_utils2.adViewFetcher)(requestUrl, baseConfig.defaultAdData);
|
|
332
180
|
console.log("AdViewController response:", response);
|
|
333
181
|
if (response instanceof Error) {
|
|
334
182
|
setAdLoadState("error");
|
|
@@ -349,7 +197,7 @@ function useAdViewController(adUnitConfig, unitId, format) {
|
|
|
349
197
|
isComplete: adLoadState === "complete",
|
|
350
198
|
isError: adLoadState === "error"
|
|
351
199
|
};
|
|
352
|
-
(0,
|
|
200
|
+
(0, import_react4.useEffect)(() => {
|
|
353
201
|
loadAd();
|
|
354
202
|
}, []);
|
|
355
203
|
return [adData, errorMessage, loadState];
|
|
@@ -361,7 +209,6 @@ function AdViewUnitClient({
|
|
|
361
209
|
unitId,
|
|
362
210
|
format,
|
|
363
211
|
children,
|
|
364
|
-
onDefault = () => null,
|
|
365
212
|
...config
|
|
366
213
|
}) {
|
|
367
214
|
const [response, error, loadState] = useAdViewController_default(
|
|
@@ -372,29 +219,12 @@ function AdViewUnitClient({
|
|
|
372
219
|
const responseGroup = error ? null : response?.groups?.[0];
|
|
373
220
|
const customTracker = responseGroup?.custom_tracker ?? {};
|
|
374
221
|
const groupItems = responseGroup?.items;
|
|
375
|
-
if (groupItems && groupItems?.length) {
|
|
222
|
+
if (groupItems && groupItems?.length > 0) {
|
|
376
223
|
return groupItems.map(({ tracker, ...data }) => {
|
|
377
|
-
return /* @__PURE__ */
|
|
378
|
-
AdViewUnitWrapper_client_default,
|
|
379
|
-
{
|
|
380
|
-
state: loadState,
|
|
381
|
-
error,
|
|
382
|
-
data,
|
|
383
|
-
onDefault
|
|
384
|
-
},
|
|
385
|
-
children
|
|
386
|
-
));
|
|
224
|
+
return /* @__PURE__ */ import_react5.default.createElement(AdViewUnitTracking_default, { key: data.id, ...tracker }, renderAnyTemplates(children, { data, type: data.type || "default", error, state: loadState }));
|
|
387
225
|
});
|
|
388
226
|
}
|
|
389
|
-
return /* @__PURE__ */
|
|
390
|
-
AdViewUnitWrapper_client_default,
|
|
391
|
-
{
|
|
392
|
-
state: loadState,
|
|
393
|
-
error,
|
|
394
|
-
onDefault
|
|
395
|
-
},
|
|
396
|
-
children
|
|
397
|
-
));
|
|
227
|
+
return /* @__PURE__ */ import_react5.default.createElement(AdViewUnitTracking_default, { ...customTracker }, renderAnyTemplates(children, { data: null, type: "default", error, state: loadState }));
|
|
398
228
|
}
|
|
399
229
|
var AdViewUnit_client_default = AdViewUnitClient;
|
|
400
230
|
//# sourceMappingURL=AdViewUnit.client.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/AdViewUnit/AdViewUnit.client.tsx","../../src/AdViewUnit/AdViewUnitTracking.tsx","../../src/AdViewUnit/AdViewUnitWrapper.client.tsx","../../src/AdViewUnit/AdViewUnitNative.tsx","../../src/AdViewUnit/AdViewUnitProxy.tsx","../../src/AdViewUnit/AdViewUnitBanner.tsx","../../src/AdViewUnit/AdViewUnitTypeSwitch.tsx","../../src/AdViewUnit/useAdViewController.ts","../../src/AdViewUnit/AdViewProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { AdViewUnitClientChildren, AdViewUnitPropsBase } from '../types';\nimport AdViewUnitTracking from './AdViewUnitTracking';\nimport AdViewUnitWrapperClient from './AdViewUnitWrapper.client';\nimport useAdViewController from './useAdViewController';\n\nexport type AdViewUnitClientProps = AdViewUnitPropsBase & {\n children?: AdViewUnitClientChildren;\n};\n\nfunction AdViewUnitClient({\n unitId,\n format,\n children,\n onDefault = () => null,\n ...config\n}: AdViewUnitClientProps) {\n const [response, error, loadState] = useAdViewController(\n config,\n unitId,\n format,\n );\n const responseGroup = error ? null : response?.groups?.[0];\n const customTracker = responseGroup?.custom_tracker ?? {};\n const groupItems = responseGroup?.items;\n\n if (groupItems && groupItems?.length) {\n return groupItems.map(({ tracker, ...data }) => {\n return (\n <AdViewUnitTracking key={data.id} {...tracker}>\n <AdViewUnitWrapperClient\n state={loadState}\n error={error}\n data={data}\n onDefault={onDefault}\n >\n {children}\n </AdViewUnitWrapperClient>\n </AdViewUnitTracking>\n );\n });\n }\n\n return (\n <AdViewUnitTracking {...customTracker}>\n <AdViewUnitWrapperClient\n state={loadState}\n error={error}\n onDefault={onDefault}\n >\n {children}\n </AdViewUnitWrapperClient>\n </AdViewUnitTracking>\n );\n}\n\nexport default AdViewUnitClient;\n","'use client';\n\nimport { executeImpressionsTracking } from '@adview/core/utils';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\ntype AdViewUnitTrackingProps = {\n impressions?: string[];\n views?: string[];\n clicks?: string[];\n children: React.ReactNode;\n};\n\nfunction AdViewUnitTracking({\n impressions,\n views,\n clicks,\n children,\n}: AdViewUnitTrackingProps) {\n const isServer = typeof window === 'undefined';\n const wrapperRef = useRef<HTMLDivElement>(null);\n const executeImpressionsTrackingHandler = useCallback(\n () => executeImpressionsTracking(impressions),\n [impressions],\n );\n const trackingObserverInstanceHandler = useCallback(\n (entries: IntersectionObserverEntry[]) => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n executeImpressionsTracking(views);\n trackingObserverInstance?.unobserve(wrapperRef.current!);\n }\n });\n },\n [views],\n );\n const trackingObserverInstance = useMemo<IntersectionObserver | null>(() => {\n return !isServer\n ? new IntersectionObserver(trackingObserverInstanceHandler)\n : null;\n }, [isServer, trackingObserverInstanceHandler]);\n const clickTrackerHandler = useCallback(() => {\n executeImpressionsTracking(clicks);\n\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n }, [clicks]);\n\n useEffect(() => {\n if (wrapperRef.current && trackingObserverInstance) {\n executeImpressionsTrackingHandler();\n wrapperRef.current?.addEventListener('click', clickTrackerHandler);\n trackingObserverInstance?.observe(wrapperRef.current);\n\n return () => {\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n if (wrapperRef.current)\n trackingObserverInstance?.unobserve(wrapperRef.current);\n };\n }\n\n return () => {};\n }, [\n trackingObserverInstance,\n executeImpressionsTrackingHandler,\n clickTrackerHandler,\n ]);\n\n return <div ref={wrapperRef}>{children}</div>;\n}\n\nexport default AdViewUnitTracking;\n","'use client';\n\nimport React from 'react';\nimport AdViewUnitTypeSwitch from './AdViewUnitTypeSwitch';\nimport {\n AdViewUnitClientChildren,\n AdViewUnitClientChildrenProps,\n AdViewUnitDefault,\n} from '../types';\n\nexport type AdViewUnitWrapperClientProps = AdViewUnitClientChildrenProps & {\n children?: AdViewUnitClientChildren;\n onDefault: AdViewUnitDefault;\n};\n\nfunction AdViewUnitWrapperClient({\n data,\n state,\n error,\n children,\n onDefault,\n}: AdViewUnitWrapperClientProps) {\n const { isLoading, isError } = state;\n const isChildrenReactNode = React.isValidElement(children);\n const isChildrenFunction = typeof children === 'function';\n\n if (isChildrenReactNode) {\n return React.cloneElement(children, {\n data,\n state,\n error,\n onDefault,\n });\n }\n\n if (isChildrenFunction) {\n return children({\n data,\n state,\n error,\n onDefault,\n });\n }\n\n if (isLoading) {\n return null;\n }\n\n if (!children && !isError && data) {\n return <AdViewUnitTypeSwitch data={data} onDefault={onDefault} />;\n }\n\n if (React.isValidElement(onDefault)) {\n return React.cloneElement(onDefault);\n }\n\n if (typeof onDefault === 'function') {\n return onDefault();\n }\n\n return null;\n}\n\nexport default AdViewUnitWrapperClient;\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdViewDataClient, AdViewStyleTokensNative } from '../types';\n\ntype AdViewUnitNativeProps = AdViewDataClient & {\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitNative({\n assets,\n fields,\n url,\n classNames,\n}: AdViewUnitNativeProps) {\n const asset = getAssetByName('main', assets);\n\n if (!url) {\n return null;\n }\n\n return (\n <div className={classNames?.container}>\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n className={classNames?.imageLink}\n >\n {asset && (\n <img\n alt={fields?.title}\n title={fields?.title}\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : undefined}\n className={classNames?.image}\n style={{ objectFit: 'cover', width: '100%', height: '100%' }}\n />\n )}\n </a>\n <div className={classNames?.label}>\n {fields?.title && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"titleLink\"\n className={classNames?.titleLink}\n >\n {fields.title}\n </a>\n )}\n {fields?.description && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"descriptionLink\"\n className={classNames?.descriptionLink}\n >\n {fields.description}\n </a>\n )}\n {fields?.brandname && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"brandNameLink\"\n className={classNames?.brandNameLink}\n >\n {fields.brandname}\n </a>\n )}\n {fields?.phone && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"phoneLink\"\n className={classNames?.phoneLink}\n >\n {fields.phone}\n </a>\n )}\n {fields?.url && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"urlLink\"\n className={classNames?.urlLink}\n >\n {fields?.url}\n </a>\n )}\n </div>\n </div>\n );\n}\n\nexport default AdViewUnitNative;\n","import React from 'react';\nimport { AdViewDataClient, AdViewStyleTokensNative } from '../types';\n\ntype AdViewUnitProxyProps = AdViewDataClient & {\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitProxy({\n // assets,\n fields,\n url,\n}: AdViewUnitProxyProps) {\n const iframeSrc = fields?.url || url;\n\n if (!iframeSrc) {\n return null;\n }\n\n return (\n <iframe\n width=\"100%\"\n height=\"100%\"\n frameBorder=\"0\"\n marginWidth={0}\n marginHeight={0}\n allowTransparency={true}\n scrolling=\"no\"\n allowFullScreen={true}\n style={{ width: '100%', height: '100%' }}\n src={iframeSrc}\n ></iframe>\n );\n}\n\nexport default AdViewUnitProxy;\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdViewDataClient, AdViewStyleTokensNative } from '../types';\n\ntype AdViewUnitBannerProps = AdViewDataClient & {\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitBanner({ assets, url }: AdViewUnitBannerProps) {\n const asset = getAssetByName('main', assets);\n\n return (\n <center>\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n className=\"banner\"\n style={{ fontSize: 0 }}\n >\n {asset && (\n <img\n alt=\"main\"\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : ''}\n />\n )}\n </a>\n </center>\n );\n}\n\nexport default AdViewUnitBanner;\n","import {\n AdViewDataClient,\n AdViewStyleTokens,\n AdViewUnitDefault,\n} from '../types';\nimport AdViewUnitNative from './AdViewUnitNative';\nimport AdViewUnitProxy from './AdViewUnitProxy';\nimport AdViewUnitBanner from './AdViewUnitBanner';\nimport React from 'react';\n\ntype AdViewUnitDefaultProps = {\n data?: AdViewDataClient;\n classNames?: AdViewStyleTokens;\n onDefault?: AdViewUnitDefault;\n};\n\nfunction AdViewUnitTypeSwitch({\n data,\n classNames,\n onDefault,\n}: AdViewUnitDefaultProps) {\n switch (data?.type) {\n case 'native':\n return <AdViewUnitNative {...data} classNames={classNames?.native} />;\n case 'proxy':\n return <AdViewUnitProxy {...data} classNames={classNames?.proxy} />;\n case 'banner':\n return <AdViewUnitBanner {...data} classNames={classNames?.banner} />;\n default:\n if (React.isValidElement(onDefault)) {\n return React.cloneElement(onDefault);\n }\n\n if (typeof onDefault === 'function') {\n return onDefault();\n }\n\n return null;\n }\n}\n\nexport default AdViewUnitTypeSwitch;\n","'use client';\n\nimport { AdViewData } from '@adview/core/typings';\nimport { adViewFetcher, getAdRequestUrl, getResolveConfig } from '@adview/core/utils';\nimport { useContext, useEffect, useState } from 'react';\nimport { AdLoadState, AdViewConfig } from '../types';\nimport { AdViewProviderContext } from './AdViewProvider';\n\ntype UseAdViewControllerProps = [AdViewData | null, Error | null, AdLoadState];\n\nfunction useAdViewController(\n adUnitConfig: AdViewConfig,\n unitId: string,\n format?: string,\n): UseAdViewControllerProps {\n const [adLoadState, setAdLoadState] = useState<string>('initial');\n const [adData, setAdData] = useState<AdViewData | null>(null);\n const [errorMessage, setErrorMessage] = useState<Error | null>(null);\n const globalConfig = useContext(AdViewProviderContext);\n const baseConfig = getResolveConfig({ ...adUnitConfig, ...globalConfig });\n const requestUrl = getAdRequestUrl(baseConfig, unitId, format);\n const loadAd = async () => {\n setAdLoadState('loading');\n\n try {\n console.log('Requesting ad data from:', adViewFetcher, 'with URL:', requestUrl);\n const response = await adViewFetcher(requestUrl, baseConfig.defaultAdData);\n console.log('AdViewController response:', response);\n\n if (response instanceof Error) {\n setAdLoadState('error');\n setErrorMessage(response);\n } else {\n setAdData(response);\n }\n setAdLoadState('complete');\n } catch (error) {\n setAdLoadState('error');\n setAdLoadState('complete');\n setErrorMessage(error as Error);\n }\n };\n const loadState = {\n isInitial: adLoadState === 'initial',\n isLoading: adLoadState === 'loading',\n isComplete: adLoadState === 'complete',\n isError: adLoadState === 'error',\n };\n\n useEffect(() => {\n loadAd();\n }, []);\n\n return [adData, errorMessage, loadState];\n}\n\nexport default useAdViewController;\n","'use client';\n\nimport React, { createContext } from 'react';\nimport { type AdViewConfig } from '../types';\n\ntype AdViewProviderContextProps = AdViewConfig;\n\nexport const AdViewProviderContext = createContext<AdViewProviderContextProps>(\n {} as AdViewProviderContextProps,\n);\n\ntype AdViewProviderProps = {\n children: React.ReactNode;\n} & AdViewProviderContextProps;\n\nconst AdViewProvider = ({ children, ...props }: AdViewProviderProps) => {\n return (\n <AdViewProviderContext.Provider value={props}>\n {children}\n </AdViewProviderContext.Provider>\n );\n};\n\nexport default AdViewProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAAkB;;;ACAlB,mBAA2C;AAC3C,mBAA+D;AAS/D,SAAS,mBAAmB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA4B;AAC1B,QAAM,WAAW,OAAO,WAAW;AACnC,QAAM,iBAAa,qBAAuB,IAAI;AAC9C,QAAM,wCAAoC;AAAA,IACxC,UAAM,yCAA2B,WAAW;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B;AAEA,+BAAU,MAAM;AACd,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AAEL,SAAO,CAAC,QAAQ,cAAc,SAAS;AACzC;AAEA,IAAO,8BAAQ;;;AP5Cf,SAAS,iBAAiB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,MAAM;AAAA,EAClB,GAAG;AACL,GAA0B;AACxB,QAAM,CAAC,UAAU,OAAO,SAAS,IAAI;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,QAAM,gBAAgB,QAAQ,OAAO,UAAU,SAAS,CAAC;AACzD,QAAM,gBAAgB,eAAe,kBAAkB,CAAC;AACxD,QAAM,aAAa,eAAe;AAElC,MAAI,cAAc,YAAY,QAAQ;AACpC,WAAO,WAAW,IAAI,CAAC,EAAE,SAAS,GAAG,KAAK,MAAM;AAC9C,aACE,8BAAAC,QAAA,cAAC,8BAAmB,KAAK,KAAK,IAAK,GAAG,WACpC,8BAAAA,QAAA;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA;AAAA,QAEC;AAAA,MACH,CACF;AAAA,IAEJ,CAAC;AAAA,EACH;AAEA,SACE,8BAAAA,QAAA,cAAC,8BAAoB,GAAG,iBACtB,8BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP;AAAA,MACA;AAAA;AAAA,IAEC;AAAA,EACH,CACF;AAEJ;AAEA,IAAO,4BAAQ;","names":["import_react","React","import_react","import_utils","import_react","React","import_react","React","import_utils","import_react","React","import_react","React","React","import_utils","import_react","import_react","React"]}
|
|
1
|
+
{"version":3,"sources":["../../src/AdViewUnit/AdViewUnit.client.tsx","../../src/AdViewUnit/AdViewUnitTemplate.tsx","../../src/AdViewUnit/AdViewUnitTracking.tsx","../../src/AdViewUnit/useAdViewController.ts","../../src/AdViewUnit/AdViewProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { AdViewUnitClientChildren, AdViewUnitPropsBase } from '../types';\nimport { renderAnyTemplates } from './AdViewUnitTemplate';\nimport AdViewUnitTracking from './AdViewUnitTracking';\nimport useAdViewController from './useAdViewController';\n\nexport type AdViewUnitClientProps = AdViewUnitPropsBase & {\n children?: AdViewUnitClientChildren;\n};\n\n// AdViewUnitClient is a client-side component that fetches ad data and renders it\n// using the provided children function. It handles loading, error states, and\n// tracks ad interactions.\n//\n// Example usage:\n// <AdView.Unit unitId=\"my-unit\" format=\"banner\" srcURL=\"https://api.example.com/ads/{<id>}\">\n// {({ data, state, error }) => (\n// <div>\n// {state.isLoading && <span>Loading...</span>}\n// {error && <span>Error: {error.message}</span>}\n// {data && <img src={data.imageUrl} alt={data.title} />\n// </div>\n// )}\n// </AdView.Unit>\n//\n// Note: This component is designed to be used in a client-side environment where\n// ad data can be fetched dynamically. It is not suitable for server-side rendering.\n// It uses the AdViewUnitTracking component to handle ad tracking and interactions.\nfunction AdViewUnitClient({\n unitId,\n format,\n children,\n ...config\n}: AdViewUnitClientProps) {\n const [response, error, loadState] = useAdViewController(\n config,\n unitId,\n format,\n );\n const responseGroup = error ? null : response?.groups?.[0];\n const customTracker = responseGroup?.custom_tracker ?? {};\n const groupItems = responseGroup?.items;\n\n if (groupItems && groupItems?.length > 0) {\n return groupItems.map(({ tracker, ...data }) => {\n return (\n <AdViewUnitTracking key={data.id} {...tracker}>\n {renderAnyTemplates(children, {data, type: data.type || 'default', error, state: loadState})}\n </AdViewUnitTracking>\n );\n });\n }\n\n return (\n <AdViewUnitTracking {...customTracker}>\n {renderAnyTemplates(children, {data: null, type: 'default', error, state: loadState})}\n </AdViewUnitTracking>\n );\n}\n\nexport default AdViewUnitClient;\n","//\n// Example\n// <AdView.Unit>\n// <AdView.Template type=\"banner\">\n// <...>\n// </AdView.Template>\n// </AdView.Unit>\n//\n\nimport React, { JSX } from 'react';\nimport { AdViewUnitClientChildrenProps, AdViewUnitTemplateProps, AdViewUnitTemplateTypeProps } from '../types';\n\n// TemplateListRender is a function that takes a list of TemplateType and returns a React element\nexport type TemplateListRender = (tmpls: TemplateElement[]) => React.ReactElement | JSX.Element;\n\n// TemplateType is a React component that can be used to render ad templates\nexport type TemplateType = React.Component<AdViewUnitTemplateProps>;\nexport type TemplateElement = React.ReactElement<AdViewUnitTemplateProps>;\n\n// TemplateTypeFunction is a function that takes AdViewUnitTemplateTypeProps and returns a React node or element\nexport type TemplateTypeFunction = (props: AdViewUnitTemplateTypeProps) => React.ReactNode | React.ReactElement;\n\n// templateFromListRender is a function that takes a list of TemplateType and returns a React element\nexport const templateFromListRender = (tmpls: TemplateElement[], data: AdViewUnitTemplateTypeProps, wrap?: (children: React.ReactNode) => React.ReactNode): JSX.Element | React.ReactElement => {\n let renderedRemplates = tmpls.map((tmpl, index) => {\n let tmp = renderTemplate(tmpl, data);\n return !!tmp && React.isValidElement(tmp)\n ? <React.Fragment key={index}>{!!wrap ? wrap(tmp) : tmp}</React.Fragment>\n : null;\n }).filter(it => !!it);\n\n if (!renderedRemplates.length) {\n renderedRemplates = tmpls.map((tmpl, index) => {\n let tmp = renderTemplate(tmpl, {...data, type: 'default'});\n return !!tmp && React.isValidElement(tmp)\n ? <React.Fragment key={index}>{!!wrap ? wrap(tmp) : tmp}</React.Fragment>\n : null;\n }).filter(it => !!it);\n }\n\n return (<>{renderedRemplates}</>);\n};\n\n// renderTemplate is a function that takes a TemplateType or a function and returns a React node\nexport const renderTemplate = (tmpl: TemplateElement | TemplateTypeFunction, data: AdViewUnitTemplateTypeProps): React.ReactNode => {\n const isFunction = typeof tmpl === 'function';\n const isReactElement = React.isValidElement(tmpl);\n\n if (isReactElement) {\n // Extract type and children from the React element\n const { type, children } = (tmpl as TemplateElement).props;\n console.log('=====>\\nrenderTemplate: React element detected, type:', type, 'data:', data.type, data.type !== type);\n // If the type does not match, return null\n if (data.type !== type) {\n return null;\n }\n // If children is a function, call it with the data\n if (typeof children === 'function') {\n return children(data as AdViewUnitClientChildrenProps);\n }\n console.log('CLONE ELEMENT', tmpl);\n // If children is a React element, clone it with the new props\n return React.cloneElement((tmpl as TemplateElement), {\n ...data,\n children: children,\n });\n }\n\n if (isFunction) {\n return tmpl(data);\n }\n\n return null;\n}\n\n// renderTemplates is a function that takes a list of TemplateType and returns a React element\nexport const renderTemplates = (tmpls: TemplateElement[], data: AdViewUnitTemplateTypeProps, listRender?: TemplateListRender): React.ReactNode | React.ReactElement | JSX.Element => {\n return listRender ? listRender(tmpls) : templateFromListRender(tmpls, data);\n};\n\nexport const renderAnyTemplates = (tmpls: any, data: AdViewUnitTemplateTypeProps, listRender?: TemplateListRender): React.ReactNode | React.ReactElement | JSX.Element | null => {\n if (!tmpls) {\n return null;\n }\n\n if (Array.isArray(tmpls)) {\n return renderTemplates(tmpls as TemplateElement[], data, listRender);\n }\n\n if (typeof tmpls === 'function') {\n return tmpls(data);\n }\n\n if (React.isValidElement(tmpls)) {\n return templateFromListRender([tmpls as TemplateElement], data);\n }\n\n return null;\n}\n\n// Template is a React component that renders a template based on the type and data provided\n// Example usage:\n// <AdView.Unit>\n// <AdView.Template type=\"banner\" data={{...}}>\n// </AdView.Unit>\nconst AdViewUnitTemplate = ({ type, children, ...data }: AdViewUnitTemplateProps) => {\n const tmplProps: AdViewUnitTemplateTypeProps = {\n type,\n ...data,\n };\n\n // If children is a function, call it with the data\n if (typeof children === 'function') {\n return children(tmplProps as AdViewUnitClientChildrenProps) as React.ReactElement;\n }\n\n // If children is a React element, clone it with the new props\n if (React.isValidElement(children)) {\n return React.cloneElement(children, tmplProps);\n }\n\n // If no children are provided, return an empty fragment\n return <></>;\n}\n\nexport default AdViewUnitTemplate;\n","'use client';\n\nimport { executeImpressionsTracking } from '@adview/core/utils';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\ntype AdViewUnitTrackingProps = {\n impressions?: string[];\n views?: string[];\n clicks?: string[];\n children: React.ReactNode;\n};\n\nfunction AdViewUnitTracking({\n impressions,\n views,\n clicks,\n children,\n}: AdViewUnitTrackingProps) {\n const isServer = typeof window === 'undefined';\n const wrapperRef = useRef<HTMLDivElement>(null);\n const executeImpressionsTrackingHandler = useCallback(\n () => executeImpressionsTracking(impressions),\n [impressions],\n );\n const trackingObserverInstanceHandler = useCallback(\n (entries: IntersectionObserverEntry[]) => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n executeImpressionsTracking(views);\n trackingObserverInstance?.unobserve(wrapperRef.current!);\n }\n });\n },\n [views],\n );\n const trackingObserverInstance = useMemo<IntersectionObserver | null>(() => {\n return !isServer\n ? new IntersectionObserver(trackingObserverInstanceHandler)\n : null;\n }, [isServer, trackingObserverInstanceHandler]);\n const clickTrackerHandler = useCallback(() => {\n executeImpressionsTracking(clicks);\n\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n }, [clicks]);\n\n useEffect(() => {\n if (wrapperRef.current && trackingObserverInstance) {\n executeImpressionsTrackingHandler();\n wrapperRef.current?.addEventListener('click', clickTrackerHandler);\n trackingObserverInstance?.observe(wrapperRef.current);\n\n return () => {\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n if (wrapperRef.current)\n trackingObserverInstance?.unobserve(wrapperRef.current);\n };\n }\n\n return () => {};\n }, [\n trackingObserverInstance,\n executeImpressionsTrackingHandler,\n clickTrackerHandler,\n ]);\n\n return <div ref={wrapperRef}>{children}</div>;\n}\n\nexport default AdViewUnitTracking;\n","'use client';\n\nimport { AdViewData } from '@adview/core/typings';\nimport { adViewFetcher, getAdRequestUrl, getResolveConfig } from '@adview/core/utils';\nimport { useContext, useEffect, useState } from 'react';\nimport { AdLoadState, AdViewConfig } from '../types';\nimport { AdViewProviderContext } from './AdViewProvider';\n\ntype UseAdViewControllerProps = [AdViewData | null, Error | null, AdLoadState];\n\nfunction useAdViewController(\n adUnitConfig: AdViewConfig,\n unitId: string,\n format?: string | string[],\n): UseAdViewControllerProps {\n const [adLoadState, setAdLoadState] = useState<string>('initial');\n const [adData, setAdData] = useState<AdViewData | null>(null);\n const [errorMessage, setErrorMessage] = useState<Error | null>(null);\n const globalConfig = useContext(AdViewProviderContext);\n const baseConfig = getResolveConfig({ ...adUnitConfig, ...globalConfig });\n const requestUrl = getAdRequestUrl(baseConfig, unitId,\n typeof format === 'string' ? format : format?.join(',') || '');\n\n const loadAd = async () => {\n setAdLoadState('loading');\n\n try {\n console.log('Requesting ad data from:', adViewFetcher, 'with URL:', requestUrl);\n const response = await adViewFetcher(requestUrl, baseConfig.defaultAdData);\n console.log('AdViewController response:', response);\n\n if (response instanceof Error) {\n setAdLoadState('error');\n setErrorMessage(response);\n } else {\n setAdData(response);\n }\n setAdLoadState('complete');\n } catch (error) {\n setAdLoadState('error');\n setAdLoadState('complete');\n setErrorMessage(error as Error);\n }\n };\n\n const loadState = {\n isInitial: adLoadState === 'initial',\n isLoading: adLoadState === 'loading',\n isComplete: adLoadState === 'complete',\n isError: adLoadState === 'error',\n };\n\n useEffect(() => {loadAd()}, []);\n\n return [adData, errorMessage, loadState];\n}\n\nexport default useAdViewController;\n","'use client';\n\nimport React, { createContext } from 'react';\nimport { type AdViewConfig } from '../types';\n\ntype AdViewProviderContextProps = AdViewConfig;\n\nexport const AdViewProviderContext = createContext<AdViewProviderContextProps>(\n {} as AdViewProviderContextProps,\n);\n\ntype AdViewProviderProps = {\n children: React.ReactNode;\n} & AdViewProviderContextProps;\n\nconst AdViewProvider = ({ children, ...props }: AdViewProviderProps) => {\n return (\n <AdViewProviderContext.Provider value={props}>\n {children}\n </AdViewProviderContext.Provider>\n );\n};\n\nexport default AdViewProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAAkB;;;ACOlB,mBAA2B;AAcpB,IAAM,yBAAyB,CAAC,OAA0B,MAAmC,SAA4F;AAC9L,MAAI,oBAAoB,MAAM,IAAI,CAAC,MAAM,UAAU;AACjD,QAAI,MAAM,eAAe,MAAM,IAAI;AACnC,WAAO,CAAC,CAAC,OA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
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { A as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-
|
|
2
|
+
import { A as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-B65WDsgh.cjs';
|
|
3
3
|
import '@adview/core/typings';
|
|
4
4
|
|
|
5
5
|
type AdViewUnitClientProps = AdViewUnitPropsBase & {
|
|
6
6
|
children?: AdViewUnitClientChildren;
|
|
7
7
|
};
|
|
8
|
-
declare function AdViewUnitClient({ unitId, format, children,
|
|
8
|
+
declare function AdViewUnitClient({ unitId, format, children, ...config }: AdViewUnitClientProps): React.JSX.Element | React.JSX.Element[];
|
|
9
9
|
|
|
10
10
|
export { type AdViewUnitClientProps, AdViewUnitClient as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { A as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-
|
|
2
|
+
import { A as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-B65WDsgh.js';
|
|
3
3
|
import '@adview/core/typings';
|
|
4
4
|
|
|
5
5
|
type AdViewUnitClientProps = AdViewUnitPropsBase & {
|
|
6
6
|
children?: AdViewUnitClientChildren;
|
|
7
7
|
};
|
|
8
|
-
declare function AdViewUnitClient({ unitId, format, children,
|
|
8
|
+
declare function AdViewUnitClient({ unitId, format, children, ...config }: AdViewUnitClientProps): React.JSX.Element | React.JSX.Element[];
|
|
9
9
|
|
|
10
10
|
export { type AdViewUnitClientProps, AdViewUnitClient as default };
|