@adview/react 1.0.14 → 1.0.16
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 +288 -66
- package/dist/AdViewUnit/AdViewUnit.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnit.client.cjs +249 -43
- package/dist/AdViewUnit/AdViewUnit.client.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnit.client.d.cts +1 -1
- package/dist/AdViewUnit/AdViewUnit.client.d.ts +1 -1
- package/dist/AdViewUnit/AdViewUnit.client.js +228 -22
- 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 +263 -41
- package/dist/AdViewUnit/AdViewUnit.js.map +1 -1
- package/dist/AdViewUnit/AdViewUnit.server.cjs +246 -42
- 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 +233 -29
- package/dist/AdViewUnit/AdViewUnit.server.js.map +1 -1
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.cjs +21 -2
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.d.cts +7 -2
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.d.ts +7 -2
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.js +21 -2
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.js.map +1 -1
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.cjs +21 -3
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.d.cts +3 -4
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.d.ts +3 -4
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.js +21 -3
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.js.map +1 -1
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.cjs +21 -2
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.d.cts +7 -2
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.d.ts +7 -2
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.js +21 -2
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.js.map +1 -1
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.cjs +21 -2
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.d.cts +7 -2
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.d.ts +7 -2
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.js +21 -2
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.js.map +1 -1
- package/dist/AdViewUnit/AdViewUnitTemplate.cjs +24 -6
- package/dist/AdViewUnit/AdViewUnitTemplate.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnitTemplate.d.cts +2 -2
- package/dist/AdViewUnit/AdViewUnitTemplate.d.ts +2 -2
- package/dist/AdViewUnit/AdViewUnitTemplate.js +24 -6
- package/dist/AdViewUnit/AdViewUnitTemplate.js.map +1 -1
- package/dist/AdViewUnit/useAdViewController.cjs +0 -2
- package/dist/AdViewUnit/useAdViewController.cjs.map +1 -1
- package/dist/AdViewUnit/useAdViewController.d.cts +1 -1
- package/dist/AdViewUnit/useAdViewController.d.ts +1 -1
- package/dist/AdViewUnit/useAdViewController.js +0 -2
- package/dist/AdViewUnit/useAdViewController.js.map +1 -1
- package/dist/AdViewUnit/utils.cjs +33 -0
- package/dist/AdViewUnit/utils.cjs.map +1 -0
- package/dist/AdViewUnit/utils.d.cts +7 -0
- package/dist/AdViewUnit/utils.d.ts +7 -0
- package/dist/AdViewUnit/utils.js +8 -0
- package/dist/AdViewUnit/utils.js.map +1 -0
- package/dist/index.cjs +278 -195
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +257 -174
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +277 -196
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +264 -183
- package/dist/server.js.map +1 -1
- package/dist/{types-B65WDsgh.d.cts → types-E00UyX0q.d.cts} +15 -27
- package/dist/{types-B65WDsgh.d.ts → types-E00UyX0q.d.ts} +15 -27
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,38 +1,226 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
// src/AdViewUnit/AdViewUnit.server.tsx
|
|
4
|
-
import
|
|
4
|
+
import React6 from "react";
|
|
5
5
|
import { adViewFetcher, getAdRequestUrl, getResolveConfig } from "@adview/core/utils";
|
|
6
6
|
|
|
7
|
-
// src/AdViewUnit/
|
|
7
|
+
// src/AdViewUnit/AdViewUnitBannerTemplate.tsx
|
|
8
|
+
import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from "@adview/core/utils";
|
|
8
9
|
import React from "react";
|
|
10
|
+
|
|
11
|
+
// src/AdViewUnit/utils.ts
|
|
12
|
+
var matchExpectedState = (expectState, state) => {
|
|
13
|
+
return !expectState || (expectState.isInitial === void 0 || expectState.isInitial === state?.isInitial) && (expectState.isLoading === void 0 || expectState.isLoading === state?.isLoading) && (expectState.isError === void 0 || expectState.isError === state?.isError) && (expectState.isComplete === void 0 || expectState.isComplete === state?.isComplete);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// src/AdViewUnit/AdViewUnitBannerTemplate.tsx
|
|
17
|
+
function AdViewUnitBannerTemplate({ className = "banner", style, data, state, ...props }) {
|
|
18
|
+
const expectState = props?.isInitial || props?.isLoading || props?.isError || props?.isComplete ? {
|
|
19
|
+
isInitial: props?.isInitial,
|
|
20
|
+
isLoading: props?.isLoading,
|
|
21
|
+
isError: props?.isError,
|
|
22
|
+
isComplete: props?.isComplete
|
|
23
|
+
} : { isComplete: true };
|
|
24
|
+
if (!data || !data.assets || !data.assets.length) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (!matchExpectedState(expectState, state)) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const asset = getAssetByName("main", data.assets);
|
|
31
|
+
return /* @__PURE__ */ React.createElement(
|
|
32
|
+
"a",
|
|
33
|
+
{
|
|
34
|
+
target: "_blank",
|
|
35
|
+
rel: "noopener noreferrer",
|
|
36
|
+
href: getPrepareURL(data.url),
|
|
37
|
+
className,
|
|
38
|
+
style: { fontSize: 0, ...style }
|
|
39
|
+
},
|
|
40
|
+
asset && /* @__PURE__ */ React.createElement(
|
|
41
|
+
"img",
|
|
42
|
+
{
|
|
43
|
+
alt: "main",
|
|
44
|
+
src: asset.path,
|
|
45
|
+
srcSet: asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : ""
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
AdViewUnitBannerTemplate.defaults = {
|
|
51
|
+
type: "banner"
|
|
52
|
+
};
|
|
53
|
+
var AdViewUnitBannerTemplate_default = AdViewUnitBannerTemplate;
|
|
54
|
+
|
|
55
|
+
// src/AdViewUnit/AdViewUnitNativeTemplate.tsx
|
|
56
|
+
import { getAssetByName as getAssetByName2, getPrepareURL as getPrepareURL2, getSrcSetCSSThumbs as getSrcSetCSSThumbs2 } from "@adview/core/utils";
|
|
57
|
+
import React2 from "react";
|
|
58
|
+
function AdViewUnitNativeTemplate({ classNames, data, state, ...props }) {
|
|
59
|
+
if (!data || !data.assets || !data.assets.length) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const expectState = props?.isInitial || props?.isLoading || props?.isError || props?.isComplete ? {
|
|
63
|
+
isInitial: props?.isInitial,
|
|
64
|
+
isLoading: props?.isLoading,
|
|
65
|
+
isError: props?.isError,
|
|
66
|
+
isComplete: props?.isComplete
|
|
67
|
+
} : { isComplete: true };
|
|
68
|
+
if (!matchExpectedState(expectState, state)) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const { assets, url, fields } = data;
|
|
72
|
+
const asset = getAssetByName2("main", assets);
|
|
73
|
+
if (!url) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
return /* @__PURE__ */ React2.createElement("div", { className: classNames?.container }, /* @__PURE__ */ React2.createElement(
|
|
77
|
+
"a",
|
|
78
|
+
{
|
|
79
|
+
target: "_blank",
|
|
80
|
+
rel: "noopener noreferrer",
|
|
81
|
+
href: getPrepareURL2(url),
|
|
82
|
+
className: classNames?.imageLink
|
|
83
|
+
},
|
|
84
|
+
asset && /* @__PURE__ */ React2.createElement(
|
|
85
|
+
"img",
|
|
86
|
+
{
|
|
87
|
+
alt: fields?.title,
|
|
88
|
+
title: fields?.title,
|
|
89
|
+
src: asset.path,
|
|
90
|
+
srcSet: asset.thumbs ? getSrcSetCSSThumbs2(asset.thumbs) : void 0,
|
|
91
|
+
className: classNames?.image,
|
|
92
|
+
style: { objectFit: "cover", width: "100%", height: "100%" }
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
), /* @__PURE__ */ React2.createElement("div", { className: classNames?.label }, fields?.title && /* @__PURE__ */ React2.createElement(
|
|
96
|
+
"a",
|
|
97
|
+
{
|
|
98
|
+
target: "_blank",
|
|
99
|
+
rel: "noopener noreferrer",
|
|
100
|
+
href: getPrepareURL2(url),
|
|
101
|
+
"data-class": "titleLink",
|
|
102
|
+
className: classNames?.titleLink
|
|
103
|
+
},
|
|
104
|
+
fields.title
|
|
105
|
+
), fields?.description && /* @__PURE__ */ React2.createElement(
|
|
106
|
+
"a",
|
|
107
|
+
{
|
|
108
|
+
target: "_blank",
|
|
109
|
+
rel: "noopener noreferrer",
|
|
110
|
+
href: getPrepareURL2(url),
|
|
111
|
+
"data-class": "descriptionLink",
|
|
112
|
+
className: classNames?.descriptionLink
|
|
113
|
+
},
|
|
114
|
+
fields.description
|
|
115
|
+
), fields?.brandname && /* @__PURE__ */ React2.createElement(
|
|
116
|
+
"a",
|
|
117
|
+
{
|
|
118
|
+
target: "_blank",
|
|
119
|
+
rel: "noopener noreferrer",
|
|
120
|
+
href: getPrepareURL2(url),
|
|
121
|
+
"data-class": "brandNameLink",
|
|
122
|
+
className: classNames?.brandNameLink
|
|
123
|
+
},
|
|
124
|
+
fields.brandname
|
|
125
|
+
), fields?.phone && /* @__PURE__ */ React2.createElement(
|
|
126
|
+
"a",
|
|
127
|
+
{
|
|
128
|
+
target: "_blank",
|
|
129
|
+
rel: "noopener noreferrer",
|
|
130
|
+
href: getPrepareURL2(url),
|
|
131
|
+
"data-class": "phoneLink",
|
|
132
|
+
className: classNames?.phoneLink
|
|
133
|
+
},
|
|
134
|
+
fields.phone
|
|
135
|
+
), fields?.url && /* @__PURE__ */ React2.createElement(
|
|
136
|
+
"a",
|
|
137
|
+
{
|
|
138
|
+
target: "_blank",
|
|
139
|
+
rel: "noopener noreferrer",
|
|
140
|
+
href: getPrepareURL2(url),
|
|
141
|
+
"data-class": "urlLink",
|
|
142
|
+
className: classNames?.urlLink
|
|
143
|
+
},
|
|
144
|
+
fields?.url
|
|
145
|
+
)));
|
|
146
|
+
}
|
|
147
|
+
AdViewUnitNativeTemplate.defaults = {
|
|
148
|
+
type: "native"
|
|
149
|
+
};
|
|
150
|
+
var AdViewUnitNativeTemplate_default = AdViewUnitNativeTemplate;
|
|
151
|
+
|
|
152
|
+
// src/AdViewUnit/AdViewUnitProxyTemplate.tsx
|
|
153
|
+
import React3 from "react";
|
|
154
|
+
function AdViewUnitProxyTemplate({ className, style, data, state, ...props }) {
|
|
155
|
+
if (!data) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
const expectState = props?.isInitial || props?.isLoading || props?.isError || props?.isComplete ? {
|
|
159
|
+
isInitial: props?.isInitial,
|
|
160
|
+
isLoading: props?.isLoading,
|
|
161
|
+
isError: props?.isError,
|
|
162
|
+
isComplete: props?.isComplete
|
|
163
|
+
} : { isComplete: true };
|
|
164
|
+
if (!matchExpectedState(expectState, state)) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
const { url, fields } = data;
|
|
168
|
+
const iframeSrc = fields?.url || url;
|
|
169
|
+
if (!iframeSrc) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
return /* @__PURE__ */ React3.createElement(
|
|
173
|
+
"iframe",
|
|
174
|
+
{
|
|
175
|
+
className,
|
|
176
|
+
width: "100%",
|
|
177
|
+
height: "100%",
|
|
178
|
+
frameBorder: "0",
|
|
179
|
+
marginWidth: 0,
|
|
180
|
+
marginHeight: 0,
|
|
181
|
+
allowTransparency: true,
|
|
182
|
+
scrolling: "no",
|
|
183
|
+
allowFullScreen: true,
|
|
184
|
+
style: { width: "100%", height: "100%", border: "none", ...style },
|
|
185
|
+
src: iframeSrc
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
AdViewUnitProxyTemplate.defaults = {
|
|
190
|
+
type: "proxy"
|
|
191
|
+
};
|
|
192
|
+
var AdViewUnitProxyTemplate_default = AdViewUnitProxyTemplate;
|
|
193
|
+
|
|
194
|
+
// src/AdViewUnit/AdViewUnitTemplate.tsx
|
|
195
|
+
import React4 from "react";
|
|
9
196
|
var templateFromListRender = (tmpls, data, wrap) => {
|
|
10
197
|
let renderedRemplates = tmpls.map((tmpl, index) => {
|
|
11
198
|
let tmp = renderTemplate(tmpl, data);
|
|
12
|
-
return !!tmp &&
|
|
199
|
+
return !!tmp && React4.isValidElement(tmp) ? /* @__PURE__ */ React4.createElement(React4.Fragment, { key: index }, !!wrap ? wrap(tmp) : tmp) : null;
|
|
13
200
|
}).filter((it) => !!it);
|
|
14
201
|
if (!renderedRemplates.length) {
|
|
15
202
|
renderedRemplates = tmpls.map((tmpl, index) => {
|
|
16
203
|
let tmp = renderTemplate(tmpl, { ...data, type: "default" });
|
|
17
|
-
return !!tmp &&
|
|
204
|
+
return !!tmp && React4.isValidElement(tmp) ? /* @__PURE__ */ React4.createElement(React4.Fragment, { key: index }, !!wrap ? wrap(tmp) : tmp) : null;
|
|
18
205
|
}).filter((it) => !!it);
|
|
19
206
|
}
|
|
20
|
-
return /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, renderedRemplates);
|
|
21
208
|
};
|
|
22
209
|
var renderTemplate = (tmpl, data) => {
|
|
23
210
|
const isFunction = typeof tmpl === "function";
|
|
24
|
-
const isReactElement =
|
|
211
|
+
const isReactElement = React4.isValidElement(tmpl);
|
|
25
212
|
if (isReactElement) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
213
|
+
let { type, children } = tmpl.props;
|
|
214
|
+
if (!type && typeof tmpl.type !== "string") {
|
|
215
|
+
type = tmpl.type?.defaults?.type;
|
|
216
|
+
}
|
|
217
|
+
if (!!type && type !== "*" && data.type !== type) {
|
|
29
218
|
return null;
|
|
30
219
|
}
|
|
31
220
|
if (typeof children === "function") {
|
|
32
221
|
return children(data);
|
|
33
222
|
}
|
|
34
|
-
|
|
35
|
-
return React.cloneElement(tmpl, {
|
|
223
|
+
return React4.cloneElement(tmpl, {
|
|
36
224
|
...data,
|
|
37
225
|
children
|
|
38
226
|
});
|
|
@@ -55,29 +243,39 @@ var renderAnyTemplates = (tmpls, data, listRender) => {
|
|
|
55
243
|
if (typeof tmpls === "function") {
|
|
56
244
|
return tmpls(data);
|
|
57
245
|
}
|
|
58
|
-
if (
|
|
246
|
+
if (React4.isValidElement(tmpls)) {
|
|
59
247
|
return templateFromListRender([tmpls], data);
|
|
60
248
|
}
|
|
61
249
|
return null;
|
|
62
250
|
};
|
|
63
|
-
var AdViewUnitTemplate = ({ type, children, ...
|
|
251
|
+
var AdViewUnitTemplate = ({ type, state, children, ...props }) => {
|
|
64
252
|
const tmplProps = {
|
|
65
253
|
type,
|
|
66
|
-
|
|
254
|
+
state,
|
|
255
|
+
...props
|
|
67
256
|
};
|
|
257
|
+
const expectState = props?.isInitial || props?.isLoading || props?.isError || props?.isComplete ? {
|
|
258
|
+
isInitial: props?.isInitial,
|
|
259
|
+
isLoading: props?.isLoading,
|
|
260
|
+
isError: props?.isError,
|
|
261
|
+
isComplete: props?.isComplete
|
|
262
|
+
} : { isComplete: true };
|
|
263
|
+
if (!matchExpectedState(expectState, state)) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
68
266
|
if (typeof children === "function") {
|
|
69
267
|
return children(tmplProps);
|
|
70
268
|
}
|
|
71
|
-
if (
|
|
72
|
-
return
|
|
269
|
+
if (React4.isValidElement(children)) {
|
|
270
|
+
return React4.cloneElement(children, tmplProps);
|
|
73
271
|
}
|
|
74
|
-
return /* @__PURE__ */
|
|
272
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null);
|
|
75
273
|
};
|
|
76
274
|
var AdViewUnitTemplate_default = AdViewUnitTemplate;
|
|
77
275
|
|
|
78
276
|
// src/AdViewUnit/AdViewUnitTracking.tsx
|
|
79
277
|
import { executeImpressionsTracking } from "@adview/core/utils";
|
|
80
|
-
import
|
|
278
|
+
import React5, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
81
279
|
function AdViewUnitTracking({
|
|
82
280
|
impressions,
|
|
83
281
|
views,
|
|
@@ -126,7 +324,7 @@ function AdViewUnitTracking({
|
|
|
126
324
|
executeImpressionsTrackingHandler,
|
|
127
325
|
clickTrackerHandler
|
|
128
326
|
]);
|
|
129
|
-
return /* @__PURE__ */
|
|
327
|
+
return /* @__PURE__ */ React5.createElement("div", { ref: wrapperRef }, children);
|
|
130
328
|
}
|
|
131
329
|
var AdViewUnitTracking_default = AdViewUnitTracking;
|
|
132
330
|
|
|
@@ -137,190 +335,73 @@ async function AdViewUnitServer({
|
|
|
137
335
|
children,
|
|
138
336
|
...config
|
|
139
337
|
}) {
|
|
338
|
+
const checkFormat = (f) => {
|
|
339
|
+
if (!format) {
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
return Array.isArray(format) ? format.includes(f) : f === format;
|
|
343
|
+
};
|
|
140
344
|
const baseConfig = getResolveConfig(config);
|
|
141
345
|
const requestUrl = getAdRequestUrl(baseConfig, unitId, format);
|
|
142
346
|
const response = await adViewFetcher(requestUrl);
|
|
143
347
|
const isLoadingError = response instanceof Error;
|
|
144
348
|
const error = isLoadingError ? response : void 0;
|
|
145
|
-
const
|
|
146
|
-
const customTracker = responseGroup?.custom_tracker ?? {};
|
|
147
|
-
const groupItems = responseGroup?.items;
|
|
148
|
-
if (groupItems && groupItems.length) {
|
|
149
|
-
return groupItems.map(({ tracker, ...data }) => {
|
|
150
|
-
return /* @__PURE__ */ React3.createElement(AdViewUnitTracking_default, { key: data.id, ...tracker }, renderAnyTemplates(children, { data, type: data.type || "default", error, state: {
|
|
151
|
-
isLoading: true,
|
|
152
|
-
isComplete: true,
|
|
153
|
-
isInitial: false,
|
|
154
|
-
isError: isLoadingError
|
|
155
|
-
} }));
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
return /* @__PURE__ */ React3.createElement(AdViewUnitTracking_default, { ...customTracker }, renderAnyTemplates(children, { data: null, type: "default", error, state: {
|
|
349
|
+
const state = {
|
|
159
350
|
isLoading: true,
|
|
160
351
|
isComplete: true,
|
|
161
352
|
isInitial: false,
|
|
162
353
|
isError: isLoadingError
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
function AdViewUnitBannerTemplate({ className = "banner", style, data, state }) {
|
|
171
|
-
if (!data || !data.assets || !data.assets.length || !state?.isComplete) {
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
const asset = getAssetByName("main", data.assets);
|
|
175
|
-
return /* @__PURE__ */ React4.createElement(
|
|
176
|
-
"a",
|
|
177
|
-
{
|
|
178
|
-
target: "_blank",
|
|
179
|
-
rel: "noopener noreferrer",
|
|
180
|
-
href: getPrepareURL(data.url),
|
|
181
|
-
className,
|
|
182
|
-
style: { fontSize: 0, ...style }
|
|
183
|
-
},
|
|
184
|
-
asset && /* @__PURE__ */ React4.createElement(
|
|
185
|
-
"img",
|
|
186
|
-
{
|
|
187
|
-
alt: "main",
|
|
188
|
-
src: asset.path,
|
|
189
|
-
srcSet: asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : ""
|
|
354
|
+
};
|
|
355
|
+
const { responseGroup: _, customTracker, groupItems } = error ? { responseGroup: null, customTracker: {}, groupItems: [] } : (() => {
|
|
356
|
+
for (let responseGroup of response?.groups || []) {
|
|
357
|
+
const customTracker2 = responseGroup?.custom_tracker ?? {};
|
|
358
|
+
const groupItems2 = (responseGroup?.items || []).map((it) => checkFormat(it.type) ? it : null).filter(Boolean);
|
|
359
|
+
if (groupItems2 && groupItems2.length > 0) {
|
|
360
|
+
return { responseGroup, customTracker: customTracker2, groupItems: groupItems2 };
|
|
190
361
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, children({ data, state, ...props }));
|
|
201
|
-
}
|
|
202
|
-
return children ? /* @__PURE__ */ React5.createElement(React5.Fragment, null, children) : /* @__PURE__ */ React5.createElement("div", { style: { padding: "1rem", textAlign: "center", color: "#666" } }, /* @__PURE__ */ React5.createElement("p", null, "\u{1F504} Default content for ad unit"), /* @__PURE__ */ React5.createElement("p", null, "Data: ", JSON.stringify(data)), /* @__PURE__ */ React5.createElement("p", null, "State: ", JSON.stringify(state)));
|
|
203
|
-
}
|
|
204
|
-
AdViewUnitDefaultTemplate.defaultProps = {
|
|
205
|
-
type: "default",
|
|
206
|
-
children: null
|
|
207
|
-
};
|
|
208
|
-
var AdViewUnitDefaultTemplate_default = AdViewUnitDefaultTemplate;
|
|
209
|
-
|
|
210
|
-
// src/AdViewUnit/AdViewUnitNativeTemplate.tsx
|
|
211
|
-
import { getAssetByName as getAssetByName2, getPrepareURL as getPrepareURL2, getSrcSetCSSThumbs as getSrcSetCSSThumbs2 } from "@adview/core/utils";
|
|
212
|
-
import React6 from "react";
|
|
213
|
-
function AdViewUnitNativeTemplate({ classNames, data, state }) {
|
|
214
|
-
if (!data || !data.assets || !data.assets.length || !state?.isComplete) {
|
|
215
|
-
return null;
|
|
362
|
+
}
|
|
363
|
+
return { responseGroup: null, customTracker: {}, groupItems: [] };
|
|
364
|
+
})();
|
|
365
|
+
if (!children) {
|
|
366
|
+
children = [
|
|
367
|
+
/* @__PURE__ */ React6.createElement(AdViewUnitBannerTemplate_default, null),
|
|
368
|
+
/* @__PURE__ */ React6.createElement(AdViewUnitNativeTemplate_default, null),
|
|
369
|
+
/* @__PURE__ */ React6.createElement(AdViewUnitProxyTemplate_default, null)
|
|
370
|
+
];
|
|
216
371
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
372
|
+
if (groupItems && groupItems.length) {
|
|
373
|
+
return groupItems.map(({ tracker, ...data }) => {
|
|
374
|
+
return /* @__PURE__ */ React6.createElement(AdViewUnitTracking_default, { key: data.id, ...tracker }, renderAnyTemplates(children, { data, type: data.type || "default", error, state }));
|
|
375
|
+
});
|
|
221
376
|
}
|
|
222
|
-
return /* @__PURE__ */ React6.createElement(
|
|
223
|
-
"a",
|
|
224
|
-
{
|
|
225
|
-
target: "_blank",
|
|
226
|
-
rel: "noopener noreferrer",
|
|
227
|
-
href: getPrepareURL2(url),
|
|
228
|
-
className: classNames?.imageLink
|
|
229
|
-
},
|
|
230
|
-
asset && /* @__PURE__ */ React6.createElement(
|
|
231
|
-
"img",
|
|
232
|
-
{
|
|
233
|
-
alt: fields?.title,
|
|
234
|
-
title: fields?.title,
|
|
235
|
-
src: asset.path,
|
|
236
|
-
srcSet: asset.thumbs ? getSrcSetCSSThumbs2(asset.thumbs) : void 0,
|
|
237
|
-
className: classNames?.image,
|
|
238
|
-
style: { objectFit: "cover", width: "100%", height: "100%" }
|
|
239
|
-
}
|
|
240
|
-
)
|
|
241
|
-
), /* @__PURE__ */ React6.createElement("div", { className: classNames?.label }, fields?.title && /* @__PURE__ */ React6.createElement(
|
|
242
|
-
"a",
|
|
243
|
-
{
|
|
244
|
-
target: "_blank",
|
|
245
|
-
rel: "noopener noreferrer",
|
|
246
|
-
href: getPrepareURL2(url),
|
|
247
|
-
"data-class": "titleLink",
|
|
248
|
-
className: classNames?.titleLink
|
|
249
|
-
},
|
|
250
|
-
fields.title
|
|
251
|
-
), fields?.description && /* @__PURE__ */ React6.createElement(
|
|
252
|
-
"a",
|
|
253
|
-
{
|
|
254
|
-
target: "_blank",
|
|
255
|
-
rel: "noopener noreferrer",
|
|
256
|
-
href: getPrepareURL2(url),
|
|
257
|
-
"data-class": "descriptionLink",
|
|
258
|
-
className: classNames?.descriptionLink
|
|
259
|
-
},
|
|
260
|
-
fields.description
|
|
261
|
-
), fields?.brandname && /* @__PURE__ */ React6.createElement(
|
|
262
|
-
"a",
|
|
263
|
-
{
|
|
264
|
-
target: "_blank",
|
|
265
|
-
rel: "noopener noreferrer",
|
|
266
|
-
href: getPrepareURL2(url),
|
|
267
|
-
"data-class": "brandNameLink",
|
|
268
|
-
className: classNames?.brandNameLink
|
|
269
|
-
},
|
|
270
|
-
fields.brandname
|
|
271
|
-
), fields?.phone && /* @__PURE__ */ React6.createElement(
|
|
272
|
-
"a",
|
|
273
|
-
{
|
|
274
|
-
target: "_blank",
|
|
275
|
-
rel: "noopener noreferrer",
|
|
276
|
-
href: getPrepareURL2(url),
|
|
277
|
-
"data-class": "phoneLink",
|
|
278
|
-
className: classNames?.phoneLink
|
|
279
|
-
},
|
|
280
|
-
fields.phone
|
|
281
|
-
), fields?.url && /* @__PURE__ */ React6.createElement(
|
|
282
|
-
"a",
|
|
283
|
-
{
|
|
284
|
-
target: "_blank",
|
|
285
|
-
rel: "noopener noreferrer",
|
|
286
|
-
href: getPrepareURL2(url),
|
|
287
|
-
"data-class": "urlLink",
|
|
288
|
-
className: classNames?.urlLink
|
|
289
|
-
},
|
|
290
|
-
fields?.url
|
|
291
|
-
)));
|
|
377
|
+
return /* @__PURE__ */ React6.createElement(AdViewUnitTracking_default, { ...customTracker }, renderAnyTemplates(children, { data: null, type: "default", error, state }));
|
|
292
378
|
}
|
|
293
|
-
var
|
|
379
|
+
var AdViewUnit_server_default = AdViewUnitServer;
|
|
294
380
|
|
|
295
|
-
// src/AdViewUnit/
|
|
381
|
+
// src/AdViewUnit/AdViewUnitDefaultTemplate.tsx
|
|
296
382
|
import React7 from "react";
|
|
297
|
-
function
|
|
298
|
-
if (
|
|
383
|
+
function AdViewUnitDefaultTemplate({ type = "default", data, state, children, ...props }) {
|
|
384
|
+
if (data) {
|
|
299
385
|
return null;
|
|
300
386
|
}
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
387
|
+
const expectState = props?.isInitial || props?.isLoading || props?.isError || props?.isComplete ? {
|
|
388
|
+
isInitial: props?.isInitial,
|
|
389
|
+
isLoading: props?.isLoading,
|
|
390
|
+
isError: props?.isError,
|
|
391
|
+
isComplete: props?.isComplete
|
|
392
|
+
} : { isComplete: true };
|
|
393
|
+
if (!matchExpectedState(expectState, state)) {
|
|
304
394
|
return null;
|
|
305
395
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
width: "100%",
|
|
311
|
-
height: "100%",
|
|
312
|
-
frameBorder: "0",
|
|
313
|
-
marginWidth: 0,
|
|
314
|
-
marginHeight: 0,
|
|
315
|
-
allowTransparency: true,
|
|
316
|
-
scrolling: "no",
|
|
317
|
-
allowFullScreen: true,
|
|
318
|
-
style: { width: "100%", height: "100%", border: "none", ...style },
|
|
319
|
-
src: iframeSrc
|
|
320
|
-
}
|
|
321
|
-
);
|
|
396
|
+
if (typeof children === "function") {
|
|
397
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, children({ data, state, ...props }));
|
|
398
|
+
}
|
|
399
|
+
return children ? /* @__PURE__ */ React7.createElement(React7.Fragment, null, children) : /* @__PURE__ */ React7.createElement("div", { style: { padding: "1rem", textAlign: "center", color: "#666" } }, /* @__PURE__ */ React7.createElement("p", null, "\u{1F504} Default content for ad unit"), /* @__PURE__ */ React7.createElement("p", null, "Data: ", JSON.stringify(data)), /* @__PURE__ */ React7.createElement("p", null, "State: ", JSON.stringify(state)));
|
|
322
400
|
}
|
|
323
|
-
|
|
401
|
+
AdViewUnitDefaultTemplate.defaults = {
|
|
402
|
+
type: "default"
|
|
403
|
+
};
|
|
404
|
+
var AdViewUnitDefaultTemplate_default = AdViewUnitDefaultTemplate;
|
|
324
405
|
export {
|
|
325
406
|
AdViewUnitBannerTemplate_default as AdViewUnitBannerTemplate,
|
|
326
407
|
AdViewUnitDefaultTemplate_default as AdViewUnitDefaultTemplate,
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AdViewUnit/AdViewUnit.server.tsx","../src/AdViewUnit/AdViewUnitTemplate.tsx","../src/AdViewUnit/AdViewUnitTracking.tsx","../src/AdViewUnit/AdViewUnitBannerTemplate.tsx","../src/AdViewUnit/AdViewUnitDefaultTemplate.tsx","../src/AdViewUnit/AdViewUnitNativeTemplate.tsx","../src/AdViewUnit/AdViewUnitProxyTemplate.tsx"],"sourcesContent":["import React from 'react';\n\nimport { AdViewGroupItem } from '@adview/core/typings';\nimport { adViewFetcher, getAdRequestUrl, getResolveConfig } from '@adview/core/utils';\nimport { AdViewUnitPropsBase, AdViewUnitServerChildren } from '../types';\nimport { renderAnyTemplates } from './AdViewUnitTemplate';\nimport AdViewUnitTracking from './AdViewUnitTracking';\n\nexport type AdViewUnitServerProps = AdViewUnitPropsBase & {\n children?: AdViewUnitServerChildren;\n};\n\nasync function AdViewUnitServer({\n unitId,\n format,\n children,\n ...config\n}: AdViewUnitServerProps) {\n const baseConfig = getResolveConfig(config);\n const requestUrl = getAdRequestUrl(baseConfig, unitId, format);\n const response = await adViewFetcher(requestUrl);\n const isLoadingError = response instanceof Error;\n const error = isLoadingError ? response : undefined;\n const responseGroup =\n response instanceof 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 }: AdViewGroupItem) => {\n return (\n <AdViewUnitTracking key={data.id} {...tracker}>\n {renderAnyTemplates(children, {data, type: data.type || 'default', error, state: {\n isLoading: true,\n isComplete: true,\n isInitial: false,\n isError: isLoadingError,\n }})}\n </AdViewUnitTracking>\n );\n });\n }\n\n return (\n <AdViewUnitTracking {...customTracker}>\n {renderAnyTemplates(children, {data: null, type: 'default', error, state: {\n isLoading: true,\n isComplete: true,\n isInitial: false,\n isError: isLoadingError,\n }})}\n </AdViewUnitTracking>\n );\n}\n\nexport default AdViewUnitServer;\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","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdViewUnitTemplateTypeProps } from '../types';\n\ntype AdViewUnitBannerTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'banner';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitBannerTemplate({className=\"banner\", style, data, state}: AdViewUnitBannerTemplateProps) {\n if (!data || !data.assets || !data.assets.length || !state?.isComplete) {\n return null;\n }\n const asset = getAssetByName('main', data.assets);\n\n return (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(data.url)}\n className={className}\n style={{ fontSize: 0, ...style }}\n >\n {asset && (\n <img\n alt=\"main\"\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : ''}\n />\n )}\n </a>\n );\n}\n\nexport default AdViewUnitBannerTemplate;\n","import React from \"react\";\nimport { AdViewOptionalDataProps, AdViewUnitTemplateTypeProps } from \"../types\";\n\ntype AdViewUnitDefaultTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'default';\n children?: React.ReactNode | ((props: AdViewOptionalDataProps) => React.ReactNode);\n};\n\nfunction AdViewUnitDefaultTemplate({ type='default', data, state, children, ...props }: AdViewUnitDefaultTemplateProps) {\n if (typeof children === 'function') {\n return <>{children({ data, state, ...props })}</>;\n }\n\n return (\n children ? <>{children}</> : (\n <div style={{ padding: '1rem', textAlign: 'center', color: '#666' }}>\n <p>🔄 Default content for ad unit</p>\n <p>Data: {JSON.stringify(data)}</p>\n <p>State: {JSON.stringify(state)}</p>\n </div>\n )\n );\n}\n\nAdViewUnitDefaultTemplate.defaultProps = {\n type: 'default',\n children: null,\n};\n\nexport default AdViewUnitDefaultTemplate;\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdViewStyleTokensNative, AdViewUnitTemplateTypeProps } from '../types';\n\ntype AdViewUnitNativeTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'native';\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitNativeTemplate({classNames, data, state}: AdViewUnitNativeTemplateProps) {\n if (!data || !data.assets || !data.assets.length || !state?.isComplete) {\n return null;\n }\n const { assets, url, fields } = data;\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 AdViewUnitNativeTemplate;\n","import React from 'react';\nimport { AdViewUnitTemplateTypeProps } from '../types';\n\ntype AdViewUnitProxyTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'proxy';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitProxyTemplate({className, style, data, state}: AdViewUnitProxyTemplateProps) {\n if (!data || !state?.isComplete) {\n return null;\n }\n const { url, fields } = data;\n const iframeSrc = fields?.url || url;\n\n if (!iframeSrc) {\n return null;\n }\n\n return (\n <iframe\n className={className}\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%', border: 'none', ...style }}\n src={iframeSrc}\n ></iframe>\n );\n}\n\nexport default AdViewUnitProxyTemplate;\n"],"mappings":";AAAA,OAAOA,YAAW;AAGlB,SAAS,eAAe,iBAAiB,wBAAwB;;;ACMjE,OAAO,WAAoB;AAcpB,IAAM,yBAAyB,CAAC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WAAW,YAAY;AAAA;AAAA,IAEtB,QAAQ;AAAA,EACX,CAEJ,CACF;AAEJ;AAEA,IAAO,mCAAQ;;;ACpGf,OAAOG,YAAW;AASlB,SAAS,wBAAwB,EAAC,WAAW,OAAO,MAAM,MAAK,GAAiC;AAC9F,MAAI,CAAC,QAAQ,CAAC,OAAO,YAAY;AAC/B,WAAO;AAAA,EACT;AACA,QAAM,EAAE,KAAK,OAAO,IAAI;AACxB,QAAM,YAAY,QAAQ,OAAO;AAEjC,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,SACE,gBAAAA,OAAA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAM;AAAA,MACN,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,aAAa;AAAA,MACb,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB,WAAU;AAAA,MACV,iBAAiB;AAAA,MACjB,OAAO,EAAE,OAAO,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,GAAG,MAAM;AAAA,MACjE,KAAK;AAAA;AAAA,EACN;AAEL;AAEA,IAAO,kCAAQ;","names":["React","React","React","React","React","getAssetByName","getPrepareURL","getSrcSetCSSThumbs","React","React"]}
|
|
1
|
+
{"version":3,"sources":["../src/AdViewUnit/AdViewUnit.server.tsx","../src/AdViewUnit/AdViewUnitBannerTemplate.tsx","../src/AdViewUnit/utils.ts","../src/AdViewUnit/AdViewUnitNativeTemplate.tsx","../src/AdViewUnit/AdViewUnitProxyTemplate.tsx","../src/AdViewUnit/AdViewUnitTemplate.tsx","../src/AdViewUnit/AdViewUnitTracking.tsx","../src/AdViewUnit/AdViewUnitDefaultTemplate.tsx"],"sourcesContent":["import React from 'react';\n\nimport { AdViewData } from '@adview/core';\nimport { AdViewGroupItem } from '@adview/core/typings';\nimport { adViewFetcher, getAdRequestUrl, getResolveConfig } from '@adview/core/utils';\nimport { AdViewUnitClientChildren, AdViewUnitPropsBase } from '../types';\nimport AdViewUnitBannerTemplate from './AdViewUnitBannerTemplate';\nimport AdViewUnitNativeTemplate from './AdViewUnitNativeTemplate';\nimport AdViewUnitProxyTemplate from './AdViewUnitProxyTemplate';\nimport { renderAnyTemplates } from './AdViewUnitTemplate';\nimport AdViewUnitTracking from './AdViewUnitTracking';\n\nexport type AdViewUnitServerProps = AdViewUnitPropsBase & {\n children?: AdViewUnitClientChildren;\n};\n\nasync function AdViewUnitServer({\n unitId,\n format,\n children,\n ...config\n}: AdViewUnitServerProps) {\n const checkFormat = (f: string) => {\n if (!format) { return true; }\n return Array.isArray(format) ? format.includes(f) : f === format;\n };\n\n const baseConfig = getResolveConfig(config);\n const requestUrl = getAdRequestUrl(baseConfig, unitId, format);\n const response = await adViewFetcher(requestUrl);\n const isLoadingError = response instanceof Error;\n const error = isLoadingError ? response : undefined;\n const state = {\n isLoading: true,\n isComplete: true,\n isInitial: false,\n isError: isLoadingError,\n };\n\n const { responseGroup: _, customTracker, groupItems } = error ? {responseGroup: null, customTracker: {}, groupItems: []} : (() => {\n for (let responseGroup of (response as AdViewData)?.groups || []) {\n const customTracker = responseGroup?.custom_tracker ?? {};\n const groupItems = (responseGroup?.items || []).map(it => checkFormat(it.type) ? it : null).\n filter(Boolean) as AdViewGroupItem[];\n if (groupItems && groupItems.length > 0) {\n return {responseGroup, customTracker, groupItems};\n }\n }\n return {responseGroup: null, customTracker: {}, groupItems: []};\n })();\n \n if (!children) {\n children = [\n <AdViewUnitBannerTemplate />,\n <AdViewUnitNativeTemplate />,\n <AdViewUnitProxyTemplate />\n ];\n }\n\n if (groupItems && groupItems.length) {\n return groupItems.map(({ tracker, ...data }: AdViewGroupItem) => {\n return (\n <AdViewUnitTracking key={data.id} {...tracker}>\n {renderAnyTemplates(children, {data, type: data.type || 'default', error, state: state})}\n </AdViewUnitTracking>\n );\n });\n }\n\n return (\n <AdViewUnitTracking {...customTracker}>\n {renderAnyTemplates(children, {data: null, type: 'default', error, state: state})}\n </AdViewUnitTracking>\n );\n}\n\nexport default AdViewUnitServer;\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdLoadState, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitBannerTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'banner';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitBannerTemplate({className=\"banner\", style, data, state, ...props}: AdViewUnitBannerTemplateProps) {\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n if (!data || !data.assets || !data.assets.length) {\n return null;\n }\n \n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const asset = getAssetByName('main', data.assets);\n\n return (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(data.url)}\n className={className}\n style={{ fontSize: 0, ...style }}\n >\n {asset && (\n <img\n alt=\"main\"\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : ''}\n />\n )}\n </a>\n );\n}\n\nAdViewUnitBannerTemplate.defaults = {\n type: 'banner',\n};\n\nexport default AdViewUnitBannerTemplate;\n","import { AdLoadState } from \"../types\";\n\nexport const matchExpectedState = (expectState?: AdLoadState, state?: AdLoadState) => {\n return !expectState || (\n (expectState.isInitial === undefined || expectState.isInitial === state?.isInitial) &&\n (expectState.isLoading === undefined || expectState.isLoading === state?.isLoading) &&\n (expectState.isError === undefined || expectState.isError === state?.isError) &&\n (expectState.isComplete === undefined || expectState.isComplete === state?.isComplete)\n );\n};\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdLoadState, AdViewStyleTokensNative, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitNativeTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'native';\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitNativeTemplate({classNames, data, state, ...props}: AdViewUnitNativeTemplateProps) {\n if (!data || !data.assets || !data.assets.length) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const { assets, url, fields } = data;\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\nAdViewUnitNativeTemplate.defaults = {\n type: 'native',\n};\n\nexport default AdViewUnitNativeTemplate;\n","import React from 'react';\nimport { AdLoadState, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitProxyTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'proxy';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitProxyTemplate({className, style, data, state, ...props}: AdViewUnitProxyTemplateProps) {\n if (!data) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const { url, fields } = data;\n const iframeSrc = fields?.url || url;\n\n if (!iframeSrc) {\n return null;\n }\n\n return (\n <iframe\n className={className}\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%', border: 'none', ...style }}\n src={iframeSrc}\n ></iframe>\n );\n}\n\nAdViewUnitProxyTemplate.defaults = {\n type: 'proxy',\n};\n\nexport default AdViewUnitProxyTemplate;\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 { AdLoadState, AdViewUnitClientChildrenProps, AdViewUnitTemplateProps, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\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 let { type, children } = tmpl.props;\n if (!type && typeof tmpl.type !== 'string') {\n type = (tmpl.type as any)?.defaults?.type;\n }\n // If the type does not match, return null\n if (!!type && type !== '*' && 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 // 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, state, children, ...props }: AdViewUnitTemplateProps) => {\n const tmplProps: AdViewUnitTemplateTypeProps = {\n type,\n state,\n ...props,\n };\n \n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\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","import React from \"react\";\nimport { AdLoadState, AdViewOptionalDataProps, AdViewUnitTemplateTypeProps } from \"../types\";\nimport { matchExpectedState } from \"./utils\";\n\ntype AdViewUnitDefaultTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'default';\n children?: React.ReactNode | ((props: AdViewOptionalDataProps) => React.ReactNode);\n};\n\nfunction AdViewUnitDefaultTemplate({ type='default', data, state, children, ...props }: AdViewUnitDefaultTemplateProps) {\n if (data) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n if (typeof children === 'function') {\n return <>{children({ data, state, ...props })}</>;\n }\n\n return (\n children ? <>{children}</> : (\n <div style={{ padding: '1rem', textAlign: 'center', color: '#666' }}>\n <p>🔄 Default content for ad unit</p>\n <p>Data: {JSON.stringify(data)}</p>\n <p>State: {JSON.stringify(state)}</p>\n </div>\n )\n );\n}\n\nAdViewUnitDefaultTemplate.defaults = {\n type: 'default',\n};\n\nexport default AdViewUnitDefaultTemplate;\n"],"mappings":";AAAA,OAAOA,YAAW;AAIlB,SAAS,eAAe,iBAAiB,wBAAwB;;;ACJjE,SAAS,gBAAgB,eAAe,0BAA0B;AAClE,OAAO,WAAW;;;ACCX,IAAM,qBAAqB,CAAC,aAA2B,UAAwB;AACpF,SAAO,CAAC,gBACL,YAAY,cAAc,UAAa,YAAY,cAAc,OAAO,eACxE,YAAY,cAAc,UAAa,YAAY,cAAc,OAAO,eACxE,YAAY,YAAY,UAAa,YAAY,YAAY,OAAO,aACpE,YAAY,eAAe,UAAa,YAAY,eAAe,OAAO;AAE/E;;;ADEA,SAAS,yBAAyB,EAAC,YAAU,UAAU,OAAO,MAAM,OAAO,GAAG,MAAK,GAAkC;AACnH,QAAM,cACH,OAAO,aAAa,OAAO,aAAa,OAAO,WAAW,OAAO,aAAc;AAAA,IAC9E,WAAW,OAAO;AAAA,IAClB,WAAW,OAAO;AAAA,IAClB,SAAS,OAAO;AAAA,IAChB,YAAY,OAAO;AAAA,EACrB,IAA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AA,OAAA,cAAC,WAAE,UAAO,KAAK,UAAU,IAAI,CAAE,GAC/B,gBAAAA,OAAA,cAAC,WAAE,WAAQ,KAAK,UAAU,KAAK,CAAE,CACnC;AAGN;AAEA,0BAA0B,WAAW;AAAA,EACnC,MAAM;AACR;AAEA,IAAO,oCAAQ;","names":["React","getAssetByName","getPrepareURL","getSrcSetCSSThumbs","React","getAssetByName","React","getPrepareURL","getSrcSetCSSThumbs","React","React","React","React","React","customTracker","groupItems","React","React","React"]}
|