glitch-javascript-sdk 3.10.7 → 3.15.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/README.md +7 -1
- package/dist/browser/hosting-runtime.js +12 -2
- package/dist/browser/hosting-runtime.js.map +1 -1
- package/dist/cjs/index.js +876 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/FestivalNetworking.d.ts +286 -0
- package/dist/esm/api/GameShows.d.ts +22 -0
- package/dist/esm/api/Messages.d.ts +4 -1
- package/dist/esm/api/Microtransactions.d.ts +554 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.js +766 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/FestivalNetworkingRoute.d.ts +7 -0
- package/dist/esm/routes/MicrotransactionsRoute.d.ts +8 -0
- package/dist/esm/util/MicrotransactionBridge.d.ts +93 -0
- package/dist/esm/util/MicrotransactionOverlay.d.ts +59 -0
- package/dist/esm/util/Requests.d.ts +5 -3
- package/dist/index.d.ts +1010 -5
- package/guides/microtransactions.md +385 -0
- package/package.json +7 -4
- package/src/api/FestivalNetworking.ts +216 -0
- package/src/api/GameShows.ts +24 -0
- package/src/api/Messages.ts +4 -1
- package/src/api/Microtransactions.ts +509 -0
- package/src/api/index.ts +2 -0
- package/src/index.ts +8 -0
- package/src/routes/FestivalNetworkingRoute.ts +33 -0
- package/src/routes/GameShowsRoute.ts +1 -0
- package/src/routes/MicrotransactionsRoute.ts +46 -0
- package/src/util/MicrotransactionBridge.ts +193 -0
- package/src/util/MicrotransactionOverlay.ts +302 -0
- package/src/util/Requests.ts +14 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosPromise, AxiosProgressEvent } from 'axios';
|
|
1
|
+
import { AxiosPromise, AxiosProgressEvent, AxiosRequestConfig } from 'axios';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Config
|
|
@@ -5916,7 +5916,10 @@ declare class Messages {
|
|
|
5916
5916
|
*/
|
|
5917
5917
|
static listMessageThreads<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
5918
5918
|
/**
|
|
5919
|
-
* Send a new message that will be added to a thread
|
|
5919
|
+
* Send a new message that will be added to a thread. Festival-scoped threads
|
|
5920
|
+
* enforce current admission, blocking and read-only state server-side.
|
|
5921
|
+
* Include an optional client_message_id UUID and reuse it when retrying a
|
|
5922
|
+
* timed-out request to prevent duplicate messages and notifications.
|
|
5920
5923
|
*
|
|
5921
5924
|
* @see https://api.glitch.fun/api/documentation#/Messages/storeMessage
|
|
5922
5925
|
*
|
|
@@ -6272,6 +6275,11 @@ interface GameShowScheduleTicketRefundInput {
|
|
|
6272
6275
|
amount_cents: number;
|
|
6273
6276
|
reason?: string;
|
|
6274
6277
|
}
|
|
6278
|
+
interface GameShowTitleCandidateSearchParams {
|
|
6279
|
+
q: string;
|
|
6280
|
+
page?: number;
|
|
6281
|
+
per_page?: number;
|
|
6282
|
+
}
|
|
6275
6283
|
declare class GameShows {
|
|
6276
6284
|
/**
|
|
6277
6285
|
* List all the GameShows.
|
|
@@ -6389,6 +6397,8 @@ declare class GameShows {
|
|
|
6389
6397
|
* Add a title to a game show by admin.
|
|
6390
6398
|
*/
|
|
6391
6399
|
static addTitle<T>(show_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
6400
|
+
/** Search privacy-safe registered Glitch games that an organizer may attach to a festival. */
|
|
6401
|
+
static searchTitleCandidates<T>(show_id: string, params: GameShowTitleCandidateSearchParams): AxiosPromise<Response<T>>;
|
|
6392
6402
|
/** Preview CSV/TSV/TXT/ZIP registrations without writing showcase data. */
|
|
6393
6403
|
static previewExternalTitles<T>(show_id: string, file: File, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
6394
6404
|
/** Import valid external registrations after organizer preview. */
|
|
@@ -11883,6 +11893,997 @@ declare class GameDesign {
|
|
|
11883
11893
|
static generateBlueprint<T = GameDesignBlueprint>(input: GameDesignBlueprintInput): AxiosPromise<Response<T>>;
|
|
11884
11894
|
}
|
|
11885
11895
|
|
|
11896
|
+
type FestivalPostKind = 'discussion' | 'job' | 'talent';
|
|
11897
|
+
type FestivalPostState = 'active' | 'locked' | 'archived' | 'hidden' | 'deleted' | 'removed' | 'paused' | 'filled' | 'expired' | 'closed';
|
|
11898
|
+
type FestivalApplicationState = 'submitted' | 'viewed' | 'shortlisted' | 'interview' | 'accepted' | 'rejected' | 'withdrawn' | 'closed';
|
|
11899
|
+
type FestivalWorkType = 'full_time' | 'part_time' | 'contract' | 'gig';
|
|
11900
|
+
type FestivalRequestOptions = Pick<AxiosRequestConfig, 'signal' | 'timeout'>;
|
|
11901
|
+
interface FestivalNetworkingSettings {
|
|
11902
|
+
discussions_enabled: boolean;
|
|
11903
|
+
jobs_enabled: boolean;
|
|
11904
|
+
employer_posts_enabled: boolean;
|
|
11905
|
+
talent_posts_enabled: boolean;
|
|
11906
|
+
matching_enabled: boolean;
|
|
11907
|
+
voting_enabled: boolean;
|
|
11908
|
+
comments_enabled: boolean;
|
|
11909
|
+
media_enabled: boolean;
|
|
11910
|
+
/** Registration or a valid ticket is mandatory; cannot be disabled. */
|
|
11911
|
+
require_registration: true;
|
|
11912
|
+
public_viewing: false;
|
|
11913
|
+
anonymous_enabled: false;
|
|
11914
|
+
categories: string[];
|
|
11915
|
+
skills: string[];
|
|
11916
|
+
}
|
|
11917
|
+
interface FestivalPostInput {
|
|
11918
|
+
kind: FestivalPostKind;
|
|
11919
|
+
title: string;
|
|
11920
|
+
/** Sanitized HTML from the shared WYSIWYG editor. */
|
|
11921
|
+
content: string;
|
|
11922
|
+
visibility?: 'public' | 'unlisted' | 'private';
|
|
11923
|
+
category?: string | null;
|
|
11924
|
+
tags?: string[];
|
|
11925
|
+
skills?: string[];
|
|
11926
|
+
preferred_skills?: string[];
|
|
11927
|
+
job_types?: FestivalWorkType[];
|
|
11928
|
+
company?: string | null;
|
|
11929
|
+
organization_id?: string | null;
|
|
11930
|
+
work_arrangement?: 'remote' | 'onsite' | 'hybrid' | null;
|
|
11931
|
+
experience?: 'any' | 'entry' | 'junior' | 'mid' | 'senior' | 'lead' | null;
|
|
11932
|
+
location?: string | null;
|
|
11933
|
+
availability?: 'immediately' | 'within_30_days' | 'specific_date' | 'flexible' | 'unavailable';
|
|
11934
|
+
availability_date?: string | null;
|
|
11935
|
+
deadline?: string | null;
|
|
11936
|
+
expires_at?: string | null;
|
|
11937
|
+
compensation_type?: 'negotiable' | 'yearly' | 'monthly' | 'hourly' | 'flat_fee';
|
|
11938
|
+
compensation_min?: number | null;
|
|
11939
|
+
compensation_max?: number | null;
|
|
11940
|
+
currency?: string | null;
|
|
11941
|
+
portfolio_url?: string | null;
|
|
11942
|
+
application_method?: 'internal' | 'external';
|
|
11943
|
+
application_url?: string | null;
|
|
11944
|
+
/** UserMedia IDs returned by uploadMedia, NOT Media IDs or clip-library selections. Max 8. */
|
|
11945
|
+
media_ids?: string[];
|
|
11946
|
+
public_compensation?: boolean;
|
|
11947
|
+
public_location?: boolean;
|
|
11948
|
+
public_availability?: boolean;
|
|
11949
|
+
public_portfolio?: boolean;
|
|
11950
|
+
}
|
|
11951
|
+
interface FestivalNetworkingFilters {
|
|
11952
|
+
kind?: FestivalPostKind;
|
|
11953
|
+
view?: 'all' | 'mine' | 'saved' | 'hidden' | 'comments';
|
|
11954
|
+
sort?: 'new' | 'hot' | 'top' | 'discussed' | 'compensation' | 'deadline';
|
|
11955
|
+
window?: 'today' | 'week' | 'month' | 'festival' | 'all';
|
|
11956
|
+
q?: string;
|
|
11957
|
+
category?: string;
|
|
11958
|
+
skill?: string;
|
|
11959
|
+
job_type?: FestivalWorkType;
|
|
11960
|
+
arrangement?: 'remote' | 'onsite' | 'hybrid';
|
|
11961
|
+
experience?: string;
|
|
11962
|
+
location?: string;
|
|
11963
|
+
company?: string;
|
|
11964
|
+
availability?: string;
|
|
11965
|
+
currency?: string;
|
|
11966
|
+
compensation_type?: string;
|
|
11967
|
+
min_compensation?: number;
|
|
11968
|
+
tag?: string;
|
|
11969
|
+
author?: string;
|
|
11970
|
+
has_comments?: boolean;
|
|
11971
|
+
has_portfolio?: boolean;
|
|
11972
|
+
media_type?: 'image' | 'video';
|
|
11973
|
+
page?: number;
|
|
11974
|
+
per_page?: number;
|
|
11975
|
+
}
|
|
11976
|
+
interface FestivalMediaUpload {
|
|
11977
|
+
id: string;
|
|
11978
|
+
user_media_id: string;
|
|
11979
|
+
media_id: string;
|
|
11980
|
+
url: string;
|
|
11981
|
+
mime_type: string;
|
|
11982
|
+
size: number;
|
|
11983
|
+
title: string;
|
|
11984
|
+
processing_status: 'completed' | 'pending' | 'processing' | 'failed';
|
|
11985
|
+
}
|
|
11986
|
+
interface FestivalNetworkingProfile {
|
|
11987
|
+
id: string | null;
|
|
11988
|
+
name: string;
|
|
11989
|
+
}
|
|
11990
|
+
interface FestivalNetworkingResponse<T> {
|
|
11991
|
+
data: T;
|
|
11992
|
+
message?: string;
|
|
11993
|
+
meta?: {
|
|
11994
|
+
current_page: number;
|
|
11995
|
+
last_page: number;
|
|
11996
|
+
total?: number;
|
|
11997
|
+
};
|
|
11998
|
+
has_access?: boolean;
|
|
11999
|
+
can_manage?: boolean;
|
|
12000
|
+
can_moderate?: boolean;
|
|
12001
|
+
user?: FestivalNetworkingProfile | null;
|
|
12002
|
+
show?: {
|
|
12003
|
+
id: string;
|
|
12004
|
+
name: string;
|
|
12005
|
+
};
|
|
12006
|
+
audit?: Array<Record<string, unknown>>;
|
|
12007
|
+
}
|
|
12008
|
+
interface FestivalPost {
|
|
12009
|
+
id: string;
|
|
12010
|
+
game_show_id: string;
|
|
12011
|
+
parent_id: string | null;
|
|
12012
|
+
kind: FestivalPostKind | 'comment';
|
|
12013
|
+
title: string;
|
|
12014
|
+
content: string;
|
|
12015
|
+
state: FestivalPostState;
|
|
12016
|
+
visibility: 'public' | 'unlisted' | 'private';
|
|
12017
|
+
details: Partial<FestivalPostInput>;
|
|
12018
|
+
author: FestivalNetworkingProfile | null;
|
|
12019
|
+
created_at: string;
|
|
12020
|
+
updated_at: string;
|
|
12021
|
+
score: number;
|
|
12022
|
+
my_vote: -1 | 0 | 1;
|
|
12023
|
+
saved: boolean;
|
|
12024
|
+
is_owner: boolean;
|
|
12025
|
+
can_edit: boolean;
|
|
12026
|
+
comment_count: number;
|
|
12027
|
+
media: Array<{
|
|
12028
|
+
id: string;
|
|
12029
|
+
user_media_id?: string | null;
|
|
12030
|
+
url: string;
|
|
12031
|
+
mime_type: string;
|
|
12032
|
+
title: string | null;
|
|
12033
|
+
}>;
|
|
12034
|
+
my_application?: {
|
|
12035
|
+
id: string;
|
|
12036
|
+
status: FestivalApplicationState;
|
|
12037
|
+
} | null;
|
|
12038
|
+
match?: {
|
|
12039
|
+
score: number;
|
|
12040
|
+
reasons: string[];
|
|
12041
|
+
missing_required_skills: string[];
|
|
12042
|
+
disclaimer: string;
|
|
12043
|
+
};
|
|
12044
|
+
}
|
|
12045
|
+
interface FestivalApplicationInput {
|
|
12046
|
+
message?: string;
|
|
12047
|
+
portfolio?: string[];
|
|
12048
|
+
}
|
|
12049
|
+
interface FestivalConversation {
|
|
12050
|
+
id: string;
|
|
12051
|
+
festival_application_id: string;
|
|
12052
|
+
can_send: boolean;
|
|
12053
|
+
read_only_reason: string | null;
|
|
12054
|
+
festival_context: {
|
|
12055
|
+
game_show_id: string;
|
|
12056
|
+
post_id: string | null;
|
|
12057
|
+
title: string;
|
|
12058
|
+
kind: FestivalPostKind;
|
|
12059
|
+
application_status: FestivalApplicationState;
|
|
12060
|
+
} | null;
|
|
12061
|
+
users: Array<{
|
|
12062
|
+
id: string | null;
|
|
12063
|
+
display_name: string;
|
|
12064
|
+
avatar: string | null;
|
|
12065
|
+
}>;
|
|
12066
|
+
messages: Array<{
|
|
12067
|
+
id: string;
|
|
12068
|
+
thread_id: string;
|
|
12069
|
+
user_id: string | null;
|
|
12070
|
+
message: string;
|
|
12071
|
+
client_message_id: string | null;
|
|
12072
|
+
created_at: string;
|
|
12073
|
+
updated_at: string;
|
|
12074
|
+
user: {
|
|
12075
|
+
id: string | null;
|
|
12076
|
+
display_name: string;
|
|
12077
|
+
avatar: string | null;
|
|
12078
|
+
};
|
|
12079
|
+
}>;
|
|
12080
|
+
}
|
|
12081
|
+
interface FestivalPreferences {
|
|
12082
|
+
notifications?: boolean;
|
|
12083
|
+
blocked_users?: string[];
|
|
12084
|
+
blocked_companies?: string[];
|
|
12085
|
+
}
|
|
12086
|
+
interface FestivalReportInput {
|
|
12087
|
+
reason: 'spam' | 'harassment' | 'hate' | 'sexual_content' | 'scam' | 'job_scam' | 'copyright' | 'malicious_link' | 'misleading' | 'other';
|
|
12088
|
+
explanation?: string;
|
|
12089
|
+
}
|
|
12090
|
+
/** Festival-scoped discussions, talent, jobs, moderation and new owned media uploads. */
|
|
12091
|
+
declare class FestivalNetworking {
|
|
12092
|
+
private static request;
|
|
12093
|
+
/** Read enabled tools and the current account's registration/ticket access. */
|
|
12094
|
+
static settings<T = FestivalNetworkingSettings>(id: string, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12095
|
+
/** Organizer-only settings update; admission remains mandatory. */
|
|
12096
|
+
static updateSettings<T = FestivalNetworkingSettings>(id: string, data: Partial<FestivalNetworkingSettings>): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12097
|
+
/** Search posts; compensation comparisons require currency and period. */
|
|
12098
|
+
static listPosts<T = FestivalPost[]>(id: string, params?: FestivalNetworkingFilters, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12099
|
+
/** Create a post with rich HTML and optional newly uploaded UserMedia IDs. */
|
|
12100
|
+
static createPost<T = FestivalPost>(id: string, data: FestivalPostInput): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12101
|
+
/** Direct links still require admission and content visibility permission. */
|
|
12102
|
+
static getPost<T = FestivalPost>(id: string, post_id: string, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12103
|
+
/** Edit or soft-delete via state; omit media_ids to preserve current attachments. */
|
|
12104
|
+
static updatePost<T = FestivalPost>(id: string, post_id: string, data: Partial<FestivalPostInput> & {
|
|
12105
|
+
state?: FestivalPostState;
|
|
12106
|
+
}): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12107
|
+
/** Paginated direct replies; fetch children to expand a thread. */
|
|
12108
|
+
static listComments<T = FestivalPost[]>(id: string, post_id: string, params?: {
|
|
12109
|
+
page?: number;
|
|
12110
|
+
}, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12111
|
+
/** Add a rich-text reply, subject to locking and five-level nesting. */
|
|
12112
|
+
static createComment<T = FestivalPost>(id: string, post_id: string, data: {
|
|
12113
|
+
content: string;
|
|
12114
|
+
}): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12115
|
+
/** Set, replace, or remove a vote/save/hide idempotently. */
|
|
12116
|
+
static setInteraction<T = FestivalPost>(id: string, post_id: string, data: {
|
|
12117
|
+
action: 'vote' | 'saved' | 'hidden';
|
|
12118
|
+
value: -1 | 0 | 1;
|
|
12119
|
+
}): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12120
|
+
/** Apply or express interest once; the original listing is snapshotted. */
|
|
12121
|
+
static apply<T = Record<string, unknown>>(id: string, post_id: string, data: FestivalApplicationInput): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12122
|
+
/** Discovery matches for the current user's own job/talent listing. */
|
|
12123
|
+
static matches<T = FestivalPost[]>(id: string, post_id: string, params?: {
|
|
12124
|
+
page?: number;
|
|
12125
|
+
}, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12126
|
+
/** Report suspicious content privately to festival moderators. */
|
|
12127
|
+
static report<T = never>(id: string, post_id: string, data: FestivalReportInput): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12128
|
+
/** Only the applicant and listing owner receive application records. */
|
|
12129
|
+
static applications<T = Array<Record<string, unknown>>>(id: string, params?: {
|
|
12130
|
+
page?: number;
|
|
12131
|
+
}, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12132
|
+
/** Applicant withdrawal or owner-managed status changes. */
|
|
12133
|
+
static updateApplication<T = Record<string, unknown>>(id: string, application_id: string, data: {
|
|
12134
|
+
status: Exclude<FestivalApplicationState, 'submitted'>;
|
|
12135
|
+
}): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12136
|
+
/** Open the application/talent inquiry's private shared-inbox conversation, creating it once for legacy applications. Only the applicant and original listing owner may call this. Use Messages.getThread/sendMessage for subsequent conversation activity. */
|
|
12137
|
+
static conversation<T = FestivalConversation>(id: string, application_id: string): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12138
|
+
/** Moderator-only report queue and audit history. */
|
|
12139
|
+
static moderation<T = Array<Record<string, unknown>>>(id: string, params?: {
|
|
12140
|
+
page?: number;
|
|
12141
|
+
}, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12142
|
+
/** Moderation remains available even while the board is disabled. */
|
|
12143
|
+
static moderatePost<T = FestivalPost>(id: string, post_id: string, data: {
|
|
12144
|
+
state?: 'active' | 'hidden' | 'locked' | 'deleted' | 'removed';
|
|
12145
|
+
remove_media?: true;
|
|
12146
|
+
}): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12147
|
+
/** Resolve, dismiss or begin reviewing a report. */
|
|
12148
|
+
static resolveReport<T = never>(id: string, report_id: string, data: {
|
|
12149
|
+
status: 'under_review' | 'resolved' | 'dismissed';
|
|
12150
|
+
}): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12151
|
+
/** Moderator-only participant restrictions. */
|
|
12152
|
+
static restrictMember<T = never>(id: string, user_id: string, data: {
|
|
12153
|
+
banned: boolean;
|
|
12154
|
+
}): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12155
|
+
/** Current user's privacy and notification preferences. */
|
|
12156
|
+
static preferences<T = FestivalPreferences>(id: string, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12157
|
+
/** Set notification opt-out and blocked participants/companies. */
|
|
12158
|
+
static updatePreferences<T = FestivalPreferences>(id: string, data: FestivalPreferences): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12159
|
+
/** Uploaded festival attachments only; not the gameplay clip library. */
|
|
12160
|
+
static media<T = Array<Record<string, unknown>>>(id: string, params?: {
|
|
12161
|
+
page?: number;
|
|
12162
|
+
}, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12163
|
+
/**
|
|
12164
|
+
* Upload a new image (10 MB max) or video (100 MB max), using the existing media pipeline.
|
|
12165
|
+
* The response ID is an owned UserMedia ID for createPost/updatePost media_ids.
|
|
12166
|
+
* @param file New file selected by the attendee; supported images exclude SVG.
|
|
12167
|
+
* @param data Which enabled board the upload is for.
|
|
12168
|
+
* @param onUploadProgress Transfer progress; 100% may still require conversion before completion.
|
|
12169
|
+
*/
|
|
12170
|
+
static uploadMedia<T = FestivalMediaUpload>(id: string, file: File | Blob, data: {
|
|
12171
|
+
kind: FestivalPostKind;
|
|
12172
|
+
}, onUploadProgress?: (event: AxiosProgressEvent) => void, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12173
|
+
/** Organizations the authenticated user is authorized to represent. */
|
|
12174
|
+
static organizations<T = Array<{
|
|
12175
|
+
id: string;
|
|
12176
|
+
name: string;
|
|
12177
|
+
}>>(id: string, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12178
|
+
/** Organizer-only aggregate participation metrics. */
|
|
12179
|
+
static analytics<T = Record<string, unknown>>(id: string, options?: FestivalRequestOptions): AxiosPromise<FestivalNetworkingResponse<T>>;
|
|
12180
|
+
}
|
|
12181
|
+
|
|
12182
|
+
type MicrotransactionEnvironment = 'sandbox' | 'live';
|
|
12183
|
+
type MicrotransactionProductType = 'durable' | 'consumable' | 'currency' | 'bundle' | 'pass';
|
|
12184
|
+
type MicrotransactionCurrency = 'USD' | 'EUR' | 'GBP' | 'CAD' | 'AUD' | 'JPY' | 'BRL' | 'INR' | 'KRW';
|
|
12185
|
+
type MicrotransactionProductStatus = 'draft' | 'active' | 'archived';
|
|
12186
|
+
type MicrotransactionPaymentStatus = 'created' | 'action_required' | 'pending' | 'unknown' | 'paid' | 'failed' | 'canceled' | 'refund_pending' | 'partially_refunded' | 'refunded' | 'disputed' | 'quarantined';
|
|
12187
|
+
type MicrotransactionFulfillmentStatus = 'not_ready' | 'pending' | 'delivered' | 'retrying' | 'failed' | 'revoked' | 'partially_recovered';
|
|
12188
|
+
type MicrotransactionAbility = 'commerce:read' | 'commerce:write' | 'commerce:finance' | 'commerce:fulfill';
|
|
12189
|
+
type MicrotransactionErrorCode = 'authentication_required' | 'permission_denied' | 'human_approval_required' | 'not_found' | 'not_eligible' | 'quote_expired' | 'already_owned' | 'idempotency_conflict' | 'payment_unknown' | 'rate_limited' | 'invalid_revenue_configuration' | 'fulfillment_pending' | 'provider_unavailable';
|
|
12190
|
+
/** The backend's JSON envelope; Axios returns this envelope in response.data. */
|
|
12191
|
+
interface MicrotransactionResponse<T> {
|
|
12192
|
+
data: T;
|
|
12193
|
+
message?: string;
|
|
12194
|
+
success?: boolean;
|
|
12195
|
+
}
|
|
12196
|
+
interface MicrotransactionError {
|
|
12197
|
+
message: string;
|
|
12198
|
+
code?: MicrotransactionErrorCode | string;
|
|
12199
|
+
errors?: Record<string, string[]>;
|
|
12200
|
+
}
|
|
12201
|
+
interface MicrotransactionRequestOptions extends Pick<AxiosRequestConfig, 'signal' | 'timeout'> {
|
|
12202
|
+
/** Optional short-lived commerce-only player token. Never a shipped developer/title token. */
|
|
12203
|
+
playerToken?: string;
|
|
12204
|
+
}
|
|
12205
|
+
interface MicrotransactionSessionOptions extends MicrotransactionRequestOptions {
|
|
12206
|
+
/** Required limited checkout capability; sent only in X-Checkout-Token, never a query. */
|
|
12207
|
+
checkoutToken: string;
|
|
12208
|
+
}
|
|
12209
|
+
interface MicrotransactionEnvironmentFilter {
|
|
12210
|
+
environment?: MicrotransactionEnvironment;
|
|
12211
|
+
}
|
|
12212
|
+
/** Self-only purchase-history filters. Identity comes from authentication, never a user_id argument. */
|
|
12213
|
+
interface MicrotransactionMyPurchasesFilters extends MicrotransactionEnvironmentFilter {
|
|
12214
|
+
/** Page number, integer 1–10000. Defaults to 1; ordering is created_at DESC, id DESC. */
|
|
12215
|
+
page?: number;
|
|
12216
|
+
/** Integer 1–100. Defaults to 20. No cursor or product filter is supported. */
|
|
12217
|
+
per_page?: number;
|
|
12218
|
+
}
|
|
12219
|
+
interface MicrotransactionCatalogFilter extends MicrotransactionEnvironmentFilter {
|
|
12220
|
+
country?: string;
|
|
12221
|
+
currency?: string;
|
|
12222
|
+
channel?: 'web';
|
|
12223
|
+
}
|
|
12224
|
+
interface MicrotransactionMedia {
|
|
12225
|
+
id: string;
|
|
12226
|
+
url: string;
|
|
12227
|
+
mime_type: string;
|
|
12228
|
+
poster?: string | null;
|
|
12229
|
+
}
|
|
12230
|
+
interface MicrotransactionBranding {
|
|
12231
|
+
display_name?: string | null;
|
|
12232
|
+
accent_color?: string | null;
|
|
12233
|
+
/** Existing authorized title Media ID, not an external URL or UserMedia ID. */
|
|
12234
|
+
logo_media_id?: string | null;
|
|
12235
|
+
/** Resolved public Media returned for display; not a writable branding input. */
|
|
12236
|
+
logo_media?: MicrotransactionMedia | null;
|
|
12237
|
+
}
|
|
12238
|
+
interface MicrotransactionPrice {
|
|
12239
|
+
/** Uppercase ISO 4217 currency. Not all currencies have two decimal places. */
|
|
12240
|
+
currency: MicrotransactionCurrency;
|
|
12241
|
+
/** Uppercase ISO 3166-1 alpha-2 buyer country, or '*' default. */
|
|
12242
|
+
country: string;
|
|
12243
|
+
/** Integer 1–100000 in currency minor units: USD 499 means $4.99; JPY 499 means ¥499. Provider minima apply separately. */
|
|
12244
|
+
amount_minor: number;
|
|
12245
|
+
}
|
|
12246
|
+
interface MicrotransactionGrant {
|
|
12247
|
+
/** Stable per-title inventory key; never a client-supplied grant at checkout. */
|
|
12248
|
+
key: string;
|
|
12249
|
+
quantity: number;
|
|
12250
|
+
kind: 'durable' | 'consumable' | 'pass';
|
|
12251
|
+
/** Required for pass grants; 60–31536000 seconds. Durable quantity must be one. */
|
|
12252
|
+
duration_seconds?: number | null;
|
|
12253
|
+
}
|
|
12254
|
+
interface MicrotransactionProductInput {
|
|
12255
|
+
sku: string;
|
|
12256
|
+
name: string;
|
|
12257
|
+
description?: string;
|
|
12258
|
+
type: MicrotransactionProductType;
|
|
12259
|
+
status?: MicrotransactionProductStatus;
|
|
12260
|
+
/** Attach IDs from the existing title-authorized Media pipeline. No arbitrary media URLs. */
|
|
12261
|
+
media_ids?: string[];
|
|
12262
|
+
prices: MicrotransactionPrice[];
|
|
12263
|
+
grants: MicrotransactionGrant[];
|
|
12264
|
+
localizations?: Record<string, {
|
|
12265
|
+
name: string;
|
|
12266
|
+
description?: string | null;
|
|
12267
|
+
}>;
|
|
12268
|
+
starts_at?: string | null;
|
|
12269
|
+
ends_at?: string | null;
|
|
12270
|
+
max_per_order?: number;
|
|
12271
|
+
/** Required for publishing/changing published goods; live approvals also enforced server-side. */
|
|
12272
|
+
confirm?: boolean;
|
|
12273
|
+
}
|
|
12274
|
+
interface MicrotransactionProduct extends Omit<MicrotransactionProductInput, 'confirm' | 'status' | 'media_ids'> {
|
|
12275
|
+
id: string;
|
|
12276
|
+
title_id: string;
|
|
12277
|
+
status: MicrotransactionProductStatus;
|
|
12278
|
+
version: number;
|
|
12279
|
+
media_ids: string[];
|
|
12280
|
+
media: MicrotransactionMedia[];
|
|
12281
|
+
created_at: string;
|
|
12282
|
+
updated_at: string;
|
|
12283
|
+
}
|
|
12284
|
+
interface MicrotransactionProvider {
|
|
12285
|
+
provider: 'stripe' | 'xsolla';
|
|
12286
|
+
environment: MicrotransactionEnvironment;
|
|
12287
|
+
configured: boolean;
|
|
12288
|
+
approved: boolean;
|
|
12289
|
+
countries: string[];
|
|
12290
|
+
currencies: string[];
|
|
12291
|
+
channels: string[];
|
|
12292
|
+
reason?: string;
|
|
12293
|
+
}
|
|
12294
|
+
interface MicrotransactionReadiness {
|
|
12295
|
+
status: 'disabled' | 'draft' | 'sandbox' | 'ready' | 'live' | 'degraded' | 'suspended';
|
|
12296
|
+
ready: boolean;
|
|
12297
|
+
blockers: string[];
|
|
12298
|
+
providers: MicrotransactionProvider[];
|
|
12299
|
+
commission_basis_points: 1200;
|
|
12300
|
+
}
|
|
12301
|
+
interface MicrotransactionFramePolicy {
|
|
12302
|
+
frame_ancestors: string[];
|
|
12303
|
+
expires_at: string | null;
|
|
12304
|
+
}
|
|
12305
|
+
interface MicrotransactionSettingsInput {
|
|
12306
|
+
enabled?: boolean;
|
|
12307
|
+
environment?: MicrotransactionEnvironment;
|
|
12308
|
+
/** Actual title-wide ad-delivery policy, distinct from ad revenue sharing. */
|
|
12309
|
+
ads_enabled?: boolean;
|
|
12310
|
+
fulfillment_mode?: 'glitch' | 'server';
|
|
12311
|
+
allowed_origins?: string[];
|
|
12312
|
+
countries?: string[];
|
|
12313
|
+
currencies?: MicrotransactionCurrency[];
|
|
12314
|
+
branding?: Omit<MicrotransactionBranding, 'logo_media'>;
|
|
12315
|
+
support_email?: string | null;
|
|
12316
|
+
webhook_url?: string | null;
|
|
12317
|
+
/** Required for policy/live changes; cannot replace recorded platform approval. */
|
|
12318
|
+
confirm?: boolean;
|
|
12319
|
+
}
|
|
12320
|
+
interface MicrotransactionSettings extends Omit<Required<MicrotransactionSettingsInput>, 'confirm'> {
|
|
12321
|
+
title_id: string;
|
|
12322
|
+
branding: MicrotransactionBranding;
|
|
12323
|
+
integration_verified: boolean;
|
|
12324
|
+
/** 12% of discounted pre-tax subtotal; no second commission for in-game currency spending. */
|
|
12325
|
+
commission_basis_points: 1200;
|
|
12326
|
+
fee_policy: 'developer_pays_provider_costs';
|
|
12327
|
+
readiness: MicrotransactionReadiness;
|
|
12328
|
+
}
|
|
12329
|
+
interface MicrotransactionCatalog {
|
|
12330
|
+
title: {
|
|
12331
|
+
id: string;
|
|
12332
|
+
name: string;
|
|
12333
|
+
};
|
|
12334
|
+
branding: MicrotransactionBranding;
|
|
12335
|
+
products: MicrotransactionProduct[];
|
|
12336
|
+
environment: MicrotransactionEnvironment;
|
|
12337
|
+
available: boolean;
|
|
12338
|
+
blockers: string[];
|
|
12339
|
+
}
|
|
12340
|
+
interface MicrotransactionPurchaseInput {
|
|
12341
|
+
product_id: string;
|
|
12342
|
+
quantity: number;
|
|
12343
|
+
country: string;
|
|
12344
|
+
currency: string;
|
|
12345
|
+
environment: MicrotransactionEnvironment;
|
|
12346
|
+
channel: 'web';
|
|
12347
|
+
}
|
|
12348
|
+
interface MicrotransactionCheckoutSessionInput extends MicrotransactionPurchaseInput {
|
|
12349
|
+
/** Exact game origin previously allowlisted by its owner. */
|
|
12350
|
+
return_origin: string;
|
|
12351
|
+
/** Random per-purchase state; retain locally and compare before claiming a handoff. */
|
|
12352
|
+
nonce: string;
|
|
12353
|
+
}
|
|
12354
|
+
interface MicrotransactionQuote extends Omit<MicrotransactionPurchaseInput, 'channel'> {
|
|
12355
|
+
id: string;
|
|
12356
|
+
product_version: number;
|
|
12357
|
+
subtotal_minor: number;
|
|
12358
|
+
tax_minor: number;
|
|
12359
|
+
total_minor: number;
|
|
12360
|
+
commission_minor: number;
|
|
12361
|
+
commission_basis_points: 1200;
|
|
12362
|
+
expires_at: string;
|
|
12363
|
+
}
|
|
12364
|
+
interface MicrotransactionEntitlement {
|
|
12365
|
+
key: string;
|
|
12366
|
+
kind: 'durable' | 'consumable' | 'pass';
|
|
12367
|
+
balance: number;
|
|
12368
|
+
environment: MicrotransactionEnvironment;
|
|
12369
|
+
updated_at: string;
|
|
12370
|
+
expires_at?: string | null;
|
|
12371
|
+
}
|
|
12372
|
+
interface MicrotransactionOrder {
|
|
12373
|
+
id: string;
|
|
12374
|
+
/** Opaque owning Glitch player ID; no email or billing identity is exposed. */
|
|
12375
|
+
player_id?: string;
|
|
12376
|
+
checkout_session_id: string | null;
|
|
12377
|
+
title_id: string;
|
|
12378
|
+
product_id: string;
|
|
12379
|
+
quantity: number;
|
|
12380
|
+
environment: MicrotransactionEnvironment;
|
|
12381
|
+
currency: string;
|
|
12382
|
+
country: string;
|
|
12383
|
+
subtotal_minor: number;
|
|
12384
|
+
tax_minor: number;
|
|
12385
|
+
total_minor: number;
|
|
12386
|
+
commission_minor: number;
|
|
12387
|
+
/** Null until actual costs are reconciled; never confuse an estimate with a payout. */
|
|
12388
|
+
provider_fee_minor: number | null;
|
|
12389
|
+
payment_status: MicrotransactionPaymentStatus;
|
|
12390
|
+
fulfillment_status: MicrotransactionFulfillmentStatus;
|
|
12391
|
+
provider: 'stripe' | 'xsolla' | null;
|
|
12392
|
+
created_at: string;
|
|
12393
|
+
paid_at: string | null;
|
|
12394
|
+
refunded_minor: number;
|
|
12395
|
+
items: MicrotransactionGrant[];
|
|
12396
|
+
entitlements?: MicrotransactionEntitlement[];
|
|
12397
|
+
}
|
|
12398
|
+
type MicrotransactionGrantUsageStatus = 'unused' | 'partially_used' | 'used_up' | 'owned' | 'expired' | 'revoked' | 'not_delivered' | 'unavailable';
|
|
12399
|
+
/** One purchase's server-calculated grant lot, not the player's aggregate inventory balance. */
|
|
12400
|
+
interface MicrotransactionGrantUsage {
|
|
12401
|
+
/** Null when the captured purchase has not produced an actual grant lot. */
|
|
12402
|
+
grant_id: string | null;
|
|
12403
|
+
key: string;
|
|
12404
|
+
kind: 'durable' | 'consumable' | 'pass';
|
|
12405
|
+
/** Promised units from the frozen grant quantity multiplied by order quantity, not money. */
|
|
12406
|
+
purchased_quantity: number;
|
|
12407
|
+
/** Actual granted units; zero when no lot exists, even if promised units are positive. */
|
|
12408
|
+
granted_quantity: number;
|
|
12409
|
+
/** Alias of actual granted_quantity, not the promised purchased_quantity. */
|
|
12410
|
+
acquired_quantity: number;
|
|
12411
|
+
/** Units remaining in the lot; expired/unavailable lots may still have raw remaining units. */
|
|
12412
|
+
remaining_quantity: number;
|
|
12413
|
+
/** acquired_quantity - remaining_quantity - revoked_quantity. Includes unrecoverable consumed units. */
|
|
12414
|
+
consumed_quantity: number;
|
|
12415
|
+
/** Units actually recovered/revoked by a refund; not gameplay consumption. */
|
|
12416
|
+
revoked_quantity: number;
|
|
12417
|
+
/** Bounded revoked_quantity + unrecoverable_quantity. This overlaps consumed quantity; do not subtract twice. */
|
|
12418
|
+
refunded_quantity: number;
|
|
12419
|
+
/** Refunded units that could not be recovered because already consumed. Overlaps consumed_quantity. */
|
|
12420
|
+
unrecoverable_quantity: number;
|
|
12421
|
+
expires_at: string | null;
|
|
12422
|
+
expired: boolean;
|
|
12423
|
+
/** Server-calculated usable units after expiry and payment/fulfillment restrictions. */
|
|
12424
|
+
usable_quantity: number;
|
|
12425
|
+
/** Consumable usage only. Durable/pass grants return null; ownership is not proof of gameplay use. */
|
|
12426
|
+
is_used: boolean | null;
|
|
12427
|
+
usage_status: MicrotransactionGrantUsageStatus;
|
|
12428
|
+
}
|
|
12429
|
+
interface MicrotransactionPlayerPurchase extends MicrotransactionOrder {
|
|
12430
|
+
/** Always present on authenticated self-history, unlike older generic order DTOs. */
|
|
12431
|
+
player_id: string;
|
|
12432
|
+
/** Product snapshot for this purchase, not a replacement for the current catalog. */
|
|
12433
|
+
product: {
|
|
12434
|
+
id: string;
|
|
12435
|
+
sku: string | null;
|
|
12436
|
+
name: string | null;
|
|
12437
|
+
type: MicrotransactionProductType | null;
|
|
12438
|
+
version: number | null;
|
|
12439
|
+
};
|
|
12440
|
+
grant_usage: MicrotransactionGrantUsage[];
|
|
12441
|
+
has_consumed_grants: boolean;
|
|
12442
|
+
has_usable_grants: boolean;
|
|
12443
|
+
}
|
|
12444
|
+
interface MicrotransactionPurchasePagination {
|
|
12445
|
+
page: number;
|
|
12446
|
+
per_page: number;
|
|
12447
|
+
total: number;
|
|
12448
|
+
last_page: number;
|
|
12449
|
+
has_more_pages: boolean;
|
|
12450
|
+
}
|
|
12451
|
+
/** Captured own-player purchases, including later refunds/disputes/quarantine; unpaid attempts are excluded. */
|
|
12452
|
+
interface MicrotransactionMyPurchases {
|
|
12453
|
+
title_id: string;
|
|
12454
|
+
player_id: string;
|
|
12455
|
+
environment: MicrotransactionEnvironment;
|
|
12456
|
+
purchases: MicrotransactionPlayerPurchase[];
|
|
12457
|
+
pagination: MicrotransactionPurchasePagination;
|
|
12458
|
+
}
|
|
12459
|
+
interface MicrotransactionCreatedCheckoutSession {
|
|
12460
|
+
id: string;
|
|
12461
|
+
checkout_session_id: string;
|
|
12462
|
+
intent: 'purchase' | 'restore';
|
|
12463
|
+
/** Short-lived capability: never log, send to analytics, or put in a URL query. */
|
|
12464
|
+
session_token: string;
|
|
12465
|
+
hosted_url: string;
|
|
12466
|
+
expires_at: string;
|
|
12467
|
+
status: 'authentication_required' | 'ready';
|
|
12468
|
+
nonce: string;
|
|
12469
|
+
}
|
|
12470
|
+
interface MicrotransactionCheckoutSession {
|
|
12471
|
+
id: string;
|
|
12472
|
+
checkout_session_id: string;
|
|
12473
|
+
title_id: string;
|
|
12474
|
+
intent: 'purchase' | 'restore';
|
|
12475
|
+
title: {
|
|
12476
|
+
id: string;
|
|
12477
|
+
name: string;
|
|
12478
|
+
};
|
|
12479
|
+
branding: MicrotransactionBranding;
|
|
12480
|
+
product: MicrotransactionProduct | null;
|
|
12481
|
+
quantity: number;
|
|
12482
|
+
country: string;
|
|
12483
|
+
currency: string;
|
|
12484
|
+
environment: MicrotransactionEnvironment;
|
|
12485
|
+
status: string;
|
|
12486
|
+
expires_at: string;
|
|
12487
|
+
authenticated: boolean;
|
|
12488
|
+
order: MicrotransactionOrder | null;
|
|
12489
|
+
return_origin: string;
|
|
12490
|
+
nonce: string;
|
|
12491
|
+
support_email: string | null;
|
|
12492
|
+
}
|
|
12493
|
+
interface MicrotransactionCheckoutInput {
|
|
12494
|
+
/** UUID retained for retries of the same purchase, never reused for different goods. */
|
|
12495
|
+
idempotency_key: string;
|
|
12496
|
+
accept_terms: true;
|
|
12497
|
+
}
|
|
12498
|
+
interface MicrotransactionCheckoutResult {
|
|
12499
|
+
order: MicrotransactionOrder;
|
|
12500
|
+
checkout_url: string | null;
|
|
12501
|
+
status: MicrotransactionPaymentStatus;
|
|
12502
|
+
provider: 'stripe' | 'xsolla';
|
|
12503
|
+
quote: MicrotransactionQuote;
|
|
12504
|
+
/** Provider's limited embedded-checkout secret if this route supports embedded checkout. */
|
|
12505
|
+
client_secret?: string | null;
|
|
12506
|
+
/** Public provider key only. Never a Stripe secret key. */
|
|
12507
|
+
publishable_key?: string | null;
|
|
12508
|
+
ui_mode: 'embedded' | 'xsolla';
|
|
12509
|
+
}
|
|
12510
|
+
interface MicrotransactionHandoff {
|
|
12511
|
+
event: {
|
|
12512
|
+
type: 'glitch.microtransaction.updated';
|
|
12513
|
+
version: 1;
|
|
12514
|
+
title_id: string;
|
|
12515
|
+
checkout_session_id: string;
|
|
12516
|
+
order_id: string;
|
|
12517
|
+
nonce: string;
|
|
12518
|
+
/** One-time claim only; never an account JWT. */
|
|
12519
|
+
claim_code: string;
|
|
12520
|
+
};
|
|
12521
|
+
target_origin: string;
|
|
12522
|
+
expires_at: string;
|
|
12523
|
+
}
|
|
12524
|
+
interface MicrotransactionHandoffClaimInput {
|
|
12525
|
+
claim_code: string;
|
|
12526
|
+
nonce: string;
|
|
12527
|
+
return_origin: string;
|
|
12528
|
+
checkout_session_id: string;
|
|
12529
|
+
}
|
|
12530
|
+
interface MicrotransactionHandoffClaim {
|
|
12531
|
+
title_id: string;
|
|
12532
|
+
checkout_session_id: string;
|
|
12533
|
+
order_id: string;
|
|
12534
|
+
player_id: string;
|
|
12535
|
+
entitlements: MicrotransactionEntitlement[];
|
|
12536
|
+
/** 15-minute title/player/environment-scoped token, stored in memory only. */
|
|
12537
|
+
player_token: string;
|
|
12538
|
+
expires_at: string;
|
|
12539
|
+
}
|
|
12540
|
+
interface MicrotransactionConsumeInput {
|
|
12541
|
+
key: string;
|
|
12542
|
+
quantity: number;
|
|
12543
|
+
action_id: string;
|
|
12544
|
+
environment: MicrotransactionEnvironment;
|
|
12545
|
+
}
|
|
12546
|
+
interface MicrotransactionRefund {
|
|
12547
|
+
refund_id: string;
|
|
12548
|
+
status: string;
|
|
12549
|
+
order_id: string;
|
|
12550
|
+
refund_allocation?: 'pro_rata_all_grants';
|
|
12551
|
+
}
|
|
12552
|
+
interface MicrotransactionRefundRequest {
|
|
12553
|
+
id: string;
|
|
12554
|
+
order_id: string;
|
|
12555
|
+
status: 'requested';
|
|
12556
|
+
}
|
|
12557
|
+
interface MicrotransactionEarnings {
|
|
12558
|
+
currency_balances: Array<{
|
|
12559
|
+
currency: string;
|
|
12560
|
+
pending_minor: number;
|
|
12561
|
+
available_minor: number;
|
|
12562
|
+
paid_minor: number;
|
|
12563
|
+
commission_minor: number;
|
|
12564
|
+
provider_fees_minor: number;
|
|
12565
|
+
/** Transfer to a connected provider balance is NOT a confirmed bank payout. */
|
|
12566
|
+
transferred_minor?: number;
|
|
12567
|
+
bank_payout_status?: 'provider_managed_not_reconciled';
|
|
12568
|
+
}>;
|
|
12569
|
+
payouts_enabled: boolean;
|
|
12570
|
+
reserve_days?: number;
|
|
12571
|
+
}
|
|
12572
|
+
type MicrotransactionOperation = 'settings.get' | 'settings.update' | 'products.list' | 'products.create' | 'products.update' | 'products.archive' | 'providers.list' | 'readiness.get' | 'orders.list' | 'orders.get' | 'earnings.get' | 'refunds.request' | 'deliveries.replay' | 'integration.get' | 'integration.verify';
|
|
12573
|
+
interface MicrotransactionOperationCapability {
|
|
12574
|
+
operation: MicrotransactionOperation;
|
|
12575
|
+
description: string;
|
|
12576
|
+
ability: MicrotransactionAbility;
|
|
12577
|
+
input_schema: Record<string, unknown>;
|
|
12578
|
+
requires_confirmation: boolean;
|
|
12579
|
+
requires_human_approval: boolean;
|
|
12580
|
+
examples: Array<Record<string, unknown>>;
|
|
12581
|
+
output_description: string;
|
|
12582
|
+
}
|
|
12583
|
+
interface MicrotransactionCapabilities {
|
|
12584
|
+
schema_version: number;
|
|
12585
|
+
title_id: string;
|
|
12586
|
+
operations: MicrotransactionOperationCapability[];
|
|
12587
|
+
[key: string]: unknown;
|
|
12588
|
+
}
|
|
12589
|
+
/**
|
|
12590
|
+
* Provider-neutral, title-scoped commerce. Configure with user JWT; purchases
|
|
12591
|
+
* use a recoverable user account and limited checkout capability. Install/title
|
|
12592
|
+
* tokens cannot authorize money, ownership, refunds, or catalog changes.
|
|
12593
|
+
*
|
|
12594
|
+
* Each result preserves payment versus fulfillment versus settlement. Redirects
|
|
12595
|
+
* and postMessage events only trigger an authoritative refresh. A timeout is
|
|
12596
|
+
* unknown; reconcile the original attempt instead of charging another provider.
|
|
12597
|
+
*/
|
|
12598
|
+
declare class Microtransactions {
|
|
12599
|
+
/**
|
|
12600
|
+
* Upload an image/video through existing Glitch Media processing with title
|
|
12601
|
+
* and actor ownership. Attach its returned Media ID to products/branding.
|
|
12602
|
+
* Does not create a social-library post, scheduler, or new payment product.
|
|
12603
|
+
*/
|
|
12604
|
+
static uploadMedia(title_id: string, media: File | Blob, onUploadProgress?: (event: AxiosProgressEvent) => void, options?: Pick<AxiosRequestConfig, 'signal' | 'timeout'>): AxiosPromise<MicrotransactionResponse<MicrotransactionMedia>>;
|
|
12605
|
+
/** Same title-authorized Media pipeline using the caller's MCP credential and commerce:write ability. */
|
|
12606
|
+
static mcpUploadMedia(title_id: string, media: File | Blob, onUploadProgress?: (event: AxiosProgressEvent) => void, options?: Pick<AxiosRequestConfig, 'signal' | 'timeout'>): AxiosPromise<MicrotransactionResponse<MicrotransactionMedia>>;
|
|
12607
|
+
/** Admin settings, including immutable 1200bp commission and readiness blockers. */
|
|
12608
|
+
static settings(title_id: string, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionSettings>>;
|
|
12609
|
+
/** Atomic policy update. Sandbox/off by default. Cannot disable the final working revenue model. */
|
|
12610
|
+
static updateSettings(title_id: string, data: MicrotransactionSettingsInput, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionSettings>>;
|
|
12611
|
+
/** Read-only country/provider/approval readiness; never enables a provider. */
|
|
12612
|
+
static readiness(title_id: string, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionReadiness>>;
|
|
12613
|
+
/** Admin list includes drafts and archives. Player clients should use catalog(). */
|
|
12614
|
+
static listProducts(title_id: string, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<{
|
|
12615
|
+
products: MicrotransactionProduct[];
|
|
12616
|
+
}>>;
|
|
12617
|
+
/** Save a catalog product. Prices use integer minor units and attached media must belong to the title. */
|
|
12618
|
+
static createProduct(title_id: string, data: MicrotransactionProductInput, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionProduct>>;
|
|
12619
|
+
/** Update a product version. Existing order snapshots remain unchanged. */
|
|
12620
|
+
static updateProduct(title_id: string, product_id: string, data: Partial<MicrotransactionProductInput>, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionProduct>>;
|
|
12621
|
+
/** Archive, never delete financial history. Requires explicit confirmation. */
|
|
12622
|
+
static archiveProduct(title_id: string, product_id: string, data: {
|
|
12623
|
+
confirm: true;
|
|
12624
|
+
}, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionProduct>>;
|
|
12625
|
+
/** Public provider metadata only. Credentials and commercial approvals are platform-managed. */
|
|
12626
|
+
static providers(title_id: string, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<{
|
|
12627
|
+
providers: MicrotransactionProvider[];
|
|
12628
|
+
}>>;
|
|
12629
|
+
/** Admin read of separate-currency balances; pending is not withdrawable revenue. */
|
|
12630
|
+
static earnings(title_id: string, params?: MicrotransactionEnvironmentFilter, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionEarnings>>;
|
|
12631
|
+
/** Admin list, bounded to the server's most recent 100 redacted orders. */
|
|
12632
|
+
static listOrders(title_id: string, params?: MicrotransactionEnvironmentFilter, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<{
|
|
12633
|
+
orders: MicrotransactionOrder[];
|
|
12634
|
+
}>>;
|
|
12635
|
+
/** Owner JWT/scoped player token or title admin. An arbitrary order UUID grants no access. */
|
|
12636
|
+
static getOrder(title_id: string, order_id: string, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionOrder>>;
|
|
12637
|
+
/** Financial admin only; original provider and human approval. Omit amount_minor for remaining full refund; partial amounts are bounded and allocated pro rata. */
|
|
12638
|
+
static refundOrder(title_id: string, order_id: string, data: {
|
|
12639
|
+
reason: string;
|
|
12640
|
+
confirm: true;
|
|
12641
|
+
amount_minor?: number;
|
|
12642
|
+
}, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionRefund>>;
|
|
12643
|
+
/** Replay the same immutable event. Receiver must deduplicate event_id. This cannot mint goods. */
|
|
12644
|
+
static replayDelivery(title_id: string, delivery_id: string, data: {
|
|
12645
|
+
confirm: true;
|
|
12646
|
+
}, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<Record<string, unknown>>>;
|
|
12647
|
+
/** Public eligible catalog. Sandbox is restricted by backend environment/admin policy. */
|
|
12648
|
+
static catalog(title_id: string, params?: MicrotransactionCatalogFilter, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionCatalog>>;
|
|
12649
|
+
/** User-authenticated quote. Clients select product/quantity, never monetary values or seller accounts. */
|
|
12650
|
+
static createQuote(title_id: string, data: MicrotransactionPurchaseInput, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionQuote>>;
|
|
12651
|
+
/** Anonymous-safe opening step only. The hosted UI creates/logs into an account before payment. */
|
|
12652
|
+
static createCheckoutSession(title_id: string, data: MicrotransactionCheckoutSessionInput, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionCreatedCheckoutSession>>;
|
|
12653
|
+
/** Anonymous-safe inventory recovery. Opens an in-game hosted sign-in overlay, never creates a charge or requires the game's account JWT. */
|
|
12654
|
+
static createRestoreSession(title_id: string, data: {
|
|
12655
|
+
return_origin: string;
|
|
12656
|
+
nonce: string;
|
|
12657
|
+
environment: MicrotransactionEnvironment;
|
|
12658
|
+
}, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionCreatedCheckoutSession>>;
|
|
12659
|
+
/** Read the session using its limited capability. Cannot mutate user identity or declare payment. */
|
|
12660
|
+
static getCheckoutSession(title_id: string, session_id: string, options: MicrotransactionSessionOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionCheckoutSession>>;
|
|
12661
|
+
/** Anonymous, read-only embedding policy: server-approved frame ancestors only, no player/session capability data. */
|
|
12662
|
+
static getCheckoutFramePolicy(title_id: string, session_id: string, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionFramePolicy>>;
|
|
12663
|
+
/** Anonymous title-wide approved embedding policy for trusted hosted account pages; no player data. */
|
|
12664
|
+
static getFramePolicy(title_id: string, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionFramePolicy>>;
|
|
12665
|
+
/** Bind once to the existing authenticated account. Cannot reassign another player's purchase. */
|
|
12666
|
+
static authenticateCheckoutSession(title_id: string, session_id: string, options: MicrotransactionSessionOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionCheckoutSession>>;
|
|
12667
|
+
/** Bound-user JWT + session capability. Reuse the idempotency key after a network timeout. */
|
|
12668
|
+
static checkout(title_id: string, session_id: string, data: MicrotransactionCheckoutInput, options: MicrotransactionSessionOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionCheckoutResult>>;
|
|
12669
|
+
/** Query original provider; never creates another charge. Pending/unknown remains non-terminal. */
|
|
12670
|
+
static reconcileCheckoutSession(title_id: string, session_id: string, options: MicrotransactionSessionOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionOrder>>;
|
|
12671
|
+
/** Hosted checkout only. Server issues an expiring one-time game handoff after verified fulfillment. */
|
|
12672
|
+
static createHandoff(title_id: string, session_id: string, options: MicrotransactionSessionOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionHandoff>>;
|
|
12673
|
+
/** Game exchanges a verified popup code. Browser Origin must match return_origin; code is consumed once. */
|
|
12674
|
+
static claimHandoff(title_id: string, data: MicrotransactionHandoffClaimInput, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionHandoffClaim>>;
|
|
12675
|
+
/**
|
|
12676
|
+
* Authenticated hosted Glitch account only: restore a previous purchase into a
|
|
12677
|
+
* NEW nonce-bound session/handoff after the game's 15-minute token expires or
|
|
12678
|
+
* storage is cleared. Does not create another payment. Return to the game via
|
|
12679
|
+
* verified source/origin and a new bridge bound to event.checkout_session_id.
|
|
12680
|
+
*/
|
|
12681
|
+
static restoreHandoff(title_id: string, data: {
|
|
12682
|
+
order_id: string;
|
|
12683
|
+
return_origin: string;
|
|
12684
|
+
nonce: string;
|
|
12685
|
+
}, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionHandoff>>;
|
|
12686
|
+
/** Record integration proof from a genuinely paid, fulfilled sandbox order with a claimed game handoff. */
|
|
12687
|
+
static verifyIntegration(title_id: string, data: {
|
|
12688
|
+
order_id: string;
|
|
12689
|
+
confirm: true;
|
|
12690
|
+
}, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionReadiness>>;
|
|
12691
|
+
/** Restore authoritative durable ownership/current consumable balances, never mutable cloud-save balances. */
|
|
12692
|
+
static listEntitlements(title_id: string, params?: MicrotransactionEnvironmentFilter, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<{
|
|
12693
|
+
entitlements: MicrotransactionEntitlement[];
|
|
12694
|
+
}>>;
|
|
12695
|
+
/**
|
|
12696
|
+
* Optional self-only purchase/usage history. A user JWT selects that user; a
|
|
12697
|
+
* scoped playerToken selects its bound title/player/environment and requires
|
|
12698
|
+
* the exact approved game Origin. No MCP/install token or caller-selected
|
|
12699
|
+
* user_id/player_id is accepted. JWT environment defaults to live; scoped
|
|
12700
|
+
* tokens default to their bound environment. Admin listOrders stays separate.
|
|
12701
|
+
*
|
|
12702
|
+
* Read response.data.data.purchases and .pagination. Use grant_usage for lot
|
|
12703
|
+
* consumption/refund/expiry status, listEntitlements for current aggregate
|
|
12704
|
+
* inventory, and consume for explicit gameplay spending. History never grants
|
|
12705
|
+
* inventory and durable/pass is_used is null rather than a guessed boolean.
|
|
12706
|
+
*/
|
|
12707
|
+
static listMyPurchases(title_id: string, filters?: MicrotransactionMyPurchasesFilters, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionMyPurchases>>;
|
|
12708
|
+
/** Atomic tracked spending. Reuse action_id for retries; a new gameplay action needs a new ID. */
|
|
12709
|
+
static consume(title_id: string, data: MicrotransactionConsumeInput, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<{
|
|
12710
|
+
entitlement: MicrotransactionEntitlement;
|
|
12711
|
+
replayed: boolean;
|
|
12712
|
+
}>>;
|
|
12713
|
+
/** Owning user asks support to review a refund. This does not execute payment reversal. */
|
|
12714
|
+
static requestRefund(title_id: string, data: {
|
|
12715
|
+
order_id: string;
|
|
12716
|
+
reason: string;
|
|
12717
|
+
}, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionRefundRequest>>;
|
|
12718
|
+
/** Trusted title server with commerce:fulfill or admin JWT acknowledges the immutable event. */
|
|
12719
|
+
static acknowledgeDelivery(title_id: string, delivery_id: string, data: {
|
|
12720
|
+
event_id: string;
|
|
12721
|
+
}, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<Record<string, unknown>>>;
|
|
12722
|
+
/** Title MCP token, never a runtime install token. Describes every argument/schema/ability/approval gate. */
|
|
12723
|
+
static mcpCapabilities(title_id: string, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<MicrotransactionCapabilities>>;
|
|
12724
|
+
/** Execute only an operation discovered in mcpCapabilities. confirm is not financial approval. */
|
|
12725
|
+
static mcpOperation<T = Record<string, unknown>>(title_id: string, operation: MicrotransactionOperation, data: {
|
|
12726
|
+
arguments: Record<string, unknown>;
|
|
12727
|
+
confirm?: boolean;
|
|
12728
|
+
}, options?: MicrotransactionRequestOptions): AxiosPromise<MicrotransactionResponse<{
|
|
12729
|
+
operation: MicrotransactionOperation;
|
|
12730
|
+
result: T;
|
|
12731
|
+
}>>;
|
|
12732
|
+
private static call;
|
|
12733
|
+
}
|
|
12734
|
+
|
|
12735
|
+
/** A one-time notification, never a receipt or authorization to grant goods. */
|
|
12736
|
+
interface MicrotransactionPurchaseMessage {
|
|
12737
|
+
type: 'glitch.microtransaction.updated';
|
|
12738
|
+
version: 1;
|
|
12739
|
+
title_id: string;
|
|
12740
|
+
checkout_session_id: string;
|
|
12741
|
+
order_id: string;
|
|
12742
|
+
/** Cryptographically random value bound to the checkout session at creation. */
|
|
12743
|
+
nonce: string;
|
|
12744
|
+
/** Server-issued one-time code; not an account or player bearer token. */
|
|
12745
|
+
claim_code: string;
|
|
12746
|
+
}
|
|
12747
|
+
/** Exact authoritative /handoffs/claim response, not the hosted session DTO. */
|
|
12748
|
+
type MicrotransactionVerifiedSession = MicrotransactionHandoffClaim;
|
|
12749
|
+
interface MicrotransactionBridgeOptions<T extends MicrotransactionVerifiedSession> {
|
|
12750
|
+
titleId: string;
|
|
12751
|
+
checkoutSessionId: string;
|
|
12752
|
+
/** Exact trusted Glitch checkout origin, with no path, wildcard, or credentials. */
|
|
12753
|
+
checkoutOrigin: string;
|
|
12754
|
+
/** The actual Window returned by window.open or the checkout iframe.contentWindow. */
|
|
12755
|
+
checkoutWindow: Window;
|
|
12756
|
+
/** At least 128 bits of randomness; use createMicrotransactionNonce(). */
|
|
12757
|
+
nonce: string;
|
|
12758
|
+
/**
|
|
12759
|
+
* Exchange message.claim_code at Glitch using claimHandoff(titleId,
|
|
12760
|
+
* {claim_code, nonce, return_origin: window.location.origin,
|
|
12761
|
+
* checkout_session_id}). Return response.data.data, the actual claim DTO.
|
|
12762
|
+
* The message has already passed source/origin/nonce checks but is still NOT
|
|
12763
|
+
* proof of payment. The server validates and consumes the one-time code.
|
|
12764
|
+
* Never exchange a site-wide login token with the game or put credentials in
|
|
12765
|
+
* postMessage, analytics, logs, or query strings.
|
|
12766
|
+
*/
|
|
12767
|
+
verify: (message: MicrotransactionPurchaseMessage) => Promise<T>;
|
|
12768
|
+
/**
|
|
12769
|
+
* Restore using the previously verified scoped token plus getOrder and
|
|
12770
|
+
* listEntitlements. Return the claim identity/token with current inventory.
|
|
12771
|
+
* Never redeem the code again. When its token expires, return the player to
|
|
12772
|
+
* the authenticated hosted flow to obtain a fresh scoped handoff.
|
|
12773
|
+
*/
|
|
12774
|
+
refresh?: (previous: T) => Promise<T>;
|
|
12775
|
+
/** Refresh display/inventory from the verified result. Make local effects idempotent. */
|
|
12776
|
+
onVerified: (result: T) => void | Promise<void>;
|
|
12777
|
+
/** A failed refresh is not a failed payment. Keep the same session and retry. */
|
|
12778
|
+
onError?: (error: unknown) => void;
|
|
12779
|
+
/** Explicit local development only; production checkout must use HTTPS. */
|
|
12780
|
+
allowLocalDevelopment?: boolean;
|
|
12781
|
+
/** Defaults to window. Useful for browser integration tests. */
|
|
12782
|
+
eventTarget?: Pick<Window, 'addEventListener' | 'removeEventListener'>;
|
|
12783
|
+
}
|
|
12784
|
+
/** Restore authenticates an existing receipt in Glitch and creates a new session. */
|
|
12785
|
+
interface MicrotransactionRestoreBridgeOptions<T extends MicrotransactionVerifiedSession> extends Omit<MicrotransactionBridgeOptions<T>, 'checkoutSessionId'> {
|
|
12786
|
+
/** Previously verified receipt/order ID. This, not the old expired session ID, is pinned. */
|
|
12787
|
+
orderId: string;
|
|
12788
|
+
}
|
|
12789
|
+
interface MicrotransactionBridge {
|
|
12790
|
+
/**
|
|
12791
|
+
* Refresh only after a successful claim, using options.refresh and its scoped
|
|
12792
|
+
* token. Concurrent refreshes share one request. A lost first-claim response
|
|
12793
|
+
* requires a fresh handoff from the authenticated hosted page, not code replay
|
|
12794
|
+
* or a new payment. No automatic polling or token refresh is performed.
|
|
12795
|
+
*/
|
|
12796
|
+
refresh(): Promise<void>;
|
|
12797
|
+
/** Remove the listener. In-flight results cannot call onVerified after disposal. */
|
|
12798
|
+
dispose(): void;
|
|
12799
|
+
}
|
|
12800
|
+
/** Generate a 256-bit browser nonce. Fails closed without secure Web Crypto. */
|
|
12801
|
+
declare function createMicrotransactionNonce(): string;
|
|
12802
|
+
/**
|
|
12803
|
+
* Listen for Glitch-hosted, game-branded checkout changes with strict origin,
|
|
12804
|
+
* source, title, session, and nonce binding. Message data cannot grant an item.
|
|
12805
|
+
* The caller always verifies the session at Glitch before updating inventory.
|
|
12806
|
+
*
|
|
12807
|
+
* Prefer openMicrotransactionOverlay with the exact server-returned URL. The
|
|
12808
|
+
* game stays mounted; no top-level navigation fallback is permitted. If an
|
|
12809
|
+
* embedded flow is unavailable, show retry/close and preserve the game state.
|
|
12810
|
+
* refresh() requires an already verified claim. Keep
|
|
12811
|
+
* secrets in memory/session storage or a URL fragment, never query parameters.
|
|
12812
|
+
* Dispose on game unmount/account change. Reconnect restores ownership through
|
|
12813
|
+
* the authenticated entitlement API, not a saved "purchase successful" flag.
|
|
12814
|
+
*/
|
|
12815
|
+
declare function createMicrotransactionBridge<T extends MicrotransactionVerifiedSession>(options: MicrotransactionBridgeOptions<T>): MicrotransactionBridge;
|
|
12816
|
+
/**
|
|
12817
|
+
* Restore-only bridge for /games/:titleId/purchases/restore. Pin the prior order,
|
|
12818
|
+
* fresh nonce, exact Glitch origin and opened window. The hosted signed-in page
|
|
12819
|
+
* creates a NEW session; the server-verified claim must match that new session
|
|
12820
|
+
* and the pinned order. This does not relax purchase-session binding.
|
|
12821
|
+
*
|
|
12822
|
+
* Open the hosted restore page, never request the account JWT in the game.
|
|
12823
|
+
* verify(message) exchanges the code using message.checkout_session_id. All
|
|
12824
|
+
* duplicate-code, expiry and same-player refresh safeguards still apply.
|
|
12825
|
+
*/
|
|
12826
|
+
declare function createMicrotransactionRestoreBridge<T extends MicrotransactionVerifiedSession>(options: MicrotransactionRestoreBridgeOptions<T>): MicrotransactionBridge;
|
|
12827
|
+
|
|
12828
|
+
interface MicrotransactionOverlayOptions {
|
|
12829
|
+
titleId: string;
|
|
12830
|
+
/** Exact configured Glitch HTTPS origin, never taken from postMessage data. */
|
|
12831
|
+
checkoutOrigin: string;
|
|
12832
|
+
/** Result of createCheckoutSession or createRestoreSession; keep its capability private. */
|
|
12833
|
+
session: MicrotransactionCreatedCheckoutSession;
|
|
12834
|
+
/** Replace displayed inventory from verified backend data; never increment blindly. */
|
|
12835
|
+
onVerified: (claim: MicrotransactionHandoffClaim) => void | Promise<void>;
|
|
12836
|
+
/** Pause game input/audio here. The SDK never unmounts or resets the game. */
|
|
12837
|
+
onOpen?: () => void;
|
|
12838
|
+
/** Resume game input/audio here. Called once, even on escape/error cleanup. */
|
|
12839
|
+
onClose?: (reason: 'dismissed' | 'completed' | 'unavailable') => void;
|
|
12840
|
+
/** Receipt/status-only update after close; this callback does not authorize item grants. */
|
|
12841
|
+
onOrderUpdate?: (order: MicrotransactionOrder | null) => void | Promise<void>;
|
|
12842
|
+
onError?: (error: unknown) => void;
|
|
12843
|
+
label?: string;
|
|
12844
|
+
/** Permit HTTP loopback/.test origins only for explicit local development. */
|
|
12845
|
+
allowLocalDevelopment?: boolean;
|
|
12846
|
+
/** Defaults to the caller's document, including when the game itself is embedded. */
|
|
12847
|
+
document?: Document;
|
|
12848
|
+
/** Bounded network timeout; defaults to 15 seconds. */
|
|
12849
|
+
timeoutMs?: number;
|
|
12850
|
+
/** Per-phase iframe load/application-ready timeout; 1–60 seconds, defaults to 20 seconds. */
|
|
12851
|
+
frameLoadTimeoutMs?: number;
|
|
12852
|
+
}
|
|
12853
|
+
/** Hosted page signals usable checkout/account UI, never payment or inventory authority. */
|
|
12854
|
+
interface MicrotransactionReadyMessage {
|
|
12855
|
+
type: 'glitch.microtransaction.ready';
|
|
12856
|
+
version: 1;
|
|
12857
|
+
title_id: string;
|
|
12858
|
+
checkout_session_id: string;
|
|
12859
|
+
nonce: string;
|
|
12860
|
+
}
|
|
12861
|
+
interface MicrotransactionOverlay {
|
|
12862
|
+
readonly element: HTMLDialogElement;
|
|
12863
|
+
readonly iframe: HTMLIFrameElement;
|
|
12864
|
+
/** Refresh verified inventory, or limited receipt status before the first claim. */
|
|
12865
|
+
refresh(): Promise<void>;
|
|
12866
|
+
/** Removes only this modal, restores focus/input, and refreshes authoritative state. */
|
|
12867
|
+
close(reason?: 'dismissed' | 'completed' | 'unavailable'): Promise<void>;
|
|
12868
|
+
/** Reload only the same checkout iframe/session. Never starts another payment. */
|
|
12869
|
+
retry(): void;
|
|
12870
|
+
}
|
|
12871
|
+
/**
|
|
12872
|
+
* Mount Glitch checkout IN the running game. The game document, URL and session
|
|
12873
|
+
* stay intact. Uses a modal dialog with focus restore and a sandboxed payment
|
|
12874
|
+
* iframe. No top-navigation permission or top-level/popup-blocked fallback exists.
|
|
12875
|
+
* Only bank/OAuth verification may open a controlled provider window from inside
|
|
12876
|
+
* the frame. If embedding is unavailable, show retry/close instead of navigating.
|
|
12877
|
+
*
|
|
12878
|
+
* Receipt messages must originate from this exact iframe.contentWindow and pass
|
|
12879
|
+
* origin/title/session/nonce checks. The SDK redeems the one-time claim at Glitch
|
|
12880
|
+
* and uses the returned scoped player token only on commerce requests. Closing
|
|
12881
|
+
* does not cancel an uncertain payment, grant goods, or discard the game state.
|
|
12882
|
+
*/
|
|
12883
|
+
declare function openMicrotransactionOverlay(options: MicrotransactionOverlayOptions): MicrotransactionOverlay;
|
|
12884
|
+
/** Same in-game modal for anonymous-safe restore sessions; never opens a new payment. */
|
|
12885
|
+
declare function openMicrotransactionRestoreOverlay(options: MicrotransactionOverlayOptions): MicrotransactionOverlay;
|
|
12886
|
+
|
|
11886
12887
|
interface Route {
|
|
11887
12888
|
url: string;
|
|
11888
12889
|
method: string;
|
|
@@ -11911,13 +12912,15 @@ declare class Requests {
|
|
|
11911
12912
|
static put<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
11912
12913
|
static patch<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
11913
12914
|
static delete<T>(url: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
11914
|
-
static uploadFile<T>(url: string, filename: string, file: File | Blob, data?: any, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
12915
|
+
static uploadFile<T>(url: string, filename: string, file: File | Blob, data?: any, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void, options?: Pick<AxiosRequestConfig, 'signal' | 'timeout'>): AxiosPromise<Response<T>>;
|
|
11915
12916
|
static postFormData<T>(url: string, formData: FormData, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
11916
12917
|
static uploadBlob<T>(url: string, filename: string, blob: Blob, data?: any, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
11917
12918
|
static uploadFileInChunks<T>(file: File, uploadUrl: string, onProgress?: (totalSize: number, amountUploaded: number) => void, data?: any, chunkSize?: number): Promise<void>;
|
|
11918
12919
|
static processRoute<T>(route: Route, data?: object, routeReplace?: {
|
|
11919
12920
|
[key: string]: any;
|
|
11920
|
-
}, params?: Record<string, any>
|
|
12921
|
+
}, params?: Record<string, any>, options?: Pick<AxiosRequestConfig, 'signal' | 'timeout' | 'headers'> & {
|
|
12922
|
+
excludeCommunityContext?: boolean;
|
|
12923
|
+
}): AxiosPromise<Response<T>>;
|
|
11921
12924
|
}
|
|
11922
12925
|
|
|
11923
12926
|
declare class Parser {
|
|
@@ -12231,6 +13234,7 @@ declare class Glitch {
|
|
|
12231
13234
|
Newsletters: typeof Newsletters;
|
|
12232
13235
|
PlayTests: typeof PlayTests;
|
|
12233
13236
|
Media: typeof Media;
|
|
13237
|
+
FestivalNetworking: typeof FestivalNetworking;
|
|
12234
13238
|
Scheduler: typeof Scheduler;
|
|
12235
13239
|
RedditSubreddits: typeof RedditSubreddits;
|
|
12236
13240
|
Funnel: typeof Funnel;
|
|
@@ -12256,6 +13260,7 @@ declare class Glitch {
|
|
|
12256
13260
|
GameAdvertising: typeof GameAdvertising;
|
|
12257
13261
|
Hosting: typeof Hosting;
|
|
12258
13262
|
GameDesign: typeof GameDesign;
|
|
13263
|
+
Microtransactions: typeof Microtransactions;
|
|
12259
13264
|
};
|
|
12260
13265
|
static util: {
|
|
12261
13266
|
Requests: typeof Requests;
|
|
@@ -12345,4 +13350,4 @@ declare class Glitch {
|
|
|
12345
13350
|
};
|
|
12346
13351
|
}
|
|
12347
13352
|
|
|
12348
|
-
export { Glitch as default };
|
|
13353
|
+
export { type FestivalApplicationInput, type FestivalApplicationState, type FestivalConversation, type FestivalMediaUpload, type FestivalNetworkingFilters, type FestivalNetworkingProfile, type FestivalNetworkingResponse, type FestivalNetworkingSettings, type FestivalPost, type FestivalPostInput, type FestivalPostKind, type FestivalPostState, type FestivalPreferences, type FestivalReportInput, type FestivalRequestOptions, type FestivalWorkType, type MicrotransactionAbility, type MicrotransactionBranding, type MicrotransactionBridge, type MicrotransactionBridgeOptions, type MicrotransactionCapabilities, type MicrotransactionCatalog, type MicrotransactionCatalogFilter, type MicrotransactionCheckoutInput, type MicrotransactionCheckoutResult, type MicrotransactionCheckoutSession, type MicrotransactionCheckoutSessionInput, type MicrotransactionConsumeInput, type MicrotransactionCreatedCheckoutSession, type MicrotransactionCurrency, type MicrotransactionEarnings, type MicrotransactionEntitlement, type MicrotransactionEnvironment, type MicrotransactionEnvironmentFilter, type MicrotransactionError, type MicrotransactionErrorCode, type MicrotransactionFramePolicy, type MicrotransactionFulfillmentStatus, type MicrotransactionGrant, type MicrotransactionGrantUsage, type MicrotransactionGrantUsageStatus, type MicrotransactionHandoff, type MicrotransactionHandoffClaim, type MicrotransactionHandoffClaimInput, type MicrotransactionMedia, type MicrotransactionMyPurchases, type MicrotransactionMyPurchasesFilters, type MicrotransactionOperation, type MicrotransactionOperationCapability, type MicrotransactionOrder, type MicrotransactionOverlay, type MicrotransactionOverlayOptions, type MicrotransactionPaymentStatus, type MicrotransactionPlayerPurchase, type MicrotransactionPrice, type MicrotransactionProduct, type MicrotransactionProductInput, type MicrotransactionProductStatus, type MicrotransactionProductType, type MicrotransactionProvider, type MicrotransactionPurchaseInput, type MicrotransactionPurchaseMessage, type MicrotransactionPurchasePagination, type MicrotransactionQuote, type MicrotransactionReadiness, type MicrotransactionReadyMessage, type MicrotransactionRefund, type MicrotransactionRefundRequest, type MicrotransactionRequestOptions, type MicrotransactionResponse, type MicrotransactionRestoreBridgeOptions, type MicrotransactionSessionOptions, type MicrotransactionSettings, type MicrotransactionSettingsInput, type MicrotransactionVerifiedSession, createMicrotransactionBridge, createMicrotransactionNonce, createMicrotransactionRestoreBridge, Glitch as default, openMicrotransactionOverlay, openMicrotransactionRestoreOverlay };
|