@spindl-xyz/embed-react
Version:
## Getting Started
43 lines (42 loc) • 931 B
JavaScript
import d from "react";
function u({
publisherId: n,
placementId: o,
format: t,
address: r,
style: s,
properties: a,
_hostUrl: i
}) {
const c = i || "https://e.spindlembed.com/v1";
if (!n)
throw new Error("publisherId is required");
if (!o)
throw new Error("placementId is required");
const l = r ? Array.isArray(r) ? r : [r] : [], e = new URLSearchParams({
publisher_id: n,
placement_id: o,
...t && { format: t },
...a && { properties: JSON.stringify(a) }
});
l.forEach((p) => {
e.append("address", p);
}), console.log("params ===>", e.toString());
const m = `${c}/serve?${e.toString()}`;
return /* @__PURE__ */ d.createElement(
"iframe",
{
className: "spindl-embed",
style: {
backgroundColor: "transparent",
border: "none",
colorScheme: "normal",
...s
},
src: m
}
);
}
export {
u as BannerEmbed
};