@adview/react 1.0.13 → 1.0.15
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 +273 -243
- package/dist/AdViewUnit/AdViewUnit.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnit.client.cjs +234 -198
- 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 +226 -190
- 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 +261 -231
- package/dist/AdViewUnit/AdViewUnit.js.map +1 -1
- package/dist/AdViewUnit/AdViewUnit.server.cjs +229 -157
- package/dist/AdViewUnit/AdViewUnit.server.cjs.map +1 -1
- package/dist/AdViewUnit/AdViewUnit.server.d.cts +3 -3
- package/dist/AdViewUnit/AdViewUnit.server.d.ts +3 -3
- package/dist/AdViewUnit/AdViewUnit.server.js +227 -155
- package/dist/AdViewUnit/AdViewUnit.server.js.map +1 -1
- package/dist/AdViewUnit/{AdViewUnitBanner.cjs → AdViewUnitBannerTemplate.cjs} +36 -14
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.cjs.map +1 -0
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.d.cts +17 -0
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.d.ts +17 -0
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.js +51 -0
- package/dist/AdViewUnit/AdViewUnitBannerTemplate.js.map +1 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.cjs +66 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.cjs.map +1 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.d.cts +16 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.d.ts +16 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.js +35 -0
- package/dist/AdViewUnit/AdViewUnitDefaultTemplate.js.map +1 -0
- package/dist/AdViewUnit/{AdViewUnitNative.cjs → AdViewUnitNativeTemplate.cjs} +31 -13
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.cjs.map +1 -0
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.d.cts +16 -0
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.d.ts +16 -0
- package/dist/AdViewUnit/{AdViewUnitNative.js → AdViewUnitNativeTemplate.js} +28 -10
- package/dist/AdViewUnit/AdViewUnitNativeTemplate.js.map +1 -0
- package/dist/AdViewUnit/{AdViewUnitProxy.cjs → AdViewUnitProxyTemplate.cjs} +33 -13
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.cjs.map +1 -0
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.d.cts +17 -0
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.d.ts +17 -0
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.js +52 -0
- package/dist/AdViewUnit/AdViewUnitProxyTemplate.js.map +1 -0
- package/dist/AdViewUnit/AdViewUnitTemplate.cjs +132 -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 +95 -0
- package/dist/AdViewUnit/AdViewUnitTemplate.js.map +1 -1
- package/dist/AdViewUnit/useAdViewController.cjs +5 -3
- 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 -3
- 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 +305 -204
- 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 +286 -193
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +302 -167
- 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 +288 -160
- package/dist/server.js.map +1 -1
- package/dist/{types-BaV07oMT.d.cts → types-DHjNgnRW.d.cts} +35 -43
- package/dist/{types-BaV07oMT.d.ts → types-DHjNgnRW.d.ts} +35 -43
- 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
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/AdViewUnit/AdViewUnitWrapper.server.tsx
|
|
31
|
-
var AdViewUnitWrapper_server_exports = {};
|
|
32
|
-
__export(AdViewUnitWrapper_server_exports, {
|
|
33
|
-
default: () => AdViewUnitWrapper_server_default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(AdViewUnitWrapper_server_exports);
|
|
36
|
-
var import_react5 = __toESM(require("react"), 1);
|
|
37
|
-
|
|
38
|
-
// src/AdViewUnit/AdViewUnitNative.tsx
|
|
39
|
-
var import_utils = require("@adview/core/utils");
|
|
40
|
-
var import_react = __toESM(require("react"), 1);
|
|
41
|
-
function AdViewUnitNative({
|
|
42
|
-
assets,
|
|
43
|
-
fields,
|
|
44
|
-
url,
|
|
45
|
-
classNames
|
|
46
|
-
}) {
|
|
47
|
-
const asset = (0, import_utils.getAssetByName)("main", assets);
|
|
48
|
-
if (!url) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: classNames?.container }, /* @__PURE__ */ import_react.default.createElement(
|
|
52
|
-
"a",
|
|
53
|
-
{
|
|
54
|
-
target: "_blank",
|
|
55
|
-
rel: "noopener noreferrer",
|
|
56
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
57
|
-
className: classNames?.imageLink
|
|
58
|
-
},
|
|
59
|
-
asset && /* @__PURE__ */ import_react.default.createElement(
|
|
60
|
-
"img",
|
|
61
|
-
{
|
|
62
|
-
alt: fields?.title,
|
|
63
|
-
title: fields?.title,
|
|
64
|
-
src: asset.path,
|
|
65
|
-
srcSet: asset.thumbs ? (0, import_utils.getSrcSetCSSThumbs)(asset.thumbs) : void 0,
|
|
66
|
-
className: classNames?.image,
|
|
67
|
-
style: { objectFit: "cover", width: "100%", height: "100%" }
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
), /* @__PURE__ */ import_react.default.createElement("div", { className: classNames?.label }, fields?.title && /* @__PURE__ */ import_react.default.createElement(
|
|
71
|
-
"a",
|
|
72
|
-
{
|
|
73
|
-
target: "_blank",
|
|
74
|
-
rel: "noopener noreferrer",
|
|
75
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
76
|
-
"data-class": "titleLink",
|
|
77
|
-
className: classNames?.titleLink
|
|
78
|
-
},
|
|
79
|
-
fields.title
|
|
80
|
-
), fields?.description && /* @__PURE__ */ import_react.default.createElement(
|
|
81
|
-
"a",
|
|
82
|
-
{
|
|
83
|
-
target: "_blank",
|
|
84
|
-
rel: "noopener noreferrer",
|
|
85
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
86
|
-
"data-class": "descriptionLink",
|
|
87
|
-
className: classNames?.descriptionLink
|
|
88
|
-
},
|
|
89
|
-
fields.description
|
|
90
|
-
), fields?.brandname && /* @__PURE__ */ import_react.default.createElement(
|
|
91
|
-
"a",
|
|
92
|
-
{
|
|
93
|
-
target: "_blank",
|
|
94
|
-
rel: "noopener noreferrer",
|
|
95
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
96
|
-
"data-class": "brandNameLink",
|
|
97
|
-
className: classNames?.brandNameLink
|
|
98
|
-
},
|
|
99
|
-
fields.brandname
|
|
100
|
-
), fields?.phone && /* @__PURE__ */ import_react.default.createElement(
|
|
101
|
-
"a",
|
|
102
|
-
{
|
|
103
|
-
target: "_blank",
|
|
104
|
-
rel: "noopener noreferrer",
|
|
105
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
106
|
-
"data-class": "phoneLink",
|
|
107
|
-
className: classNames?.phoneLink
|
|
108
|
-
},
|
|
109
|
-
fields.phone
|
|
110
|
-
), fields?.url && /* @__PURE__ */ import_react.default.createElement(
|
|
111
|
-
"a",
|
|
112
|
-
{
|
|
113
|
-
target: "_blank",
|
|
114
|
-
rel: "noopener noreferrer",
|
|
115
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
116
|
-
"data-class": "urlLink",
|
|
117
|
-
className: classNames?.urlLink
|
|
118
|
-
},
|
|
119
|
-
fields?.url
|
|
120
|
-
)));
|
|
121
|
-
}
|
|
122
|
-
var AdViewUnitNative_default = AdViewUnitNative;
|
|
123
|
-
|
|
124
|
-
// src/AdViewUnit/AdViewUnitProxy.tsx
|
|
125
|
-
var import_react2 = __toESM(require("react"), 1);
|
|
126
|
-
function AdViewUnitProxy({
|
|
127
|
-
// assets,
|
|
128
|
-
fields,
|
|
129
|
-
url
|
|
130
|
-
}) {
|
|
131
|
-
const iframeSrc = fields?.url || url;
|
|
132
|
-
if (!iframeSrc) {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
return /* @__PURE__ */ import_react2.default.createElement(
|
|
136
|
-
"iframe",
|
|
137
|
-
{
|
|
138
|
-
width: "100%",
|
|
139
|
-
height: "100%",
|
|
140
|
-
frameBorder: "0",
|
|
141
|
-
marginWidth: 0,
|
|
142
|
-
marginHeight: 0,
|
|
143
|
-
allowTransparency: true,
|
|
144
|
-
scrolling: "no",
|
|
145
|
-
allowFullScreen: true,
|
|
146
|
-
style: { width: "100%", height: "100%" },
|
|
147
|
-
src: iframeSrc
|
|
148
|
-
}
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
var AdViewUnitProxy_default = AdViewUnitProxy;
|
|
152
|
-
|
|
153
|
-
// src/AdViewUnit/AdViewUnitBanner.tsx
|
|
154
|
-
var import_utils2 = require("@adview/core/utils");
|
|
155
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
156
|
-
function AdViewUnitBanner({ assets, url }) {
|
|
157
|
-
const asset = (0, import_utils2.getAssetByName)("main", assets);
|
|
158
|
-
return /* @__PURE__ */ import_react3.default.createElement("center", null, /* @__PURE__ */ import_react3.default.createElement(
|
|
159
|
-
"a",
|
|
160
|
-
{
|
|
161
|
-
target: "_blank",
|
|
162
|
-
rel: "noopener noreferrer",
|
|
163
|
-
href: (0, import_utils2.getPrepareURL)(url),
|
|
164
|
-
className: "banner",
|
|
165
|
-
style: { fontSize: 0 }
|
|
166
|
-
},
|
|
167
|
-
asset && /* @__PURE__ */ import_react3.default.createElement(
|
|
168
|
-
"img",
|
|
169
|
-
{
|
|
170
|
-
alt: "main",
|
|
171
|
-
src: asset.path,
|
|
172
|
-
srcSet: asset.thumbs ? (0, import_utils2.getSrcSetCSSThumbs)(asset.thumbs) : ""
|
|
173
|
-
}
|
|
174
|
-
)
|
|
175
|
-
));
|
|
176
|
-
}
|
|
177
|
-
var AdViewUnitBanner_default = AdViewUnitBanner;
|
|
178
|
-
|
|
179
|
-
// src/AdViewUnit/AdViewUnitTypeSwitch.tsx
|
|
180
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
181
|
-
function AdViewUnitTypeSwitch({
|
|
182
|
-
data,
|
|
183
|
-
classNames,
|
|
184
|
-
onDefault
|
|
185
|
-
}) {
|
|
186
|
-
switch (data?.type) {
|
|
187
|
-
case "native":
|
|
188
|
-
return /* @__PURE__ */ import_react4.default.createElement(AdViewUnitNative_default, { ...data, classNames: classNames?.native });
|
|
189
|
-
case "proxy":
|
|
190
|
-
return /* @__PURE__ */ import_react4.default.createElement(AdViewUnitProxy_default, { ...data, classNames: classNames?.proxy });
|
|
191
|
-
case "banner":
|
|
192
|
-
return /* @__PURE__ */ import_react4.default.createElement(AdViewUnitBanner_default, { ...data, classNames: classNames?.banner });
|
|
193
|
-
default:
|
|
194
|
-
if (import_react4.default.isValidElement(onDefault)) {
|
|
195
|
-
return import_react4.default.cloneElement(onDefault);
|
|
196
|
-
}
|
|
197
|
-
if (typeof onDefault === "function") {
|
|
198
|
-
return onDefault();
|
|
199
|
-
}
|
|
200
|
-
return null;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
var AdViewUnitTypeSwitch_default = AdViewUnitTypeSwitch;
|
|
204
|
-
|
|
205
|
-
// src/AdViewUnit/AdViewUnitWrapper.server.tsx
|
|
206
|
-
async function AdViewUnitWrapperServer({
|
|
207
|
-
data,
|
|
208
|
-
children,
|
|
209
|
-
onDefault
|
|
210
|
-
}) {
|
|
211
|
-
const isChildrenReactNode = import_react5.default.isValidElement(children);
|
|
212
|
-
const isChildrenFunction = typeof children === "function";
|
|
213
|
-
const isLoadingError = data instanceof Error;
|
|
214
|
-
if (isChildrenReactNode) {
|
|
215
|
-
return import_react5.default.cloneElement(children, { data, onDefault });
|
|
216
|
-
}
|
|
217
|
-
if (isChildrenFunction) {
|
|
218
|
-
return children({ data, onDefault });
|
|
219
|
-
}
|
|
220
|
-
if (!children && !isLoadingError) {
|
|
221
|
-
return /* @__PURE__ */ import_react5.default.createElement(AdViewUnitTypeSwitch_default, { data, onDefault });
|
|
222
|
-
}
|
|
223
|
-
if (import_react5.default.isValidElement(onDefault)) {
|
|
224
|
-
return import_react5.default.cloneElement(onDefault);
|
|
225
|
-
}
|
|
226
|
-
if (typeof onDefault === "function") {
|
|
227
|
-
return onDefault();
|
|
228
|
-
}
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
231
|
-
var AdViewUnitWrapper_server_default = AdViewUnitWrapperServer;
|
|
232
|
-
//# sourceMappingURL=AdViewUnitWrapper.server.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/AdViewUnit/AdViewUnitWrapper.server.tsx","../../src/AdViewUnit/AdViewUnitNative.tsx","../../src/AdViewUnit/AdViewUnitProxy.tsx","../../src/AdViewUnit/AdViewUnitBanner.tsx","../../src/AdViewUnit/AdViewUnitTypeSwitch.tsx"],"sourcesContent":["import React from 'react';\nimport AdViewUnitTypeSwitch from './/AdViewUnitTypeSwitch';\n\nimport {\n AdViewUnitDefault,\n AdViewUnitServerChildren,\n AdViewUnitServerChildrenProps,\n} from '../types';\n\nexport type AdViewUnitWrapperServerProps = AdViewUnitServerChildrenProps & {\n children?: AdViewUnitServerChildren;\n onDefault?: AdViewUnitDefault;\n};\n\nasync function AdViewUnitWrapperServer({\n data,\n children,\n onDefault,\n}: AdViewUnitWrapperServerProps) {\n const isChildrenReactNode = React.isValidElement(children);\n const isChildrenFunction = typeof children === 'function';\n const isLoadingError = data instanceof Error;\n\n if (isChildrenReactNode) {\n return React.cloneElement(children, { data, onDefault });\n }\n\n if (isChildrenFunction) {\n return children({ data, onDefault });\n }\n\n if (!children && !isLoadingError) {\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 AdViewUnitWrapperServer;\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAA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ACrC;AAEA,MAAI,CAAC,YAAY,CAAC,gBAAgB;AAChC,WAAO,8BAAAA,QAAA,cAAC,gCAAqB,MAAY,WAAsB;AAAA,EACjE;AAEA,MAAI,cAAAA,QAAM,eAAe,SAAS,GAAG;AACnC,WAAO,cAAAA,QAAM,aAAa,SAAS;AAAA,EACrC;AAEA,MAAI,OAAO,cAAc,YAAY;AACnC,WAAO,UAAU;AAAA,EACnB;AAEA,SAAO;AACT;AAEA,IAAO,mCAAQ;","names":["import_react","React","import_react","React","import_utils","import_react","React","import_react","React","React"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { h as AdViewUnitServerChildrenProps, b as AdViewUnitServerChildren, f as AdViewUnitDefault } from '../types-BaV07oMT.cjs';
|
|
3
|
-
import '@adview/core/typings';
|
|
4
|
-
|
|
5
|
-
type AdViewUnitWrapperServerProps = AdViewUnitServerChildrenProps & {
|
|
6
|
-
children?: AdViewUnitServerChildren;
|
|
7
|
-
onDefault?: AdViewUnitDefault;
|
|
8
|
-
};
|
|
9
|
-
declare function AdViewUnitWrapperServer({ data, children, onDefault, }: AdViewUnitWrapperServerProps): Promise<string | number | bigint | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined>;
|
|
10
|
-
|
|
11
|
-
export { type AdViewUnitWrapperServerProps, AdViewUnitWrapperServer as default };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { h as AdViewUnitServerChildrenProps, b as AdViewUnitServerChildren, f as AdViewUnitDefault } from '../types-BaV07oMT.js';
|
|
3
|
-
import '@adview/core/typings';
|
|
4
|
-
|
|
5
|
-
type AdViewUnitWrapperServerProps = AdViewUnitServerChildrenProps & {
|
|
6
|
-
children?: AdViewUnitServerChildren;
|
|
7
|
-
onDefault?: AdViewUnitDefault;
|
|
8
|
-
};
|
|
9
|
-
declare function AdViewUnitWrapperServer({ data, children, onDefault, }: AdViewUnitWrapperServerProps): Promise<string | number | bigint | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined>;
|
|
10
|
-
|
|
11
|
-
export { type AdViewUnitWrapperServerProps, AdViewUnitWrapperServer as default };
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
// src/AdViewUnit/AdViewUnitWrapper.server.tsx
|
|
2
|
-
import React5 from "react";
|
|
3
|
-
|
|
4
|
-
// src/AdViewUnit/AdViewUnitNative.tsx
|
|
5
|
-
import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from "@adview/core/utils";
|
|
6
|
-
import React from "react";
|
|
7
|
-
function AdViewUnitNative({
|
|
8
|
-
assets,
|
|
9
|
-
fields,
|
|
10
|
-
url,
|
|
11
|
-
classNames
|
|
12
|
-
}) {
|
|
13
|
-
const asset = getAssetByName("main", assets);
|
|
14
|
-
if (!url) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return /* @__PURE__ */ React.createElement("div", { className: classNames?.container }, /* @__PURE__ */ React.createElement(
|
|
18
|
-
"a",
|
|
19
|
-
{
|
|
20
|
-
target: "_blank",
|
|
21
|
-
rel: "noopener noreferrer",
|
|
22
|
-
href: getPrepareURL(url),
|
|
23
|
-
className: classNames?.imageLink
|
|
24
|
-
},
|
|
25
|
-
asset && /* @__PURE__ */ React.createElement(
|
|
26
|
-
"img",
|
|
27
|
-
{
|
|
28
|
-
alt: fields?.title,
|
|
29
|
-
title: fields?.title,
|
|
30
|
-
src: asset.path,
|
|
31
|
-
srcSet: asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : void 0,
|
|
32
|
-
className: classNames?.image,
|
|
33
|
-
style: { objectFit: "cover", width: "100%", height: "100%" }
|
|
34
|
-
}
|
|
35
|
-
)
|
|
36
|
-
), /* @__PURE__ */ React.createElement("div", { className: classNames?.label }, fields?.title && /* @__PURE__ */ React.createElement(
|
|
37
|
-
"a",
|
|
38
|
-
{
|
|
39
|
-
target: "_blank",
|
|
40
|
-
rel: "noopener noreferrer",
|
|
41
|
-
href: getPrepareURL(url),
|
|
42
|
-
"data-class": "titleLink",
|
|
43
|
-
className: classNames?.titleLink
|
|
44
|
-
},
|
|
45
|
-
fields.title
|
|
46
|
-
), fields?.description && /* @__PURE__ */ React.createElement(
|
|
47
|
-
"a",
|
|
48
|
-
{
|
|
49
|
-
target: "_blank",
|
|
50
|
-
rel: "noopener noreferrer",
|
|
51
|
-
href: getPrepareURL(url),
|
|
52
|
-
"data-class": "descriptionLink",
|
|
53
|
-
className: classNames?.descriptionLink
|
|
54
|
-
},
|
|
55
|
-
fields.description
|
|
56
|
-
), fields?.brandname && /* @__PURE__ */ React.createElement(
|
|
57
|
-
"a",
|
|
58
|
-
{
|
|
59
|
-
target: "_blank",
|
|
60
|
-
rel: "noopener noreferrer",
|
|
61
|
-
href: getPrepareURL(url),
|
|
62
|
-
"data-class": "brandNameLink",
|
|
63
|
-
className: classNames?.brandNameLink
|
|
64
|
-
},
|
|
65
|
-
fields.brandname
|
|
66
|
-
), fields?.phone && /* @__PURE__ */ React.createElement(
|
|
67
|
-
"a",
|
|
68
|
-
{
|
|
69
|
-
target: "_blank",
|
|
70
|
-
rel: "noopener noreferrer",
|
|
71
|
-
href: getPrepareURL(url),
|
|
72
|
-
"data-class": "phoneLink",
|
|
73
|
-
className: classNames?.phoneLink
|
|
74
|
-
},
|
|
75
|
-
fields.phone
|
|
76
|
-
), fields?.url && /* @__PURE__ */ React.createElement(
|
|
77
|
-
"a",
|
|
78
|
-
{
|
|
79
|
-
target: "_blank",
|
|
80
|
-
rel: "noopener noreferrer",
|
|
81
|
-
href: getPrepareURL(url),
|
|
82
|
-
"data-class": "urlLink",
|
|
83
|
-
className: classNames?.urlLink
|
|
84
|
-
},
|
|
85
|
-
fields?.url
|
|
86
|
-
)));
|
|
87
|
-
}
|
|
88
|
-
var AdViewUnitNative_default = AdViewUnitNative;
|
|
89
|
-
|
|
90
|
-
// src/AdViewUnit/AdViewUnitProxy.tsx
|
|
91
|
-
import React2 from "react";
|
|
92
|
-
function AdViewUnitProxy({
|
|
93
|
-
// assets,
|
|
94
|
-
fields,
|
|
95
|
-
url
|
|
96
|
-
}) {
|
|
97
|
-
const iframeSrc = fields?.url || url;
|
|
98
|
-
if (!iframeSrc) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
return /* @__PURE__ */ React2.createElement(
|
|
102
|
-
"iframe",
|
|
103
|
-
{
|
|
104
|
-
width: "100%",
|
|
105
|
-
height: "100%",
|
|
106
|
-
frameBorder: "0",
|
|
107
|
-
marginWidth: 0,
|
|
108
|
-
marginHeight: 0,
|
|
109
|
-
allowTransparency: true,
|
|
110
|
-
scrolling: "no",
|
|
111
|
-
allowFullScreen: true,
|
|
112
|
-
style: { width: "100%", height: "100%" },
|
|
113
|
-
src: iframeSrc
|
|
114
|
-
}
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
var AdViewUnitProxy_default = AdViewUnitProxy;
|
|
118
|
-
|
|
119
|
-
// src/AdViewUnit/AdViewUnitBanner.tsx
|
|
120
|
-
import { getAssetByName as getAssetByName2, getPrepareURL as getPrepareURL2, getSrcSetCSSThumbs as getSrcSetCSSThumbs2 } from "@adview/core/utils";
|
|
121
|
-
import React3 from "react";
|
|
122
|
-
function AdViewUnitBanner({ assets, url }) {
|
|
123
|
-
const asset = getAssetByName2("main", assets);
|
|
124
|
-
return /* @__PURE__ */ React3.createElement("center", null, /* @__PURE__ */ React3.createElement(
|
|
125
|
-
"a",
|
|
126
|
-
{
|
|
127
|
-
target: "_blank",
|
|
128
|
-
rel: "noopener noreferrer",
|
|
129
|
-
href: getPrepareURL2(url),
|
|
130
|
-
className: "banner",
|
|
131
|
-
style: { fontSize: 0 }
|
|
132
|
-
},
|
|
133
|
-
asset && /* @__PURE__ */ React3.createElement(
|
|
134
|
-
"img",
|
|
135
|
-
{
|
|
136
|
-
alt: "main",
|
|
137
|
-
src: asset.path,
|
|
138
|
-
srcSet: asset.thumbs ? getSrcSetCSSThumbs2(asset.thumbs) : ""
|
|
139
|
-
}
|
|
140
|
-
)
|
|
141
|
-
));
|
|
142
|
-
}
|
|
143
|
-
var AdViewUnitBanner_default = AdViewUnitBanner;
|
|
144
|
-
|
|
145
|
-
// src/AdViewUnit/AdViewUnitTypeSwitch.tsx
|
|
146
|
-
import React4 from "react";
|
|
147
|
-
function AdViewUnitTypeSwitch({
|
|
148
|
-
data,
|
|
149
|
-
classNames,
|
|
150
|
-
onDefault
|
|
151
|
-
}) {
|
|
152
|
-
switch (data?.type) {
|
|
153
|
-
case "native":
|
|
154
|
-
return /* @__PURE__ */ React4.createElement(AdViewUnitNative_default, { ...data, classNames: classNames?.native });
|
|
155
|
-
case "proxy":
|
|
156
|
-
return /* @__PURE__ */ React4.createElement(AdViewUnitProxy_default, { ...data, classNames: classNames?.proxy });
|
|
157
|
-
case "banner":
|
|
158
|
-
return /* @__PURE__ */ React4.createElement(AdViewUnitBanner_default, { ...data, classNames: classNames?.banner });
|
|
159
|
-
default:
|
|
160
|
-
if (React4.isValidElement(onDefault)) {
|
|
161
|
-
return React4.cloneElement(onDefault);
|
|
162
|
-
}
|
|
163
|
-
if (typeof onDefault === "function") {
|
|
164
|
-
return onDefault();
|
|
165
|
-
}
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
var AdViewUnitTypeSwitch_default = AdViewUnitTypeSwitch;
|
|
170
|
-
|
|
171
|
-
// src/AdViewUnit/AdViewUnitWrapper.server.tsx
|
|
172
|
-
async function AdViewUnitWrapperServer({
|
|
173
|
-
data,
|
|
174
|
-
children,
|
|
175
|
-
onDefault
|
|
176
|
-
}) {
|
|
177
|
-
const isChildrenReactNode = React5.isValidElement(children);
|
|
178
|
-
const isChildrenFunction = typeof children === "function";
|
|
179
|
-
const isLoadingError = data instanceof Error;
|
|
180
|
-
if (isChildrenReactNode) {
|
|
181
|
-
return React5.cloneElement(children, { data, onDefault });
|
|
182
|
-
}
|
|
183
|
-
if (isChildrenFunction) {
|
|
184
|
-
return children({ data, onDefault });
|
|
185
|
-
}
|
|
186
|
-
if (!children && !isLoadingError) {
|
|
187
|
-
return /* @__PURE__ */ React5.createElement(AdViewUnitTypeSwitch_default, { data, onDefault });
|
|
188
|
-
}
|
|
189
|
-
if (React5.isValidElement(onDefault)) {
|
|
190
|
-
return React5.cloneElement(onDefault);
|
|
191
|
-
}
|
|
192
|
-
if (typeof onDefault === "function") {
|
|
193
|
-
return onDefault();
|
|
194
|
-
}
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
var AdViewUnitWrapper_server_default = AdViewUnitWrapperServer;
|
|
198
|
-
export {
|
|
199
|
-
AdViewUnitWrapper_server_default as default
|
|
200
|
-
};
|
|
201
|
-
//# sourceMappingURL=AdViewUnitWrapper.server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/AdViewUnit/AdViewUnitWrapper.server.tsx","../../src/AdViewUnit/AdViewUnitNative.tsx","../../src/AdViewUnit/AdViewUnitProxy.tsx","../../src/AdViewUnit/AdViewUnitBanner.tsx","../../src/AdViewUnit/AdViewUnitTypeSwitch.tsx"],"sourcesContent":["import React from 'react';\nimport AdViewUnitTypeSwitch from './/AdViewUnitTypeSwitch';\n\nimport {\n AdViewUnitDefault,\n AdViewUnitServerChildren,\n AdViewUnitServerChildrenProps,\n} from '../types';\n\nexport type AdViewUnitWrapperServerProps = AdViewUnitServerChildrenProps & {\n children?: AdViewUnitServerChildren;\n onDefault?: AdViewUnitDefault;\n};\n\nasync function AdViewUnitWrapperServer({\n data,\n children,\n onDefault,\n}: AdViewUnitWrapperServerProps) {\n const isChildrenReactNode = React.isValidElement(children);\n const isChildrenFunction = typeof children === 'function';\n const isLoadingError = data instanceof Error;\n\n if (isChildrenReactNode) {\n return React.cloneElement(children, { data, onDefault });\n }\n\n if (isChildrenFunction) {\n return children({ data, onDefault });\n }\n\n if (!children && !isLoadingError) {\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 AdViewUnitWrapperServer;\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"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,SAAS,gBAAgB,eAAe,0BAA0B;AAClE,OAAO,WAAW;AAOlB,SAAS,iBAAiB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA0B;AACxB,QAAM,QAAQ,eAAe,QAAQ,MAAM;AAE3C,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AAEA,SACE,oCAAC,SAAI,WAAW,YAAY,aAC1B;AAAA,IAAC;AAAA;AAAA,MACC,QAAO;AAAA,MACP,KAAI;AAAA,MACJ,MAAM,cAAc,GAAG;AAAA,MACvB,WAAW,YAAY;AAAA;AAAA,IAEtB,SACC;AAAA,MAAC;AAAA;AAAA,QACC,KAAK,QAAQ;AAAA,QACb,OAAO,QAAQ;AAAA,QACf,KAAK,MAAM;AAAA,QACX,QAAQ,MAAM,SAAS,mBAAmB,MAAM,MAAM,IAAI;AAAA,QAC1D,WAAW,YAAY;AAAA,QACvB,OAAO,EAAE,WAAW,SAAS,OAAO,QAAQ,QAAQ,OAAO;AAAA;AAAA,IAC7D;AAAA,EAEJ,GACA,oCAAC,SAAI,WAAW,YAAY,SACzB,QAAQ,SACP;AAAA,IAAC;AAAA;AAAA,MACC,QAAO;AAAA,MACP,KAAI;AAAA,MACJ,MAAM,cAAc,GAAG;AAA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