glitch-javascript-sdk 3.6.0 → 3.7.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/dist/cjs/index.js +42 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/GameAdvertising.d.ts +66 -2
- package/dist/esm/api/Users.d.ts +49 -4
- package/dist/esm/index.js +42 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/GameAdvertisingRoute.d.ts +4 -0
- package/dist/index.d.ts +115 -6
- package/package.json +1 -1
- package/src/api/GameAdvertising.ts +80 -2
- package/src/api/Users.ts +53 -4
- package/src/routes/GameAdvertisingRoute.ts +8 -0
|
@@ -1,24 +1,88 @@
|
|
|
1
1
|
import { AxiosPromise } from 'axios';
|
|
2
2
|
import Response from '../util/Response';
|
|
3
3
|
export interface GameAdEventPayload {
|
|
4
|
+
/** Opaque token returned by the server-created advertising manifest. */
|
|
4
5
|
token: string;
|
|
6
|
+
/** Client idempotency UUID. Reuse is valid only within the same ad session. */
|
|
5
7
|
event_uuid?: string;
|
|
8
|
+
/** Provider that produced or attempted the event. */
|
|
6
9
|
provider: string;
|
|
10
|
+
/** Stable Glitch placement name, such as game_banner or game_video. */
|
|
7
11
|
placement: string;
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
/** Normalized creative/ad format. */
|
|
13
|
+
format: 'banner' | 'video' | 'interstitial' | 'rewarded' | 'in_game_image' | 'in_game_video' | 'other';
|
|
14
|
+
/** Normalized SDK/ad lifecycle event. */
|
|
15
|
+
event_type: 'sdk_ready' | 'request_started' | 'loaded' | 'channel_registered' | 'measurement' | 'no_fill' | 'fallback_shown' | 'started' | 'impression' | 'viewable' | 'clicked' | 'completed' | 'skipped' | 'closed' | 'paused_game' | 'resumed_game' | 'error';
|
|
16
|
+
/** Optional provider-native event or impression identifier. */
|
|
10
17
|
provider_event_id?: string;
|
|
18
|
+
/** Non-sensitive provider diagnostics and event context. */
|
|
11
19
|
metadata?: Record<string, any>;
|
|
20
|
+
/** ISO 8601 client-observed timestamp. Defaults to server receipt time. */
|
|
12
21
|
occurred_at?: string;
|
|
13
22
|
}
|
|
23
|
+
/** Provider-neutral intrinsic-ad surface declared by a game developer. */
|
|
24
|
+
export interface GameInGameAdPlacement {
|
|
25
|
+
id?: string;
|
|
26
|
+
title_id?: string;
|
|
27
|
+
provider?: 'anzu';
|
|
28
|
+
placement_key: string;
|
|
29
|
+
channel_name: string;
|
|
30
|
+
surface_type: 'mesh' | 'sprite' | 'ui_image' | 'raw_image' | 'html' | 'electron_shell';
|
|
31
|
+
scene_name?: string | null;
|
|
32
|
+
aspect_ratio: number;
|
|
33
|
+
allow_images: boolean;
|
|
34
|
+
allow_videos: boolean;
|
|
35
|
+
allow_audio?: boolean;
|
|
36
|
+
is_dynamic: boolean;
|
|
37
|
+
is_clickable: boolean;
|
|
38
|
+
shrink_to_fit: boolean;
|
|
39
|
+
fallback_media_url?: string | null;
|
|
40
|
+
status: 'active' | 'disabled';
|
|
41
|
+
metadata?: Record<string, any> | null;
|
|
42
|
+
}
|
|
43
|
+
/** Public delivery identity for a provider and runtime platform. */
|
|
44
|
+
export interface GameAdProviderApp {
|
|
45
|
+
id?: string;
|
|
46
|
+
title_id?: string | null;
|
|
47
|
+
provider: 'anzu';
|
|
48
|
+
platform: 'web' | 'electron_macos' | 'electron_windows' | 'electron_linux' | 'unity_webgl' | 'cocos_web' | 'construct_web';
|
|
49
|
+
app_key: string;
|
|
50
|
+
bundle_id?: string | null;
|
|
51
|
+
mode: 'integration' | 'production';
|
|
52
|
+
integration_type: 'managed' | 'direct';
|
|
53
|
+
status: 'active' | 'disabled' | 'pending';
|
|
54
|
+
metadata?: Record<string, any> | null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Typed client for platform-served game advertising.
|
|
58
|
+
*
|
|
59
|
+
* These endpoints manage publisher inventory displayed around playable games;
|
|
60
|
+
* they are intentionally separate from APIs used to buy advertising campaigns.
|
|
61
|
+
*/
|
|
14
62
|
declare class GameAdvertising {
|
|
63
|
+
/** Return developer-visible ad-earnings settings for a title. */
|
|
15
64
|
static settings<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
65
|
+
/** Update developer ad-earnings activation and optional title provider ID. */
|
|
16
66
|
static updateSettings<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
67
|
+
/** Resolve ad eligibility and create an expiring provider manifest/session. */
|
|
17
68
|
static createSession<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
69
|
+
/** Store one normalized, idempotent event for an advertising session. */
|
|
18
70
|
static storeEvent<T>(title_id: string, session_id: string, data: GameAdEventPayload): AxiosPromise<Response<T>>;
|
|
71
|
+
/** Return developer-visible estimated/finalized earnings and delivery totals. */
|
|
19
72
|
static revenueSummary<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
73
|
+
/** Return every intrinsic-ad surface configured for a title. */
|
|
74
|
+
static inGamePlacements<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
75
|
+
/** Atomically replace a title's provider-neutral intrinsic-ad surfaces. */
|
|
76
|
+
static replaceInGamePlacements<T>(title_id: string, placements: GameInGameAdPlacement[]): AxiosPromise<Response<T>>;
|
|
77
|
+
/** Return site-admin delivery settings, aggregate metrics, and recent revenue. */
|
|
20
78
|
static adminDashboard<T>(): AxiosPromise<Response<T>>;
|
|
79
|
+
/** Partially update platform-wide providers and delivery frequency. */
|
|
21
80
|
static adminUpdateSettings<T>(data: object): AxiosPromise<Response<T>>;
|
|
81
|
+
/** Import or reconcile one provider revenue report row. */
|
|
22
82
|
static adminStoreRevenue<T>(data: object): AxiosPromise<Response<T>>;
|
|
83
|
+
/** Return public provider app keys and platform mappings for site admins. */
|
|
84
|
+
static adminProviderApps<T>(): AxiosPromise<Response<T>>;
|
|
85
|
+
/** Create or update a provider app mapping without accepting report secrets. */
|
|
86
|
+
static adminUpsertProviderApp<T>(data: GameAdProviderApp): AxiosPromise<Response<T>>;
|
|
23
87
|
}
|
|
24
88
|
export default GameAdvertising;
|
package/dist/esm/api/Users.d.ts
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
import Response from "../util/Response";
|
|
2
2
|
import { AxiosPromise } from "axios";
|
|
3
|
+
/** Human-readable earning categories returned by influencer payout APIs. */
|
|
4
|
+
export type InfluencerPayoutSourceType = "campaign_compensation" | "ad_revenue_share" | "subscription_residual" | "manual_adjustment";
|
|
5
|
+
/** Auditable metrics and creator-content attribution attached to a payout. */
|
|
6
|
+
export interface InfluencerPayoutBreakdown {
|
|
7
|
+
label?: string;
|
|
8
|
+
payment_method?: "flat" | "performance" | "hybrid";
|
|
9
|
+
provider?: string;
|
|
10
|
+
period_start?: string;
|
|
11
|
+
period_end?: string;
|
|
12
|
+
impressions?: number;
|
|
13
|
+
clicks?: number;
|
|
14
|
+
short_link_id?: string | null;
|
|
15
|
+
short_link_click_id?: string | null;
|
|
16
|
+
social_media_post_id?: string | null;
|
|
17
|
+
tracking_link_label?: string | null;
|
|
18
|
+
social_platform?: string | null;
|
|
19
|
+
social_post_url?: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** One campaign or advertising earning payable to the authenticated influencer. */
|
|
22
|
+
export interface InfluencerPayout {
|
|
23
|
+
id: string;
|
|
24
|
+
user_id: string;
|
|
25
|
+
campaign_id: string;
|
|
26
|
+
amount: number;
|
|
27
|
+
currency: string;
|
|
28
|
+
status: "pending" | "completed" | "failed";
|
|
29
|
+
payout_date?: string | null;
|
|
30
|
+
source_type: InfluencerPayoutSourceType;
|
|
31
|
+
source_label: string;
|
|
32
|
+
source_reference_id?: string | null;
|
|
33
|
+
breakdown?: InfluencerPayoutBreakdown;
|
|
34
|
+
campaign?: Record<string, any>;
|
|
35
|
+
}
|
|
36
|
+
/** Optional filters for the authenticated influencer's payout history. */
|
|
37
|
+
export interface InfluencerPayoutQuery {
|
|
38
|
+
campaign_id?: string;
|
|
39
|
+
month?: number;
|
|
40
|
+
year?: number;
|
|
41
|
+
amount?: number;
|
|
42
|
+
status?: "pending" | "completed" | "failed";
|
|
43
|
+
source_type?: InfluencerPayoutSourceType;
|
|
44
|
+
orderBy?: "created_at" | "amount";
|
|
45
|
+
orderDirection?: "asc" | "desc";
|
|
46
|
+
}
|
|
3
47
|
declare class Users {
|
|
4
48
|
/**
|
|
5
49
|
* List all the users.
|
|
@@ -42,16 +86,17 @@ declare class Users {
|
|
|
42
86
|
*/
|
|
43
87
|
static getCampaignInvites<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
44
88
|
/**
|
|
45
|
-
* Gets payouts from
|
|
89
|
+
* Gets the authenticated influencer's payouts from campaigns and attributed
|
|
90
|
+
* game advertising. Advertising revenue is returned as a separate additive
|
|
91
|
+
* source with provider-period metrics and tracking-link/social-post IDs.
|
|
46
92
|
*
|
|
47
93
|
* @see https://api.glitch.fun/api/documentation#/Users%20Route/showMe
|
|
48
94
|
*
|
|
49
|
-
* @param
|
|
50
|
-
* @param data The data to update.
|
|
95
|
+
* @param params Optional campaign, date, status, source, and ordering filters.
|
|
51
96
|
*
|
|
52
97
|
* @returns promise
|
|
53
98
|
*/
|
|
54
|
-
static getPayouts<T>(params?:
|
|
99
|
+
static getPayouts<T = InfluencerPayout[]>(params?: InfluencerPayoutQuery): AxiosPromise<Response<T>>;
|
|
55
100
|
/**
|
|
56
101
|
* Sync the current influencer's information.
|
|
57
102
|
*
|
package/dist/esm/index.js
CHANGED
|
@@ -9045,12 +9045,13 @@ var Users = /** @class */ (function () {
|
|
|
9045
9045
|
return Requests.processRoute(UserRoutes.routes.getCampaignInvites, {}, undefined, params);
|
|
9046
9046
|
};
|
|
9047
9047
|
/**
|
|
9048
|
-
* Gets payouts from
|
|
9048
|
+
* Gets the authenticated influencer's payouts from campaigns and attributed
|
|
9049
|
+
* game advertising. Advertising revenue is returned as a separate additive
|
|
9050
|
+
* source with provider-period metrics and tracking-link/social-post IDs.
|
|
9049
9051
|
*
|
|
9050
9052
|
* @see https://api.glitch.fun/api/documentation#/Users%20Route/showMe
|
|
9051
9053
|
*
|
|
9052
|
-
* @param
|
|
9053
|
-
* @param data The data to update.
|
|
9054
|
+
* @param params Optional campaign, date, status, source, and ordering filters.
|
|
9054
9055
|
*
|
|
9055
9056
|
* @returns promise
|
|
9056
9057
|
*/
|
|
@@ -20961,46 +20962,84 @@ var MarketResearch = /** @class */ (function () {
|
|
|
20961
20962
|
var GameAdvertisingRoute = /** @class */ (function () {
|
|
20962
20963
|
function GameAdvertisingRoute() {
|
|
20963
20964
|
}
|
|
20965
|
+
/**
|
|
20966
|
+
* Route templates for publisher game-ad inventory, telemetry, earnings, and
|
|
20967
|
+
* site administration. Placeholders are expanded by Requests.processRoute.
|
|
20968
|
+
*/
|
|
20964
20969
|
GameAdvertisingRoute.routes = {
|
|
20965
20970
|
settings: { url: '/titles/{title_id}/advertising/settings', method: HTTP_METHODS.GET },
|
|
20966
20971
|
updateSettings: { url: '/titles/{title_id}/advertising/settings', method: HTTP_METHODS.PUT },
|
|
20967
20972
|
createSession: { url: '/titles/{title_id}/advertising/sessions', method: HTTP_METHODS.POST },
|
|
20968
20973
|
storeEvent: { url: '/titles/{title_id}/advertising/sessions/{session_id}/events', method: HTTP_METHODS.POST },
|
|
20969
20974
|
revenueSummary: { url: '/titles/{title_id}/advertising/revenue-summary', method: HTTP_METHODS.GET },
|
|
20975
|
+
inGamePlacements: { url: '/titles/{title_id}/advertising/in-game/placements', method: HTTP_METHODS.GET },
|
|
20976
|
+
replaceInGamePlacements: { url: '/titles/{title_id}/advertising/in-game/placements', method: HTTP_METHODS.PUT },
|
|
20970
20977
|
adminDashboard: { url: '/admin/game-advertising', method: HTTP_METHODS.GET },
|
|
20971
20978
|
adminUpdateSettings: { url: '/admin/game-advertising/settings', method: HTTP_METHODS.PUT },
|
|
20972
20979
|
adminStoreRevenue: { url: '/admin/game-advertising/revenue', method: HTTP_METHODS.POST },
|
|
20980
|
+
adminProviderApps: { url: '/admin/game-advertising/provider-apps', method: HTTP_METHODS.GET },
|
|
20981
|
+
adminUpsertProviderApp: { url: '/admin/game-advertising/provider-apps', method: HTTP_METHODS.PUT },
|
|
20973
20982
|
};
|
|
20974
20983
|
return GameAdvertisingRoute;
|
|
20975
20984
|
}());
|
|
20976
20985
|
|
|
20986
|
+
/**
|
|
20987
|
+
* Typed client for platform-served game advertising.
|
|
20988
|
+
*
|
|
20989
|
+
* These endpoints manage publisher inventory displayed around playable games;
|
|
20990
|
+
* they are intentionally separate from APIs used to buy advertising campaigns.
|
|
20991
|
+
*/
|
|
20977
20992
|
var GameAdvertising = /** @class */ (function () {
|
|
20978
20993
|
function GameAdvertising() {
|
|
20979
20994
|
}
|
|
20995
|
+
/** Return developer-visible ad-earnings settings for a title. */
|
|
20980
20996
|
GameAdvertising.settings = function (title_id) {
|
|
20981
20997
|
return Requests.processRoute(GameAdvertisingRoute.routes.settings, undefined, { title_id: title_id });
|
|
20982
20998
|
};
|
|
20999
|
+
/** Update developer ad-earnings activation and optional title provider ID. */
|
|
20983
21000
|
GameAdvertising.updateSettings = function (title_id, data) {
|
|
20984
21001
|
return Requests.processRoute(GameAdvertisingRoute.routes.updateSettings, data, { title_id: title_id });
|
|
20985
21002
|
};
|
|
21003
|
+
/** Resolve ad eligibility and create an expiring provider manifest/session. */
|
|
20986
21004
|
GameAdvertising.createSession = function (title_id, data) {
|
|
20987
21005
|
return Requests.processRoute(GameAdvertisingRoute.routes.createSession, data, { title_id: title_id });
|
|
20988
21006
|
};
|
|
21007
|
+
/** Store one normalized, idempotent event for an advertising session. */
|
|
20989
21008
|
GameAdvertising.storeEvent = function (title_id, session_id, data) {
|
|
20990
21009
|
return Requests.processRoute(GameAdvertisingRoute.routes.storeEvent, data, { title_id: title_id, session_id: session_id });
|
|
20991
21010
|
};
|
|
21011
|
+
/** Return developer-visible estimated/finalized earnings and delivery totals. */
|
|
20992
21012
|
GameAdvertising.revenueSummary = function (title_id, params) {
|
|
20993
21013
|
return Requests.processRoute(GameAdvertisingRoute.routes.revenueSummary, undefined, { title_id: title_id }, params);
|
|
20994
21014
|
};
|
|
21015
|
+
/** Return every intrinsic-ad surface configured for a title. */
|
|
21016
|
+
GameAdvertising.inGamePlacements = function (title_id) {
|
|
21017
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.inGamePlacements, undefined, { title_id: title_id });
|
|
21018
|
+
};
|
|
21019
|
+
/** Atomically replace a title's provider-neutral intrinsic-ad surfaces. */
|
|
21020
|
+
GameAdvertising.replaceInGamePlacements = function (title_id, placements) {
|
|
21021
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.replaceInGamePlacements, { placements: placements }, { title_id: title_id });
|
|
21022
|
+
};
|
|
21023
|
+
/** Return site-admin delivery settings, aggregate metrics, and recent revenue. */
|
|
20995
21024
|
GameAdvertising.adminDashboard = function () {
|
|
20996
21025
|
return Requests.processRoute(GameAdvertisingRoute.routes.adminDashboard);
|
|
20997
21026
|
};
|
|
21027
|
+
/** Partially update platform-wide providers and delivery frequency. */
|
|
20998
21028
|
GameAdvertising.adminUpdateSettings = function (data) {
|
|
20999
21029
|
return Requests.processRoute(GameAdvertisingRoute.routes.adminUpdateSettings, data);
|
|
21000
21030
|
};
|
|
21031
|
+
/** Import or reconcile one provider revenue report row. */
|
|
21001
21032
|
GameAdvertising.adminStoreRevenue = function (data) {
|
|
21002
21033
|
return Requests.processRoute(GameAdvertisingRoute.routes.adminStoreRevenue, data);
|
|
21003
21034
|
};
|
|
21035
|
+
/** Return public provider app keys and platform mappings for site admins. */
|
|
21036
|
+
GameAdvertising.adminProviderApps = function () {
|
|
21037
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminProviderApps);
|
|
21038
|
+
};
|
|
21039
|
+
/** Create or update a provider app mapping without accepting report secrets. */
|
|
21040
|
+
GameAdvertising.adminUpsertProviderApp = function (data) {
|
|
21041
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminUpsertProviderApp, data);
|
|
21042
|
+
};
|
|
21004
21043
|
return GameAdvertising;
|
|
21005
21044
|
}());
|
|
21006
21045
|
|