@admeta/sdk 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 admeta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @admeta/sdk
2
+
3
+ Shared types and server-safe primitives for source generated by the admeta monetize Codex Skill.
4
+
5
+ `@admeta/sdk` does not provide advertiser supply, tracking, payouts, or a network. It provides the small, inspectable building blocks used by Sandbox and developer-owned BYO integrations.
@@ -0,0 +1,36 @@
1
+ /** Shared server-safe primitives for application-specific admeta integrations. */
2
+ export type OfferMode = 'sandbox' | 'byo';
3
+ export type ServerOffer = {
4
+ id: string;
5
+ advertiser: string;
6
+ title: string;
7
+ price: string;
8
+ mode: OfferMode;
9
+ destinationUrl: URL;
10
+ intent: string;
11
+ surface: string;
12
+ };
13
+ export type DisplayOffer = Omit<ServerOffer, 'destinationUrl'> & {
14
+ clickUrl: string;
15
+ };
16
+ export type CommercialInteractionReceipt = {
17
+ receipt_id: string;
18
+ publisher: string;
19
+ offer_id: string;
20
+ intent: string;
21
+ surface: string;
22
+ event: 'click';
23
+ timestamp: string;
24
+ };
25
+ export declare function createSandboxOffer(input: {
26
+ destinationUrl: URL;
27
+ intent: string;
28
+ surface: string;
29
+ }): ServerOffer;
30
+ export declare function isHttpsUrl(value: URL | string): boolean;
31
+ export declare function createCommercialInteractionReceipt(input: {
32
+ publisher: string;
33
+ offer: Pick<ServerOffer, 'id' | 'intent' | 'surface'>;
34
+ receiptId?: string;
35
+ timestamp?: string;
36
+ }): CommercialInteractionReceipt;
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ export function createSandboxOffer(input) {
2
+ return {
3
+ id: 'demosim-europe-10gb',
4
+ advertiser: 'DemoSIM',
5
+ title: 'Europe 10 GB',
6
+ price: '€18',
7
+ mode: 'sandbox',
8
+ ...input,
9
+ };
10
+ }
11
+ export function isHttpsUrl(value) {
12
+ try {
13
+ return new URL(value).protocol === 'https:';
14
+ }
15
+ catch {
16
+ return false;
17
+ }
18
+ }
19
+ export function createCommercialInteractionReceipt(input) {
20
+ const receiptId = input.receiptId ?? globalThis.crypto?.randomUUID?.();
21
+ if (!receiptId)
22
+ throw new Error('A receipt ID is required in this runtime.');
23
+ return {
24
+ receipt_id: receiptId,
25
+ publisher: input.publisher,
26
+ offer_id: input.offer.id,
27
+ intent: input.offer.intent,
28
+ surface: input.offer.surface,
29
+ event: 'click',
30
+ timestamp: input.timestamp ?? new Date().toISOString(),
31
+ };
32
+ }
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@admeta/sdk",
3
+ "version": "0.1.0",
4
+ "description": "Runtime types and privacy-aware monetization primitives for admeta integrations.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/AdMetaNetwork/admeta-monetize.git",
9
+ "directory": "packages/sdk"
10
+ },
11
+ "homepage": "https://github.com/AdMetaNetwork/admeta-monetize#readme",
12
+ "bugs": "https://github.com/AdMetaNetwork/admeta-monetize/issues",
13
+ "type": "module",
14
+ "sideEffects": false,
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "engines": {
29
+ "node": ">=20.9.0"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "provenance": true
34
+ },
35
+ "scripts": {
36
+ "build": "tsc --project tsconfig.build.json",
37
+ "test": "npm run build && node --test test/*.test.mjs",
38
+ "prepack": "npm run build"
39
+ }
40
+ }