@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,250 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
"use strict";
|
|
4
|
-
"use client";
|
|
5
|
-
var __create = Object.create;
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __export = (target, all) => {
|
|
12
|
-
for (var name in all)
|
|
13
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
-
};
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let key of __getOwnPropNames(from))
|
|
18
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
|
|
33
|
-
// src/AdViewUnit/AdViewUnitWrapper.client.tsx
|
|
34
|
-
var AdViewUnitWrapper_client_exports = {};
|
|
35
|
-
__export(AdViewUnitWrapper_client_exports, {
|
|
36
|
-
default: () => AdViewUnitWrapper_client_default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(AdViewUnitWrapper_client_exports);
|
|
39
|
-
var import_react5 = __toESM(require("react"), 1);
|
|
40
|
-
|
|
41
|
-
// src/AdViewUnit/AdViewUnitNative.tsx
|
|
42
|
-
var import_utils = require("@adview/core/utils");
|
|
43
|
-
var import_react = __toESM(require("react"), 1);
|
|
44
|
-
function AdViewUnitNative({
|
|
45
|
-
assets,
|
|
46
|
-
fields,
|
|
47
|
-
url,
|
|
48
|
-
classNames
|
|
49
|
-
}) {
|
|
50
|
-
const asset = (0, import_utils.getAssetByName)("main", assets);
|
|
51
|
-
if (!url) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: classNames?.container }, /* @__PURE__ */ import_react.default.createElement(
|
|
55
|
-
"a",
|
|
56
|
-
{
|
|
57
|
-
target: "_blank",
|
|
58
|
-
rel: "noopener noreferrer",
|
|
59
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
60
|
-
className: classNames?.imageLink
|
|
61
|
-
},
|
|
62
|
-
asset && /* @__PURE__ */ import_react.default.createElement(
|
|
63
|
-
"img",
|
|
64
|
-
{
|
|
65
|
-
alt: fields?.title,
|
|
66
|
-
title: fields?.title,
|
|
67
|
-
src: asset.path,
|
|
68
|
-
srcSet: asset.thumbs ? (0, import_utils.getSrcSetCSSThumbs)(asset.thumbs) : void 0,
|
|
69
|
-
className: classNames?.image,
|
|
70
|
-
style: { objectFit: "cover", width: "100%", height: "100%" }
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
), /* @__PURE__ */ import_react.default.createElement("div", { className: classNames?.label }, fields?.title && /* @__PURE__ */ import_react.default.createElement(
|
|
74
|
-
"a",
|
|
75
|
-
{
|
|
76
|
-
target: "_blank",
|
|
77
|
-
rel: "noopener noreferrer",
|
|
78
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
79
|
-
"data-class": "titleLink",
|
|
80
|
-
className: classNames?.titleLink
|
|
81
|
-
},
|
|
82
|
-
fields.title
|
|
83
|
-
), fields?.description && /* @__PURE__ */ import_react.default.createElement(
|
|
84
|
-
"a",
|
|
85
|
-
{
|
|
86
|
-
target: "_blank",
|
|
87
|
-
rel: "noopener noreferrer",
|
|
88
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
89
|
-
"data-class": "descriptionLink",
|
|
90
|
-
className: classNames?.descriptionLink
|
|
91
|
-
},
|
|
92
|
-
fields.description
|
|
93
|
-
), fields?.brandname && /* @__PURE__ */ import_react.default.createElement(
|
|
94
|
-
"a",
|
|
95
|
-
{
|
|
96
|
-
target: "_blank",
|
|
97
|
-
rel: "noopener noreferrer",
|
|
98
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
99
|
-
"data-class": "brandNameLink",
|
|
100
|
-
className: classNames?.brandNameLink
|
|
101
|
-
},
|
|
102
|
-
fields.brandname
|
|
103
|
-
), fields?.phone && /* @__PURE__ */ import_react.default.createElement(
|
|
104
|
-
"a",
|
|
105
|
-
{
|
|
106
|
-
target: "_blank",
|
|
107
|
-
rel: "noopener noreferrer",
|
|
108
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
109
|
-
"data-class": "phoneLink",
|
|
110
|
-
className: classNames?.phoneLink
|
|
111
|
-
},
|
|
112
|
-
fields.phone
|
|
113
|
-
), fields?.url && /* @__PURE__ */ import_react.default.createElement(
|
|
114
|
-
"a",
|
|
115
|
-
{
|
|
116
|
-
target: "_blank",
|
|
117
|
-
rel: "noopener noreferrer",
|
|
118
|
-
href: (0, import_utils.getPrepareURL)(url),
|
|
119
|
-
"data-class": "urlLink",
|
|
120
|
-
className: classNames?.urlLink
|
|
121
|
-
},
|
|
122
|
-
fields?.url
|
|
123
|
-
)));
|
|
124
|
-
}
|
|
125
|
-
var AdViewUnitNative_default = AdViewUnitNative;
|
|
126
|
-
|
|
127
|
-
// src/AdViewUnit/AdViewUnitProxy.tsx
|
|
128
|
-
var import_react2 = __toESM(require("react"), 1);
|
|
129
|
-
function AdViewUnitProxy({
|
|
130
|
-
// assets,
|
|
131
|
-
fields,
|
|
132
|
-
url
|
|
133
|
-
}) {
|
|
134
|
-
const iframeSrc = fields?.url || url;
|
|
135
|
-
if (!iframeSrc) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
return /* @__PURE__ */ import_react2.default.createElement(
|
|
139
|
-
"iframe",
|
|
140
|
-
{
|
|
141
|
-
width: "100%",
|
|
142
|
-
height: "100%",
|
|
143
|
-
frameBorder: "0",
|
|
144
|
-
marginWidth: 0,
|
|
145
|
-
marginHeight: 0,
|
|
146
|
-
allowTransparency: true,
|
|
147
|
-
scrolling: "no",
|
|
148
|
-
allowFullScreen: true,
|
|
149
|
-
style: { width: "100%", height: "100%" },
|
|
150
|
-
src: iframeSrc
|
|
151
|
-
}
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
var AdViewUnitProxy_default = AdViewUnitProxy;
|
|
155
|
-
|
|
156
|
-
// src/AdViewUnit/AdViewUnitBanner.tsx
|
|
157
|
-
var import_utils2 = require("@adview/core/utils");
|
|
158
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
159
|
-
function AdViewUnitBanner({ assets, url }) {
|
|
160
|
-
const asset = (0, import_utils2.getAssetByName)("main", assets);
|
|
161
|
-
return /* @__PURE__ */ import_react3.default.createElement("center", null, /* @__PURE__ */ import_react3.default.createElement(
|
|
162
|
-
"a",
|
|
163
|
-
{
|
|
164
|
-
target: "_blank",
|
|
165
|
-
rel: "noopener noreferrer",
|
|
166
|
-
href: (0, import_utils2.getPrepareURL)(url),
|
|
167
|
-
className: "banner",
|
|
168
|
-
style: { fontSize: 0 }
|
|
169
|
-
},
|
|
170
|
-
asset && /* @__PURE__ */ import_react3.default.createElement(
|
|
171
|
-
"img",
|
|
172
|
-
{
|
|
173
|
-
alt: "main",
|
|
174
|
-
src: asset.path,
|
|
175
|
-
srcSet: asset.thumbs ? (0, import_utils2.getSrcSetCSSThumbs)(asset.thumbs) : ""
|
|
176
|
-
}
|
|
177
|
-
)
|
|
178
|
-
));
|
|
179
|
-
}
|
|
180
|
-
var AdViewUnitBanner_default = AdViewUnitBanner;
|
|
181
|
-
|
|
182
|
-
// src/AdViewUnit/AdViewUnitTypeSwitch.tsx
|
|
183
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
184
|
-
function AdViewUnitTypeSwitch({
|
|
185
|
-
data,
|
|
186
|
-
classNames,
|
|
187
|
-
onDefault
|
|
188
|
-
}) {
|
|
189
|
-
switch (data?.type) {
|
|
190
|
-
case "native":
|
|
191
|
-
return /* @__PURE__ */ import_react4.default.createElement(AdViewUnitNative_default, { ...data, classNames: classNames?.native });
|
|
192
|
-
case "proxy":
|
|
193
|
-
return /* @__PURE__ */ import_react4.default.createElement(AdViewUnitProxy_default, { ...data, classNames: classNames?.proxy });
|
|
194
|
-
case "banner":
|
|
195
|
-
return /* @__PURE__ */ import_react4.default.createElement(AdViewUnitBanner_default, { ...data, classNames: classNames?.banner });
|
|
196
|
-
default:
|
|
197
|
-
if (import_react4.default.isValidElement(onDefault)) {
|
|
198
|
-
return import_react4.default.cloneElement(onDefault);
|
|
199
|
-
}
|
|
200
|
-
if (typeof onDefault === "function") {
|
|
201
|
-
return onDefault();
|
|
202
|
-
}
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
var AdViewUnitTypeSwitch_default = AdViewUnitTypeSwitch;
|
|
207
|
-
|
|
208
|
-
// src/AdViewUnit/AdViewUnitWrapper.client.tsx
|
|
209
|
-
function AdViewUnitWrapperClient({
|
|
210
|
-
data,
|
|
211
|
-
state,
|
|
212
|
-
error,
|
|
213
|
-
children,
|
|
214
|
-
onDefault
|
|
215
|
-
}) {
|
|
216
|
-
const { isLoading, isError } = state;
|
|
217
|
-
const isChildrenReactNode = import_react5.default.isValidElement(children);
|
|
218
|
-
const isChildrenFunction = typeof children === "function";
|
|
219
|
-
if (isChildrenReactNode) {
|
|
220
|
-
return import_react5.default.cloneElement(children, {
|
|
221
|
-
data,
|
|
222
|
-
state,
|
|
223
|
-
error,
|
|
224
|
-
onDefault
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
if (isChildrenFunction) {
|
|
228
|
-
return children({
|
|
229
|
-
data,
|
|
230
|
-
state,
|
|
231
|
-
error,
|
|
232
|
-
onDefault
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
if (isLoading) {
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
if (!children && !isError && data) {
|
|
239
|
-
return /* @__PURE__ */ import_react5.default.createElement(AdViewUnitTypeSwitch_default, { data, onDefault });
|
|
240
|
-
}
|
|
241
|
-
if (import_react5.default.isValidElement(onDefault)) {
|
|
242
|
-
return import_react5.default.cloneElement(onDefault);
|
|
243
|
-
}
|
|
244
|
-
if (typeof onDefault === "function") {
|
|
245
|
-
return onDefault();
|
|
246
|
-
}
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
var AdViewUnitWrapper_client_default = AdViewUnitWrapperClient;
|
|
250
|
-
//# sourceMappingURL=AdViewUnitWrapper.client.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/AdViewUnit/AdViewUnitWrapper.client.tsx","../../src/AdViewUnit/AdViewUnitNative.tsx","../../src/AdViewUnit/AdViewUnitProxy.tsx","../../src/AdViewUnit/AdViewUnitBanner.tsx","../../src/AdViewUnit/AdViewUnitTypeSwitch.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport AdViewUnitTypeSwitch from './AdViewUnitTypeSwitch';\nimport {\n AdViewUnitClientChildren,\n AdViewUnitClientChildrenProps,\n AdViewUnitDefault,\n} from '../types';\n\nexport type AdViewUnitWrapperClientProps = AdViewUnitClientChildrenProps & {\n children?: AdViewUnitClientChildren;\n onDefault: AdViewUnitDefault;\n};\n\nfunction AdViewUnitWrapperClient({\n data,\n state,\n error,\n children,\n onDefault,\n}: AdViewUnitWrapperClientProps) {\n const { isLoading, isError } = state;\n const isChildrenReactNode = React.isValidElement(children);\n const isChildrenFunction = typeof children === 'function';\n\n if (isChildrenReactNode) {\n return React.cloneElement(children, {\n data,\n state,\n error,\n onDefault,\n });\n }\n\n if (isChildrenFunction) {\n return children({\n data,\n state,\n error,\n onDefault,\n });\n }\n\n if (isLoading) {\n return null;\n }\n\n if (!children && !isError && data) {\n return <AdViewUnitTypeSwitch data={data} onDefault={onDefault} />;\n }\n\n if (React.isValidElement(onDefault)) {\n return React.cloneElement(onDefault);\n }\n\n if (typeof onDefault === 'function') {\n return onDefault();\n }\n\n return null;\n}\n\nexport default AdViewUnitWrapperClient;\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdViewDataClient, AdViewStyleTokensNative } from '../types';\n\ntype AdViewUnitNativeProps = AdViewDataClient & {\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitNative({\n assets,\n fields,\n url,\n classNames,\n}: AdViewUnitNativeProps) {\n const asset = getAssetByName('main', assets);\n\n if (!url) {\n return null;\n }\n\n return (\n <div className={classNames?.container}>\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n className={classNames?.imageLink}\n >\n {asset && (\n <img\n alt={fields?.title}\n title={fields?.title}\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : undefined}\n className={classNames?.image}\n style={{ objectFit: 'cover', width: '100%', height: '100%' }}\n />\n )}\n </a>\n <div className={classNames?.label}>\n {fields?.title && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"titleLink\"\n className={classNames?.titleLink}\n >\n {fields.title}\n </a>\n )}\n {fields?.description && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"descriptionLink\"\n className={classNames?.descriptionLink}\n >\n {fields.description}\n </a>\n )}\n {fields?.brandname && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"brandNameLink\"\n className={classNames?.brandNameLink}\n >\n {fields.brandname}\n </a>\n )}\n {fields?.phone && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"phoneLink\"\n className={classNames?.phoneLink}\n >\n {fields.phone}\n </a>\n )}\n {fields?.url && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"urlLink\"\n className={classNames?.urlLink}\n >\n {fields?.url}\n </a>\n )}\n </div>\n </div>\n );\n}\n\nexport default AdViewUnitNative;\n","import React from 'react';\nimport { AdViewDataClient, AdViewStyleTokensNative } from '../types';\n\ntype AdViewUnitProxyProps = AdViewDataClient & {\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitProxy({\n // assets,\n fields,\n url,\n}: AdViewUnitProxyProps) {\n const iframeSrc = fields?.url || url;\n\n if (!iframeSrc) {\n return null;\n }\n\n return (\n <iframe\n width=\"100%\"\n height=\"100%\"\n frameBorder=\"0\"\n marginWidth={0}\n marginHeight={0}\n allowTransparency={true}\n scrolling=\"no\"\n allowFullScreen={true}\n style={{ width: '100%', height: '100%' }}\n src={iframeSrc}\n ></iframe>\n );\n}\n\nexport default AdViewUnitProxy;\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdViewDataClient, AdViewStyleTokensNative } from '../types';\n\ntype AdViewUnitBannerProps = AdViewDataClient & {\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitBanner({ assets, url }: AdViewUnitBannerProps) {\n const asset = getAssetByName('main', assets);\n\n return (\n <center>\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n className=\"banner\"\n style={{ fontSize: 0 }}\n >\n {asset && (\n <img\n alt=\"main\"\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : ''}\n />\n )}\n </a>\n </center>\n );\n}\n\nexport default AdViewUnitBanner;\n","import {\n AdViewDataClient,\n AdViewStyleTokens,\n AdViewUnitDefault,\n} from '../types';\nimport AdViewUnitNative from './AdViewUnitNative';\nimport AdViewUnitProxy from './AdViewUnitProxy';\nimport AdViewUnitBanner from './AdViewUnitBanner';\nimport React from 'react';\n\ntype AdViewUnitDefaultProps = {\n data?: AdViewDataClient;\n classNames?: AdViewStyleTokens;\n onDefault?: AdViewUnitDefault;\n};\n\nfunction AdViewUnitTypeSwitch({\n data,\n classNames,\n onDefault,\n}: AdViewUnitDefaultProps) {\n switch (data?.type) {\n case 'native':\n return <AdViewUnitNative {...data} classNames={classNames?.native} />;\n case 'proxy':\n return <AdViewUnitProxy {...data} classNames={classNames?.proxy} />;\n case 'banner':\n return <AdViewUnitBanner {...data} classNames={classNames?.banner} />;\n default:\n if (React.isValidElement(onDefault)) {\n return React.cloneElement(onDefault);\n }\n\n if (typeof onDefault === 'function') {\n return onDefault();\n }\n\n return null;\n }\n}\n\nexport default AdViewUnitTypeSwitch;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAAkB;;;ACFlB,mBAAkE;AAClE,mBAAkB;AAOlB,SAAS,iBAAiB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA0B;AACxB,QAAM,YAAQ,6BAAe,QAAQ,MAAM;AAE3C,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AAEA,SACE,6BAAAC,QAAA,cAAC,SAAI,WAAW,YAAY,aAC1B,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,QAAO;AAAA,MACP,KAAI;AAAA,MACJ,UAAM,4BAAc,GAAG;AAAA,MACvB,WAAW,YAAY;AAAA;AAAA,IAEtB,SACC,6BAAAA,QAAA;AAAA,MAAC;AAAA;AAAA,QACC,KAAK,QAAQ;AAAA,QACb,OAAO,QAAQ;AAAA,QACf,KAAK,MAAM;AAAA,QACX,QAAQ,MAAM,aAAS,iCAAmB,MAAM,MAAM,IAAI;AAAA,QAC1D,WAAW,YAAY;AAAA,QACvB,OAAO,EAAE,WAAW,SAAS,OAAO,QAAQ,QAAQ,OAAO;AAAA;AAAA,IAC7D;AAAA,EAEJ,GACA,6BAAAA,QAAA,cAAC,SAAI,WAAW,YAAY,SACzB,QAAQ,SACP,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,QAAO;AAAA,MACP,KAAI;AAAA,MACJ,UAAM,4BAAc,GAAG;AAAA,MACvB,cAAW;AAAA,MACX,WAA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,SAAS,wBAAwB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAiC;AAC/B,QAAM,EAAE,WAAW,QAAQ,IAAI;AAC/B,QAAM,sBAAsB,cAAAC,QAAM,eAAe,QAAQ;AACzD,QAAM,qBAAqB,OAAO,aAAa;AAE/C,MAAI,qBAAqB;AACvB,WAAO,cAAAA,QAAM,aAAa,UAAU;AAAA,MAClC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,oBAAoB;AACtB,WAAO,SAAS;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,WAAW;AACb,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,YAAY,CAAC,WAAW,MAAM;AACjC,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 { g as AdViewUnitClientChildrenProps, a as AdViewUnitClientChildren, f as AdViewUnitDefault } from '../types-BaV07oMT.cjs';
|
|
3
|
-
import '@adview/core/typings';
|
|
4
|
-
|
|
5
|
-
type AdViewUnitWrapperClientProps = AdViewUnitClientChildrenProps & {
|
|
6
|
-
children?: AdViewUnitClientChildren;
|
|
7
|
-
onDefault: AdViewUnitDefault;
|
|
8
|
-
};
|
|
9
|
-
declare function AdViewUnitWrapperClient({ data, state, error, children, onDefault, }: AdViewUnitWrapperClientProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
10
|
-
|
|
11
|
-
export { type AdViewUnitWrapperClientProps, AdViewUnitWrapperClient as default };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { g as AdViewUnitClientChildrenProps, a as AdViewUnitClientChildren, f as AdViewUnitDefault } from '../types-BaV07oMT.js';
|
|
3
|
-
import '@adview/core/typings';
|
|
4
|
-
|
|
5
|
-
type AdViewUnitWrapperClientProps = AdViewUnitClientChildrenProps & {
|
|
6
|
-
children?: AdViewUnitClientChildren;
|
|
7
|
-
onDefault: AdViewUnitDefault;
|
|
8
|
-
};
|
|
9
|
-
declare function AdViewUnitWrapperClient({ data, state, error, children, onDefault, }: AdViewUnitWrapperClientProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
10
|
-
|
|
11
|
-
export { type AdViewUnitWrapperClientProps, AdViewUnitWrapperClient as default };
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
"use client";
|
|
4
|
-
|
|
5
|
-
// src/AdViewUnit/AdViewUnitWrapper.client.tsx
|
|
6
|
-
import React5 from "react";
|
|
7
|
-
|
|
8
|
-
// src/AdViewUnit/AdViewUnitNative.tsx
|
|
9
|
-
import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from "@adview/core/utils";
|
|
10
|
-
import React from "react";
|
|
11
|
-
function AdViewUnitNative({
|
|
12
|
-
assets,
|
|
13
|
-
fields,
|
|
14
|
-
url,
|
|
15
|
-
classNames
|
|
16
|
-
}) {
|
|
17
|
-
const asset = getAssetByName("main", assets);
|
|
18
|
-
if (!url) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
return /* @__PURE__ */ React.createElement("div", { className: classNames?.container }, /* @__PURE__ */ React.createElement(
|
|
22
|
-
"a",
|
|
23
|
-
{
|
|
24
|
-
target: "_blank",
|
|
25
|
-
rel: "noopener noreferrer",
|
|
26
|
-
href: getPrepareURL(url),
|
|
27
|
-
className: classNames?.imageLink
|
|
28
|
-
},
|
|
29
|
-
asset && /* @__PURE__ */ React.createElement(
|
|
30
|
-
"img",
|
|
31
|
-
{
|
|
32
|
-
alt: fields?.title,
|
|
33
|
-
title: fields?.title,
|
|
34
|
-
src: asset.path,
|
|
35
|
-
srcSet: asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : void 0,
|
|
36
|
-
className: classNames?.image,
|
|
37
|
-
style: { objectFit: "cover", width: "100%", height: "100%" }
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
), /* @__PURE__ */ React.createElement("div", { className: classNames?.label }, fields?.title && /* @__PURE__ */ React.createElement(
|
|
41
|
-
"a",
|
|
42
|
-
{
|
|
43
|
-
target: "_blank",
|
|
44
|
-
rel: "noopener noreferrer",
|
|
45
|
-
href: getPrepareURL(url),
|
|
46
|
-
"data-class": "titleLink",
|
|
47
|
-
className: classNames?.titleLink
|
|
48
|
-
},
|
|
49
|
-
fields.title
|
|
50
|
-
), fields?.description && /* @__PURE__ */ React.createElement(
|
|
51
|
-
"a",
|
|
52
|
-
{
|
|
53
|
-
target: "_blank",
|
|
54
|
-
rel: "noopener noreferrer",
|
|
55
|
-
href: getPrepareURL(url),
|
|
56
|
-
"data-class": "descriptionLink",
|
|
57
|
-
className: classNames?.descriptionLink
|
|
58
|
-
},
|
|
59
|
-
fields.description
|
|
60
|
-
), fields?.brandname && /* @__PURE__ */ React.createElement(
|
|
61
|
-
"a",
|
|
62
|
-
{
|
|
63
|
-
target: "_blank",
|
|
64
|
-
rel: "noopener noreferrer",
|
|
65
|
-
href: getPrepareURL(url),
|
|
66
|
-
"data-class": "brandNameLink",
|
|
67
|
-
className: classNames?.brandNameLink
|
|
68
|
-
},
|
|
69
|
-
fields.brandname
|
|
70
|
-
), fields?.phone && /* @__PURE__ */ React.createElement(
|
|
71
|
-
"a",
|
|
72
|
-
{
|
|
73
|
-
target: "_blank",
|
|
74
|
-
rel: "noopener noreferrer",
|
|
75
|
-
href: getPrepareURL(url),
|
|
76
|
-
"data-class": "phoneLink",
|
|
77
|
-
className: classNames?.phoneLink
|
|
78
|
-
},
|
|
79
|
-
fields.phone
|
|
80
|
-
), fields?.url && /* @__PURE__ */ React.createElement(
|
|
81
|
-
"a",
|
|
82
|
-
{
|
|
83
|
-
target: "_blank",
|
|
84
|
-
rel: "noopener noreferrer",
|
|
85
|
-
href: getPrepareURL(url),
|
|
86
|
-
"data-class": "urlLink",
|
|
87
|
-
className: classNames?.urlLink
|
|
88
|
-
},
|
|
89
|
-
fields?.url
|
|
90
|
-
)));
|
|
91
|
-
}
|
|
92
|
-
var AdViewUnitNative_default = AdViewUnitNative;
|
|
93
|
-
|
|
94
|
-
// src/AdViewUnit/AdViewUnitProxy.tsx
|
|
95
|
-
import React2 from "react";
|
|
96
|
-
function AdViewUnitProxy({
|
|
97
|
-
// assets,
|
|
98
|
-
fields,
|
|
99
|
-
url
|
|
100
|
-
}) {
|
|
101
|
-
const iframeSrc = fields?.url || url;
|
|
102
|
-
if (!iframeSrc) {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
return /* @__PURE__ */ React2.createElement(
|
|
106
|
-
"iframe",
|
|
107
|
-
{
|
|
108
|
-
width: "100%",
|
|
109
|
-
height: "100%",
|
|
110
|
-
frameBorder: "0",
|
|
111
|
-
marginWidth: 0,
|
|
112
|
-
marginHeight: 0,
|
|
113
|
-
allowTransparency: true,
|
|
114
|
-
scrolling: "no",
|
|
115
|
-
allowFullScreen: true,
|
|
116
|
-
style: { width: "100%", height: "100%" },
|
|
117
|
-
src: iframeSrc
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
var AdViewUnitProxy_default = AdViewUnitProxy;
|
|
122
|
-
|
|
123
|
-
// src/AdViewUnit/AdViewUnitBanner.tsx
|
|
124
|
-
import { getAssetByName as getAssetByName2, getPrepareURL as getPrepareURL2, getSrcSetCSSThumbs as getSrcSetCSSThumbs2 } from "@adview/core/utils";
|
|
125
|
-
import React3 from "react";
|
|
126
|
-
function AdViewUnitBanner({ assets, url }) {
|
|
127
|
-
const asset = getAssetByName2("main", assets);
|
|
128
|
-
return /* @__PURE__ */ React3.createElement("center", null, /* @__PURE__ */ React3.createElement(
|
|
129
|
-
"a",
|
|
130
|
-
{
|
|
131
|
-
target: "_blank",
|
|
132
|
-
rel: "noopener noreferrer",
|
|
133
|
-
href: getPrepareURL2(url),
|
|
134
|
-
className: "banner",
|
|
135
|
-
style: { fontSize: 0 }
|
|
136
|
-
},
|
|
137
|
-
asset && /* @__PURE__ */ React3.createElement(
|
|
138
|
-
"img",
|
|
139
|
-
{
|
|
140
|
-
alt: "main",
|
|
141
|
-
src: asset.path,
|
|
142
|
-
srcSet: asset.thumbs ? getSrcSetCSSThumbs2(asset.thumbs) : ""
|
|
143
|
-
}
|
|
144
|
-
)
|
|
145
|
-
));
|
|
146
|
-
}
|
|
147
|
-
var AdViewUnitBanner_default = AdViewUnitBanner;
|
|
148
|
-
|
|
149
|
-
// src/AdViewUnit/AdViewUnitTypeSwitch.tsx
|
|
150
|
-
import React4 from "react";
|
|
151
|
-
function AdViewUnitTypeSwitch({
|
|
152
|
-
data,
|
|
153
|
-
classNames,
|
|
154
|
-
onDefault
|
|
155
|
-
}) {
|
|
156
|
-
switch (data?.type) {
|
|
157
|
-
case "native":
|
|
158
|
-
return /* @__PURE__ */ React4.createElement(AdViewUnitNative_default, { ...data, classNames: classNames?.native });
|
|
159
|
-
case "proxy":
|
|
160
|
-
return /* @__PURE__ */ React4.createElement(AdViewUnitProxy_default, { ...data, classNames: classNames?.proxy });
|
|
161
|
-
case "banner":
|
|
162
|
-
return /* @__PURE__ */ React4.createElement(AdViewUnitBanner_default, { ...data, classNames: classNames?.banner });
|
|
163
|
-
default:
|
|
164
|
-
if (React4.isValidElement(onDefault)) {
|
|
165
|
-
return React4.cloneElement(onDefault);
|
|
166
|
-
}
|
|
167
|
-
if (typeof onDefault === "function") {
|
|
168
|
-
return onDefault();
|
|
169
|
-
}
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
var AdViewUnitTypeSwitch_default = AdViewUnitTypeSwitch;
|
|
174
|
-
|
|
175
|
-
// src/AdViewUnit/AdViewUnitWrapper.client.tsx
|
|
176
|
-
function AdViewUnitWrapperClient({
|
|
177
|
-
data,
|
|
178
|
-
state,
|
|
179
|
-
error,
|
|
180
|
-
children,
|
|
181
|
-
onDefault
|
|
182
|
-
}) {
|
|
183
|
-
const { isLoading, isError } = state;
|
|
184
|
-
const isChildrenReactNode = React5.isValidElement(children);
|
|
185
|
-
const isChildrenFunction = typeof children === "function";
|
|
186
|
-
if (isChildrenReactNode) {
|
|
187
|
-
return React5.cloneElement(children, {
|
|
188
|
-
data,
|
|
189
|
-
state,
|
|
190
|
-
error,
|
|
191
|
-
onDefault
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
if (isChildrenFunction) {
|
|
195
|
-
return children({
|
|
196
|
-
data,
|
|
197
|
-
state,
|
|
198
|
-
error,
|
|
199
|
-
onDefault
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
if (isLoading) {
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
if (!children && !isError && data) {
|
|
206
|
-
return /* @__PURE__ */ React5.createElement(AdViewUnitTypeSwitch_default, { data, onDefault });
|
|
207
|
-
}
|
|
208
|
-
if (React5.isValidElement(onDefault)) {
|
|
209
|
-
return React5.cloneElement(onDefault);
|
|
210
|
-
}
|
|
211
|
-
if (typeof onDefault === "function") {
|
|
212
|
-
return onDefault();
|
|
213
|
-
}
|
|
214
|
-
return null;
|
|
215
|
-
}
|
|
216
|
-
var AdViewUnitWrapper_client_default = AdViewUnitWrapperClient;
|
|
217
|
-
export {
|
|
218
|
-
AdViewUnitWrapper_client_default as default
|
|
219
|
-
};
|
|
220
|
-
//# sourceMappingURL=AdViewUnitWrapper.client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/AdViewUnit/AdViewUnitWrapper.client.tsx","../../src/AdViewUnit/AdViewUnitNative.tsx","../../src/AdViewUnit/AdViewUnitProxy.tsx","../../src/AdViewUnit/AdViewUnitBanner.tsx","../../src/AdViewUnit/AdViewUnitTypeSwitch.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport AdViewUnitTypeSwitch from './AdViewUnitTypeSwitch';\nimport {\n AdViewUnitClientChildren,\n AdViewUnitClientChildrenProps,\n AdViewUnitDefault,\n} from '../types';\n\nexport type AdViewUnitWrapperClientProps = AdViewUnitClientChildrenProps & {\n children?: AdViewUnitClientChildren;\n onDefault: AdViewUnitDefault;\n};\n\nfunction AdViewUnitWrapperClient({\n data,\n state,\n error,\n children,\n onDefault,\n}: AdViewUnitWrapperClientProps) {\n const { isLoading, isError } = state;\n const isChildrenReactNode = React.isValidElement(children);\n const isChildrenFunction = typeof children === 'function';\n\n if (isChildrenReactNode) {\n return React.cloneElement(children, {\n data,\n state,\n error,\n onDefault,\n });\n }\n\n if (isChildrenFunction) {\n return children({\n data,\n state,\n error,\n onDefault,\n });\n }\n\n if (isLoading) {\n return null;\n }\n\n if (!children && !isError && data) {\n return <AdViewUnitTypeSwitch data={data} onDefault={onDefault} />;\n }\n\n if (React.isValidElement(onDefault)) {\n return React.cloneElement(onDefault);\n }\n\n if (typeof onDefault === 'function') {\n return onDefault();\n }\n\n return null;\n}\n\nexport default AdViewUnitWrapperClient;\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdViewDataClient, AdViewStyleTokensNative } from '../types';\n\ntype AdViewUnitNativeProps = AdViewDataClient & {\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitNative({\n assets,\n fields,\n url,\n classNames,\n}: AdViewUnitNativeProps) {\n const asset = getAssetByName('main', assets);\n\n if (!url) {\n return null;\n }\n\n return (\n <div className={classNames?.container}>\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n className={classNames?.imageLink}\n >\n {asset && (\n <img\n alt={fields?.title}\n title={fields?.title}\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : undefined}\n className={classNames?.image}\n style={{ objectFit: 'cover', width: '100%', height: '100%' }}\n />\n )}\n </a>\n <div className={classNames?.label}>\n {fields?.title && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"titleLink\"\n className={classNames?.titleLink}\n >\n {fields.title}\n </a>\n )}\n {fields?.description && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"descriptionLink\"\n className={classNames?.descriptionLink}\n >\n {fields.description}\n </a>\n )}\n {fields?.brandname && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"brandNameLink\"\n className={classNames?.brandNameLink}\n >\n {fields.brandname}\n </a>\n )}\n {fields?.phone && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"phoneLink\"\n className={classNames?.phoneLink}\n >\n {fields.phone}\n </a>\n )}\n {fields?.url && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"urlLink\"\n className={classNames?.urlLink}\n >\n {fields?.url}\n </a>\n )}\n </div>\n </div>\n );\n}\n\nexport default AdViewUnitNative;\n","import React from 'react';\nimport { AdViewDataClient, AdViewStyleTokensNative } from '../types';\n\ntype AdViewUnitProxyProps = AdViewDataClient & {\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitProxy({\n // assets,\n fields,\n url,\n}: AdViewUnitProxyProps) {\n const iframeSrc = fields?.url || url;\n\n if (!iframeSrc) {\n return null;\n }\n\n return (\n <iframe\n width=\"100%\"\n height=\"100%\"\n frameBorder=\"0\"\n marginWidth={0}\n marginHeight={0}\n allowTransparency={true}\n scrolling=\"no\"\n allowFullScreen={true}\n style={{ width: '100%', height: '100%' }}\n src={iframeSrc}\n ></iframe>\n );\n}\n\nexport default AdViewUnitProxy;\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdViewDataClient, AdViewStyleTokensNative } from '../types';\n\ntype AdViewUnitBannerProps = AdViewDataClient & {\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitBanner({ assets, url }: AdViewUnitBannerProps) {\n const asset = getAssetByName('main', assets);\n\n return (\n <center>\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n className=\"banner\"\n style={{ fontSize: 0 }}\n >\n {asset && (\n <img\n alt=\"main\"\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : ''}\n />\n )}\n </a>\n </center>\n );\n}\n\nexport default AdViewUnitBanner;\n","import {\n AdViewDataClient,\n AdViewStyleTokens,\n AdViewUnitDefault,\n} from '../types';\nimport AdViewUnitNative from './AdViewUnitNative';\nimport AdViewUnitProxy from './AdViewUnitProxy';\nimport AdViewUnitBanner from './AdViewUnitBanner';\nimport React from 'react';\n\ntype AdViewUnitDefaultProps = {\n data?: AdViewDataClient;\n classNames?: AdViewStyleTokens;\n onDefault?: AdViewUnitDefault;\n};\n\nfunction AdViewUnitTypeSwitch({\n data,\n classNames,\n onDefault,\n}: AdViewUnitDefaultProps) {\n switch (data?.type) {\n case 'native':\n return <AdViewUnitNative {...data} classNames={classNames?.native} />;\n case 'proxy':\n return <AdViewUnitProxy {...data} classNames={classNames?.proxy} />;\n case 'banner':\n return <AdViewUnitBanner {...data} classNames={classNames?.banner} />;\n default:\n if (React.isValidElement(onDefault)) {\n return React.cloneElement(onDefault);\n }\n\n if (typeof onDefault === 'function') {\n return onDefault();\n }\n\n return null;\n }\n}\n\nexport default AdViewUnitTypeSwitch;\n"],"mappings":";;;AAEA,OAAOA,YAAW;;;ACFlB,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;AAAA,MACvB,cAAW;AAAA,MACX,WAAW,YAAY;AAAA;AAAA,IAEtB,OAAO;AAAA,EACV,GAED,QAAQ,eACP;AAAA,IAAC;AAAA;AAAA,MACC,QAAO;AAAA,MACP,KAAI;AAAA,MACJ,MAAM,cAAc,GAAG;AAAA,MACvB,cAAW;AAAA,MACX,WAAW,YAAY;AAAA;AA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