@adland/embed 0.1.1
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/CHANGELOG.md +47 -0
- package/README.md +72 -0
- package/dist/adland-farcaster.js +285 -0
- package/dist/adland-farcaster.js.map +1 -0
- package/dist/adland.js +147 -0
- package/dist/adland.js.map +1 -0
- package/dist/index.cjs +337 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +329 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @adland/embed
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [488490a]
|
|
8
|
+
- Updated dependencies [859ebec]
|
|
9
|
+
- @adland/react@0.18.1
|
|
10
|
+
- @adland/data@0.16.3
|
|
11
|
+
|
|
12
|
+
## 0.1.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- b32cc89: Publisher SDK: platform-agnostic config, action adapters, and a framework-free web component.
|
|
17
|
+
|
|
18
|
+
- **@adland/react**: optional `AdlandProvider` supplying `endpoint`/`gateway`/`rpcUrl`/`chainId`/`consent`/`onEvent` defaults (all overridable per-`Ad`); stable `AdEvent` shape mirrored to a publisher `onEvent`; consent-gated analytics beacon (default `granted`); `context` → `placement` with `context` kept as a deprecated alias. New `ActionAdapter` seam with `WebActionAdapter`/`FarcasterActionAdapter` (default preserves current behavior); injectable viem chain registry + `subgraphUrl`. New React-free `./core` and `./farcaster` subpath exports.
|
|
19
|
+
- **@adland/embed** (new): `<adland-slot>` custom element with `render-mode` `isolated` (sandboxed iframe, default) and `inline` (shadow DOM with `::part()` hooks), CSS custom-property theming, and impression/click tracking. Dual self-contained CDN bundles — `adland.js` (web, zero Farcaster) and `adland-farcaster.js` (Mini App). Copy-paste simple by default, deeply customizable when wanted.
|
|
20
|
+
- **@adland/data**: guard `process.env` access so the module is safe when bundled into browser builds.
|
|
21
|
+
|
|
22
|
+
- 55d2d70: Verified-impression handshake (opt-in).
|
|
23
|
+
|
|
24
|
+
- `@adland/react/core`: `trackVerifiedImpression` requests a single-use nonce from `/v1/serve` on mount, waits for a viewability dwell, then posts a verified `/v1/event`, falling back to the legacy `/track` beacon if the verified path is unavailable — an impression is never lost. Opt in with the new `verified` prop on `Ad` (or the provider). `tracking` was refactored to separate the local `onEvent` mirror from the network beacon.
|
|
25
|
+
- `@adland/embed`: opt in with a `verified` attribute on `<adland-slot>`.
|
|
26
|
+
|
|
27
|
+
Server support (`apps/api`, unpublished): `/v1/serve` + `/v1/event` with an origin bound to the request header, a single-use nonce store, and additive `verified`/`placement`/`viewable_ms` columns on `events`. Legacy `/track` continues to work and records `verified: false`.
|
|
28
|
+
|
|
29
|
+
- cf1313d: Make the ad render path version-proof and drop the 0xSlots SDK from the bundle.
|
|
30
|
+
|
|
31
|
+
Reading a slot's creative used to go through the SDK's `getSlotInfo()`, which decodes a large struct whose shape changes as the protocol evolves — a slot deployed after the `module` → `utility` rename fails to decode against an older SDK ABI, breaking rendering entirely. The render path now issues two single-value reads instead (`module()` on the slot, then `tokenURI(slot)` on the module), which cannot drift that way.
|
|
32
|
+
|
|
33
|
+
With the last value import of `@0xslots/sdk` removed (`SlotsChain.BASE` is now a plain constant), the SDK no longer ends up in a publisher's bundle at all.
|
|
34
|
+
|
|
35
|
+
Breaking for two low-level exports — `<Ad>` and `<adland-slot>` are unchanged:
|
|
36
|
+
|
|
37
|
+
- `createReadClient` now returns a viem `PublicClient` instead of a `SlotsClient`, and no longer takes a `subgraphUrl` argument.
|
|
38
|
+
- `fetchMetadataURI` now takes a viem `PublicClient`.
|
|
39
|
+
- `AdlandConfig.subgraphUrl` is removed; reads need RPC only.
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [b32cc89]
|
|
44
|
+
- Updated dependencies [55d2d70]
|
|
45
|
+
- Updated dependencies [cf1313d]
|
|
46
|
+
- @adland/react@0.18.0
|
|
47
|
+
- @adland/data@0.16.2
|
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# @adland/embed
|
|
2
|
+
|
|
3
|
+
Framework-free `<adland-slot>` web component for embedding AdLand ad slots on any
|
|
4
|
+
site — no React required.
|
|
5
|
+
|
|
6
|
+
## Copy & paste
|
|
7
|
+
|
|
8
|
+
```html
|
|
9
|
+
<script src="https://cdn.adland.space/v1/adland.js" async></script>
|
|
10
|
+
|
|
11
|
+
<adland-slot slot="0xYourSlotAddress"></adland-slot>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
That renders a polished ad card in a sandboxed iframe (`render-mode="isolated"`,
|
|
15
|
+
the safe default). Nothing else to configure.
|
|
16
|
+
|
|
17
|
+
For Farcaster Mini Apps, use the Mini App bundle instead — same element, Farcaster
|
|
18
|
+
click routing:
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<script src="https://cdn.adland.space/v1/adland-farcaster.js" async></script>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Attributes
|
|
25
|
+
|
|
26
|
+
| Attribute | Description |
|
|
27
|
+
| --------------- | ------------------------------------------------------------------ |
|
|
28
|
+
| `slot` | Slot contract address (required unless `data-ad` is set) |
|
|
29
|
+
| `chain` | Chain id (default `8453`) |
|
|
30
|
+
| `render-mode` | `isolated` (default, sandboxed iframe) or `inline` (shadow DOM) |
|
|
31
|
+
| `placement` | Label sent with events (e.g. `sidebar`) |
|
|
32
|
+
| `gateway` | IPFS gateway origin |
|
|
33
|
+
| `endpoint` | Analytics API base URL |
|
|
34
|
+
| `consent` | `pending` \| `granted` \| `denied` (gates the beacon) |
|
|
35
|
+
| `rpc-url` | Read RPC override |
|
|
36
|
+
| `base-link-url` | Base URL for the empty-slot CTA |
|
|
37
|
+
| `data-ad` | Inline ad JSON to render without an on-chain read |
|
|
38
|
+
|
|
39
|
+
## Styling
|
|
40
|
+
|
|
41
|
+
Three levels, pick what you need:
|
|
42
|
+
|
|
43
|
+
1. **Nothing** — the default card looks good out of the box.
|
|
44
|
+
2. **Quick theming** — set `--adland-*` custom properties on the element. These
|
|
45
|
+
apply in both render modes (they're copied into the isolated iframe):
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<adland-slot
|
|
49
|
+
slot="0x…"
|
|
50
|
+
style="--adland-bg:#111;--adland-fg:#fff;--adland-radius:16px"
|
|
51
|
+
></adland-slot>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
3. **Deep control** — use `render-mode="inline"` and style the exposed parts:
|
|
55
|
+
|
|
56
|
+
```css
|
|
57
|
+
adland-slot::part(card) { border: 2px solid hotpink; }
|
|
58
|
+
adland-slot::part(title) { font-family: "Georgia"; }
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Parts: `card`, `media`, `body`, `title`, `description`, `badge`, `label`.
|
|
62
|
+
|
|
63
|
+
React users wanting full control should use the compound components in
|
|
64
|
+
[`@adland/react`](../react) instead.
|
|
65
|
+
|
|
66
|
+
## Programmatic use
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { registerAdlandSlot, WebActionAdapter } from "@adland/embed";
|
|
70
|
+
// Auto-registered with the web adapter on import; call again to customize.
|
|
71
|
+
registerAdlandSlot(WebActionAdapter);
|
|
72
|
+
```
|